]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix netmask thanks to Marc Duponcheel.
authorRoy Marples <roy@marples.name>
Wed, 6 Dec 2006 10:02:03 +0000 (10:02 +0000)
committerRoy Marples <roy@marples.name>
Wed, 6 Dec 2006 10:02:03 +0000 (10:02 +0000)
ChangeLog
interface.c

index 8253a04590091c84a2dbcf5d01e4830d3e5e0396..6c8e1719a20a26f27688a29ef3cc17c28c43d395 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+Fix netmask thanks to Marc Duponcheel.
 Send the hostname by default unless null, (none) or localhost.
 This can be overridden by using a an empty option for -h (-h '').
 
index 20aa2278eb2e666f8cc93fa50311593db39a7c1e..6e5aa27630a05ece5b895509b18d5a767c8e68e3 100644 (file)
@@ -542,11 +542,11 @@ static int do_address(const char *ifname,
   nlm.ifa.ifa_family = AF_INET;
 
   /* Store the netmask in the prefix */
-  uint32_t mask = netmask.s_addr;
+  uint32_t mask = htonl (netmask.s_addr);
   while (mask)
     {
       nlm.ifa.ifa_prefixlen++;
-      mask >>= 1;
+      mask <<= 1;
     }
 
   add_attr_l (&nlm.hdr, sizeof (nlm), IFA_LOCAL, &address.s_addr,
@@ -610,11 +610,11 @@ static int do_route (const char *ifname,
     }
 
   /* Store the netmask in the prefix */
-  uint32_t mask = netmask.s_addr;
+  uint32_t mask = htonl (netmask.s_addr);
   while (mask)
     {
       nlm.rt.rtm_dst_len++;
-      mask >>= 1;
+      mask <<= 1;
     }
 
   add_attr_l (&nlm.hdr, sizeof (nlm), RTA_DST, &destination.s_addr,