summaryrefslogtreecommitdiffstats
path: root/cpukit/libnetworking/netinet
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2011-02-24 06:48:52 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2011-02-24 06:48:52 +0000
commit460674d99fa3cda2c368453e9618111a2216140d (patch)
tree0b45ddbb060a4c6c4ee56247e82b552e8810546d /cpukit/libnetworking/netinet
parent2011-02-23 Ralf Corsépius <ralf.corsepius@rtems.org> (diff)
downloadrtems-460674d99fa3cda2c368453e9618111a2216140d.tar.bz2
2011-02-24 Ralf Corsépius <ralf.corsepius@rtems.org>
* libnetworking/netinet/in_systm.h, libnetworking/netinet/tcp_debug.c, libnetworking/netinet/tcp_debug.h, libnetworking/netinet/tcp_seq.h, libnetworking/netinet/tcp_var.h, libnetworking/netinet/tcpip.h: Misc changes from FreeBSD.
Diffstat (limited to 'cpukit/libnetworking/netinet')
-rw-r--r--cpukit/libnetworking/netinet/in_systm.h15
-rw-r--r--cpukit/libnetworking/netinet/tcp_debug.c38
-rw-r--r--cpukit/libnetworking/netinet/tcp_debug.h14
-rw-r--r--cpukit/libnetworking/netinet/tcp_seq.h8
-rw-r--r--cpukit/libnetworking/netinet/tcp_var.h6
-rw-r--r--cpukit/libnetworking/netinet/tcpip.h20
6 files changed, 43 insertions, 58 deletions
diff --git a/cpukit/libnetworking/netinet/in_systm.h b/cpukit/libnetworking/netinet/in_systm.h
index 9c93ae78f0..43d458fa20 100644
--- a/cpukit/libnetworking/netinet/in_systm.h
+++ b/cpukit/libnetworking/netinet/in_systm.h
@@ -10,10 +10,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -31,6 +27,9 @@
* SUCH DAMAGE.
*
* @(#)in_systm.h 8.1 (Berkeley) 6/10/93
+ * $FreeBSD: src/sys/netinet/in_systm.h,v 1.13 2009/02/13 15:14:43 luigi Exp $
+ */
+/*
* $Id$
*/
@@ -50,13 +49,13 @@
* the bytes before transmission at each protocol level. The n_ types
* represent the types with the bytes in ``high-ender'' order.
*/
-typedef u_short n_short; /* short as received from the net */
-typedef u_long n_long; /* long as received from the net */
+typedef u_int16_t n_short; /* short as received from the net */
+typedef u_int32_t n_long; /* long as received from the net */
-typedef u_long n_time; /* ms since 00:00 GMT, byte rev */
+typedef u_int32_t n_time; /* ms since 00:00 GMT, byte rev */
#ifdef _KERNEL
-n_time iptime(void);
+uint32_t iptime(void);
#endif
#endif
diff --git a/cpukit/libnetworking/netinet/tcp_debug.c b/cpukit/libnetworking/netinet/tcp_debug.c
index acf9ea5c74..779c5fb5c7 100644
--- a/cpukit/libnetworking/netinet/tcp_debug.c
+++ b/cpukit/libnetworking/netinet/tcp_debug.c
@@ -34,6 +34,8 @@
#include "config.h"
#endif
+#include <rtems/bsd/sys/cdefs.h>
+#include "opt_inet.h"
#include "opt_tcpdebug.h"
#ifdef TCPDEBUG
@@ -45,39 +47,39 @@
#endif
#include <sys/param.h>
-#include <rtems/bsd/sys/queue.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
#include <sys/protosw.h>
-#include <errno.h>
-#include <net/route.h>
-#include <net/if.h>
+#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
-#include <netinet/in_pcb.h>
#include <netinet/ip_var.h>
#include <netinet/tcp.h>
#include <netinet/tcp_fsm.h>
-#include <netinet/tcp_seq.h>
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
#include <netinet/tcpip.h>
#include <netinet/tcp_debug.h>
#ifdef TCPDEBUG
-static int tcpconsdebug = 0; /* set to 1 to enable prints */
+static int tcpconsdebug = 0;
#endif
-static struct tcp_debug tcp_debug[TCP_NDEBUG];
-static int tcp_debx;
+/*
+ * Global ring buffer of TCP debugging state. Each entry captures a snapshot
+ * of TCP connection state at any given moment. tcp_debx addresses at the
+ * next available slot. There is no explicit export of this data structure;
+ * it will be read via /dev/kmem by debugging tools.
+ */
+static struct tcp_debug tcp_debug[TCP_NDEBUG];
+static int tcp_debx;
/*
- * Tcp debug routines
+ * Save TCP state at a given moment; optionally, both tcpcb and TCP packet
+ * header state will be saved.
*/
void
tcp_trace(short act, short ostate, struct tcpcb *tp, struct tcpiphdr *ti,
@@ -87,15 +89,16 @@ tcp_trace(short act, short ostate, struct tcpcb *tp, struct tcpiphdr *ti,
tcp_seq seq, ack;
int len, flags;
#endif
- struct tcp_debug *td = &tcp_debug[tcp_debx++];
+ struct tcp_debug *td;
+ td = &tcp_debug[tcp_debx++];
if (tcp_debx == TCP_NDEBUG)
tcp_debx = 0;
td->td_time = iptime();
td->td_act = act;
td->td_ostate = ostate;
td->td_tcb = (caddr_t)tp;
- if (tp)
+ if (tp != NULL)
td->td_cb = *tp;
else
bzero((caddr_t)&td->td_cb, sizeof (*tp));
@@ -107,13 +110,12 @@ tcp_trace(short act, short ostate, struct tcpcb *tp, struct tcpiphdr *ti,
#ifdef TCPDEBUG
if (tcpconsdebug == 0)
return;
- if (tp)
+ if (tp != NULL)
printf("%p %s:", tp, tcpstates[ostate]);
else
printf("???????? ");
printf("%s ", tanames[act]);
switch (act) {
-
case TA_INPUT:
case TA_OUTPUT:
case TA_DROP:
@@ -154,11 +156,11 @@ tcp_trace(short act, short ostate, struct tcpcb *tp, struct tcpiphdr *ti,
printf("<%s>", tcptimers[req>>8]);
break;
}
- if (tp)
+ if (tp != NULL)
printf(" -> %s", tcpstates[tp->t_state]);
/* print out internal state of tp !?! */
printf("\n");
- if (tp == 0)
+ if (tp == NULL)
return;
printf("\trcv_(nxt,wnd,up) (%x,%x,%x) snd_(una,nxt,max) (%x,%x,%x)\n",
tp->rcv_nxt, tp->rcv_wnd, tp->rcv_up, tp->snd_una, tp->snd_nxt,
diff --git a/cpukit/libnetworking/netinet/tcp_debug.h b/cpukit/libnetworking/netinet/tcp_debug.h
index 4bff757e2a..11a2b003f4 100644
--- a/cpukit/libnetworking/netinet/tcp_debug.h
+++ b/cpukit/libnetworking/netinet/tcp_debug.h
@@ -10,10 +10,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -31,6 +27,10 @@
* SUCH DAMAGE.
*
* @(#)tcp_debug.h 8.1 (Berkeley) 6/10/93
+ * $FreeBSD: src/sys/netinet/tcp_debug.h,v 1.17 2009/02/13 15:14:43 luigi Exp $
+ */
+
+/*
* $Id$
*/
@@ -38,7 +38,7 @@
#define _NETINET_TCP_DEBUG_H_
struct tcp_debug {
- n_time td_time;
+ uint32_t td_time; /* network format */
short td_act;
short td_ostate;
caddr_t td_tcb;
@@ -47,14 +47,14 @@ struct tcp_debug {
struct tcpcb td_cb;
};
-#define TA_INPUT 0
+#define TA_INPUT 0
#define TA_OUTPUT 1
#define TA_USER 2
#define TA_RESPOND 3
#define TA_DROP 4
#ifdef TANAMES
-static char *tanames[] =
+static const char *tanames[] =
{ "input", "output", "user", "respond", "drop" };
#endif
diff --git a/cpukit/libnetworking/netinet/tcp_seq.h b/cpukit/libnetworking/netinet/tcp_seq.h
index 01505377ba..5d42a8ed3e 100644
--- a/cpukit/libnetworking/netinet/tcp_seq.h
+++ b/cpukit/libnetworking/netinet/tcp_seq.h
@@ -10,10 +10,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -31,6 +27,10 @@
* SUCH DAMAGE.
*
* @(#)tcp_seq.h 8.3 (Berkeley) 6/21/95
+ * $FreeBSD: src/sys/netinet/tcp_seq.h,v 1.26 2006/06/18 14:24:12 andre Exp $
+ */
+
+/*
* $Id$
*/
diff --git a/cpukit/libnetworking/netinet/tcp_var.h b/cpukit/libnetworking/netinet/tcp_var.h
index 385694cbee..aea40f694e 100644
--- a/cpukit/libnetworking/netinet/tcp_var.h
+++ b/cpukit/libnetworking/netinet/tcp_var.h
@@ -185,12 +185,6 @@ struct rmxp_tao {
tcp_cc tao_cc; /* latest CC in valid SYN */
tcp_cc tao_ccsent; /* latest CC sent to peer */
u_short tao_mssopt; /* peer's cached MSS */
-#ifdef notyet
- u_short tao_flags; /* cache status flags */
-#define TAOF_DONT 0x0001 /* peer doesn't understand rfc1644 */
-#define TAOF_OK 0x0002 /* peer does understand rfc1644 */
-#define TAOF_UNDEF 0 /* we don't know yet */
-#endif /* notyet */
};
#define rmx_taop(r) ((struct rmxp_tao *)(r).rmx_filler)
diff --git a/cpukit/libnetworking/netinet/tcpip.h b/cpukit/libnetworking/netinet/tcpip.h
index b8634bfd15..0b136633b7 100644
--- a/cpukit/libnetworking/netinet/tcpip.h
+++ b/cpukit/libnetworking/netinet/tcpip.h
@@ -10,10 +10,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -31,6 +27,10 @@
* SUCH DAMAGE.
*
* @(#)tcpip.h 8.1 (Berkeley) 6/10/93
+ * $FreeBSD: src/sys/netinet/tcpip.h,v 1.12.22.1.4.1 2010/06/14 02:09:06 kensmith Exp $
+ */
+
+/*
* $Id$
*/
@@ -41,19 +41,9 @@
* Tcp+ip header, after ip options removed.
*/
struct tcpiphdr {
- struct ipovly ti_i; /* overlaid ip structure */
- struct tcphdr ti_t; /* tcp header */
-};
-#ifdef notyet
-/*
- * Tcp+ip header, after ip options removed but including TCP options.
- */
-struct full_tcpiphdr {
- struct ipovly ti_i; /* overlaid ip structure */
+ struct ipovly ti_i; /* overlaid ip structure */
struct tcphdr ti_t; /* tcp header */
- char ti_o[TCP_MAXOLEN]; /* space for tcp options */
};
-#endif /* notyet */
#define ti_next ti_i.ih_next
#define ti_prev ti_i.ih_prev
#define ti_x1 ti_i.ih_x1