From: Roy Marples Date: Wed, 6 Dec 2006 10:02:03 +0000 (+0000) Subject: Fix netmask thanks to Marc Duponcheel. X-Git-Tag: v3.2.3~354 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40ec9a9debec3974531a6c1e297a3b4b2e93499f;p=thirdparty%2Fdhcpcd.git Fix netmask thanks to Marc Duponcheel. --- diff --git a/ChangeLog b/ChangeLog index 8253a045..6c8e1719 100644 --- 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 ''). diff --git a/interface.c b/interface.c index 20aa2278..6e5aa276 100644 --- a/interface.c +++ b/interface.c @@ -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,