diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-04-14 09:06:43 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-04-14 09:06:43 +0000 |
commit | 54617071ea9f9eb023d9167cbe7bfdb60e27aad3 (patch) | |
tree | 2218c953c0e2eb6e811932a00c47f0aaa1891483 /sys/netinet | |
parent | b2b037dc36001ccef4f7d611af54e498fb846fcc (diff) |
"struct pkthdr" holds a routing table ID, not a routing domain one.
Avoid the confusion by using an appropriate name for the variable.
Note that since routing domain IDs are a subset of the set of routing
table IDs, the following idiom is correct:
rtableid = rdomain
But to get the routing domain ID corresponding to a given routing table
ID, you must call rtable_l2(9).
claudio@ likes it, ok mikeb@
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/if_ether.c | 8 | ||||
-rw-r--r-- | sys/netinet/in_gif.c | 12 | ||||
-rw-r--r-- | sys/netinet/ip_carp.c | 6 | ||||
-rw-r--r-- | sys/netinet/ip_divert.c | 6 | ||||
-rw-r--r-- | sys/netinet/ip_ether.c | 6 | ||||
-rw-r--r-- | sys/netinet/ip_gre.c | 6 | ||||
-rw-r--r-- | sys/netinet/ip_icmp.c | 18 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 24 | ||||
-rw-r--r-- | sys/netinet/ip_ipip.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_ipsp.c | 6 | ||||
-rw-r--r-- | sys/netinet/ip_output.c | 22 | ||||
-rw-r--r-- | sys/netinet/ip_spd.c | 4 | ||||
-rw-r--r-- | sys/netinet/ipsec_input.c | 4 | ||||
-rw-r--r-- | sys/netinet/raw_ip.c | 8 | ||||
-rw-r--r-- | sys/netinet/tcp_input.c | 22 | ||||
-rw-r--r-- | sys/netinet/tcp_output.c | 6 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 8 | ||||
-rw-r--r-- | sys/netinet/udp_usrreq.c | 21 |
18 files changed, 96 insertions, 95 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index d645e7540b5..4286eaee5a9 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.124 2014/04/10 14:36:25 mikeb Exp $ */ +/* $OpenBSD: if_ether.c,v 1.125 2014/04/14 09:06:42 mpi Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -303,7 +303,7 @@ arprequest(struct ifnet *ifp, u_int32_t *sip, u_int32_t *tip, u_int8_t *enaddr) return; m->m_len = sizeof(*ea); m->m_pkthdr.len = sizeof(*ea); - m->m_pkthdr.rdomain = ifp->if_rdomain; + m->m_pkthdr.ph_rtableid = ifp->if_rdomain; MH_ALIGN(m, sizeof(*ea)); ea = mtod(m, struct ether_arp *); eh = (struct ether_header *)sa.sa_data; @@ -630,7 +630,7 @@ in_arpinput(struct mbuf *m) goto reply; } la = arplookup(isaddr.s_addr, itaddr.s_addr == myaddr.s_addr, 0, - rtable_l2(m->m_pkthdr.rdomain)); + rtable_l2(m->m_pkthdr.ph_rtableid)); if (la && (rt = la->la_rt) && (sdl = SDL(rt->rt_gateway))) { if (sdl->sdl_alen) { if (memcmp(ea->arp_sha, LLADDR(sdl), sdl->sdl_alen)) { @@ -729,7 +729,7 @@ out: memcpy(ea->arp_sha, enaddr, sizeof(ea->arp_sha)); } else { la = arplookup(itaddr.s_addr, 0, SIN_PROXY, - rtable_l2(m->m_pkthdr.rdomain)); + rtable_l2(m->m_pkthdr.ph_rtableid)); if (la == 0) goto out; rt = la->la_rt; diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c index 0a36e50d098..9e3e181cd6a 100644 --- a/sys/netinet/in_gif.c +++ b/sys/netinet/in_gif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_gif.c,v 1.39 2011/06/19 17:55:37 jsg Exp $ */ +/* $OpenBSD: in_gif.c,v 1.40 2014/04/14 09:06:42 mpi Exp $ */ /* $KAME: in_gif.c,v 1.50 2001/01/22 07:27:16 itojun Exp $ */ /* @@ -81,10 +81,10 @@ in_gif_output(struct ifnet *ifp, int family, struct mbuf **m0) } #ifdef DIAGNOSTIC - if (ifp->if_rdomain != rtable_l2(m->m_pkthdr.rdomain)) { + if (ifp->if_rdomain != rtable_l2(m->m_pkthdr.ph_rtableid)) { printf("%s: trying to send packet on wrong domain. " "if %d vs. mbuf %d, AF %d\n", ifp->if_xname, - ifp->if_rdomain, rtable_l2(m->m_pkthdr.rdomain), + ifp->if_rdomain, rtable_l2(m->m_pkthdr.ph_rtableid), family); } #endif @@ -145,7 +145,7 @@ in_gif_output(struct ifnet *ifp, int family, struct mbuf **m0) m = *m0; - m->m_pkthdr.rdomain = sc->gif_rtableid; + m->m_pkthdr.ph_rtableid = sc->gif_rtableid; #if NPF > 0 pf_pkt_addr_changed(m); #endif @@ -179,7 +179,7 @@ in_gif_input(struct mbuf *m, ...) sc->gif_psrc->sa_family != AF_INET || sc->gif_pdst->sa_family != AF_INET || rtable_l2(sc->gif_rtableid) != - rtable_l2(m->m_pkthdr.rdomain)) { + rtable_l2(m->m_pkthdr.ph_rtableid)) { continue; } @@ -195,7 +195,7 @@ in_gif_input(struct mbuf *m, ...) if (gifp) { m->m_pkthdr.rcvif = gifp; - m->m_pkthdr.rdomain = gifp->if_rdomain; + m->m_pkthdr.ph_rtableid = gifp->if_rdomain; gifp->if_ipackets++; gifp->if_ibytes += m->m_pkthdr.len; /* We have a configured GIF */ diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 7d9ad85434d..1b95591028b 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_carp.c,v 1.225 2014/03/27 10:39:23 mpi Exp $ */ +/* $OpenBSD: ip_carp.c,v 1.226 2014/04/14 09:06:42 mpi Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -1133,7 +1133,7 @@ carp_send_ad(void *v) len = sizeof(*ip) + sizeof(ch); m->m_pkthdr.len = len; m->m_pkthdr.rcvif = NULL; - m->m_pkthdr.rdomain = sc->sc_if.if_rdomain; + m->m_pkthdr.ph_rtableid = sc->sc_if.if_rdomain; m->m_pkthdr.pf.prio = CARP_IFQ_PRIO; m->m_len = len; MH_ALIGN(m, m->m_len); @@ -1225,7 +1225,7 @@ carp_send_ad(void *v) m->m_pkthdr.len = len; m->m_pkthdr.rcvif = NULL; m->m_pkthdr.pf.prio = CARP_IFQ_PRIO; - m->m_pkthdr.rdomain = sc->sc_if.if_rdomain; + m->m_pkthdr.ph_rtableid = sc->sc_if.if_rdomain; m->m_len = len; MH_ALIGN(m, m->m_len); m->m_flags |= M_MCAST; diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index d29a925c6b7..4a1ab47f26b 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_divert.c,v 1.19 2014/04/07 10:04:17 mpi Exp $ */ +/* $OpenBSD: ip_divert.c,v 1.20 2014/04/14 09:06:42 mpi Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -100,7 +100,7 @@ divert_output(struct mbuf *m, ...) m->m_pkthdr.rcvif = NULL; m->m_nextpkt = NULL; - m->m_pkthdr.rdomain = inp->inp_rtableid; + m->m_pkthdr.ph_rtableid = inp->inp_rtableid; if (control) m_freem(control); @@ -166,7 +166,7 @@ divert_output(struct mbuf *m, ...) if (sin->sin_addr.s_addr != INADDR_ANY) { ipaddr.sin_addr = sin->sin_addr; - ifa = ifa_ifwithaddr(sintosa(&ipaddr), m->m_pkthdr.rdomain); + ifa = ifa_ifwithaddr(sintosa(&ipaddr), m->m_pkthdr.ph_rtableid); if (ifa == NULL) { error = EADDRNOTAVAIL; goto fail; diff --git a/sys/netinet/ip_ether.c b/sys/netinet/ip_ether.c index c8e745fbd83..5ad8a94ec8b 100644 --- a/sys/netinet/ip_ether.c +++ b/sys/netinet/ip_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ether.c,v 1.65 2014/01/09 06:29:06 tedu Exp $ */ +/* $OpenBSD: ip_ether.c,v 1.66 2014/04/14 09:06:42 mpi Exp $ */ /* * The author of this code is Angelos D. Keromytis (kermit@adk.gr) * @@ -276,7 +276,7 @@ etherip_decap(struct mbuf *m, int iphlen) pf_pkt_addr_changed(m); #endif m->m_pkthdr.rcvif = &sc->gif_if; - m->m_pkthdr.rdomain = sc->gif_if.if_rdomain; + m->m_pkthdr.ph_rtableid = sc->gif_if.if_rdomain; if (m->m_flags & (M_BCAST|M_MCAST)) sc->gif_if.if_imcasts++; @@ -342,7 +342,7 @@ mplsip_decap(struct mbuf *m, int iphlen) #endif m->m_pkthdr.rcvif = &sc->gif_if; - m->m_pkthdr.rdomain = sc->gif_if.if_rdomain; + m->m_pkthdr.ph_rtableid = sc->gif_if.if_rdomain; #if NPF > 0 pf_pkt_addr_changed(m); #endif diff --git a/sys/netinet/ip_gre.c b/sys/netinet/ip_gre.c index 2b2c183a7da..1c6c464c73b 100644 --- a/sys/netinet/ip_gre.c +++ b/sys/netinet/ip_gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_gre.c,v 1.48 2013/12/31 03:24:44 tedu Exp $ */ +/* $OpenBSD: ip_gre.c,v 1.49 2014/04/14 09:06:42 mpi Exp $ */ /* $NetBSD: ip_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */ /* @@ -118,7 +118,7 @@ gre_input2(struct mbuf *m, int hlen, u_char proto) gip = mtod(m, struct greip *); m->m_pkthdr.rcvif = &sc->sc_if; - m->m_pkthdr.rdomain = sc->sc_if.if_rdomain; + m->m_pkthdr.ph_rtableid = sc->sc_if.if_rdomain; sc->sc_if.if_ipackets++; sc->sc_if.if_ibytes += m->m_pkthdr.len; @@ -363,7 +363,7 @@ gre_lookup(struct mbuf *m, u_int8_t proto) (sc->g_src.s_addr == ip->ip_dst.s_addr) && (sc->g_proto == proto) && (rtable_l2(sc->g_rtableid) == - rtable_l2(m->m_pkthdr.rdomain)) && + rtable_l2(m->m_pkthdr.ph_rtableid)) && ((sc->sc_if.if_flags & IFF_UP) != 0)) return (sc); } diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index 7f55d6e61b2..4fecc8b6ced 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_icmp.c,v 1.118 2014/03/21 10:44:42 mpi Exp $ */ +/* $OpenBSD: ip_icmp.c,v 1.119 2014/04/14 09:06:42 mpi Exp $ */ /* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */ /* @@ -218,8 +218,8 @@ icmp_do_error(struct mbuf *n, int type, int code, n_long dest, int destmtu) } if (m == NULL) goto freeit; - /* keep in same domain and rtable (the latter is a bit unclear) */ - m->m_pkthdr.rdomain = n->m_pkthdr.rdomain; + /* keep in same rtable */ + m->m_pkthdr.ph_rtableid = n->m_pkthdr.ph_rtableid; m->m_len = icmplen + ICMP_MINLEN; if ((m->m_flags & M_EXT) == 0) MH_ALIGN(m, m->m_len); @@ -491,7 +491,7 @@ icmp_input(struct mbuf *m, ...) */ ctlfunc = inetsw[ip_protox[icp->icmp_ip.ip_p]].pr_ctlinput; if (ctlfunc) - (*ctlfunc)(code, sintosa(&sin), m->m_pkthdr.rdomain, + (*ctlfunc)(code, sintosa(&sin), m->m_pkthdr.ph_rtableid, &icp->icmp_ip); break; @@ -638,10 +638,10 @@ reflect: #endif rtredirect(sintosa(&sdst), sintosa(&sgw), NULL, RTF_GATEWAY | RTF_HOST, sintosa(&ssrc), - &newrt, m->m_pkthdr.rdomain); + &newrt, m->m_pkthdr.ph_rtableid); if (newrt != NULL && icmp_redirtimeout != 0) { (void)rt_timer_add(newrt, icmp_redirect_timeout, - icmp_redirect_timeout_q, m->m_pkthdr.rdomain); + icmp_redirect_timeout_q, m->m_pkthdr.ph_rtableid); } if (newrt != NULL) rtfree(newrt); @@ -709,7 +709,7 @@ icmp_reflect(struct mbuf *m, struct mbuf **op, struct in_ifaddr *ia) if (ia == NULL) { TAILQ_FOREACH(ia, &in_ifaddr, ia_list) { if (ia->ia_ifp->if_rdomain != - rtable_l2(m->m_pkthdr.rdomain)) + rtable_l2(m->m_pkthdr.ph_rtableid)) continue; if (t.s_addr == ia->ia_addr.sin_addr.s_addr) break; @@ -729,7 +729,7 @@ icmp_reflect(struct mbuf *m, struct mbuf **op, struct in_ifaddr *ia) struct route ro; memset(&ro, 0, sizeof(ro)); - ro.ro_tableid = m->m_pkthdr.rdomain; + ro.ro_tableid = m->m_pkthdr.ph_rtableid; dst = satosin(&ro.ro_dst); dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); @@ -737,7 +737,7 @@ icmp_reflect(struct mbuf *m, struct mbuf **op, struct in_ifaddr *ia) /* keep packet in the original virtual instance */ ro.ro_rt = rtalloc1(&ro.ro_dst, RT_REPORT, - m->m_pkthdr.rdomain); + m->m_pkthdr.ph_rtableid); if (ro.ro_rt == 0) { ipstat.ips_noroute++; m_freem(m); diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 0022d57696e..cdff2df43a0 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.228 2014/03/27 10:44:23 mpi Exp $ */ +/* $OpenBSD: ip_input.c,v 1.229 2014/04/14 09:06:42 mpi Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -673,7 +673,7 @@ in_ouraddr(struct mbuf *m, struct ifnet *ifp, struct in_addr ina) sin.sin_len = sizeof(sin); sin.sin_family = AF_INET; sin.sin_addr = ina; - ia = ifatoia(ifa_ifwithaddr(sintosa(&sin), m->m_pkthdr.rdomain)); + ia = ifatoia(ifa_ifwithaddr(sintosa(&sin), m->m_pkthdr.ph_rtableid)); if (ia == NULL) { struct ifaddr *ifa; @@ -688,7 +688,7 @@ in_ouraddr(struct mbuf *m, struct ifnet *ifp, struct in_addr ina) !IN_CLASSFULBROADCAST(ina.s_addr, ina.s_addr)) return (0); - if (ifp->if_rdomain != m->m_pkthdr.rdomain) + if (ifp->if_rdomain != rtable_l2(m->m_pkthdr.ph_rtableid)) return (0); /* * The check in the loop assumes you only rx a packet on an UP @@ -1065,7 +1065,7 @@ ip_dooptions(struct mbuf *m, struct ifnet *ifp) } ipaddr.sin_addr = ip->ip_dst; ia = ifatoia(ifa_ifwithaddr(sintosa(&ipaddr), - m->m_pkthdr.rdomain)); + m->m_pkthdr.ph_rtableid)); if (ia == 0) { if (opt == IPOPT_SSRR) { type = ICMP_UNREACH; @@ -1094,13 +1094,13 @@ ip_dooptions(struct mbuf *m, struct ifnet *ifp) sizeof(ipaddr.sin_addr)); if (opt == IPOPT_SSRR) { if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(&ipaddr), - m->m_pkthdr.rdomain))) == NULL) + m->m_pkthdr.ph_rtableid))) == NULL) ia = ifatoia(ifa_ifwithnet(sintosa(&ipaddr), - m->m_pkthdr.rdomain)); + m->m_pkthdr.ph_rtableid)); } else /* keep packet in the virtual instance */ ia = ip_rtaddr(ipaddr.sin_addr, - m->m_pkthdr.rdomain); + m->m_pkthdr.ph_rtableid); if (ia == 0) { type = ICMP_UNREACH; code = ICMP_UNREACH_SRCFAIL; @@ -1140,9 +1140,9 @@ ip_dooptions(struct mbuf *m, struct ifnet *ifp) * Again keep the packet inside the virtual instance. */ if ((ia = ifatoia(ifa_ifwithaddr(sintosa(&ipaddr), - m->m_pkthdr.rdomain))) == 0 && + m->m_pkthdr.ph_rtableid))) == 0 && (ia = ip_rtaddr(ipaddr.sin_addr, - m->m_pkthdr.rdomain)) == 0) { + m->m_pkthdr.ph_rtableid)) == 0) { type = ICMP_UNREACH; code = ICMP_UNREACH_HOST; goto bad; @@ -1191,7 +1191,7 @@ ip_dooptions(struct mbuf *m, struct ifnet *ifp) memcpy(&ipaddr.sin_addr, &sin, sizeof(struct in_addr)); if (ifa_ifwithaddr(sintosa(&ipaddr), - m->m_pkthdr.rdomain) == 0) + m->m_pkthdr.ph_rtableid) == 0) continue; ipt.ipt_ptr += sizeof(struct in_addr); break; @@ -1402,7 +1402,7 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, int srcrt) return; } - rtableid = m->m_pkthdr.rdomain; + rtableid = m->m_pkthdr.ph_rtableid; sin = satosin(&ipforward_rt.ro_dst); if ((rt = ipforward_rt.ro_rt) == 0 || @@ -1458,7 +1458,7 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, int srcrt) (rt->rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) == 0 && satosin(rt_key(rt))->sin_addr.s_addr != 0 && ipsendredirects && !srcrt && - !arpproxy(satosin(rt_key(rt))->sin_addr, m->m_pkthdr.rdomain)) { + !arpproxy(satosin(rt_key(rt))->sin_addr, m->m_pkthdr.ph_rtableid)) { if (rt->rt_ifa && (ip->ip_src.s_addr & ifatoia(rt->rt_ifa)->ia_netmask) == ifatoia(rt->rt_ifa)->ia_net) { diff --git a/sys/netinet/ip_ipip.c b/sys/netinet/ip_ipip.c index fd67c21695c..9f67b266d5a 100644 --- a/sys/netinet/ip_ipip.c +++ b/sys/netinet/ip_ipip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipip.c,v 1.51 2013/10/24 11:31:43 mpi Exp $ */ +/* $OpenBSD: ip_ipip.c,v 1.52 2014/04/14 09:06:42 mpi Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -313,7 +313,7 @@ ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp, int proto) if ((m->m_pkthdr.rcvif == NULL || !(m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK)) && ipip_allow != 2) { - rdomain = rtable_l2(m->m_pkthdr.rdomain); + rdomain = rtable_l2(m->m_pkthdr.ph_rtableid); TAILQ_FOREACH(ifp, &ifnet, if_list) { if (ifp->if_rdomain != rdomain) continue; diff --git a/sys/netinet/ip_ipsp.c b/sys/netinet/ip_ipsp.c index 4bf78b72421..ed39eb78e25 100644 --- a/sys/netinet/ip_ipsp.c +++ b/sys/netinet/ip_ipsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipsp.c,v 1.193 2014/01/09 06:29:06 tedu Exp $ */ +/* $OpenBSD: ip_ipsp.c,v 1.194 2014/04/14 09:06:42 mpi Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr), @@ -1182,7 +1182,7 @@ ipsp_parse_headers(struct mbuf *m, int off, u_int8_t proto) sizeof(struct sockaddr_in6); tdbi->dst.sin6.sin6_addr = ip6_dst; tdbi->rdomain = - rtable_l2(m->m_pkthdr.rdomain); + rtable_l2(m->m_pkthdr.ph_rtableid); SLIST_INSERT_HEAD(&tags, mtag, m_tag_link); } @@ -1275,7 +1275,7 @@ ipsp_parse_headers(struct mbuf *m, int off, u_int8_t proto) (caddr_t) &tdbi->spi); tdbi->proto = proto; /* AH or ESP */ - tdbi->rdomain = rtable_l2(m->m_pkthdr.rdomain); + tdbi->rdomain = rtable_l2(m->m_pkthdr.ph_rtableid); #ifdef INET /* Last network header was IPv4. */ diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 3c5cb18912b..3fd187b9d23 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.260 2014/04/07 10:04:17 mpi Exp $ */ +/* $OpenBSD: ip_output.c,v 1.261 2014/04/14 09:06:42 mpi Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -182,7 +182,7 @@ ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro, int flags, */ if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 || dst->sin_addr.s_addr != ip->ip_dst.s_addr || - ro->ro_tableid != m->m_pkthdr.rdomain)) { + ro->ro_tableid != m->m_pkthdr.ph_rtableid)) { RTFREE(ro->ro_rt); ro->ro_rt = (struct rtentry *)0; } @@ -191,7 +191,7 @@ ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro, int flags, dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); dst->sin_addr = ip->ip_dst; - ro->ro_tableid = m->m_pkthdr.rdomain; + ro->ro_tableid = m->m_pkthdr.ph_rtableid; } if ((IN_MULTICAST(ip->ip_dst.s_addr) || @@ -332,7 +332,7 @@ reroute: */ if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 || dst->sin_addr.s_addr != ip->ip_dst.s_addr || - ro->ro_tableid != m->m_pkthdr.rdomain)) { + ro->ro_tableid != m->m_pkthdr.ph_rtableid)) { RTFREE(ro->ro_rt); ro->ro_rt = (struct rtentry *)0; } @@ -341,7 +341,7 @@ reroute: dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); dst->sin_addr = ip->ip_dst; - ro->ro_tableid = m->m_pkthdr.rdomain; + ro->ro_tableid = m->m_pkthdr.ph_rtableid; } if ((IN_MULTICAST(ip->ip_dst.s_addr) || @@ -489,7 +489,7 @@ reroute: * this check. */ if ((sproto == 0) && (in_broadcast(dst->sin_addr, ifp, - m->m_pkthdr.rdomain))) { + m->m_pkthdr.ph_rtableid))) { if ((ifp->if_flags & IFF_BROADCAST) == 0) { error = EADDRNOTAVAIL; goto bad; @@ -522,7 +522,7 @@ sendit: * Check if the packet needs encapsulation. */ if (sproto != 0) { - tdb = gettdb(rtable_l2(m->m_pkthdr.rdomain), + tdb = gettdb(rtable_l2(m->m_pkthdr.ph_rtableid), sspi, &sdst, sproto); if (tdb == NULL) { DPRINTF(("ip_output: unknown TDB")); @@ -578,7 +578,7 @@ sendit: rt = NULL; else if (rt == NULL || (rt->rt_flags & RTF_HOST) == 0) { rt = icmp_mtudisc_clone(ip->ip_dst, - m->m_pkthdr.rdomain); + m->m_pkthdr.ph_rtableid); rt_mtucloned = 1; } DPRINTF(("ip_output: spi %08x mtu %d rt %p cloned %d\n", @@ -588,7 +588,7 @@ sendit: if (ro && ro->ro_rt != NULL) { RTFREE(ro->ro_rt); ro->ro_rt = rtalloc1(&ro->ro_dst, RT_REPORT, - m->m_pkthdr.rdomain); + m->m_pkthdr.ph_rtableid); } if (rt_mtucloned) rtfree(rt); @@ -778,9 +778,9 @@ ip_fragment(struct mbuf *m, struct ifnet *ifp, u_long mtu) m->m_data += max_linkhdr; mhip = mtod(m, struct ip *); *mhip = *ip; - /* we must inherit MCAST and BCAST flags and rdomain */ + /* we must inherit MCAST and BCAST flags and routing table */ m->m_flags |= m0->m_flags & (M_MCAST|M_BCAST); - m->m_pkthdr.rdomain = m0->m_pkthdr.rdomain; + m->m_pkthdr.ph_rtableid = m0->m_pkthdr.ph_rtableid; if (hlen > sizeof (struct ip)) { mhlen = ip_optcopy(ip, mhip) + sizeof (struct ip); mhip->ip_hl = mhlen >> 2; diff --git a/sys/netinet/ip_spd.c b/sys/netinet/ip_spd.c index 795bc0381d0..49621775410 100644 --- a/sys/netinet/ip_spd.c +++ b/sys/netinet/ip_spd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_spd.c,v 1.70 2014/01/09 06:29:06 tedu Exp $ */ +/* $OpenBSD: ip_spd.c,v 1.71 2014/04/14 09:06:42 mpi Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -95,7 +95,7 @@ ipsp_spd_lookup(struct mbuf *m, int af, int hlen, int *error, int direction, struct ipsec_ref *dstid = NULL, *srcid = NULL; struct tdb *tdbin = NULL; int signore = 0, dignore = 0; - u_int rdomain = rtable_l2(m->m_pkthdr.rdomain); + u_int rdomain = rtable_l2(m->m_pkthdr.ph_rtableid); /* * If there are no flows in place, there's no point diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c index 5b9a36fb437..40f7afbae36 100644 --- a/sys/netinet/ipsec_input.c +++ b/sys/netinet/ipsec_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_input.c,v 1.119 2014/01/09 06:29:06 tedu Exp $ */ +/* $OpenBSD: ipsec_input.c,v 1.120 2014/04/14 09:06:42 mpi Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -235,7 +235,7 @@ ipsec_common_input(struct mbuf *m, int skip, int protoff, int af, int sproto, } s = splsoftnet(); - tdbp = gettdb(rtable_l2(m->m_pkthdr.rdomain), + tdbp = gettdb(rtable_l2(m->m_pkthdr.ph_rtableid), spi, &dst_address, sproto); if (tdbp == NULL) { splx(s); diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 3f796d5f29e..6e2de4c3ef6 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip.c,v 1.70 2014/04/07 10:04:17 mpi Exp $ */ +/* $OpenBSD: raw_ip.c,v 1.71 2014/04/14 09:06:42 mpi Exp $ */ /* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */ /* @@ -135,7 +135,7 @@ rip_input(struct mbuf *m, ...) continue; #endif if (rtable_l2(inp->inp_rtableid) != - rtable_l2(m->m_pkthdr.rdomain)) + rtable_l2(m->m_pkthdr.ph_rtableid)) continue; if (inp->inp_ip.ip_p && inp->inp_ip.ip_p != ip->ip_p) @@ -274,8 +274,8 @@ rip_output(struct mbuf *m, ...) * ip_output should be guarded against v6/v4 problems. */ #endif - /* force routing domain */ - m->m_pkthdr.rdomain = inp->inp_rtableid; + /* force routing table */ + m->m_pkthdr.ph_rtableid = inp->inp_rtableid; error = ip_output(m, inp->inp_options, &inp->inp_route, flags, inp->inp_moptions, inp); diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index ced6114875e..0572c82aeca 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.272 2014/01/24 18:54:58 henning Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.273 2014/04/14 09:06:42 mpi Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -464,7 +464,7 @@ tcp_input(struct mbuf *m, ...) ip = mtod(m, struct ip *); if (IN_MULTICAST(ip->ip_dst.s_addr) || in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif, - m->m_pkthdr.rdomain)) + m->m_pkthdr.ph_rtableid)) goto drop; #ifdef TCP_ECN /* save ip_tos before clearing it for checksum */ @@ -595,13 +595,13 @@ findpcb: case AF_INET6: inp = in6_pcbhashlookup(&tcbtable, &ip6->ip6_src, th->th_sport, &ip6->ip6_dst, th->th_dport, - m->m_pkthdr.rdomain); + m->m_pkthdr.ph_rtableid); break; #endif case AF_INET: inp = in_pcbhashlookup(&tcbtable, ip->ip_src, th->th_sport, ip->ip_dst, th->th_dport, - m->m_pkthdr.rdomain); + m->m_pkthdr.ph_rtableid); break; } #if NPF > 0 @@ -621,13 +621,13 @@ findpcb: case AF_INET6: inp = in6_pcblookup_listen(&tcbtable, &ip6->ip6_dst, th->th_dport, inpl_reverse, m, - m->m_pkthdr.rdomain); + m->m_pkthdr.ph_rtableid); break; #endif /* INET6 */ case AF_INET: inp = in_pcblookup_listen(&tcbtable, ip->ip_dst, th->th_dport, inpl_reverse, m, - m->m_pkthdr.rdomain); + m->m_pkthdr.ph_rtableid); break; } /* @@ -959,7 +959,7 @@ findpcb: if (optp) #endif if (tcp_dooptions(tp, optp, optlen, th, m, iphlen, &opti, - m->m_pkthdr.rdomain)) + m->m_pkthdr.ph_rtableid)) goto drop; if (opti.ts_present && opti.ts_ecr) { @@ -2255,12 +2255,12 @@ dropwithreset: goto drop; if (tiflags & TH_ACK) { tcp_respond(tp, mtod(m, caddr_t), th, (tcp_seq)0, th->th_ack, - TH_RST, m->m_pkthdr.rdomain); + TH_RST, m->m_pkthdr.ph_rtableid); } else { if (tiflags & TH_SYN) tlen++; tcp_respond(tp, mtod(m, caddr_t), th, th->th_seq + tlen, - (tcp_seq)0, TH_RST|TH_ACK, m->m_pkthdr.rdomain); + (tcp_seq)0, TH_RST|TH_ACK, m->m_pkthdr.ph_rtableid); } m_freem(m); return; @@ -3900,7 +3900,7 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th, resetandabort: tcp_respond(NULL, mtod(m, caddr_t), th, (tcp_seq)0, th->th_ack, TH_RST, - m->m_pkthdr.rdomain); + m->m_pkthdr.ph_rtableid); m_freem(m); abort: if (so != NULL) @@ -4238,7 +4238,7 @@ syn_cache_respond(struct syn_cache *sc, struct mbuf *m) m->m_data += max_linkhdr; m->m_len = m->m_pkthdr.len = tlen; m->m_pkthdr.rcvif = NULL; - m->m_pkthdr.rdomain = sc->sc_rtableid; + m->m_pkthdr.ph_rtableid = sc->sc_rtableid; memset(mtod(m, u_char *), 0, tlen); switch (sc->sc_src.sa.sa_family) { diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index caacc1d8233..d18c22776cb 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_output.c,v 1.104 2014/04/07 10:04:17 mpi Exp $ */ +/* $OpenBSD: tcp_output.c,v 1.105 2014/04/14 09:06:42 mpi Exp $ */ /* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */ /* @@ -1050,8 +1050,8 @@ send: } #endif - /* force routing domain */ - m->m_pkthdr.rdomain = tp->t_inpcb->inp_rtableid; + /* force routing table */ + m->m_pkthdr.ph_rtableid = tp->t_inpcb->inp_rtableid; #if NPF > 0 m->m_pkthdr.pf.inp = tp->t_inpcb; diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 5cbe000edd6..4ab283ccab8 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.125 2013/10/24 11:31:43 mpi Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.126 2014/04/14 09:06:42 mpi Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -397,11 +397,11 @@ tcp_respond(struct tcpcb *tp, caddr_t template, struct tcphdr *th0, th->th_win = htons((u_int16_t)win); th->th_urp = 0; - /* force routing domain */ + /* force routing table */ if (tp) - m->m_pkthdr.rdomain = tp->t_inpcb->inp_rtableid; + m->m_pkthdr.ph_rtableid = tp->t_inpcb->inp_rtableid; else - m->m_pkthdr.rdomain = rtableid; + m->m_pkthdr.ph_rtableid = rtableid; switch (af) { #ifdef INET6 diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 09f1b3689f0..6bfe5238e4b 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_usrreq.c,v 1.179 2014/04/07 19:51:15 chrisz Exp $ */ +/* $OpenBSD: udp_usrreq.c,v 1.180 2014/04/14 09:06:42 mpi Exp $ */ /* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */ /* @@ -406,10 +406,11 @@ udp_input(struct mbuf *m, ...) if ((ip6 && IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) || (ip && IN_MULTICAST(ip->ip_dst.s_addr)) || (ip && in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif, - m->m_pkthdr.rdomain))) { + m->m_pkthdr.ph_rtableid))) { #else /* INET6 */ if (IN_MULTICAST(ip->ip_dst.s_addr) || - in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif, m->m_pkthdr.rdomain)) { + in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif, + m->m_pkthdr.ph_rtableid)) { #endif /* INET6 */ struct inpcb *last; /* @@ -446,7 +447,7 @@ udp_input(struct mbuf *m, ...) continue; #endif if (rtable_l2(inp->inp_rtableid) != - rtable_l2(m->m_pkthdr.rdomain)) + rtable_l2(m->m_pkthdr.ph_rtableid)) continue; if (inp->inp_lport != uh->uh_dport) continue; @@ -563,11 +564,11 @@ udp_input(struct mbuf *m, ...) if (ip6) inp = in6_pcbhashlookup(&udbtable, &ip6->ip6_src, uh->uh_sport, &ip6->ip6_dst, uh->uh_dport, - m->m_pkthdr.rdomain); + m->m_pkthdr.ph_rtableid); else #endif /* INET6 */ inp = in_pcbhashlookup(&udbtable, ip->ip_src, uh->uh_sport, - ip->ip_dst, uh->uh_dport, m->m_pkthdr.rdomain); + ip->ip_dst, uh->uh_dport, m->m_pkthdr.ph_rtableid); #if NPF > 0 if (m->m_pkthdr.pf.statekey && inp) { m->m_pkthdr.pf.statekey->inp = inp; @@ -584,12 +585,12 @@ udp_input(struct mbuf *m, ...) if (ip6) { inp = in6_pcblookup_listen(&udbtable, &ip6->ip6_dst, uh->uh_dport, inpl_reverse, m, - m->m_pkthdr.rdomain); + m->m_pkthdr.ph_rtableid); } else #endif /* INET6 */ inp = in_pcblookup_listen(&udbtable, ip->ip_dst, uh->uh_dport, inpl_reverse, m, - m->m_pkthdr.rdomain); + m->m_pkthdr.ph_rtableid); if (inp == 0) { udpstat.udps_noport++; if (m->m_flags & (M_BCAST | M_MCAST)) { @@ -1093,8 +1094,8 @@ udp_output(struct mbuf *m, ...) udpstat.udps_opackets++; - /* force routing domain */ - m->m_pkthdr.rdomain = inp->inp_rtableid; + /* force routing table */ + m->m_pkthdr.ph_rtableid = inp->inp_rtableid; error = ip_output(m, inp->inp_options, &inp->inp_route, (inp->inp_socket->so_options & SO_BROADCAST) | IP_IPSECFLOW, |