summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2016-03-26 21:41:18 +0000
committermpi <mpi@openbsd.org>2016-03-26 21:41:18 +0000
commit9306be5d06046e557065b257bd7603f2d22075d7 (patch)
tree4dc6c1ac7ccffd8738b45be4e7b5a11d51ef84b8
parentadd newline on the end of the failure message (diff)
downloadwireguard-openbsd-9306be5d06046e557065b257bd7603f2d22075d7.tar.xz
wireguard-openbsd-9306be5d06046e557065b257bd7603f2d22075d7.zip
Do not populate RTAX_NETMASK when sending a routing message for RTF_HOST
entries. This is a noop with the radix routing table because rt_mask() is always NULL for RTF_HOST entries, but it preserves the old behavior with ART. With the ART routing table host entry always have a prefix length equals to the length of the address. Fix a regression reported by semarie@. ok semarie@, bluhm@
-rw-r--r--sys/net/route.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index d301f5ec1f7..4c9f9bc6dfe 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.296 2016/03/07 18:44:00 naddy Exp $ */
+/* $OpenBSD: route.c,v 1.297 2016/03/26 21:41:18 mpi Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -480,7 +480,8 @@ rt_sendmsg(struct rtentry *rt, int cmd, u_int rtableid)
memset(&info, 0, sizeof(info));
info.rti_info[RTAX_DST] = rt_key(rt);
info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
- info.rti_info[RTAX_NETMASK] = rt_plen2mask(rt, &sa_mask);
+ if (!ISSET(rt->rt_flags, RTF_HOST))
+ info.rti_info[RTAX_NETMASK] = rt_plen2mask(rt, &sa_mask);
info.rti_info[RTAX_LABEL] = rtlabel_id2sa(rt->rt_labelid, &sa_rl);
ifp = if_get(rt->rt_ifidx);
if (ifp != NULL) {