This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: RedBoot sending incorrect TCP window size
- To: ecos-discuss at sources dot redhat dot com
- Subject: Re: [ECOS] RedBoot sending incorrect TCP window size
- From: Grant Edwards <grante at visi dot com>
- Date: Thu, 8 Feb 2001 13:46:27 -0600
- References: <20010208105133.A1381@visi.com>
On Thu, Feb 08, 2001 at 10:51:36AM -0600, Grant Edwards wrote:
> All occurrences of "sizeof (eth_header_t)" in net.h, tcp.c, udp.c
> need to be replace by a hard coded constant. I'll send a patch
> later today...
And here it is.
--
Grant Edwards
grante@visi.com
Index: src/net/tcp.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/net/tcp.c,v
retrieving revision 1.2
diff -U5 -r1.2 tcp.c
--- tcp.c 2000/12/08 03:30:09 1.2
+++ tcp.c 2001/02/08 19:37:23
@@ -43,11 +43,11 @@
//
//==========================================================================
#include <net/net.h>
-#define MAX_TCP_SEGMENT (ETH_MAX_PKTLEN - (sizeof(eth_header_t) + sizeof(ip_header_t)))
+#define MAX_TCP_SEGMENT (ETH_MAX_PKTLEN - (ETH_HDR_SIZE + sizeof(ip_header_t)))
#define MAX_TCP_DATA (MAX_TCP_SEGMENT - sizeof(tcp_header_t))
/* sequence number comparison macros */
#define SEQ_LT(a,b) ((int)((a)-(b)) < 0)
Index: src/net/udp.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/net/udp.c,v
retrieving revision 1.2
diff -U5 -r1.2 udp.c
--- udp.c 2000/10/31 20:53:15 1.2
+++ udp.c 2001/02/08 19:37:24
@@ -51,11 +51,11 @@
static int udp_rx_handled;
static int udp_rx_cksum;
static int udp_rx_dropped;
#endif
-#define MAX_UDP_DATA (ETH_MAX_PKTLEN - (sizeof(eth_header_t) + \
+#define MAX_UDP_DATA (ETH_MAX_PKTLEN - (ETH_HDR_SIZE + \
sizeof(ip_header_t) + \
sizeof(udp_header_t)))
/*
* A major assumption is that only a very small number of sockets will
Index: include/net/net.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/include/net/net.h,v
retrieving revision 1.3
diff -U5 -r1.3 net.h
--- net.h 2000/12/08 03:30:08 1.3
+++ net.h 2001/02/08 19:37:25
@@ -77,10 +78,11 @@
/*
* Minimum ethernet packet length.
*/
#define ETH_MIN_PKTLEN 60
#define ETH_MAX_PKTLEN 1514
+#define ETH_HDR_SIZE 14
typedef unsigned char enet_addr_t[6];
typedef unsigned char ip_addr_t[4];
typedef unsigned char octet;
@@ -163,11 +165,11 @@
enet_addr_t target_enet;
ip_addr_t target_ip;
} arp_header_t;
-#define ARP_PKT_SIZE (sizeof(arp_header_t) + sizeof(eth_header_t))
+#define ARP_PKT_SIZE (sizeof(arp_header_t) + ETH_HDR_SIZE)
/*
* Internet Protocol header.
*/
typedef struct {
@@ -191,11 +193,11 @@
ip_addr_t source;
ip_addr_t destination;
} ip_header_t;
-#define IP_PKT_SIZE (60 + sizeof(eth_header_t))
+#define IP_PKT_SIZE (60 + ETH_HDR_SIZE)
/*
* A IP<->ethernet address mapping.
*/