summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_input.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2014-04-14 09:06:43 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2014-04-14 09:06:43 +0000
commit54617071ea9f9eb023d9167cbe7bfdb60e27aad3 (patch)
tree2218c953c0e2eb6e811932a00c47f0aaa1891483 /sys/netinet/ip_input.c
parentb2b037dc36001ccef4f7d611af54e498fb846fcc (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/ip_input.c')
-rw-r--r--sys/netinet/ip_input.c24
1 files changed, 12 insertions, 12 deletions
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) {