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
F114598708: D2989.diff
Mon, Apr 14, 7:20 AM
F114593417: D2989.id.diff
Mon, Apr 14, 6:17 AM
F114591847: D2989.id6681.diff
Mon, Apr 14, 5:59 AM
F114590317: D2989.id6719.diff
Mon, Apr 14, 5:42 AM
Unknown Object (File)
Feb 8 2025, 2:06 PM
Unknown Object (File)
Jan 19 2025, 2:13 PM
Unknown Object (File)
Jan 13 2025, 3:25 AM
Unknown Object (File)
Dec 26 2024, 8:54 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.