summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2020-01-08 10:02:55 +0000
committerclaudio <claudio@openbsd.org>2020-01-08 10:02:55 +0000
commit9c223be75852e06e0e4f0af96e2e9f9b05e981d1 (patch)
treec1857b156c7f3e826c59a5a1e0df2641e5a1927c
parentremove literal tab from a column list; (diff)
downloadwireguard-openbsd-9c223be75852e06e0e4f0af96e2e9f9b05e981d1.tar.xz
wireguard-openbsd-9c223be75852e06e0e4f0af96e2e9f9b05e981d1.zip
Fix confusion around rtlabelid and rtableid in rt_ifa_add() and rt_ifa_del().
The routing labels have nothing todo with rdomains and routing tables. Remove the unneeded rdomain check. With this rtlabel on interfaces work again. OK kn@
-rw-r--r--sys/net/route.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index 2cc08bbe552..85431805560 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.387 2019/06/24 22:26:25 bluhm Exp $ */
+/* $OpenBSD: route.c,v 1.388 2020/01/08 10:02:55 claudio Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -1101,6 +1101,8 @@ rt_ifa_add(struct ifaddr *ifa, int flags, struct sockaddr *dst,
uint8_t prio = ifp->if_priority + RTP_STATIC;
int error;
+ KASSERT(rdomain == rtable_l2(rdomain));
+
memset(&info, 0, sizeof(info));
info.rti_ifa = ifa;
info.rti_flags = flags;
@@ -1109,12 +1111,7 @@ rt_ifa_add(struct ifaddr *ifa, int flags, struct sockaddr *dst,
info.rti_info[RTAX_GATEWAY] = sdltosa(ifp->if_sadl);
else
info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr;
-
- KASSERT(rdomain == rtable_l2(rdomain));
- if (rdomain == rtable_l2(ifp->if_rtlabelid)) {
- info.rti_info[RTAX_LABEL] =
- rtlabel_id2sa(ifp->if_rtlabelid, &sa_rl);
- }
+ info.rti_info[RTAX_LABEL] = rtlabel_id2sa(ifp->if_rtlabelid, &sa_rl);
#ifdef MPLS
if ((flags & RTF_MPLS) == RTF_MPLS)
@@ -1158,6 +1155,8 @@ rt_ifa_del(struct ifaddr *ifa, int flags, struct sockaddr *dst,
uint8_t prio = ifp->if_priority + RTP_STATIC;
int error;
+ KASSERT(rdomain == rtable_l2(rdomain));
+
if ((flags & RTF_HOST) == 0 && ifa->ifa_netmask) {
m = m_get(M_DONTWAIT, MT_SONAME);
if (m == NULL)
@@ -1173,11 +1172,7 @@ rt_ifa_del(struct ifaddr *ifa, int flags, struct sockaddr *dst,
info.rti_info[RTAX_DST] = dst;
if ((flags & RTF_LLINFO) == 0)
info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr;
-
- if (rdomain == rtable_l2(ifp->if_rtlabelid)) {
- info.rti_info[RTAX_LABEL] =
- rtlabel_id2sa(ifp->if_rtlabelid, &sa_rl);
- }
+ info.rti_info[RTAX_LABEL] = rtlabel_id2sa(ifp->if_rtlabelid, &sa_rl);
if ((flags & RTF_HOST) == 0)
info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask;