diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/pf.c | 10 | ||||
-rw-r--r-- | sys/netinet/in_pcb.c | 28 | ||||
-rw-r--r-- | sys/netinet/in_pcb.h | 9 | ||||
-rw-r--r-- | sys/netinet/ip_carp.c | 5 | ||||
-rw-r--r-- | sys/netinet/ip_icmp.c | 4 | ||||
-rw-r--r-- | sys/netinet/tcp_input.c | 8 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 10 | ||||
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 10 | ||||
-rw-r--r-- | sys/netinet/udp_usrreq.c | 18 | ||||
-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 |
16 files changed, 87 insertions, 67 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c index 1322ce6bc62..c9357ef3565 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.845 2013/10/19 10:47:53 henning Exp $ */ +/* $OpenBSD: pf.c,v 1.846 2013/10/20 11:03:00 phessler Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -2875,10 +2875,10 @@ pf_socket_lookup(struct pf_pdesc *pd) #ifdef INET6 case AF_INET6: inp = in6_pcbhashlookup(tb, &saddr->v6, sport, &daddr->v6, - dport); + dport, pd->rdomain); if (inp == NULL) { inp = in6_pcblookup_listen(tb, &daddr->v6, dport, 0, - NULL); + NULL, pd->rdomain); if (inp == NULL) return (-1); } @@ -5728,6 +5728,7 @@ pf_route6(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp, dst->sin6_family = AF_INET6; dst->sin6_len = sizeof(*dst); dst->sin6_addr = ip6->ip6_dst; + ro->ro_tableid = m0->m_pkthdr.rdomain; if (!r->rt) { m0->m_pkthdr.pf.flags |= PF_TAG_GENERATED; @@ -6130,6 +6131,7 @@ pf_setup_pdesc(struct pf_pdesc *pd, void *pdhdrs, sa_family_t af, int dir, pd->sidx = (dir == PF_IN) ? 0 : 1; pd->didx = (dir == PF_IN) ? 1 : 0; pd->af = pd->naf = af; + pd->rdomain = rtable_l2(pd->m->m_pkthdr.rdomain); switch (pd->af) { #ifdef INET @@ -6157,7 +6159,6 @@ pf_setup_pdesc(struct pf_pdesc *pd, void *pdhdrs, sa_family_t af, int dir, pd->virtual_proto = pd->proto = h->ip_p; pd->tot_len = ntohs(h->ip_len); pd->tos = h->ip_tos & ~IPTOS_ECN_MASK; - pd->rdomain = rtable_l2(pd->m->m_pkthdr.rdomain); pd->ttl = h->ip_ttl; if (h->ip_hl > 5) /* has options */ pd->badopts++; @@ -6207,7 +6208,6 @@ pf_setup_pdesc(struct pf_pdesc *pd, void *pdhdrs, sa_family_t af, int dir, pd->tot_len = ntohs(h->ip6_plen) + sizeof(struct ip6_hdr); pd->tos = 0; pd->ttl = h->ip6_hlim; - pd->rdomain = 0; if (pd->fragoff != 0) pd->virtual_proto = PF_VPROTO_FRAGMENT; diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 02330f5718c..b710bf30fd7 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.142 2013/10/18 21:27:27 bluhm Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.143 2013/10/20 11:03:00 phessler Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -122,9 +122,9 @@ int inpcb_pool_initialized = 0; &(table)->inpt_hashtbl[(ntohl((faddr)->s_addr) + \ ntohs((fport)) + ntohs((lport)) + (rdom)) & (table->inpt_hash)] -#define IN6PCBHASH(table, faddr, fport, laddr, lport) \ +#define IN6PCBHASH(table, faddr, fport, laddr, lport, rdom) \ &(table)->inpt_hashtbl[(ntohl((faddr)->s6_addr32[0] ^ \ - (faddr)->s6_addr32[3]) + ntohs((fport)) + ntohs((lport))) & \ + (faddr)->s6_addr32[3]) + ntohs((fport)) + ntohs((lport)) + (rdom)) & \ (table->inpt_hash)] #define INPCBLHASH(table, lport, rdom) \ @@ -873,8 +873,8 @@ in_pcbrehash(struct inpcb *inp) #ifdef INET6 if (inp->inp_flags & INP_IPV6) { LIST_INSERT_HEAD(IN6PCBHASH(table, &inp->inp_faddr6, - inp->inp_fport, &inp->inp_laddr6, inp->inp_lport), - inp, inp_hash); + inp->inp_fport, &inp->inp_laddr6, inp->inp_lport, + rtable_l2(inp->inp_rtableid)), inp, inp_hash); } else { #endif /* INET6 */ LIST_INSERT_HEAD(INPCBHASH(table, &inp->inp_faddr, @@ -944,19 +944,22 @@ in_pcbhashlookup(struct inpcbtable *table, struct in_addr faddr, #ifdef INET6 struct inpcb * in6_pcbhashlookup(struct inpcbtable *table, const struct in6_addr *faddr, - u_int fport_arg, const struct in6_addr *laddr, u_int lport_arg) + u_int fport_arg, const struct in6_addr *laddr, u_int lport_arg, + u_int rtable) { struct inpcbhead *head; struct inpcb *inp; u_int16_t fport = fport_arg, lport = lport_arg; - head = IN6PCBHASH(table, faddr, fport, laddr, lport); + rtable = rtable_l2(rtable); /* convert passed rtableid to rdomain */ + head = IN6PCBHASH(table, faddr, fport, laddr, lport, rtable); LIST_FOREACH(inp, head, inp_hash) { if (!(inp->inp_flags & INP_IPV6)) continue; if (IN6_ARE_ADDR_EQUAL(&inp->inp_faddr6, faddr) && inp->inp_fport == fport && inp->inp_lport == lport && - IN6_ARE_ADDR_EQUAL(&inp->inp_laddr6, laddr)) { + IN6_ARE_ADDR_EQUAL(&inp->inp_laddr6, laddr) && + rtable_l2(inp->inp_rtableid) == rtable) { /* * Move this PCB to the head of hash chain so that * repeated accesses are quicker. This is analogous to @@ -1062,13 +1065,14 @@ in_pcblookup_listen(struct inpcbtable *table, struct in_addr laddr, #ifdef INET6 struct inpcb * in6_pcblookup_listen(struct inpcbtable *table, struct in6_addr *laddr, - u_int lport_arg, int reverse, struct mbuf *m) + u_int lport_arg, int reverse, struct mbuf *m, u_int rtable) { struct inpcbhead *head; struct in6_addr *key1, *key2; struct inpcb *inp; u_int16_t lport = lport_arg; + rtable = rtable_l2(rtable); /* convert passed rtableid to rdomain */ #if NPF > 0 if (m && m->m_pkthdr.pf.flags & PF_TAG_DIVERTED) { struct pf_divert *divert; @@ -1087,21 +1091,23 @@ in6_pcblookup_listen(struct inpcbtable *table, struct in6_addr *laddr, key2 = &zeroin6_addr; } - head = IN6PCBHASH(table, &zeroin6_addr, 0, key1, lport); + head = IN6PCBHASH(table, &zeroin6_addr, 0, key1, lport, rtable); LIST_FOREACH(inp, head, inp_hash) { if (!(inp->inp_flags & INP_IPV6)) continue; if (inp->inp_lport == lport && inp->inp_fport == 0 && + rtable_l2(inp->inp_rtableid) == rtable && IN6_ARE_ADDR_EQUAL(&inp->inp_laddr6, key1) && IN6_IS_ADDR_UNSPECIFIED(&inp->inp_faddr6)) break; } if (inp == NULL && ! IN6_ARE_ADDR_EQUAL(key1, key2)) { - head = IN6PCBHASH(table, &zeroin6_addr, 0, key2, lport); + head = IN6PCBHASH(table, &zeroin6_addr, 0, key2, lport, rtable); LIST_FOREACH(inp, head, inp_hash) { if (!(inp->inp_flags & INP_IPV6)) continue; if (inp->inp_lport == lport && inp->inp_fport == 0 && + rtable_l2(inp->inp_rtableid) == rtable && IN6_ARE_ADDR_EQUAL(&inp->inp_laddr6, key2) && IN6_IS_ADDR_UNSPECIFIED(&inp->inp_faddr6)) break; diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 9c06a41c7b9..40b53761a85 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.h,v 1.79 2013/05/31 13:15:53 bluhm Exp $ */ +/* $OpenBSD: in_pcb.h,v 1.80 2013/10/20 11:03:00 phessler Exp $ */ /* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */ /* @@ -267,10 +267,11 @@ struct inpcb * #ifdef INET6 struct inpcb * in6_pcbhashlookup(struct inpcbtable *, const struct in6_addr *, - u_int, const struct in6_addr *, u_int); + u_int, const struct in6_addr *, u_int, u_int); struct inpcb * in6_pcblookup_listen(struct inpcbtable *, - struct in6_addr *, u_int, int, struct mbuf *); + struct in6_addr *, u_int, int, struct mbuf *, + u_int); int in6_pcbbind(struct inpcb *, struct mbuf *, struct proc *); int in6_pcbconnect(struct inpcb *, struct mbuf *); int in6_setsockaddr(struct inpcb *, struct mbuf *); @@ -294,7 +295,7 @@ struct rtentry * /* INET6 stuff */ int in6_pcbnotify(struct inpcbtable *, struct sockaddr_in6 *, - u_int, const struct sockaddr_in6 *, u_int, int, void *, + u_int, const struct sockaddr_in6 *, u_int, u_int, int, void *, void (*)(struct inpcb *, int)); int in6_selecthlim(struct inpcb *, struct ifnet *); int in6_pcbsetport(struct in6_addr *, struct inpcb *, struct proc *); diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index cfa476b9cc0..a967c29e4ff 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_carp.c,v 1.213 2013/10/19 16:09:53 bluhm Exp $ */ +/* $OpenBSD: ip_carp.c,v 1.214 2013/10/20 11:03:01 phessler Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -1241,7 +1241,7 @@ carp_send_ad(void *v) m->m_pkthdr.len = len; m->m_pkthdr.rcvif = NULL; m->m_pkthdr.pf.prio = CARP_IFQ_PRIO; - /* XXX m->m_pkthdr.rdomain = sc->sc_if.if_rdomain; */ + m->m_pkthdr.rdomain = sc->sc_if.if_rdomain; m->m_len = len; MH_ALIGN(m, m->m_len); m->m_flags |= M_MCAST; @@ -2123,6 +2123,7 @@ carp_set_addr6(struct carp_softc *sc, struct sockaddr_in6 *sin6) if (ia->ia_ifp != &sc->sc_if && ia->ia_ifp->if_type != IFT_CARP && (ia->ia_ifp->if_flags & IFF_MULTICAST) && + ia->ia_ifp->if_rdomain == sc->sc_if.if_rdomain && (i == 4)) break; } diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index 40f99cc0df4..d34fc1eaeb5 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_icmp.c,v 1.106 2013/08/21 09:05:22 mpi Exp $ */ +/* $OpenBSD: ip_icmp.c,v 1.107 2013/10/20 11:03:01 phessler Exp $ */ /* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */ /* @@ -722,6 +722,7 @@ icmp_reflect(struct mbuf *m, struct mbuf **op, struct in_ifaddr *ia) struct route ro; bzero((caddr_t) &ro, sizeof(ro)); + ro.ro_tableid = m->m_pkthdr.rdomain; dst = satosin(&ro.ro_dst); dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); @@ -925,6 +926,7 @@ icmp_mtudisc_clone(struct in_addr dst, u_int rtableid) int error; bzero(&ro, sizeof(ro)); + ro.ro_tableid = rtableid; sin = satosin(&ro.ro_dst); sin->sin_family = AF_INET; sin->sin_len = sizeof(*sin); diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 978e9474fcf..d9b274a437e 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.268 2013/09/06 18:35:16 bluhm Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.269 2013/10/20 11:03:01 phessler Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -596,7 +596,8 @@ findpcb: #ifdef INET6 case AF_INET6: inp = in6_pcbhashlookup(&tcbtable, &ip6->ip6_src, - th->th_sport, &ip6->ip6_dst, th->th_dport); + th->th_sport, &ip6->ip6_dst, th->th_dport, + m->m_pkthdr.rdomain); break; #endif case AF_INET: @@ -621,7 +622,8 @@ findpcb: #ifdef INET6 case AF_INET6: inp = in6_pcblookup_listen(&tcbtable, - &ip6->ip6_dst, th->th_dport, inpl_reverse, m); + &ip6->ip6_dst, th->th_dport, inpl_reverse, m, + m->m_pkthdr.rdomain); break; #endif /* INET6 */ case AF_INET: diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 1546619145c..3bb7f08f688 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.121 2013/10/19 10:38:55 henning Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.122 2013/10/20 11:03:01 phessler Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -728,7 +728,7 @@ tcp6_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *d) */ inp = in6_pcbhashlookup(&tcbtable, &sa6->sin6_addr, th.th_dport, (struct in6_addr *)&sa6_src->sin6_addr, - th.th_sport); + th.th_sport, rdomain); if (cmd == PRC_MSGSIZE) { /* * Depending on the value of "valid" and routing table @@ -752,10 +752,10 @@ tcp6_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *d) inet6ctlerrmap[cmd] == ENETUNREACH || inet6ctlerrmap[cmd] == EHOSTDOWN)) syn_cache_unreach((struct sockaddr *)sa6_src, - sa, &th, /* XXX */ 0); + sa, &th, rdomain); } else { (void) in6_pcbnotify(&tcbtable, sa6, 0, - sa6_src, 0, cmd, NULL, notify); + sa6_src, 0, rdomain, cmd, NULL, notify); } } #endif @@ -901,7 +901,7 @@ tcp6_mtudisc_callback(faddr) sin6.sin6_len = sizeof(struct sockaddr_in6); sin6.sin6_addr = *faddr; (void) in6_pcbnotify(&tcbtable, &sin6, 0, - &sa6_any, 0, PRC_MSGSIZE, NULL, tcp_mtudisc); + &sa6_any, 0, /* XXX rdomain */ 0, PRC_MSGSIZE, NULL, tcp_mtudisc); } #endif /* INET6 */ diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index d979aee0c1d..51c06c73129 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_usrreq.c,v 1.115 2013/10/17 16:27:44 bluhm Exp $ */ +/* $OpenBSD: tcp_usrreq.c,v 1.116 2013/10/20 11:03:01 phessler Exp $ */ /* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */ /* @@ -830,12 +830,12 @@ tcp_ident(void *oldp, size_t *oldlenp, void *newp, size_t newlen, int dodrop) #ifdef INET6 case AF_INET6: inp = in6_pcbhashlookup(&tcbtable, &f6, - fin6->sin6_port, &l6, lin6->sin6_port); + fin6->sin6_port, &l6, lin6->sin6_port, tir.rdomain); break; #endif case AF_INET: - inp = in_pcbhashlookup(&tcbtable, fin->sin_addr, - fin->sin_port, lin->sin_addr, lin->sin_port , tir.rdomain); + inp = in_pcbhashlookup(&tcbtable, fin->sin_addr, + fin->sin_port, lin->sin_addr, lin->sin_port, tir.rdomain); break; } @@ -855,7 +855,7 @@ tcp_ident(void *oldp, size_t *oldlenp, void *newp, size_t newlen, int dodrop) #ifdef INET6 case AF_INET6: inp = in6_pcblookup_listen(&tcbtable, - &l6, lin6->sin6_port, 0, NULL); + &l6, lin6->sin6_port, 0, NULL, tir.rdomain); break; #endif case AF_INET: diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 0604b9f0c8a..0aca9ff7d6f 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_usrreq.c,v 1.169 2013/10/19 10:38:55 henning Exp $ */ +/* $OpenBSD: udp_usrreq.c,v 1.170 2013/10/20 11:03:01 phessler Exp $ */ /* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */ /* @@ -565,7 +565,8 @@ udp_input(struct mbuf *m, ...) #ifdef INET6 if (ip6) inp = in6_pcbhashlookup(&udbtable, &ip6->ip6_src, - uh->uh_sport, &ip6->ip6_dst, uh->uh_dport); + uh->uh_sport, &ip6->ip6_dst, uh->uh_dport, + m->m_pkthdr.rdomain); else #endif /* INET6 */ inp = in_pcbhashlookup(&udbtable, ip->ip_src, uh->uh_sport, @@ -585,7 +586,8 @@ udp_input(struct mbuf *m, ...) #ifdef INET6 if (ip6) { inp = in6_pcblookup_listen(&udbtable, - &ip6->ip6_dst, uh->uh_dport, inpl_reverse, m); + &ip6->ip6_dst, uh->uh_dport, inpl_reverse, m, + m->m_pkthdr.rdomain); } else #endif /* INET6 */ inp = in_pcblookup_listen(&udbtable, @@ -870,7 +872,8 @@ udp6_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *d) * payload. */ if (in6_pcbhashlookup(&udbtable, &sa6.sin6_addr, - uh.uh_dport, &sa6_src.sin6_addr, uh.uh_sport)) + uh.uh_dport, &sa6_src.sin6_addr, uh.uh_sport, + rdomain)) valid = 1; #if 0 /* @@ -881,7 +884,8 @@ udp6_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *d) * is really ours. */ else if (in6_pcblookup_listen(&udbtable, - &sa6_src.sin6_addr, uh.uh_sport, 0); + &sa6_src.sin6_addr, uh.uh_sport, 0, + rdomain)) valid = 1; #endif @@ -904,10 +908,10 @@ udp6_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *d) } (void) in6_pcbnotify(&udbtable, &sa6, uh.uh_dport, - &sa6_src, uh.uh_sport, cmd, cmdarg, notify); + &sa6_src, uh.uh_sport, rdomain, cmd, cmdarg, notify); } else { (void) in6_pcbnotify(&udbtable, &sa6, 0, - &sa6_any, 0, cmd, cmdarg, notify); + &sa6_any, 0, rdomain, cmd, cmdarg, notify); } } #endif 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); } /* |