Here's another dhclient patch to address another bug in the bpf code by correctly using BPF_WORDALIGN to advance the pointer. It assumes the previous patch (as committed to HEAD) has been applied. I've got a couple systems running this with debug compiled versons so if we still have bpf related bugs, I should be able to find them. -- Brooks ----- Forwarded message from Brooks Davis <brooks_at_freebsd.org> ----- From: Brooks Davis <brooks_at_freebsd.org> Date: Thu, 28 Jul 2005 01:18:21 GMT To: Perforce Change Reviews <perforce_at_freebsd.org> Subject: PERFORCE change 81096 for review http://perforce.freebsd.org/chv.cgi?CH=81096 Change 81096 by brooks_at_brooks_pagefault on 2005/07/28 01:17:44 Futher BPF handing fixes. Use BPF_WORDALIGN when incrementing the pointer. From ISC via krw at OpenBSD. Affected files ... .. //depot/user/brooks/cleanup/sbin/dhclient/bpf.c#6 edit Differences ... ==== //depot/user/brooks/cleanup/sbin/dhclient/bpf.c#6 (text+ko) ==== _at__at_ -325,7 +325,9 _at__at_ * do is drop it. */ if (hdr.bh_caplen != hdr.bh_datalen) { - interface->rbuf_offset += hdr.bh_caplen; + interface->rbuf_offset = + BPF_WORDALIGN(interface->rbuf_offset + + hdr.bh_caplen); continue; } _at__at_ -339,7 +341,9 _at__at_ * this packet. */ if (offset < 0) { - interface->rbuf_offset += hdr.bh_caplen; + interface->rbuf_offset = + BPF_WORDALIGN(interface->rbuf_offset + + hdr.bh_caplen); continue; } interface->rbuf_offset += offset; _at__at_ -351,7 +355,9 _at__at_ /* If the IP or UDP checksum was bad, skip the packet... */ if (offset < 0) { - interface->rbuf_offset += hdr.bh_caplen; + interface->rbuf_offset = + BPF_WORDALIGN(interface->rbuf_offset + + hdr.bh_caplen); continue; } interface->rbuf_offset += offset; _at__at_ -363,14 +369,18 _at__at_ * life, though). */ if (hdr.bh_caplen > len) { - interface->rbuf_offset += hdr.bh_caplen; + interface->rbuf_offset = + BPF_WORDALIGN(interface->rbuf_offset + + hdr.bh_caplen); continue; } /* Copy out the data in the packet... */ memcpy(buf, interface->rbuf + interface->rbuf_offset, hdr.bh_caplen); - interface->rbuf_offset += hdr.bh_caplen; + interface->rbuf_offset = + BPF_WORDALIGN(interface->rbuf_offset + + hdr.bh_caplen); return (hdr.bh_caplen); } while (!length); return (0); ----- End forwarded message ----- -- Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:39 UTC