mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 04:35:38 +08:00
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.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
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.
|
||||
|
||||
2011-02-23 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* libnetworking/net/if_pppvar.h: Add "extern C++" guards.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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$
|
||||
*/
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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 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 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
|
||||
|
||||
Reference in New Issue
Block a user