diff options
author | Peter Hessler <phessler@cvs.openbsd.org> | 2013-10-20 11:03:04 +0000 |
---|---|---|
committer | Peter Hessler <phessler@cvs.openbsd.org> | 2013-10-20 11:03:04 +0000 |
commit | 51af3a791d7649a044d750e62f6fadb6a19a067f (patch) | |
tree | 89492abc1a604c6e28a2e0a804e6e0a16891f066 /sys/netinet6 | |
parent | 5d95e5679b62bf050ffb3997ec86ef7f5f611b9a (diff) |
Put a large chunk of the IPv6 rdomain support in-tree.
Still some important missing pieces, and this is not yet enabled.
OK bluhm@
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/frag6.c | 3 | ||||
-rw-r--r-- | sys/netinet6/in6.c | 4 | ||||
-rw-r--r-- | sys/netinet6/in6_pcb.c | 16 | ||||
-rw-r--r-- | sys/netinet6/nd6.c | 9 | ||||
-rw-r--r-- | sys/netinet6/nd6_nbr.c | 4 | ||||
-rw-r--r-- | sys/netinet6/nd6_rtr.c | 7 | ||||
-rw-r--r-- | sys/netinet6/raw_ip6.c | 9 |
7 files changed, 28 insertions, 24 deletions
diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index a0407d809b1..bfb5c945018 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frag6.c,v 1.49 2013/10/17 16:27:45 bluhm Exp $ */ +/* $OpenBSD: frag6.c,v 1.50 2013/10/20 11:03:02 phessler Exp $ */ /* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */ /* @@ -189,6 +189,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) #ifdef IN6_IFSTAT_STRICT /* find the destination interface of the packet. */ bzero(&ro, sizeof(ro)); + ro.ro_tableid = m->m_pkthdr.rdomain; dst = &ro.ro_dst; dst->sin6_family = AF_INET6; dst->sin6_len = sizeof(struct sockaddr_in6); diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index f59bf0ccbcc..57c8d825405 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.120 2013/10/17 16:27:45 bluhm Exp $ */ +/* $OpenBSD: in6.c,v 1.121 2013/10/20 11:03:02 phessler Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -283,7 +283,7 @@ in6_ifremloop(struct ifaddr *ifa) * a subnet-router anycast address on an interface attached * to a shared medium. */ - rt = rtalloc1(ifa->ifa_addr, 0, 0); + rt = rtalloc1(ifa->ifa_addr, 0, ifa->ifa_ifp->if_rdomain); if (rt != NULL && (rt->rt_flags & RTF_HOST) != 0 && (rt->rt_ifp->if_flags & IFF_LOOPBACK) != 0) { rt->rt_refcnt--; diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 14828324d45..6061d25deb2 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_pcb.c,v 1.56 2013/05/31 15:04:24 bluhm Exp $ */ +/* $OpenBSD: in6_pcb.c,v 1.57 2013/10/20 11:03:02 phessler Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -269,7 +269,7 @@ in6_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p) t = in_pcblookup(head, (struct in_addr *)&zeroin6_addr, 0, (struct in_addr *)&sin6->sin6_addr, lport, - wild, /* XXX */ 0); + wild, inp->inp_rtableid); if (t && (reuseport & t->inp_socket->so_options) == 0) return EADDRINUSE; @@ -346,7 +346,7 @@ in6_pcbsetport(struct in6_addr *laddr, struct inpcb *inp, struct proc *p) lport = htons(*lastport); } while (in_baddynamic(*lastport, so->so_proto->pr_protocol) || in_pcblookup(table, &zeroin6_addr, 0, - &inp->inp_laddr6, lport, wild, /* XXX */ 0)); + &inp->inp_laddr6, lport, wild, inp->inp_rtableid)); } else { /* * counting up @@ -364,7 +364,7 @@ in6_pcbsetport(struct in6_addr *laddr, struct inpcb *inp, struct proc *p) lport = htons(*lastport); } while (in_baddynamic(*lastport, so->so_proto->pr_protocol) || in_pcblookup(table, &zeroin6_addr, 0, - &inp->inp_laddr6, lport, wild, /* XXX */ 0)); + &inp->inp_laddr6, lport, wild, inp->inp_rtableid)); } inp->inp_lport = lport; @@ -445,7 +445,7 @@ in6_pcbconnect(struct inpcb *inp, struct mbuf *nam) if (in_pcblookup(inp->inp_table, &sin6->sin6_addr, sin6->sin6_port, IN6_IS_ADDR_UNSPECIFIED(&inp->inp_laddr6) ? in6a : &inp->inp_laddr6, - inp->inp_lport, INPLOOKUP_IPV6, /* XXX */ 0)) { + inp->inp_lport, INPLOOKUP_IPV6, inp->inp_rtableid)) { return (EADDRINUSE); } if (IN6_IS_ADDR_UNSPECIFIED(&inp->inp_laddr6)) { @@ -479,8 +479,8 @@ in6_pcbconnect(struct inpcb *inp, struct mbuf *nam) */ int in6_pcbnotify(struct inpcbtable *head, struct sockaddr_in6 *dst, - uint fport_arg, const struct sockaddr_in6 *src, uint lport_arg, int cmd, - void *cmdarg, void (*notify)(struct inpcb *, int)) + uint fport_arg, const struct sockaddr_in6 *src, uint lport_arg, + u_int rdomain, int cmd, void *cmdarg, void (*notify)(struct inpcb *, int)) { struct inpcb *inp, *ninp; u_short fport = fport_arg, lport = lport_arg; @@ -501,6 +501,7 @@ in6_pcbnotify(struct inpcbtable *head, struct sockaddr_in6 *dst, return (0); } + rdomain = rtable_l2(rdomain); /* * note that src can be NULL when we get notify by local fragmentation. */ @@ -590,6 +591,7 @@ in6_pcbnotify(struct inpcbtable *head, struct sockaddr_in6 *dst, goto do_notify; else if (!IN6_ARE_ADDR_EQUAL(&inp->inp_faddr6, &dst->sin6_addr) || + rtable_l2(inp->inp_rtableid) != rdomain || inp->inp_socket == 0 || (lport && inp->inp_lport != lport) || (!IN6_IS_ADDR_UNSPECIFIED(&sa6_src.sin6_addr) && diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 3f279fec873..0675307b32d 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.102 2013/08/28 06:58:57 mpi Exp $ */ +/* $OpenBSD: nd6.c,v 1.103 2013/10/20 11:03:02 phessler Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -948,10 +948,6 @@ nd6_nud_hint(struct rtentry *rt, struct in6_addr *dst6, int force) } } -/* - * info - XXX: unused - */ - void nd6_rtrequest(int req, struct rtentry *rt) { @@ -1023,7 +1019,8 @@ nd6_rtrequest(int req, struct rtentry *rt) * (RTF_LLINFO && !ln case). */ rt_setgate(rt, rt_key(rt), - (struct sockaddr *)&null_sdl, 0); + (struct sockaddr *)&null_sdl, + rt->rt_ifp->if_rdomain); gate = rt->rt_gateway; SDL(gate)->sdl_type = ifp->if_type; SDL(gate)->sdl_index = ifp->if_index; diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index f7bfe793af6..d8b82afbdf4 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_nbr.c,v 1.68 2013/10/17 16:27:46 bluhm Exp $ */ +/* $OpenBSD: nd6_nbr.c,v 1.69 2013/10/20 11:03:02 phessler Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -349,6 +349,7 @@ nd6_ns_output(struct ifnet *ifp, struct in6_addr *daddr6, struct route_in6 ro; bzero(&ro, sizeof(ro)); + ro.ro_tableid = ifp->if_rdomain; if (IN6_IS_ADDR_MULTICAST(taddr6)) return; @@ -883,6 +884,7 @@ nd6_na_output(struct ifnet *ifp, struct in6_addr *daddr6, mac = NULL; bzero(&ro, sizeof(ro)); + ro.ro_tableid = ifp->if_rdomain; /* estimate the size of message */ maxlen = sizeof(*ip6) + sizeof(*nd_na); diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index a0393f3670c..e4d08cb10e3 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_rtr.c,v 1.72 2013/07/01 14:22:20 bluhm Exp $ */ +/* $OpenBSD: nd6_rtr.c,v 1.73 2013/10/20 11:03:02 phessler Exp $ */ /* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */ /* @@ -427,7 +427,8 @@ nd6_rtmsg(int cmd, struct rtentry *rt) info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr; } - rt_missmsg(cmd, &info, rt->rt_flags, rt->rt_ifp, 0, 0); + rt_missmsg(cmd, &info, rt->rt_flags, rt->rt_ifp, 0, + rt->rt_ifp->if_rdomain); } void @@ -1947,7 +1948,7 @@ in6_init_address_ltimes(struct nd_prefix *new, struct in6_addrlifetime *lt6) void rt6_flush(struct in6_addr *gateway, struct ifnet *ifp) { - struct radix_node_head *rnh = rt_gettable(AF_INET6, 0); + struct radix_node_head *rnh = rt_gettable(AF_INET6, ifp->if_rdomain); int s = splsoftnet(); /* We'll care only link-local addresses */ diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index e62599bece3..5f3e75d7698 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip6.c,v 1.59 2013/10/17 16:27:47 bluhm Exp $ */ +/* $OpenBSD: raw_ip6.c,v 1.60 2013/10/20 11:03:03 phessler Exp $ */ /* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */ /* @@ -305,7 +305,7 @@ rip6_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *d) */ in6p = NULL; in6p = in6_pcbhashlookup(&rawin6pcbtable, &sa6->sin6_addr, 0, - &sa6_src->sin6_addr, 0); + &sa6_src->sin6_addr, 0, rdomain); #if 0 if (!in6p) { /* @@ -317,7 +317,8 @@ rip6_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *d) */ in6p = in_pcblookup(&rawin6pcbtable, &sa6->sin6_addr, 0, (struct in6_addr *)&sa6_src->sin6_addr, 0, - INPLOOKUP_WILDCARD | INPLOOKUP_IPV6); + INPLOOKUP_WILDCARD | INPLOOKUP_IPV6, + rdomain); } #endif @@ -344,7 +345,7 @@ rip6_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *d) } (void) in6_pcbnotify(&rawin6pcbtable, sa6, 0, - sa6_src, 0, cmd, cmdarg, notify); + sa6_src, 0, rdomain, cmd, cmdarg, notify); } /* |