X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=interface-ip.c;h=54f56d69b291d2eb207dd596cd19039c300a7286;hp=8eb2ff3f7e9bde010b77083eaa2f664e06775052;hb=a0f133ed22dee4eccc05961f646e14ecc0514060;hpb=a8f7addd5fca0af20a5942149711acc8bb35c5ce diff --git a/interface-ip.c b/interface-ip.c index 8eb2ff3..54f56d6 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -473,11 +473,17 @@ interface_update_proto_addr(struct vlist_tree *tree, if ((a_new->flags & DEVADDR_FAMILY) == DEVADDR_INET4 && !a_new->broadcast) { - uint32_t mask = ~0; - uint32_t *a = (uint32_t *) &a_new->addr; - - mask >>= a_new->mask; - a_new->broadcast = *a | htonl(mask); + /* /31 and /32 addressing need 255.255.255.255 + * as broadcast address. */ + if (a_new->mask >= 31) { + a_new->broadcast = (uint32_t) ~0; + } else { + uint32_t mask = ~0; + uint32_t *a = (uint32_t *) &a_new->addr; + + mask >>= a_new->mask; + a_new->broadcast = *a | htonl(mask); + } } } @@ -591,7 +597,7 @@ interface_update_proto_route(struct vlist_tree *tree, if (node_old && node_new) keep = !memcmp(&route_old->nexthop, &route_new->nexthop, sizeof(route_old->nexthop)) && (route_old->mtu == route_new->mtu) && (route_old->type == route_new->type) && - (route_old->valid_until == route_new->valid_until) && !route_old->failed; + !route_old->failed; if (node_old) { if (!(route_old->flags & DEVADDR_EXTERNAL) && route_old->enabled && !keep)