summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorzec <zec@FreeBSD.org>2008-11-26 22:32:07 +0000
committerzec <zec@FreeBSD.org>2008-11-26 22:32:07 +0000
commit95a15f5c8435d206ae030c1ed698f4fca6afdeae (patch)
tree92dfba43d59635c80de0299501512e8472dbe130 /sys/netinet
parent7beb3e535d23cc0fe9278167a9c3dc67220250fd (diff)
downloadFreeBSD-src-95a15f5c8435d206ae030c1ed698f4fca6afdeae.zip
FreeBSD-src-95a15f5c8435d206ae030c1ed698f4fca6afdeae.tar.gz
Merge more of currently non-functional (i.e. resolving to
whitespace) macros from p4/vimage branch. Do a better job at enclosing all instantiations of globals scheduled for virtualization in #ifdef VIMAGE_GLOBALS blocks. De-virtualize and mark as const saorder_state_alive and saorder_state_any arrays from ipsec code, given that they are never updated at runtime, so virtualizing them would be pointless. Reviewed by: bz, julian Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/if_ether.c4
-rw-r--r--sys/netinet/in_pcb.c3
-rw-r--r--sys/netinet/in_rmx.c2
-rw-r--r--sys/netinet/ip_divert.c1
-rw-r--r--sys/netinet/ip_fw_pfil.c1
-rw-r--r--sys/netinet/ip_output.c1
-rw-r--r--sys/netinet/tcp_input.c1
-rw-r--r--sys/netinet/tcp_subr.c28
-rw-r--r--sys/netinet/tcp_syncache.c22
-rw-r--r--sys/netinet/tcp_timewait.c4
-rw-r--r--sys/netinet/udp_usrreq.c3
-rw-r--r--sys/netinet/vinet.h7
12 files changed, 49 insertions, 28 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 130ba0c..82dc605 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -89,8 +89,8 @@ static int useloopback; /* use loopback interface for local traffic */
static int arp_proxyall;
#endif
-SYSCTL_INT(_net_link_ether_inet, OID_AUTO, max_age, CTLFLAG_RW,
- &arpt_keep, 0, "ARP entry lifetime in seconds");
+SYSCTL_V_INT(V_NET, vnet_inet, _net_link_ether_inet, OID_AUTO, max_age,
+ CTLFLAG_RW, arpt_keep, 0, "ARP entry lifetime in seconds");
#define rt_expire rt_rmx.rmx_expire
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index dd5fb15..09fed47 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -120,6 +120,7 @@ int ipport_tcplastcount;
static int
sysctl_net_ipport_check(SYSCTL_HANDLER_ARGS)
{
+ INIT_VNET_INET(curvnet);
int error;
error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
@@ -1474,7 +1475,7 @@ inp_apply_all(void (*func)(struct inpcb *, void *), void *arg)
struct inpcb *inp;
INP_INFO_RLOCK(&V_tcbinfo);
- LIST_FOREACH(inp, tcbinfo.ipi_listhead, inp_list) {
+ LIST_FOREACH(inp, V_tcbinfo.ipi_listhead, inp_list) {
INP_WLOCK(inp);
func(inp, arg);
INP_WUNLOCK(inp);
diff --git a/sys/netinet/in_rmx.c b/sys/netinet/in_rmx.c
index d70aaa6..adb4fee 100644
--- a/sys/netinet/in_rmx.c
+++ b/sys/netinet/in_rmx.c
@@ -287,6 +287,7 @@ in_rtqtimo(void *rock)
static void
in_rtqtimo_one(void *rock)
{
+ INIT_VNET_INET(curvnet);
struct radix_node_head *rnh = rock;
struct rtqk_arg arg;
static time_t last_adjusted_timeout = 0;
@@ -341,6 +342,7 @@ in_rtqdrain(void)
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
INIT_VNET_NET(vnet_iter);
+
for ( fibnum = 0; fibnum < rt_numfibs; fibnum++) {
rnh = V_rt_tables[fibnum][AF_INET];
arg.found = arg.killed = 0;
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index dd0445d..b74f5db 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -581,6 +581,7 @@ div_ctlinput(int cmd, struct sockaddr *sa, void *vip)
static int
div_pcblist(SYSCTL_HANDLER_ARGS)
{
+ INIT_VNET_INET(curvnet);
int error, i, n;
struct inpcb *inp, **inp_list;
inp_gen_t gencnt;
diff --git a/sys/netinet/ip_fw_pfil.c b/sys/netinet/ip_fw_pfil.c
index 64a1752..3199ce8 100644
--- a/sys/netinet/ip_fw_pfil.c
+++ b/sys/netinet/ip_fw_pfil.c
@@ -487,6 +487,7 @@ ipfw6_unhook(void)
int
ipfw_chg_hook(SYSCTL_HANDLER_ARGS)
{
+ INIT_VNET_IPFW(curvnet);
int enable = *(int *)arg1;
int error;
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index aa5d3e7..197ce9c 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -791,6 +791,7 @@ done:
void
in_delayed_cksum(struct mbuf *m)
{
+ INIT_VNET_INET(curvnet);
struct ip *ip;
u_short csum, offset;
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 4c17f10d..7b292d2 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -2986,6 +2986,7 @@ tcp_mss(struct tcpcb *tp, int offer)
int isipv6;
#endif
KASSERT(tp != NULL, ("%s: tp == NULL", __func__));
+ INIT_VNET_INET(tp->t_vnet);
tcp_mss_update(tp, offer, &metrics, &mtuflags);
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index e28d40c..9fe707f 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -130,7 +130,7 @@ static int tcp_inflight_stab;
static int
sysctl_net_inet_tcp_mss_check(SYSCTL_HANDLER_ARGS)
{
- INIT_VNET_INET(TD_TO_VNET(curthread));
+ INIT_VNET_INET(curvnet);
int error, new;
new = V_tcp_mssdflt;
@@ -144,15 +144,16 @@ sysctl_net_inet_tcp_mss_check(SYSCTL_HANDLER_ARGS)
return (error);
}
-SYSCTL_PROC(_net_inet_tcp, TCPCTL_MSSDFLT, mssdflt, CTLTYPE_INT|CTLFLAG_RW,
- &tcp_mssdflt, 0, &sysctl_net_inet_tcp_mss_check, "I",
- "Default TCP Maximum Segment Size");
+SYSCTL_V_PROC(V_NET, vnet_inet, _net_inet_tcp, TCPCTL_MSSDFLT, mssdflt,
+ CTLTYPE_INT|CTLFLAG_RW, tcp_mssdflt, 0,
+ &sysctl_net_inet_tcp_mss_check, "I",
+ "Default TCP Maximum Segment Size");
#ifdef INET6
static int
sysctl_net_inet_tcp_mss_v6_check(SYSCTL_HANDLER_ARGS)
{
- INIT_VNET_INET6(TD_TO_VNET(curthread));
+ INIT_VNET_INET6(curvnet);
int error, new;
new = V_tcp_v6mssdflt;
@@ -166,9 +167,10 @@ sysctl_net_inet_tcp_mss_v6_check(SYSCTL_HANDLER_ARGS)
return (error);
}
-SYSCTL_PROC(_net_inet_tcp, TCPCTL_V6MSSDFLT, v6mssdflt, CTLTYPE_INT|CTLFLAG_RW,
- &tcp_v6mssdflt, 0, &sysctl_net_inet_tcp_mss_v6_check, "I",
- "Default TCP Maximum Segment Size for IPv6");
+SYSCTL_V_PROC(V_NET, vnet_inet, _net_inet_tcp, TCPCTL_V6MSSDFLT, v6mssdflt,
+ CTLTYPE_INT|CTLFLAG_RW, tcp_v6mssdflt, 0,
+ &sysctl_net_inet_tcp_mss_v6_check, "I",
+ "Default TCP Maximum Segment Size for IPv6");
#endif
/*
@@ -225,9 +227,9 @@ static int tcp_inflight_debug = 0;
SYSCTL_INT(_net_inet_tcp_inflight, OID_AUTO, debug, CTLFLAG_RW,
&tcp_inflight_debug, 0, "Debug TCP inflight calculations");
-SYSCTL_PROC(_net_inet_tcp_inflight, OID_AUTO, rttthresh, CTLTYPE_INT|CTLFLAG_RW,
- &tcp_inflight_rttthresh, 0, sysctl_msec_to_ticks, "I",
- "RTT threshold below which inflight will deactivate itself");
+SYSCTL_V_PROC(V_NET, vnet_inet, _net_inet_tcp_inflight, OID_AUTO, rttthresh,
+ CTLTYPE_INT|CTLFLAG_RW, tcp_inflight_rttthresh, 0, sysctl_msec_to_ticks,
+ "I", "RTT threshold below which inflight will deactivate itself");
SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp_inflight, OID_AUTO, min,
CTLFLAG_RW, tcp_inflight_min, 0, "Lower-bound for TCP inflight window");
@@ -947,6 +949,9 @@ static struct inpcb *
tcp_notify(struct inpcb *inp, int error)
{
struct tcpcb *tp;
+#ifdef INVARIANTS
+ INIT_VNET_INET(inp->inp_vnet); /* V_tcbinfo WLOCK ASSERT */
+#endif
INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
INP_WLOCK_ASSERT(inp);
@@ -1940,6 +1945,7 @@ int
tcp_signature_compute(struct mbuf *m, int _unused, int len, int optlen,
u_char *buf, u_int direction)
{
+ INIT_VNET_IPSEC(curvnet);
union sockaddr_union dst;
struct ippseudo ippseudo;
MD5_CTX ctx;
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index a69b0b2..252fa1c 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -105,12 +105,12 @@ static int tcp_syncookiesonly;
int tcp_sc_rst_sock_fail;
#endif
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, syncookies, CTLFLAG_RW,
- &tcp_syncookies, 0,
+SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, syncookies,
+ CTLFLAG_RW, tcp_syncookies, 0,
"Use TCP SYN cookies if the syncache overflows");
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, syncookies_only, CTLFLAG_RW,
- &tcp_syncookiesonly, 0,
+SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, syncookies_only,
+ CTLFLAG_RW, tcp_syncookiesonly, 0,
"Use only TCP SYN cookies");
#ifdef TCP_OFFLOAD_DISABLE
@@ -359,11 +359,13 @@ static void
syncache_timer(void *xsch)
{
struct syncache_head *sch = (struct syncache_head *)xsch;
- INIT_VNET_INET(sch->sch_vnet);
struct syncache *sc, *nsc;
int tick = ticks;
char *s;
+ CURVNET_SET(sch->sch_vnet);
+ INIT_VNET_INET(sch->sch_vnet);
+
/* NB: syncache_head has already been locked by the callout. */
SCH_LOCK_ASSERT(sch);
@@ -412,6 +414,7 @@ syncache_timer(void *xsch)
if (!TAILQ_EMPTY(&(sch)->sch_bucket))
callout_reset(&(sch)->sch_timer, (sch)->sch_nextc - tick,
syncache_timer, (void *)(sch));
+ CURVNET_RESTORE();
}
/*
@@ -836,7 +839,7 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
* B. check that the syncookie is valid. If it is, then
* cobble up a fake syncache entry, and return.
*/
- if (!tcp_syncookies) {
+ if (!V_tcp_syncookies) {
SCH_UNLOCK(sch);
if ((s = tcp_log_addrs(inc, th, NULL, NULL)))
log(LOG_DEBUG, "%s; %s: Spurious ACK, "
@@ -929,6 +932,7 @@ int
tcp_offload_syncache_expand(struct in_conninfo *inc, struct tcpopt *to,
struct tcphdr *th, struct socket **lsop, struct mbuf *m)
{
+ INIT_VNET_INET(curvnet);
int rc;
INP_INFO_WLOCK(&V_tcbinfo);
@@ -1097,7 +1101,7 @@ _syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
syncache_drop(sc, sch);
sc = uma_zalloc(V_tcp_syncache.zone, M_NOWAIT | M_ZERO);
if (sc == NULL) {
- if (tcp_syncookies) {
+ if (V_tcp_syncookies) {
bzero(&scs, sizeof(scs));
sc = &scs;
} else {
@@ -1206,7 +1210,7 @@ _syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
if ((th->th_flags & (TH_ECE|TH_CWR)) && V_tcp_do_ecn)
sc->sc_flags |= SCF_ECN;
- if (tcp_syncookies) {
+ if (V_tcp_syncookies) {
syncookie_generate(sch, sc, &flowtmp);
#ifdef INET6
if (autoflowlabel)
@@ -1225,7 +1229,7 @@ _syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
* Do a standard 3-way handshake.
*/
if (TOEPCB_ISSET(sc) || syncache_respond(sc) == 0) {
- if (tcp_syncookies && tcp_syncookiesonly && sc != &scs)
+ if (V_tcp_syncookies && V_tcp_syncookiesonly && sc != &scs)
syncache_free(sc);
else if (sc != &scs)
syncache_insert(sc, sch); /* locks and unlocks sch */
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
index a97b4a2..d3a582c 100644
--- a/sys/netinet/tcp_timewait.c
+++ b/sys/netinet/tcp_timewait.c
@@ -150,8 +150,8 @@ SYSCTL_PROC(_net_inet_tcp, OID_AUTO, maxtcptw, CTLTYPE_INT|CTLFLAG_RW,
&maxtcptw, 0, sysctl_maxtcptw, "IU",
"Maximum number of compressed TCP TIME_WAIT entries");
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, nolocaltimewait, CTLFLAG_RW,
- &nolocaltimewait, 0,
+SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, nolocaltimewait,
+ CTLFLAG_RW, nolocaltimewait, 0,
"Do not create compressed TCP TIME_WAIT entries for local connections");
void
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 9409235..de341af 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -113,7 +113,8 @@ int udp_log_in_vain = 0;
SYSCTL_INT(_net_inet_udp, OID_AUTO, log_in_vain, CTLFLAG_RW,
&udp_log_in_vain, 0, "Log all incoming UDP packets");
-SYSCTL_INT(_net_inet_udp, OID_AUTO, blackhole, CTLFLAG_RW, &udp_blackhole, 0,
+SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_udp, OID_AUTO, blackhole,
+ CTLFLAG_RW, udp_blackhole, 0,
"Do not send port unreachables for refused connects");
u_long udp_sendspace = 9216; /* really max datagram size */
diff --git a/sys/netinet/vinet.h b/sys/netinet/vinet.h
index 961e772..005a46b 100644
--- a/sys/netinet/vinet.h
+++ b/sys/netinet/vinet.h
@@ -89,12 +89,16 @@ struct vnet_inet {
struct tcpstat _tcpstat; /* tcp statistics */
struct tcp_hostcache _tcp_hostcache;
struct callout _tcp_hc_callout;
+
struct tcp_syncache _tcp_syncache;
+ int _tcp_syncookies;
+ int _tcp_syncookiesonly;
+ int _tcp_sc_rst_sock_fail;
+
struct inpcbhead _divcb;
struct inpcbinfo _divcbinfo;
TAILQ_HEAD(, tcptw) _twq_2msl;
- int _tcp_sc_rst_sock_fail;
int _tcp_mssdflt;
int _tcp_v6mssdflt;
int _tcp_minmss;
@@ -206,7 +210,6 @@ struct vnet_inet {
#define V_arp_maxtries VNET_INET(arp_maxtries)
#define V_arp_proxyall VNET_INET(arp_proxyall)
#define V_arpt_keep VNET_INET(arpt_keep)
-#define V_arpt_prune VNET_INET(arpt_prune)
#define V_blackhole VNET_INET(blackhole)
#define V_divcb VNET_INET(divcb)
#define V_divcbinfo VNET_INET(divcbinfo)
OpenPOWER on IntegriCloud