From 810ae1b744042fbfe474c2d431fac6f7ec5e7693 Mon Sep 17 00:00:00 2001 From: Peter Hessler Date: Mon, 21 Oct 2013 08:44:14 +0000 Subject: Enable IPv6 routing domain support Started by claudio@ for IPv4, lots of heavy work by sperreault@ My part started at s2k11, continued at n2k12, g2k12, c2k12 and n2k13. Lots of help and hints from claudio and bluhm OK claudio@, bluhm@ --- sys/net/if.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'sys/net') diff --git a/sys/net/if.c b/sys/net/if.c index 23014af5566..b773e41cb86 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.272 2013/10/20 13:21:56 claudio Exp $ */ +/* $OpenBSD: if.c,v 1.273 2013/10/21 08:44:13 phessler Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -1213,6 +1213,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) size_t bytesdone; short oif_flags; const char *label; + short up = 0; switch (cmd) { @@ -1495,6 +1496,16 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) /* XXX hell this is ugly */ if (ifr->ifr_rdomainid != ifp->if_rdomain) { s = splnet(); + if (ifp->if_flags & IFF_UP) + up = 1; + /* + * We are tearing down the world. + * Take down the IF so: + * 1. everything that cares gets a message + * 2. the automagic IPv6 bits are recreated + */ + if (up) + if_down(ifp); rt_if_remove(ifp); #ifdef INET rti_delete(ifp); @@ -1504,7 +1515,6 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) #endif #ifdef INET6 in6_ifdetach(ifp); - ifp->if_xflags |= IFXF_NOINET6; #endif #ifdef INET in_ifdetach(ifp); @@ -1652,6 +1662,12 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) } #endif } + /* If we took down the IF, bring it back */ + if (up) { + s = splnet(); + if_up(ifp); + splx(s); + } return (error); } -- cgit v1.2.3