Page MenuHomeFreeBSD

Fix if_loop so bpfwrite() can use it regardless of the state of bd_hdrcmplt.
ClosedPublic

Authored by pkelsey on Jul 4 2015, 3:57 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sep 12 2024, 1:03 AM
Unknown Object (File)
Sep 12 2024, 1:03 AM
Unknown Object (File)
Sep 8 2024, 7:58 PM
Unknown Object (File)
Sep 8 2024, 6:32 PM
Unknown Object (File)
Sep 8 2024, 1:12 AM
Unknown Object (File)
Aug 26 2024, 1:34 AM
Unknown Object (File)
Aug 1 2024, 3:10 AM
Unknown Object (File)
Jul 16 2024, 3:13 PM
Subscribers

Details

Summary

The logic in looutput() that detects a write from BPF and
retrieves the address family from sa_data instead of sa_family
performs this detection by checking sa_family for AF_UNSPEC. This is
defeated when bd_hdrcmplt is set in the BPF instance that is doing the
writing, because in that case sa_family is set to pseudo_AF_HDRCMPLT.
Thus BPF writes to an if_loop instance fail with EAFNOSUPPORT when
bd_hdrcmplt is set. This currently happens, for example, when using
libpcap to write to lo0.

bd_hdrcmplt exists to provide an indication to the interface, when
set, that it should not modify the link-level header. Since if_loop
does not use link-level headers, it should work the same with BPF
regardless of the setting of bd_hdrcmplt.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

pkelsey retitled this revision from to Fix if_loop so bpfwrite() can use it regardless of the state of bd_hdrcmplt..
pkelsey updated this object.
pkelsey added reviewers: gnn, melifaro.
melifaro edited edge metadata.

Looks fine to me.

This revision is now accepted and ready to land.Jul 4 2015, 7:13 AM
gnn edited edge metadata.
This revision was automatically updated to reflect the committed changes.