Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/dhcp/common Make sure to BPF_WORDALIGN() the buffer...



details:   https://anonhg.NetBSD.org/src/rev/f91a20576f55
branches:  trunk
changeset: 499718:f91a20576f55
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Mon Nov 27 17:08:16 2000 +0000

description:
Make sure to BPF_WORDALIGN() the buffer pointer for each packet, as BPF does in
the kernel.  Otherwise the pointers get out of sync and dhcpd goes nuts.

diffstat:

 usr.sbin/dhcp/common/bpf.c |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r 3b2006ccccf3 -r f91a20576f55 usr.sbin/dhcp/common/bpf.c
--- a/usr.sbin/dhcp/common/bpf.c        Mon Nov 27 17:04:13 2000 +0000
+++ b/usr.sbin/dhcp/common/bpf.c        Mon Nov 27 17:08:16 2000 +0000
@@ -47,7 +47,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: bpf.c,v 1.6 2000/10/17 16:12:20 taca Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: bpf.c,v 1.7 2000/11/27 17:08:16 mycroft Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -436,6 +436,10 @@
                        continue;
                }
 
+               /* Adjust for any padding BPF inserted between the packets. */
+               interface -> rbuf_offset =
+                   BPF_WORDALIGN (interface -> rbuf_offset);
+
                /* Copy out a bpf header... */
                memcpy (&hdr, &interface -> rbuf [interface -> rbuf_offset],
                        sizeof hdr);



Home | Main Index | Thread Index | Old Index