summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2018-09-08 01:04:00 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2018-09-08 01:04:00 +0000
commit4c3475c2990afd050591a1b4f7487c5a3863e71f (patch)
treea239be340007049ec6aa95d12575b8e6d95d9046
parent232c98426493a7e81fe3d12c28ca9f0265719a25 (diff)
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);