This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
bind corrupting sockaddr and stats_in_cksum
- From: Andrew Lunn <andrew at lunn dot ch>
- To: eCos Patches <ecos-patches at ecos dot sourceware dot org>
- Date: Wed, 18 Aug 2004 11:40:19 +0200
- Subject: bind corrupting sockaddr and stats_in_cksum
Hi Folks
This patch fixed the two recently reported problems with the FreeBSD
stack.
Andrew
*cdl/freebsd_net.cdl:
Index: net/bsd_tcpip/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/bsd_tcpip/current/ChangeLog,v
retrieving revision 1.48
diff -u -r1.48 ChangeLog
--- net/bsd_tcpip/current/ChangeLog 16 Jul 2004 10:43:28 -0000 1.48
+++ net/bsd_tcpip/current/ChangeLog 18 Aug 2004 09:37:57 -0000
@@ -1,3 +1,15 @@
+2004-08-18 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * src/ecos/support.c (show_net_times): Removed stats_in_cksum.
+ It does not exist in the FreeBSD stack. Pointed out by
+ Philip Keller.
+
+2004-08-17 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * src/sys/kern/sockio.c (bsd_bind): Pass a copy of the sa into
+ bind so that the "kernel" code does not modify the "user" codes
+ version of the socket address.
+
2004-07-15 Oyvind Harboe <oyvind.harboe@zylin.com>
*cdl/freebsd_net.cdl:
Index: net/bsd_tcpip/current/src/ecos/support.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/bsd_tcpip/current/src/ecos/support.c,v
retrieving revision 1.14
diff -u -r1.14 support.c
--- net/bsd_tcpip/current/src/ecos/support.c 16 Jul 2004 10:43:30 -0000 1.14
+++ net/bsd_tcpip/current/src/ecos/support.c 18 Aug 2004 09:37:59 -0000
@@ -147,7 +147,6 @@
static struct net_stats stats_malloc, stats_free,
stats_memcpy, stats_memset,
stats_mbuf_alloc, stats_mbuf_free, stats_cluster_alloc;
-extern struct net_stats stats_in_cksum;
// Display a number of ticks as microseconds
// Note: for improved calculation significance, values are kept in ticks*1000
@@ -193,7 +192,6 @@
show_net_stats(&stats_mbuf_alloc, "Mbuf alloc");
show_net_stats(&stats_mbuf_free, "Mbuf free");
show_net_stats(&stats_cluster_alloc, "Cluster alloc");
- show_net_stats(&stats_in_cksum, "Checksum");
show_net_stats(&stats_memcpy, "Net memcpy");
show_net_stats(&stats_memset, "Net memset");
}
Index: net/bsd_tcpip/current/src/sys/kern/sockio.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/bsd_tcpip/current/src/sys/kern/sockio.c,v
retrieving revision 1.5
diff -u -r1.5 sockio.c
--- net/bsd_tcpip/current/src/sys/kern/sockio.c 17 Jan 2004 14:10:52 -0000 1.5
+++ net/bsd_tcpip/current/src/sys/kern/sockio.c 18 Aug 2004 09:38:00 -0000
@@ -246,8 +246,9 @@
bsd_bind(cyg_file *fp, const sockaddr *sa, socklen_t len)
{
int error;
-
- error = sobind((struct socket *)fp->f_data, (sockaddr *)sa, 0);
+ sockaddr sa1=*sa;
+
+ error = sobind((struct socket *)fp->f_data, (sockaddr *)&sa1, 0);
return error;
}