Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Remove #ifdef INET. Same as tcp_input.c. Makes t...
details: https://anonhg.NetBSD.org/src/rev/5b438cb2b9d7
branches: trunk
changeset: 831406:5b438cb2b9d7
user: maxv <maxv%NetBSD.org@localhost>
date: Thu Mar 29 07:46:43 2018 +0000
description:
Remove #ifdef INET. Same as tcp_input.c. Makes the code easier to
understand.
Also make tcp6_mtudisc() static in tcp_subr.c.
diffstat:
sys/netinet/tcp_congctl.c | 7 +----
sys/netinet/tcp_debug.c | 7 +----
sys/netinet/tcp_output.c | 57 +++++++--------------------------------------
sys/netinet/tcp_sack.c | 7 +----
sys/netinet/tcp_subr.c | 49 +++++++--------------------------------
sys/netinet/tcp_timer.c | 19 +-------------
sys/netinet/tcp_usrreq.c | 58 +++-------------------------------------------
7 files changed, 30 insertions(+), 174 deletions(-)
diffs (truncated from 1072 to 300 lines):
diff -r 1929acda7ff4 -r 5b438cb2b9d7 sys/netinet/tcp_congctl.c
--- a/sys/netinet/tcp_congctl.c Thu Mar 29 07:24:26 2018 +0000
+++ b/sys/netinet/tcp_congctl.c Thu Mar 29 07:46:43 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_congctl.c,v 1.23 2017/01/02 09:29:38 skrll Exp $ */
+/* $NetBSD: tcp_congctl.c,v 1.24 2018/03/29 07:46:43 maxv Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2001, 2005, 2006 The NetBSD Foundation, Inc.
@@ -135,7 +135,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_congctl.c,v 1.23 2017/01/02 09:29:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_congctl.c,v 1.24 2018/03/29 07:46:43 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -167,9 +167,6 @@
#include <netinet/ip_var.h>
#ifdef INET6
-#ifndef INET
-#include <netinet/in.h>
-#endif
#include <netinet/ip6.h>
#include <netinet6/ip6_var.h>
#include <netinet6/in6_pcb.h>
diff -r 1929acda7ff4 -r 5b438cb2b9d7 sys/netinet/tcp_debug.c
--- a/sys/netinet/tcp_debug.c Thu Mar 29 07:24:26 2018 +0000
+++ b/sys/netinet/tcp_debug.c Thu Mar 29 07:46:43 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_debug.c,v 1.30 2016/04/26 08:44:44 ozaki-r Exp $ */
+/* $NetBSD: tcp_debug.c,v 1.31 2018/03/29 07:46:43 maxv Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_debug.c,v 1.30 2016/04/26 08:44:44 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_debug.c,v 1.31 2018/03/29 07:46:43 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -91,9 +91,6 @@
#include <netinet/ip_var.h>
#ifdef INET6
-#ifndef INET
-#include <netinet/in.h>
-#endif
#include <netinet/ip6.h>
#endif
diff -r 1929acda7ff4 -r 5b438cb2b9d7 sys/netinet/tcp_output.c
--- a/sys/netinet/tcp_output.c Thu Mar 29 07:24:26 2018 +0000
+++ b/sys/netinet/tcp_output.c Thu Mar 29 07:46:43 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_output.c,v 1.199 2018/03/10 23:28:13 khorben Exp $ */
+/* $NetBSD: tcp_output.c,v 1.200 2018/03/29 07:46:43 maxv Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -135,7 +135,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.199 2018/03/10 23:28:13 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.200 2018/03/29 07:46:43 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -166,9 +166,6 @@
#include <netinet/ip_var.h>
#ifdef INET6
-#ifndef INET
-#include <netinet/in.h>
-#endif
#include <netinet/ip6.h>
#include <netinet6/in6_var.h>
#include <netinet6/ip6_var.h>
@@ -182,7 +179,7 @@
#ifdef INET6
#include <netipsec/ipsec6.h>
#endif
-#endif /* IPSEC*/
+#endif
#include <netinet/tcp.h>
#define TCPOUTFLAGS
@@ -238,9 +235,7 @@
tcp_segsize(struct tcpcb *tp, int *txsegsizep, int *rxsegsizep,
bool *alwaysfragp)
{
-#ifdef INET
struct inpcb *inp = tp->t_inpcb;
-#endif
#ifdef INET6
struct in6pcb *in6p = tp->t_in6pcb;
#endif
@@ -258,11 +253,9 @@
panic("tcp_segsize: both t_inpcb and t_in6pcb are set");
#endif
switch (tp->t_family) {
-#ifdef INET
case AF_INET:
hdrlen = sizeof(struct ip) + sizeof(struct tcphdr);
break;
-#endif
#ifdef INET6
case AF_INET6:
hdrlen = sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
@@ -274,12 +267,10 @@
}
rt = NULL;
-#ifdef INET
if (inp) {
rt = in_pcbrtentry(inp);
so = inp->inp_socket;
}
-#endif
#ifdef INET6
if (in6p) {
rt = in6_pcbrtentry(in6p);
@@ -311,24 +302,19 @@
#endif
} else if (ifp->if_flags & IFF_LOOPBACK)
size = ifp->if_mtu - hdrlen;
-#ifdef INET
else if (inp && tp->t_mtudisc)
size = ifp->if_mtu - hdrlen;
else if (inp && in_localaddr(inp->inp_faddr))
size = ifp->if_mtu - hdrlen;
-#endif
#ifdef INET6
else if (in6p) {
-#ifdef INET
if (IN6_IS_ADDR_V4MAPPED(&in6p->in6p_faddr)) {
/* mapped addr case */
struct in_addr d;
bcopy(&in6p->in6p_faddr.s6_addr32[3], &d, sizeof(d));
if (tp->t_mtudisc || in_localaddr(d))
size = ifp->if_mtu - hdrlen;
- } else
-#endif
- {
+ } else {
/*
* for IPv6, path MTU discovery is always turned on,
* or the node must use packet size <= 1280.
@@ -338,10 +324,8 @@
}
}
#endif
-#ifdef INET
if (inp)
in_pcbrtentry_unref(rt, inp);
-#endif
#ifdef INET6
if (in6p)
in6_pcbrtentry_unref(rt, in6p);
@@ -357,7 +341,7 @@
* XXX tp->t_ourmss should have the right size, but without this code
* fragmentation will occur... need more investigation
*/
-#ifdef INET
+
if (inp) {
#if defined(IPSEC)
if (ipsec_used &&
@@ -366,9 +350,8 @@
#endif
optlen += ip_optlen(inp);
}
-#endif
+
#ifdef INET6
-#ifdef INET
if (in6p && tp->t_family == AF_INET) {
#if defined(IPSEC)
if (ipsec_used &&
@@ -376,9 +359,7 @@
optlen += ipsec4_hdrsiz_tcp(tp);
#endif
/* XXX size -= ip_optlen(in6p); */
- } else
-#endif
- if (in6p && tp->t_family == AF_INET6) {
+ } else if (in6p && tp->t_family == AF_INET6) {
#if defined(IPSEC)
if (ipsec_used &&
!ipsec_pcb_skip_ipsec(in6p->in6p_sp, IPSEC_DIR_OUTBOUND))
@@ -605,7 +586,6 @@
#endif
switch (af = tp->t_family) {
-#ifdef INET
case AF_INET:
if (tp->t_inpcb)
break;
@@ -615,7 +595,6 @@
break;
#endif
return (EINVAL);
-#endif
#ifdef INET6
case AF_INET6:
if (tp->t_in6pcb)
@@ -638,7 +617,7 @@
* - If the interface can do it
*/
has_tso4 = has_tso6 = false;
-#if defined(INET)
+
has_tso4 = tp->t_inpcb != NULL &&
#if defined(IPSEC)
(!ipsec_used || ipsec_pcb_skip_ipsec(tp->t_inpcb->inp_sp,
@@ -650,7 +629,7 @@
rtcache_unref(rt, &tp->t_inpcb->inp_route);
rt = NULL;
}
-#endif /* defined(INET) */
+
#if defined(INET6)
has_tso6 = tp->t_in6pcb != NULL &&
#if defined(IPSEC)
@@ -695,11 +674,9 @@
* slow start to get ack "clock" running again.
*/
int ss = tcp_init_win;
-#ifdef INET
if (tp->t_inpcb &&
in_localaddr(tp->t_inpcb->inp_faddr))
ss = tcp_init_win_local;
-#endif
#ifdef INET6
if (tp->t_in6pcb &&
in6_localaddr(&tp->t_in6pcb->in6p_faddr))
@@ -1118,11 +1095,9 @@
optlen = 0;
optp = opt;
switch (af) {
-#ifdef INET
case AF_INET:
iphdrlen = sizeof(struct ip) + sizeof(struct tcphdr);
break;
-#endif
#ifdef INET6
case AF_INET6:
iphdrlen = sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
@@ -1137,10 +1112,8 @@
struct rtentry *synrt;
synrt = NULL;
-#ifdef INET
if (tp->t_inpcb)
synrt = in_pcbrtentry(tp->t_inpcb);
-#endif
#ifdef INET6
if (tp->t_in6pcb)
synrt = in6_pcbrtentry(tp->t_in6pcb);
@@ -1149,10 +1122,8 @@
tp->snd_nxt = tp->iss;
tp->t_ourmss = tcp_mss_to_advertise(synrt != NULL ?
synrt->rt_ifp : NULL, af);
-#ifdef INET
if (tp->t_inpcb)
in_pcbrtentry_unref(synrt, tp->t_inpcb);
-#endif
#ifdef INET6
if (tp->t_in6pcb)
in6_pcbrtentry_unref(synrt, tp->t_in6pcb);
@@ -1358,7 +1329,6 @@
}
m_reset_rcvif(m);
switch (af) {
-#ifdef INET
case AF_INET:
ip = mtod(m, struct ip *);
#ifdef INET6
@@ -1366,7 +1336,6 @@
#endif
th = (struct tcphdr *)(ip + 1);
break;
-#endif
#ifdef INET6
case AF_INET6:
ip = NULL;
@@ -1513,7 +1482,6 @@
* hits the wire.
*/
switch (af) {
-#ifdef INET
case AF_INET:
m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum);
if (use_tso) {
Home |
Main Index |
Thread Index |
Old Index