diff options
author | akoshibe <akoshibe@cvs.openbsd.org> | 2018-08-09 03:35:20 +0000 |
---|---|---|
committer | akoshibe <akoshibe@cvs.openbsd.org> | 2018-08-09 03:35:20 +0000 |
commit | c221273428cdfb607e65e71b17d823669e67b8d1 (patch) | |
tree | d60ace4e7bab86cf6a00ee6a023302526e640399 /sys | |
parent | ad725f4bc50bf4b1af333640f417fa3186b7fed9 (diff) |
Currently, attempting to move an immovable lo(4) to a new rdomain will fail
with an EPERM, but the target rdomain will still be created.
Move the check for an lo(4)'s if_index/if_rdomain to before the creation of a
nonexisting target routing table.
ok benno@ claudio@ mpi@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index e6546dff224..7097eb278ef 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.558 2018/07/11 09:08:21 henning Exp $ */ +/* $OpenBSD: if.c,v 1.559 2018/08/09 03:35:19 akoshibe Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -1743,6 +1743,10 @@ if_setrdomain(struct ifnet *ifp, int rdomain) if (rdomain < 0 || rdomain > RT_TABLEID_MAX) return (EINVAL); + if ((ifp->if_flags & IFF_LOOPBACK) && + (ifp->if_index == rtable_loindex(ifp->if_rdomain))) + return (EPERM); + /* * Create the routing table if it does not exist, including its * loopback interface with unit == rdomain. @@ -1777,10 +1781,6 @@ if_setrdomain(struct ifnet *ifp, int rdomain) return (EINVAL); if (rdomain != ifp->if_rdomain) { - if ((ifp->if_flags & IFF_LOOPBACK) && - (ifp->if_index == rtable_loindex(ifp->if_rdomain))) - return (EPERM); - s = splnet(); /* * We are tearing down the world. |