summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryasuoka <yasuoka@openbsd.org>2018-09-08 01:03:59 +0000
committeryasuoka <yasuoka@openbsd.org>2018-09-08 01:03:59 +0000
commitd59e8e14cd2b84d6d268a21f40d6ec0b32baf5f7 (patch)
tree5f90b19af0dd554965ddc9647fd3f8f360b97d43
parentMore __func__ to fix error messages (diff)
downloadwireguard-openbsd-d59e8e14cd2b84d6d268a21f40d6ec0b32baf5f7.tar.xz
wireguard-openbsd-d59e8e14cd2b84d6d268a21f40d6ec0b32baf5f7.zip
Don't cause an error when setting the same rdomain.
Found by asou at soum.co.jp. ok claudio mpi akoshibe benno
-rw-r--r--sys/net/if.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 7097eb278ef..a78b53db9bc 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.559 2018/08/09 03:35:19 akoshibe Exp $ */
+/* $OpenBSD: if.c,v 1.560 2018/09/08 01:03:59 yasuoka Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1743,7 +1743,8 @@ if_setrdomain(struct ifnet *ifp, int rdomain)
if (rdomain < 0 || rdomain > RT_TABLEID_MAX)
return (EINVAL);
- if ((ifp->if_flags & IFF_LOOPBACK) &&
+ if (rdomain != ifp->if_rdomain &&
+ (ifp->if_flags & IFF_LOOPBACK) &&
(ifp->if_index == rtable_loindex(ifp->if_rdomain)))
return (EPERM);