From: Roy Marples Date: Thu, 10 Nov 2016 18:26:32 +0000 (+0000) Subject: Set sa_len when creating a sockaddr from a prefix. X-Git-Tag: v7.0.0-beta1~116 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f7c845e537ad295450b2d6da707fe71fe443670;p=thirdparty%2Fdhcpcd.git Set sa_len when creating a sockaddr from a prefix. --- diff --git a/sa.c b/sa.c index 07e85d8f..f8fabc76 100644 --- a/sa.c +++ b/sa.c @@ -284,11 +284,17 @@ sa_fromprefix(struct sockaddr *sa, int prefix) #ifdef INET case AF_INET: max_prefix = 32; +#ifdef HAVE_SA_LEN + sa->sa_len = sizeof(struct in_addr); +#endif break; #endif #ifdef INET6 case AF_INET6: max_prefix = 128; +#ifdef HAVE_SA_LEN + sa->sa_len = sizeof(struct in6_addr); +#endif break; #endif default: