diff options
author | David Malone <dwmalone@FreeBSD.org> | 2005-06-26 18:11:11 +0000 |
---|---|---|
committer | David Malone <dwmalone@FreeBSD.org> | 2005-06-26 18:11:11 +0000 |
commit | 01399f34a56a26b5520766a47be1a6e1f1df9783 (patch) | |
tree | 5510fdb16b02fe3d6d31530943a20683c2479916 /sys/dev/iicbus/if_ic.c | |
parent | 7db9a6fcd1bded89968a56ef974e251f3ef9b5e7 (diff) | |
download | src-01399f34a56a26b5520766a47be1a6e1f1df9783.tar.gz src-01399f34a56a26b5520766a47be1a6e1f1df9783.zip |
Fix some long standing bugs in writing to the BPF device attached to
a DLT_NULL interface. In particular:
1) Consistently use type u_int32_t for the header of a
DLT_NULL device - it continues to represent the address
family as always.
2) In the DLT_NULL case get bpf_movein to store the u_int32_t
in a sockaddr rather than in the mbuf, to be consistent
with all the DLT types.
3) Consequently fix a bug in bpf_movein/bpfwrite which
only permitted packets up to 4 bytes less than the MTU
to be written.
4) Fix all DLT_NULL devices to have the code required to
allow writing to their bpf devices.
5) Move the code to allow writing to if_lo from if_simloop
to looutput, because it only applies to DLT_NULL devices
but was being applied to other devices that use if_simloop
possibly incorrectly.
PR: 82157
Submitted by: Matthew Luckie <mjl@luckie.org.nz>
Approved by: re (scottl)
Notes
Notes:
svn path=/head/; revision=147611
Diffstat (limited to 'sys/dev/iicbus/if_ic.c')
-rw-r--r-- | sys/dev/iicbus/if_ic.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/iicbus/if_ic.c b/sys/dev/iicbus/if_ic.c index d0068bb6137a..fba21d169f91 100644 --- a/sys/dev/iicbus/if_ic.c +++ b/sys/dev/iicbus/if_ic.c @@ -374,7 +374,13 @@ icoutput(struct ifnet *ifp, struct mbuf *m, int s, len, sent; struct mbuf *mm; u_char *cp; - u_int32_t hdr = dst->sa_family; + u_int32_t hdr; + + /* BPF writes need to be handled specially. */ + if (dst->sa_family == AF_UNSPEC) + bcopy(dst->sa_data, &hdr, sizeof(hdr)); + else + hdr = dst->sa_family; ifp->if_flags |= IFF_RUNNING; |