]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Set sa_len when creating a sockaddr from a prefix.
authorRoy Marples <roy@marples.name>
Thu, 10 Nov 2016 18:26:32 +0000 (18:26 +0000)
committerRoy Marples <roy@marples.name>
Thu, 10 Nov 2016 18:26:32 +0000 (18:26 +0000)
sa.c

diff --git a/sa.c b/sa.c
index 07e85d8f90126f3b6f85afbe2f819327ea4b3751..f8fabc760c4c01c27adf6013d5b58de11598bf85 100644 (file)
--- 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: