+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 '').
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,
}
/* 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,