A previous commit supposed to mask out excess host bits in route targets
failed to correctly calculate the mask value, causing it to produce
improper results for certain mask lengths.
Fixes: #17
Fixes: 76eb342 ("interface-ip: mask out host bits in IPv4 route targets")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
/* Mask out IPv4 host bits to avoid "Invalid prefix for given prefix length" */
if (af == AF_INET && route->mask < 32)
- route->addr.in.s_addr &= ((1u << route->mask) - 1);
+ clear_if_addr(&route->addr, route->mask);
}
if ((cur = tb[ROUTE_GATEWAY]) != NULL) {