summaryrefslogtreecommitdiff
path: root/sys
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
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')
-rw-r--r--sys/kern/init_main.c6
-rw-r--r--sys/kern/init_sysent.c8
-rw-r--r--sys/kern/syscalls.c6
-rw-r--r--sys/kern/syscalls.master6
-rw-r--r--sys/kern/uipc_socket.c3
-rw-r--r--sys/kern/uipc_syscalls.c24
-rw-r--r--sys/net/if.c10
-rw-r--r--sys/net/if_enc.c4
-rw-r--r--sys/net/if_gif.c6
-rw-r--r--sys/net/if_gre.c6
-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
-rw-r--r--sys/netinet6/ip6_divert.c4
-rw-r--r--sys/sys/proc.h4
-rw-r--r--sys/sys/socket.h8
-rw-r--r--sys/sys/sockio.h10
-rw-r--r--sys/sys/syscall.h10
-rw-r--r--sys/sys/syscallargs.h10
28 files changed, 155 insertions, 165 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 4d90750370d..e3d5d4c3ee2 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.168 2010/06/29 20:25:57 guenther Exp $ */
+/* $OpenBSD: init_main.c,v 1.169 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -265,8 +265,8 @@ main(void *framep)
process0.ps_refcnt = 1;
p->p_p = &process0;
- /* Set the default routing domain. */
- process0.ps_rdomain = 0;
+ /* Set the default routing table/domain. */
+ process0.ps_rtableid = 0;
LIST_INSERT_HEAD(&allproc, p, p_list);
p->p_pgrp = &pgrp0;
diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c
index 94adf2c2b6f..3d0d8095f58 100644
--- a/sys/kern/init_sysent.c
+++ b/sys/kern/init_sysent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_sysent.c,v 1.113 2010/07/01 23:11:11 tedu Exp $ */
+/* $OpenBSD: init_sysent.c,v 1.114 2010/07/03 04:44:51 guenther Exp $ */
/*
* System call switch table.
@@ -811,9 +811,9 @@ struct sysent sysent[] = {
sys_fstatfs }, /* 308 = fstatfs */
{ 2, s(struct sys_fhstatfs_args), 0,
sys_fhstatfs }, /* 309 = fhstatfs */
- { 1, s(struct sys_setrdomain_args), 0,
- sys_setrdomain }, /* 310 = setrdomain */
+ { 1, s(struct sys_setrtable_args), 0,
+ sys_setrtable }, /* 310 = setrtable */
{ 0, 0, 0,
- sys_getrdomain }, /* 311 = getrdomain */
+ sys_getrtable }, /* 311 = getrtable */
};
diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c
index 1355521ef12..b3128deb54f 100644
--- a/sys/kern/syscalls.c
+++ b/sys/kern/syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscalls.c,v 1.114 2010/07/01 23:11:11 tedu Exp $ */
+/* $OpenBSD: syscalls.c,v 1.115 2010/07/03 04:44:51 guenther Exp $ */
/*
* System call names.
@@ -419,6 +419,6 @@ char *syscallnames[] = {
"statfs", /* 307 = statfs */
"fstatfs", /* 308 = fstatfs */
"fhstatfs", /* 309 = fhstatfs */
- "setrdomain", /* 310 = setrdomain */
- "getrdomain", /* 311 = getrdomain */
+ "setrtable", /* 310 = setrtable */
+ "getrtable", /* 311 = getrtable */
};
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 279bbc72290..90e52eea635 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -1,4 +1,4 @@
-; $OpenBSD: syscalls.master,v 1.101 2010/07/01 23:10:40 tedu Exp $
+; $OpenBSD: syscalls.master,v 1.102 2010/07/03 04:44:51 guenther Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -605,5 +605,5 @@
308 STD { int sys_fstatfs(int fd, struct statfs *buf); }
309 STD { int sys_fhstatfs(const fhandle_t *fhp, \
struct statfs *buf); }
-310 STD { int sys_setrdomain(int rdomain); }
-311 STD { int sys_getrdomain(void); }
+310 STD { int sys_setrtable(int rtableid); }
+311 STD { int sys_getrtable(void); }
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 1f8d93ec1d0..5c2e7448bb0 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.82 2010/07/02 19:57:15 tedu Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.83 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -981,7 +981,6 @@ sosetopt(struct socket *so, int level, int optname, struct mbuf *m0)
} else {
switch (optname) {
case SO_BINDANY:
- case SO_RDOMAIN:
if ((error = suser(curproc, 0)) != 0) /* XXX */
goto bad;
break;
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 4a3c9c2166c..533c53595aa 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_syscalls.c,v 1.75 2010/06/30 19:57:05 deraadt Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.76 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
@@ -1096,30 +1096,30 @@ getsock(struct filedesc *fdp, int fdes, struct file **fpp)
/* ARGSUSED */
int
-sys_setrdomain(struct proc *p, void *v, register_t *retval)
+sys_setrtable(struct proc *p, void *v, register_t *retval)
{
- struct sys_setrdomain_args /* {
- syscallarg(int) rdomain;
+ struct sys_setrtable_args /* {
+ syscallarg(int) rtableid;
} */ *uap = v;
- int rdomain, error;
+ int rtableid, error;
- rdomain = SCARG(uap, rdomain);
+ rtableid = SCARG(uap, rtableid);
- if (p->p_p->ps_rdomain == (u_int)rdomain)
+ if (p->p_p->ps_rtableid == (u_int)rtableid)
return (0);
- if (p->p_p->ps_rdomain != 0 && (error = suser(p, 0)) != 0)
+ if (p->p_p->ps_rtableid != 0 && (error = suser(p, 0)) != 0)
return (error);
- if (rdomain < 0 || !rtable_exists((u_int)rdomain))
+ if (rtableid < 0 || !rtable_exists((u_int)rtableid))
return (EINVAL);
- p->p_p->ps_rdomain = (u_int)rdomain;
+ p->p_p->ps_rtableid = (u_int)rtableid;
return (0);
}
/* ARGSUSED */
int
-sys_getrdomain(struct proc *p, void *v, register_t *retval)
+sys_getrtable(struct proc *p, void *v, register_t *retval)
{
- *retval = (int)p->p_p->ps_rdomain;
+ *retval = (int)p->p_p->ps_rtableid;
return (0);
}
diff --git a/sys/net/if.c b/sys/net/if.c
index 94f55218045..8e0d467b8ce 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.217 2010/06/29 21:28:37 reyk Exp $ */
+/* $OpenBSD: if.c,v 1.218 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1409,7 +1409,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
case SIOCSIFPHYADDR_IN6:
#endif
case SIOCSLIFPHYADDR:
- case SIOCSLIFPHYRTABLEID:
+ case SIOCSLIFPHYRTABLE:
case SIOCADDMULTI:
case SIOCDELMULTI:
case SIOCSIFMEDIA:
@@ -1419,7 +1419,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
case SIOCGIFPSRCADDR:
case SIOCGIFPDSTADDR:
case SIOCGLIFPHYADDR:
- case SIOCGLIFPHYRTABLEID:
+ case SIOCGLIFPHYRTABLE:
case SIOCGIFMEDIA:
if (ifp->if_ioctl == 0)
return (EOPNOTSUPP);
@@ -1476,11 +1476,11 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
ifp->if_priority = ifr->ifr_metric;
break;
- case SIOCGIFRTABLEID:
+ case SIOCGIFRDOMAIN:
ifr->ifr_rdomainid = ifp->if_rdomain;
break;
- case SIOCSIFRTABLEID:
+ case SIOCSIFRDOMAIN:
if ((error = suser(p, 0)) != 0)
return (error);
if (ifr->ifr_rdomainid < 0 ||
diff --git a/sys/net/if_enc.c b/sys/net/if_enc.c
index 8ea76cfe231..ee51f84d38a 100644
--- a/sys/net/if_enc.c
+++ b/sys/net/if_enc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_enc.c,v 1.51 2010/07/01 02:09:45 reyk Exp $ */
+/* $OpenBSD: if_enc.c,v 1.52 2010/07/03 04:44:51 guenther Exp $ */
/*
* Copyright (c) 2010 Reyk Floeter <reyk@vantronix.net>
@@ -184,7 +184,7 @@ enc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
else
ifp->if_flags &= ~IFF_RUNNING;
break;
- case SIOCSIFRTABLEID:
+ case SIOCSIFRDOMAIN:
if ((error = enc_setif(ifp, ifr->ifr_rdomainid)) != 0)
return (error);
/* FALLTHROUGH */
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index cb9ccba73e0..3aab9f40093 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gif.c,v 1.54 2010/05/11 09:36:07 claudio Exp $ */
+/* $OpenBSD: if_gif.c,v 1.55 2010/07/03 04:44:51 guenther Exp $ */
/* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */
/*
@@ -649,7 +649,7 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
ifp->if_mtu = ifr->ifr_mtu;
break;
- case SIOCSLIFPHYRTABLEID:
+ case SIOCSLIFPHYRTABLE:
if (ifr->ifr_rdomainid < 0 ||
ifr->ifr_rdomainid > RT_TABLEID_MAX ||
!rtable_exists(ifr->ifr_rdomainid)) {
@@ -658,7 +658,7 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
}
sc->gif_rtableid = ifr->ifr_rdomainid;
break;
- case SIOCGLIFPHYRTABLEID:
+ case SIOCGLIFPHYRTABLE:
ifr->ifr_rdomainid = sc->gif_rtableid;
break;
default:
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 6ebf41232db..aa0c8319113 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gre.c,v 1.50 2010/06/26 22:11:51 claudio Exp $ */
+/* $OpenBSD: if_gre.c,v 1.51 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
@@ -637,7 +637,7 @@ recompute:
si.sin_addr.s_addr = sc->g_dst.s_addr;
memcpy(&lifr->dstaddr, &si, sizeof(si));
break;
- case SIOCSLIFPHYRTABLEID:
+ case SIOCSLIFPHYRTABLE:
if ((error = suser(prc, 0)) != 0)
break;
if (ifr->ifr_rdomainid < 0 ||
@@ -648,7 +648,7 @@ recompute:
}
sc->g_rtableid = ifr->ifr_rdomainid;
goto recompute;
- case SIOCGLIFPHYRTABLEID:
+ case SIOCGLIFPHYRTABLE:
ifr->ifr_rdomainid = sc->g_rtableid;
break;
default:
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 &
diff --git a/sys/netinet6/ip6_divert.c b/sys/netinet6/ip6_divert.c
index 8c6a3668107..2894afafa77 100644
--- a/sys/netinet6/ip6_divert.c
+++ b/sys/netinet6/ip6_divert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_divert.c,v 1.4 2010/04/20 22:05:44 tedu Exp $ */
+/* $OpenBSD: ip6_divert.c,v 1.5 2010/07/03 04:44:51 guenther Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -99,7 +99,7 @@ divert6_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/sys/proc.h b/sys/sys/proc.h
index dc350e3b493..2cb299f285b 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.129 2010/06/30 00:40:28 guenther Exp $ */
+/* $OpenBSD: proc.h,v 1.130 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@@ -154,7 +154,7 @@ struct process {
#define ps_startcopy ps_limit
struct plimit *ps_limit; /* Process limits. */
- u_int ps_rdomain; /* Process routing domain. */
+ u_int ps_rtableid; /* Process routing table/domain. */
/* End area that is copied on creation. */
#define ps_endcopy ps_refcnt
diff --git a/sys/sys/socket.h b/sys/sys/socket.h
index 91ddae61c1b..ca2dfb3ed1b 100644
--- a/sys/sys/socket.h
+++ b/sys/sys/socket.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: socket.h,v 1.68 2010/07/02 19:57:15 tedu Exp $ */
+/* $OpenBSD: socket.h,v 1.69 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: socket.h,v 1.14 1996/02/09 18:25:36 christos Exp $ */
/*
@@ -85,7 +85,7 @@
#define SO_ERROR 0x1007 /* get error status and clear */
#define SO_TYPE 0x1008 /* get socket type */
#define SO_NETPROC 0x1020 /* multiplex; network processing */
-#define SO_RDOMAIN 0x1021 /* routing domain socket belongs to */
+#define SO_RTABLE 0x1021 /* routing table to be used */
#define SO_PEERCRED 0x1022 /* get connect-time credentials */
/*
@@ -498,8 +498,8 @@ int setsockopt(int, int, int, const void *, socklen_t);
int shutdown(int, int);
int socket(int, int, int);
int socketpair(int, int, int, int *);
-int getrdomain(void);
-int setrdomain(int);
+int getrtable(void);
+int setrtable(int);
__END_DECLS
#else
# if defined(COMPAT_43) || defined(COMPAT_LINUX) || \
diff --git a/sys/sys/sockio.h b/sys/sys/sockio.h
index 3b1996bdaf5..198b7a6c81d 100644
--- a/sys/sys/sockio.h
+++ b/sys/sys/sockio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sockio.h,v 1.47 2010/06/26 19:49:54 claudio Exp $ */
+/* $OpenBSD: sockio.h,v 1.48 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: sockio.h,v 1.5 1995/08/23 00:40:47 thorpej Exp $ */
/*-
@@ -173,11 +173,11 @@
#define SIOCSIFXFLAGS _IOW('i', 157, struct ifreq) /* set ifnet xflags */
#define SIOCGIFXFLAGS _IOWR('i', 158, struct ifreq) /* get ifnet xflags */
-#define SIOCSIFRTABLEID _IOW('i', 159, struct ifreq) /* set ifnet VRF id */
-#define SIOCGIFRTABLEID _IOWR('i', 160, struct ifreq) /* get ifnet VRF id */
+#define SIOCSIFRDOMAIN _IOW('i', 159, struct ifreq) /* set ifnet VRF id */
+#define SIOCGIFRDOMAIN _IOWR('i', 160, struct ifreq) /* get ifnet VRF id */
-#define SIOCSLIFPHYRTABLEID _IOW('i', 161, struct ifreq) /* set tunnel VRF id */
-#define SIOCGLIFPHYRTABLEID _IOWR('i', 162, struct ifreq) /* get tunnel id */
+#define SIOCSLIFPHYRTABLE _IOW('i', 161, struct ifreq) /* set tunnel VRF id */
+#define SIOCGLIFPHYRTABLE _IOWR('i', 162, struct ifreq) /* get tunnel VRF id */
#define SIOCSETKALIVE _IOW('i', 163, struct ifkalivereq)
#define SIOCGETKALIVE _IOWR('i', 164, struct ifkalivereq)
diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h
index b2140c38b94..53f064adadb 100644
--- a/sys/sys/syscall.h
+++ b/sys/sys/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.113 2010/07/01 23:11:11 tedu Exp $ */
+/* $OpenBSD: syscall.h,v 1.114 2010/07/03 04:44:51 guenther Exp $ */
/*
* System call numbers.
@@ -682,10 +682,10 @@
/* syscall: "fhstatfs" ret: "int" args: "const fhandle_t *" "struct statfs *" */
#define SYS_fhstatfs 309
-/* syscall: "setrdomain" ret: "int" args: "int" */
-#define SYS_setrdomain 310
+/* syscall: "setrtable" ret: "int" args: "int" */
+#define SYS_setrtable 310
-/* syscall: "getrdomain" ret: "int" args: */
-#define SYS_getrdomain 311
+/* syscall: "getrtable" ret: "int" args: */
+#define SYS_getrtable 311
#define SYS_MAXSYSCALL 312
diff --git a/sys/sys/syscallargs.h b/sys/sys/syscallargs.h
index 768ec01f7be..a5bb5cc2bd5 100644
--- a/sys/sys/syscallargs.h
+++ b/sys/sys/syscallargs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscallargs.h,v 1.115 2010/07/01 23:11:11 tedu Exp $ */
+/* $OpenBSD: syscallargs.h,v 1.116 2010/07/03 04:44:51 guenther Exp $ */
/*
* System call argument lists.
@@ -1217,8 +1217,8 @@ struct sys_fhstatfs_args {
syscallarg(struct statfs *) buf;
};
-struct sys_setrdomain_args {
- syscallarg(int) rdomain;
+struct sys_setrtable_args {
+ syscallarg(int) rtableid;
};
/*
@@ -1531,5 +1531,5 @@ int sys_getfsstat(struct proc *, void *, register_t *);
int sys_statfs(struct proc *, void *, register_t *);
int sys_fstatfs(struct proc *, void *, register_t *);
int sys_fhstatfs(struct proc *, void *, register_t *);
-int sys_setrdomain(struct proc *, void *, register_t *);
-int sys_getrdomain(struct proc *, void *, register_t *);
+int sys_setrtable(struct proc *, void *, register_t *);
+int sys_getrtable(struct proc *, void *, register_t *);