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)
Fri, Jun 13, 10:31 AM
Unknown Object (File)
Mon, Jun 9, 4:07 PM
Unknown Object (File)
Sun, Jun 8, 10:45 PM
Unknown Object (File)
Fri, Jun 6, 10:49 PM
Unknown Object (File)
Thu, Jun 5, 10:40 PM
Unknown Object (File)
Sun, Jun 1, 3:31 PM
Unknown Object (File)
Sat, May 31, 12:47 PM
Unknown Object (File)
Fri, May 30, 3:00 AM
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.