summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2010-08-25 13:57:08 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2010-08-25 13:57:08 +0000
commita931256365e6b694f694c66b72d3e99f237425ed (patch)
tree86d72202bcc98ba3dae4715e739b856492d0b0ff /sys
parent331b4748570a2f58ba29b5a9f65aeaf57035dfd0 (diff)
Move the iface specific ioctl call for SIOCSIFRDOMAIN further down so that
all the magic cleanup happens before. This is needed because mpe(4) needs to add a route which would be removed by the cleanup code. OK henning
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if.c12
-rw-r--r--sys/net/if_mpe.c13
2 files changed, 18 insertions, 7 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 73015a235bd..bb06caf9f1d 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.222 2010/08/25 13:06:09 claudio Exp $ */
+/* $OpenBSD: if.c,v 1.223 2010/08/25 13:57:07 claudio Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1488,11 +1488,6 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
ifr->ifr_rdomainid > RT_TABLEID_MAX)
return (EINVAL);
- /* Let devices like enc(4) enforce the rdomain */
- if ((error = (*ifp->if_ioctl)(ifp, cmd, data)) != ENOTTY)
- return (error);
- error = 0;
-
/* remove all routing entries when switching domains */
/* XXX hell this is ugly */
if (ifr->ifr_rdomainid != ifp->if_rdomain) {
@@ -1530,6 +1525,11 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
splx(s);
}
+ /* Let devices like enc(4) enforce the rdomain */
+ if ((error = (*ifp->if_ioctl)(ifp, cmd, data)) != ENOTTY)
+ return (error);
+ error = 0;
+
/* Add interface to the specified rdomain */
rtable_addif(ifp, ifr->ifr_rdomainid);
break;
diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c
index 509bd795882..870360f2beb 100644
--- a/sys/net/if_mpe.c
+++ b/sys/net/if_mpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpe.c,v 1.21 2010/07/02 02:40:16 blambert Exp $ */
+/* $OpenBSD: if_mpe.c,v 1.22 2010/08/25 13:57:07 claudio Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -343,6 +343,17 @@ mpeioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
ifm->sc_shim.shim_label = shim.shim_label;
break;
+ case SIOCSIFRDOMAIN:
+ /* must readd the MPLS "route" for our label */
+ ifm = ifp->if_softc;
+ if (ifr->ifr_rdomainid != ifp->if_rdomain) {
+ if (ifm->sc_shim.shim_label) {
+ shim.shim_label = ifm->sc_shim.shim_label;
+ error = mpe_newlabel(ifp, RTM_ADD, &shim);
+ }
+ }
+ /* return with ENOTTY so that the parent handler finishes */
+ return (ENOTTY);
default:
return (ENOTTY);
}