summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2010-07-03 04:44:53 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2010-07-03 04:44:53 +0000
commit1df4f9d5fc0dabecca2ff9680db469442a1cfc73 (patch)
treef1096c33d9ee94872dc2030b23f093a1335185a3 /sys/netinet
parenta5a38a4c5ed836aeac420d462a2319bc2732aab9 (diff)
Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!) to rtables and not just rdomains. This changes the name of the system calls, socket option, and ioctl. After building with this you should remove the files /usr/share/man/cat2/[gs]etrdomain.0. Since this removes the existing [gs]etrdomain() system calls, the libc major is bumped. Written by claudio@, criticized^Wcritiqued by me
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in_pcb.c68
-rw-r--r--sys/netinet/in_pcb.h4
-rw-r--r--sys/netinet/ip_divert.c4
-rw-r--r--sys/netinet/ip_icmp.c3
-rw-r--r--sys/netinet/ip_output.c31
-rw-r--r--sys/netinet/raw_ip.c9
-rw-r--r--sys/netinet/tcp_input.c30
-rw-r--r--sys/netinet/tcp_output.c4
-rw-r--r--sys/netinet/tcp_subr.c23
-rw-r--r--sys/netinet/tcp_timer.c8
-rw-r--r--sys/netinet/tcp_var.h4
-rw-r--r--sys/netinet/udp_usrreq.c7
12 files changed, 93 insertions, 102 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index b57ae431fad..026b74b1502 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.112 2010/05/07 13:33:16 claudio Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.113 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -197,13 +197,13 @@ in_pcballoc(so, v)
inp->inp_seclevel[SL_ESP_TRANS] = ipsec_esp_trans_default_level;
inp->inp_seclevel[SL_ESP_NETWORK] = ipsec_esp_network_default_level;
inp->inp_seclevel[SL_IPCOMP] = ipsec_ipcomp_default_level;
- inp->inp_rdomain = curproc->p_p->ps_rdomain;
+ inp->inp_rtableid = curproc->p_p->ps_rtableid;
s = splnet();
CIRCLEQ_INSERT_HEAD(&table->inpt_queue, inp, inp_queue);
LIST_INSERT_HEAD(INPCBLHASH(table, inp->inp_lport,
- inp->inp_rdomain), inp, inp_lhash);
+ inp->inp_rtableid), inp, inp_lhash);
LIST_INSERT_HEAD(INPCBHASH(table, &inp->inp_faddr, inp->inp_fport,
- &inp->inp_laddr, inp->inp_lport, inp->inp_rdomain),
+ &inp->inp_laddr, inp->inp_lport, rtable_l2(inp->inp_rtableid)),
inp, inp_hash);
splx(s);
so->so_pcb = inp;
@@ -277,7 +277,7 @@ in_pcbbind(v, nam, p)
sin->sin_port = 0; /* yech... */
if (!(so->so_options & SO_BINDANY) &&
in_iawithaddr(sin->sin_addr, NULL,
- inp->inp_rdomain) == 0)
+ inp->inp_rtableid) == 0)
return (EADDRNOTAVAIL);
}
if (lport) {
@@ -290,12 +290,12 @@ in_pcbbind(v, nam, p)
if (so->so_euid) {
t = in_pcblookup(table, &zeroin_addr, 0,
&sin->sin_addr, lport, INPLOOKUP_WILDCARD,
- inp->inp_rdomain);
+ inp->inp_rtableid);
if (t && (so->so_euid != t->inp_socket->so_euid))
return (EADDRINUSE);
}
t = in_pcblookup(table, &zeroin_addr, 0,
- &sin->sin_addr, lport, wild, inp->inp_rdomain);
+ &sin->sin_addr, lport, wild, inp->inp_rtableid);
if (t && (reuseport & t->inp_socket->so_options) == 0)
return (EADDRINUSE);
}
@@ -343,7 +343,7 @@ in_pcbbind(v, nam, p)
lport = htons(*lastport);
} while (in_baddynamic(*lastport, so->so_proto->pr_protocol) ||
in_pcblookup(table, &zeroin_addr, 0,
- &inp->inp_laddr, lport, wild, inp->inp_rdomain));
+ &inp->inp_laddr, lport, wild, inp->inp_rtableid));
} else {
/*
* counting up
@@ -361,7 +361,7 @@ in_pcbbind(v, nam, p)
lport = htons(*lastport);
} while (in_baddynamic(*lastport, so->so_proto->pr_protocol) ||
in_pcblookup(table, &zeroin_addr, 0,
- &inp->inp_laddr, lport, wild, inp->inp_rdomain));
+ &inp->inp_laddr, lport, wild, inp->inp_rtableid));
}
}
inp->inp_lport = lport;
@@ -415,7 +415,7 @@ in_pcbconnect(v, nam)
int error;
ifaddr = in_selectsrc(sin, &inp->inp_route,
inp->inp_socket->so_options, inp->inp_moptions, &error,
- inp->inp_rdomain);
+ inp->inp_rtableid);
if (ifaddr == NULL) {
if (error == 0)
error = EADDRNOTAVAIL;
@@ -424,7 +424,7 @@ in_pcbconnect(v, nam)
}
if (in_pcbhashlookup(inp->inp_table, sin->sin_addr, sin->sin_port,
inp->inp_laddr.s_addr ? inp->inp_laddr : ifaddr->sin_addr,
- inp->inp_lport, inp->inp_rdomain) != 0)
+ inp->inp_lport, inp->inp_rtableid) != 0)
return (EADDRINUSE);
if (inp->inp_laddr.s_addr == INADDR_ANY) {
if (inp->inp_lport == 0 &&
@@ -570,12 +570,8 @@ in_setpeeraddr(inp, nam)
* Must be called at splsoftnet.
*/
void
-in_pcbnotifyall(table, dst, rdomain, errno, notify)
- struct inpcbtable *table;
- struct sockaddr *dst;
- u_int rdomain;
- int errno;
- void (*notify)(struct inpcb *, int);
+in_pcbnotifyall(struct inpcbtable *table, struct sockaddr *dst, u_int rdomain,
+ int errno, void (*notify)(struct inpcb *, int))
{
struct inpcb *inp, *oinp;
struct in_addr faddr;
@@ -596,6 +592,7 @@ in_pcbnotifyall(table, dst, rdomain, errno, notify)
if (faddr.s_addr == INADDR_ANY)
return;
+ rdomain = rtable_l2(rdomain);
for (inp = CIRCLEQ_FIRST(&table->inpt_queue);
inp != CIRCLEQ_END(&table->inpt_queue);) {
#ifdef INET6
@@ -605,7 +602,7 @@ in_pcbnotifyall(table, dst, rdomain, errno, notify)
}
#endif
if (inp->inp_faddr.s_addr != faddr.s_addr ||
- inp->inp_rdomain != rdomain ||
+ rtable_l2(inp->inp_rtableid) != rdomain ||
inp->inp_socket == 0) {
inp = CIRCLEQ_NEXT(inp, inp_queue);
continue;
@@ -638,10 +635,10 @@ in_losing(inp)
info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
info.rti_info[RTAX_NETMASK] = rt_mask(rt);
rt_missmsg(RTM_LOSING, &info, rt->rt_flags, rt->rt_ifp, 0,
- inp->inp_rdomain);
+ inp->inp_rtableid);
if (rt->rt_flags & RTF_DYNAMIC)
(void)rtrequest1(RTM_DELETE, &info, rt->rt_priority,
- (struct rtentry **)0, inp->inp_rdomain);
+ (struct rtentry **)0, inp->inp_rtableid);
/*
* A new route can be allocated
* the next time output is attempted.
@@ -672,7 +669,8 @@ in_rtchange(inp, errno)
}
struct inpcb *
-in_pcblookup(struct inpcbtable *table, void *faddrp, u_int fport_arg, void *laddrp, u_int lport_arg, int flags, u_int rdomain)
+in_pcblookup(struct inpcbtable *table, void *faddrp, u_int fport_arg,
+ void *laddrp, u_int lport_arg, int flags, u_int rdomain)
{
struct inpcb *inp, *match = 0;
int matchwild = 3, wildcard;
@@ -680,10 +678,10 @@ in_pcblookup(struct inpcbtable *table, void *faddrp, u_int fport_arg, void *ladd
struct in_addr faddr = *(struct in_addr *)faddrp;
struct in_addr laddr = *(struct in_addr *)laddrp;
- rdomain = rtable_l2(rdomain);
+ rdomain = rtable_l2(rdomain); /* convert passed rtableid to rdomain */
for (inp = LIST_FIRST(INPCBLHASH(table, lport, rdomain)); inp;
inp = LIST_NEXT(inp, inp_lhash)) {
- if (inp->inp_rdomain != rdomain)
+ if (rtable_l2(inp->inp_rtableid) != rdomain)
continue;
if (inp->inp_lport != lport)
continue;
@@ -789,7 +787,7 @@ in_pcbrtentry(inp)
break;
ro->ro_dst.sa_family = AF_INET;
ro->ro_dst.sa_len = sizeof(ro->ro_dst);
- ro->ro_tableid = inp->inp_rdomain;
+ ro->ro_tableid = inp->inp_rtableid;
satosin(&ro->ro_dst)->sin_addr = inp->inp_faddr;
rtalloc_mpath(ro, &inp->inp_laddr.s_addr);
break;
@@ -800,7 +798,7 @@ in_pcbrtentry(inp)
struct sockaddr_in *
in_selectsrc(struct sockaddr_in *sin, struct route *ro, int soopts,
- struct ip_moptions *mopts, int *errorp, u_int rdomain)
+ struct ip_moptions *mopts, int *errorp, u_int rtableid)
{
struct sockaddr_in *sin2;
struct in_ifaddr *ia;
@@ -824,7 +822,7 @@ in_selectsrc(struct sockaddr_in *sin, struct route *ro, int soopts,
ro->ro_dst.sa_family = AF_INET;
ro->ro_dst.sa_len = sizeof(struct sockaddr_in);
satosin(&ro->ro_dst)->sin_addr = sin->sin_addr;
- ro->ro_tableid = rdomain;
+ ro->ro_tableid = rtableid;
rtalloc_mpath(ro, NULL);
/*
@@ -846,9 +844,9 @@ in_selectsrc(struct sockaddr_in *sin, struct route *ro, int soopts,
u_int16_t fport = sin->sin_port;
sin->sin_port = 0;
- ia = ifatoia(ifa_ifwithdstaddr(sintosa(sin), rdomain));
+ ia = ifatoia(ifa_ifwithdstaddr(sintosa(sin), rtableid));
if (ia == 0)
- ia = ifatoia(ifa_ifwithnet(sintosa(sin), rdomain));
+ ia = ifatoia(ifa_ifwithnet(sintosa(sin), rtableid));
sin->sin_port = fport;
if (ia == 0)
ia = TAILQ_FIRST(&in_ifaddr);
@@ -890,7 +888,7 @@ in_pcbrehash(inp)
s = splnet();
LIST_REMOVE(inp, inp_lhash);
- LIST_INSERT_HEAD(INPCBLHASH(table, inp->inp_lport, inp->inp_rdomain),
+ LIST_INSERT_HEAD(INPCBLHASH(table, inp->inp_lport, inp->inp_rtableid),
inp, inp_lhash);
LIST_REMOVE(inp, inp_hash);
#ifdef INET6
@@ -902,7 +900,7 @@ in_pcbrehash(inp)
#endif /* INET6 */
LIST_INSERT_HEAD(INPCBHASH(table, &inp->inp_faddr,
inp->inp_fport, &inp->inp_laddr, inp->inp_lport,
- inp->inp_rdomain), inp, inp_hash);
+ rtable_l2(inp->inp_rtableid)), inp, inp_hash);
#ifdef INET6
}
#endif /* INET6 */
@@ -930,7 +928,7 @@ in_pcbhashlookup(struct inpcbtable *table, struct in_addr faddr,
struct inpcb *inp;
u_int16_t fport = fport_arg, lport = lport_arg;
- rdomain = rtable_l2(rdomain);
+ rdomain = rtable_l2(rdomain); /* convert passed rtableid to rdomain */
head = INPCBHASH(table, &faddr, fport, &laddr, lport, rdomain);
LIST_FOREACH(inp, head, inp_hash) {
#ifdef INET6
@@ -941,7 +939,7 @@ in_pcbhashlookup(struct inpcbtable *table, struct in_addr faddr,
inp->inp_fport == fport &&
inp->inp_lport == lport &&
inp->inp_laddr.s_addr == laddr.s_addr &&
- inp->inp_rdomain == rdomain) {
+ rtable_l2(inp->inp_rtableid) == rdomain) {
/*
* Move this PCB to the head of hash chain so that
* repeated accesses are quicker. This is analogous to
@@ -1019,7 +1017,7 @@ in_pcblookup_listen(struct inpcbtable *table, struct in_addr laddr,
struct inpcb *inp;
u_int16_t lport = lport_arg;
- rdomain = rtable_l2(rdomain);
+ rdomain = rtable_l2(rdomain); /* convert passed rtableid to rdomain */
#if NPF > 0
if (m && m->m_pkthdr.pf.flags & PF_TAG_DIVERTED) {
struct pf_divert *divert;
@@ -1047,7 +1045,7 @@ in_pcblookup_listen(struct inpcbtable *table, struct in_addr laddr,
if (inp->inp_lport == lport && inp->inp_fport == 0 &&
inp->inp_laddr.s_addr == key1->s_addr &&
inp->inp_faddr.s_addr == INADDR_ANY &&
- inp->inp_rdomain == rdomain)
+ rtable_l2(inp->inp_rtableid) == rdomain)
break;
}
if (inp == NULL && key1->s_addr != key2->s_addr) {
@@ -1060,7 +1058,7 @@ in_pcblookup_listen(struct inpcbtable *table, struct in_addr laddr,
if (inp->inp_lport == lport && inp->inp_fport == 0 &&
inp->inp_laddr.s_addr == key2->s_addr &&
inp->inp_faddr.s_addr == INADDR_ANY &&
- inp->inp_rdomain == rdomain)
+ rtable_l2(inp->inp_rtableid) == rdomain)
break;
}
}
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index da1df0acdcc..ac17a6d6a81 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.h,v 1.68 2009/11/13 20:54:05 claudio Exp $ */
+/* $OpenBSD: in_pcb.h,v 1.69 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
/*
@@ -146,7 +146,7 @@ struct inpcb {
#endif
struct icmp6_filter *inp_icmp6filt;
void *inp_pf_sk;
- u_int inp_rdomain;
+ u_int inp_rtableid;
};
struct inpcbtable {
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index 805a99e339e..44de7acc5ff 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_divert.c,v 1.6 2010/04/20 22:05:43 tedu Exp $ */
+/* $OpenBSD: ip_divert.c,v 1.7 2010/07/03 04:44:51 guenther Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -94,7 +94,7 @@ divert_output(struct mbuf *m, ...)
m->m_pkthdr.rcvif = NULL;
m->m_nextpkt = NULL;
- m->m_pkthdr.rdomain = inp->inp_rdomain;
+ m->m_pkthdr.rdomain = inp->inp_rtableid;
if (control)
m_freem(control);
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index f22005e5fc6..d3512f133a9 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_icmp.c,v 1.89 2010/05/07 13:33:16 claudio Exp $ */
+/* $OpenBSD: ip_icmp.c,v 1.90 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
@@ -999,6 +999,7 @@ icmp_mtudisc_timeout(struct rtentry *rt, struct rttimer *r)
info.rti_flags = rt->rt_flags;
sa = *(struct sockaddr_in *)rt_key(rt);
+ /* XXX this needs the rtableid */
rtrequest1(RTM_DELETE, &info, rt->rt_priority, NULL, 0);
/* Notify TCP layer of increased Path MTU estimate */
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index fc8ebc17d1d..8dca59f9b4d 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.208 2010/07/02 02:40:16 blambert Exp $ */
+/* $OpenBSD: ip_output.c,v 1.209 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -1162,7 +1162,7 @@ ip_ctloutput(op, so, level, optname, mp)
case IP_ADD_MEMBERSHIP:
case IP_DROP_MEMBERSHIP:
error = ip_setmoptions(optname, &inp->inp_moptions, m,
- inp->inp_rdomain);
+ inp->inp_rtableid);
break;
case IP_PORTRANGE:
@@ -1426,24 +1426,23 @@ ip_ctloutput(op, so, level, optname, mp)
}
#endif
break;
- case SO_RDOMAIN:
+ case SO_RTABLE:
if (m == NULL || m->m_len < sizeof(u_int)) {
error = EINVAL;
break;
}
rtid = *mtod(m, u_int *);
- if (p->p_p->ps_rdomain != 0 &&
- p->p_p->ps_rdomain != rtid &&
- (error = suser(p, 0)) != 0) {
+ /* needs priviledges to switch when already set */
+ if (p->p_p->ps_rtableid != 0 && suser(p, 0) != 0) {
error = EACCES;
break;
}
- /* table must exist and be a domain */
- if (!rtable_exists(rtid) || rtid != rtable_l2(rtid)) {
+ /* table must exist */
+ if (!rtable_exists(rtid)) {
error = EINVAL;
break;
}
- inp->inp_rdomain = rtid;
+ inp->inp_rtableid = rtid;
break;
default:
error = ENOPROTOOPT;
@@ -1638,10 +1637,10 @@ ip_ctloutput(op, so, level, optname, mp)
}
#endif
break;
- case SO_RDOMAIN:
+ case SO_RTABLE:
*mp = m = m_get(M_WAIT, MT_SOOPTS);
m->m_len = sizeof(u_int);
- *mtod(m, u_int *) = inp->inp_rdomain;
+ *mtod(m, u_int *) = inp->inp_rtableid;
break;
default:
error = ENOPROTOOPT;
@@ -1765,7 +1764,7 @@ bad:
*/
int
ip_setmoptions(int optname, struct ip_moptions **imop, struct mbuf *m,
- u_int rdomain)
+ u_int rtableid)
{
int error = 0;
u_char loop;
@@ -1822,7 +1821,7 @@ ip_setmoptions(int optname, struct ip_moptions **imop, struct mbuf *m,
* IP address. Find the interface and confirm that
* it supports multicasting.
*/
- INADDR_TO_IFP(addr, ifp, rdomain);
+ INADDR_TO_IFP(addr, ifp, rtableid);
if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) {
error = EADDRNOTAVAIL;
break;
@@ -1881,7 +1880,7 @@ ip_setmoptions(int optname, struct ip_moptions **imop, struct mbuf *m,
if (!(ro.ro_rt && ro.ro_rt->rt_ifp &&
(ro.ro_rt->rt_flags & RTF_UP)))
ro.ro_rt = rtalloc1(&ro.ro_dst, RT_REPORT,
- rdomain);
+ rtableid);
if (ro.ro_rt == NULL) {
error = EADDRNOTAVAIL;
break;
@@ -1889,7 +1888,7 @@ ip_setmoptions(int optname, struct ip_moptions **imop, struct mbuf *m,
ifp = ro.ro_rt->rt_ifp;
rtfree(ro.ro_rt);
} else {
- INADDR_TO_IFP(mreq->imr_interface, ifp, rdomain);
+ INADDR_TO_IFP(mreq->imr_interface, ifp, rtableid);
}
/*
* See if we found an interface, and confirm that it
@@ -1975,7 +1974,7 @@ ip_setmoptions(int optname, struct ip_moptions **imop, struct mbuf *m,
if (mreq->imr_interface.s_addr == INADDR_ANY)
ifp = NULL;
else {
- INADDR_TO_IFP(mreq->imr_interface, ifp, rdomain);
+ INADDR_TO_IFP(mreq->imr_interface, ifp, rtableid);
if (ifp == NULL) {
error = EADDRNOTAVAIL;
break;
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 75af8738b6d..f9f78226aba 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip.c,v 1.48 2009/11/03 10:59:04 claudio Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.49 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
@@ -132,7 +132,8 @@ rip_input(struct mbuf *m, ...)
if (inp->inp_flags & INP_IPV6)
continue;
#endif
- if (inp->inp_rdomain != rtable_l2(m->m_pkthdr.rdomain))
+ if (rtable_l2(inp->inp_rtableid) !=
+ rtable_l2(m->m_pkthdr.rdomain))
continue;
if (inp->inp_ip.ip_p && inp->inp_ip.ip_p != ip->ip_p)
@@ -272,7 +273,7 @@ rip_output(struct mbuf *m, ...)
*/
#endif
/* force routing domain */
- m->m_pkthdr.rdomain = inp->inp_rdomain;
+ m->m_pkthdr.rdomain = inp->inp_rtableid;
return (ip_output(m, inp->inp_options, &inp->inp_route, flags,
inp->inp_moptions, inp));
@@ -418,7 +419,7 @@ rip_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
(addr->sin_family != AF_IMPLINK)) ||
(addr->sin_addr.s_addr &&
(!(so->so_options & SO_BINDANY) &&
- in_iawithaddr(addr->sin_addr, NULL, inp->inp_rdomain) ==
+ in_iawithaddr(addr->sin_addr, NULL, inp->inp_rtableid) ==
0))) {
error = EADDRNOTAVAIL;
break;
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 13c1ca14942..a9716a68433 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.232 2010/03/11 00:24:58 sthen Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.233 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -723,7 +723,7 @@ findpcb:
if ((tiflags & (TH_RST|TH_ACK|TH_SYN)) != TH_SYN) {
if (tiflags & TH_RST) {
syn_cache_reset(&src.sa, &dst.sa, th,
- inp->inp_rdomain);
+ inp->inp_rtableid);
} else if ((tiflags & (TH_ACK|TH_SYN)) ==
(TH_ACK|TH_SYN)) {
/*
@@ -3038,7 +3038,7 @@ tcp_mss(struct tcpcb *tp, int offer)
else if (tp->pf == AF_INET) {
if (ip_mtudisc)
mss = ifp->if_mtu - iphlen - sizeof(struct tcphdr);
- else if (inp && in_localaddr(inp->inp_faddr, inp->inp_rdomain))
+ else if (inp && in_localaddr(inp->inp_faddr, inp->inp_rtableid))
mss = ifp->if_mtu - iphlen - sizeof(struct tcphdr);
}
#ifdef INET6
@@ -3564,7 +3564,7 @@ syn_cache_cleanup(struct tcpcb *tp)
*/
struct syn_cache *
syn_cache_lookup(struct sockaddr *src, struct sockaddr *dst,
- struct syn_cache_head **headp, u_int rdomain)
+ struct syn_cache_head **headp, u_int rtableid)
{
struct syn_cache *sc;
struct syn_cache_head *scp;
@@ -3582,7 +3582,7 @@ syn_cache_lookup(struct sockaddr *src, struct sockaddr *dst,
continue;
if (!bcmp(&sc->sc_src, src, src->sa_len) &&
!bcmp(&sc->sc_dst, dst, dst->sa_len) &&
- rtable_l2(rdomain) == rtable_l2(sc->sc_rdomain)) {
+ rtable_l2(rtableid) == rtable_l2(sc->sc_rtableid)) {
splx(s);
return (sc);
}
@@ -3628,7 +3628,7 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
s = splsoftnet();
if ((sc = syn_cache_lookup(src, dst, &scp,
- sotoinpcb(so)->inp_rdomain)) == NULL) {
+ sotoinpcb(so)->inp_rtableid)) == NULL) {
splx(s);
return (NULL);
}
@@ -3708,8 +3708,8 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
inp = (struct inpcb *)so->so_pcb;
#endif /* INET6 */
- /* inherit rdomain from listening socket */
- inp->inp_rdomain = sc->sc_rdomain;
+ /* inherit rtable from listening socket */
+ inp->inp_rtableid = sc->sc_rtableid;
inp->inp_lport = th->th_dport;
switch (src->sa_family) {
@@ -3867,13 +3867,13 @@ abort:
void
syn_cache_reset(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
- u_int rdomain)
+ u_int rtableid)
{
struct syn_cache *sc;
struct syn_cache_head *scp;
int s = splsoftnet();
- if ((sc = syn_cache_lookup(src, dst, &scp, rdomain)) == NULL) {
+ if ((sc = syn_cache_lookup(src, dst, &scp, rtableid)) == NULL) {
splx(s);
return;
}
@@ -3890,14 +3890,14 @@ syn_cache_reset(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
void
syn_cache_unreach(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
- u_int rdomain)
+ u_int rtableid)
{
struct syn_cache *sc;
struct syn_cache_head *scp;
int s;
s = splsoftnet();
- if ((sc = syn_cache_lookup(src, dst, &scp, rdomain)) == NULL) {
+ if ((sc = syn_cache_lookup(src, dst, &scp, rtableid)) == NULL) {
splx(s);
return;
}
@@ -4005,7 +4005,7 @@ syn_cache_add(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
* If we do, resend the SYN,ACK. We do not count this
* as a retransmission (XXX though maybe we should).
*/
- if ((sc = syn_cache_lookup(src, dst, &scp, sotoinpcb(so)->inp_rdomain))
+ if ((sc = syn_cache_lookup(src, dst, &scp, sotoinpcb(so)->inp_rtableid))
!= NULL) {
tcpstat.tcps_sc_dupesyn++;
if (ipopts) {
@@ -4038,7 +4038,7 @@ syn_cache_add(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
*/
bcopy(src, &sc->sc_src, src->sa_len);
bcopy(dst, &sc->sc_dst, dst->sa_len);
- sc->sc_rdomain = sotoinpcb(so)->inp_rdomain;
+ sc->sc_rtableid = sotoinpcb(so)->inp_rtableid;
sc->sc_flags = 0;
sc->sc_ipopts = ipopts;
sc->sc_irs = th->th_seq;
@@ -4166,7 +4166,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_rdomain;
+ m->m_pkthdr.rdomain = 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 036c54176cd..cb9964e9e32 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_output.c,v 1.88 2010/05/28 08:32:41 kettenis Exp $ */
+/* $OpenBSD: tcp_output.c,v 1.89 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */
/*
@@ -1061,7 +1061,7 @@ send:
#endif
/* force routing domain */
- m->m_pkthdr.rdomain = tp->t_inpcb->inp_rdomain;
+ m->m_pkthdr.rdomain = tp->t_inpcb->inp_rtableid;
switch (tp->pf) {
case 0: /*default to PF_INET*/
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 5cd48cce9c8..3d04fac05ef 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_subr.c,v 1.110 2010/01/15 18:20:23 chl Exp $ */
+/* $OpenBSD: tcp_subr.c,v 1.111 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */
/*
@@ -318,13 +318,8 @@ tcp_template(tp)
/* This function looks hairy, because it was so IPv4-dependent. */
#endif /* INET6 */
void
-tcp_respond(tp, template, th0, ack, seq, flags, rdomain)
- struct tcpcb *tp;
- caddr_t template;
- struct tcphdr *th0;
- tcp_seq ack, seq;
- int flags;
- u_int rdomain;
+tcp_respond(struct tcpcb *tp, caddr_t template, struct tcphdr *th0,
+ tcp_seq ack, tcp_seq seq, int flags, u_int rtableid)
{
int tlen;
int win = 0;
@@ -412,9 +407,9 @@ tcp_respond(tp, template, th0, ack, seq, flags, rdomain)
/* force routing domain */
if (tp)
- m->m_pkthdr.rdomain = tp->t_inpcb->inp_rdomain;
+ m->m_pkthdr.rdomain = tp->t_inpcb->inp_rtableid;
else
- m->m_pkthdr.rdomain = rdomain;
+ m->m_pkthdr.rdomain = rtableid;
switch (af) {
#ifdef INET6
@@ -774,11 +769,7 @@ tcp6_ctlinput(cmd, sa, d)
#endif
void *
-tcp_ctlinput(cmd, sa, rdomain, v)
- int cmd;
- struct sockaddr *sa;
- u_int rdomain;
- void *v;
+tcp_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v)
{
struct ip *ip = v;
struct tcphdr *th;
@@ -839,7 +830,7 @@ tcp_ctlinput(cmd, sa, rdomain, v)
* route (traditional PMTUD).
*/
tp->t_flags &= ~TF_PMTUD_PEND;
- icmp_mtudisc(icp, inp->inp_rdomain);
+ icmp_mtudisc(icp, inp->inp_rtableid);
} else {
/*
* Record the information got in the ICMP
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c
index 8253775bfa3..a1dd72aae79 100644
--- a/sys/netinet/tcp_timer.c
+++ b/sys/netinet/tcp_timer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_timer.c,v 1.44 2009/11/13 20:54:05 claudio Exp $ */
+/* $OpenBSD: tcp_timer.c,v 1.45 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: tcp_timer.c,v 1.14 1996/02/13 23:44:09 christos Exp $ */
/*
@@ -213,14 +213,14 @@ tcp_timer_rexmt(void *arg)
icmp.icmp_ip.ip_len = tp->t_pmtud_ip_len;
icmp.icmp_ip.ip_hl = tp->t_pmtud_ip_hl;
icmpsrc.sin_addr = tp->t_inpcb->inp_faddr;
- icmp_mtudisc(&icmp, tp->t_inpcb->inp_rdomain);
+ icmp_mtudisc(&icmp, tp->t_inpcb->inp_rtableid);
/*
* Notify all connections to the same peer about
* new mss and trigger retransmit.
*/
in_pcbnotifyall(&tcbtable, sintosa(&icmpsrc),
- tp->t_inpcb->inp_rdomain, EMSGSIZE, tcp_mtudisc);
+ tp->t_inpcb->inp_rtableid, EMSGSIZE, tcp_mtudisc);
splx(s);
return;
}
@@ -286,7 +286,7 @@ tcp_timer_rexmt(void *arg)
sin.sin_len = sizeof(struct sockaddr_in);
sin.sin_addr = inp->inp_faddr;
rt = icmp_mtudisc_clone(sintosa(&sin),
- inp->inp_rdomain);
+ inp->inp_rtableid);
break;
}
if (rt != NULL) {
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 2650017254f..57cd44fd8ef 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_var.h,v 1.93 2009/11/13 20:54:05 claudio Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.94 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
@@ -274,7 +274,7 @@ struct syn_cache {
union syn_cache_sa sc_dst;
tcp_seq sc_irs;
tcp_seq sc_iss;
- u_int sc_rdomain;
+ u_int sc_rtableid;
u_int sc_rxtcur; /* current rxt timeout */
u_int sc_rxttot; /* total time spend on queues */
u_short sc_rxtshift; /* for computing backoff */
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 831ff59126a..55bfe45b7ab 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_usrreq.c,v 1.134 2010/04/20 22:05:43 tedu Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.135 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@@ -444,7 +444,8 @@ udp_input(struct mbuf *m, ...)
if (!ip6 && (inp->inp_flags & INP_IPV6))
continue;
#endif
- if (inp->inp_rdomain != rtable_l2(m->m_pkthdr.rdomain))
+ if (rtable_l2(inp->inp_rtableid) !=
+ rtable_l2(m->m_pkthdr.rdomain))
continue;
if (inp->inp_lport != uh->uh_dport)
continue;
@@ -1011,7 +1012,7 @@ udp_output(struct mbuf *m, ...)
udpstat.udps_opackets++;
/* force routing domain */
- m->m_pkthdr.rdomain = inp->inp_rdomain;
+ m->m_pkthdr.rdomain = inp->inp_rtableid;
error = ip_output(m, inp->inp_options, &inp->inp_route,
inp->inp_socket->so_options &