When I ported the CAP (Columbia Appletalk Package) to FreeBSD 1.0 I discovered what I felt to be a bug in the BPF code. I sent a simple fix to comp.386bsd.bugs but the fix hasn't been incorporated into FreeBSD 2.0 . The problem occurs when writing to the packet filter device and results in the ethernet type field being reversed. The reason is that CAP writes the data to the device in network order, then "bpf_movein" takes the ethernet header off as uninterpreted bytes. The ethernet device puts back the header, but converts the type field from host to network order. Fix: My fix was to have "bpf_movein" convert the type field back from network to host order. It may that there was a good reason why the fix wasn't incorporated, in which case it is easy enough to get round in the CAP code. I have already had people asking about running CAP on FreeBSD 2.0 and I would like to submit my patches. It would be nice to know whether this should be fixed by a temporary kernel patch or a work-around in the CAP code.--c8DTIalbRvVhSe6HgjPS2OrKY5GL7mRZBKNloG5Y4QLtmHLY Content-Type: text/plain; name="file.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="file.diff" *** /usr/src/sys/net/bpf.c Fri Mar 17 13:45:47 1995 --- /usr/src/sys/net/bpf.c.ORIG Sun Oct 9 08:35:03 1994 *************** *** 217,234 **** error = UIOMOVE((caddr_t)sockp->sa_data, hlen, UIO_WRITE, uio); if (error) goto bad; - - if (linktype == DLT_EN10MB) { - /* Adjust the protocol field. The type field - should already be in network order, but the - ethernet driver will assume that this is - an ethernet header with the type field in - host order. */ - struct ether_header *eh; - eh = (struct ether_header *)sockp->sa_data; - eh->ether_type = ntohs(eh->ether_type); - } - } error = UIOMOVE(mtod(m, caddr_t), len - hlen, UIO_WRITE, uio); if (!error) --- 217,222 ----
Responsible Changed From-To: freebsd-bugs->pst Duplicate of WIDE iij-ppp problem (with fix)
State Changed From-To: open->closed Fixed in -current today by davidg.
MARKED AS SPAM