tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: should rt_msg1() zero rt_msghdr?
christos%astron.com@localhost (Christos Zoulas) writes:
> In article <874p8y86v9.fsf%orac.acorntoolworks.com@localhost>,
> J.T. Conklin <jtc%acorntoolworks.com@localhost> wrote:
>>While debugging a problem with routing socket messages, I noticed that
>>messages contained random data in the rtm_seq, rtm_pid, and rtm_errno
>>fields.
>>
>>In TCP/IP Illustrated, rt_msg1() contains a bzero() to clear rt_msghdr
>>fields. This bzero() is not present in NetBSD-4 (which I am using) or
>>in the -current sources.
>>
>>Should a memset() be added where the bzero() used to be?
>
> Can you post a diff?
This patch with memset() is equivalent to the version in TCP/IP
Illustrated that used bzero(). I'm building a kernel with this
change as I write this, so I haven't yet had a chance to verify
it.
--jtc
Index: rtsock.c
===================================================================
RCS file: /cvsroot/src/sys/net/rtsock.c,v
retrieving revision 1.103
diff -u -r1.103 rtsock.c
--- rtsock.c 13 May 2008 20:16:30 -0000 1.103
+++ rtsock.c 16 May 2008 21:27:54 -0000
@@ -586,6 +586,7 @@
m->m_pkthdr.rcvif = NULL;
m_copyback(m, 0, datalen, data);
rtm = mtod(m, struct rt_msghdr *);
+ memset(rtm, 0, len);
for (i = 0; i < RTAX_MAX; i++) {
if ((sa = rtinfo->rti_info[i]) == NULL)
continue;
--
J.T. Conklin
Home |
Main Index |
Thread Index |
Old Index