Page MenuHomeFreeBSD

bpf: modularize ifnet(9) part of bpf
Needs ReviewPublic

Authored by glebius on Fri, Nov 21, 10:57 PM.
Tags
None
Referenced Files
F137321559: D53872.id.diff
Sat, Nov 22, 11:02 AM
F137303825: D53872.id166932.diff
Sat, Nov 22, 6:08 AM
F137300572: D53872.id166938.diff
Sat, Nov 22, 5:09 AM
F137300187: D53872.id166932.diff
Sat, Nov 22, 5:02 AM
F137294472: D53872.id166938.diff
Sat, Nov 22, 3:55 AM
F137292343: D53872.id.diff
Sat, Nov 22, 3:22 AM
F137284329: D53872.diff
Sat, Nov 22, 1:26 AM
Subscribers

Details

Summary

Imagine that bpf(9) tapping can happen at any point in the network stack,
not necessarily at interface transmit or receive. To achieve that we need
a thin layer of abstraction defined by struct bif_methods, that defines
how generic bpf layer works with a tap point of this kind.

Implement ifnet(9) specific methods in a separate file bpf_ifnet.c. At
this point there is 100% compatibility for all existing interfaces, there
is no KPI change, yet. The legacy attaching KPI is layered over new ifnet
agnostic KPI. The new KPI may change though, as we can implement multiple
DLTs per single tap point in a prettier fashion.

The new abstraction layer allows us to move all the 802.11 radio injection
hacks out of bpf.c into ieee80211_radiotap.c, so do that immediately as a
good proof of concept. Note that these hacks originate from 246b5467621a
and there were no real software that uses it, except
tools/tools/net80211/wlaninject. The current state of the tool and the
API is unknown, thus 802.11 part of the change was only compile-tested.
However, I'd like to convert the tool into a regression test with help of
wtap.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 68804
Build 65687: arc lint + arc unit

Event Timeline

bz requested changes to this revision.Fri, Nov 21, 11:31 PM
bz added a subscriber: bz.

I like the idea. I haven't fully wrapped my head around it yet.

Also things like "removing DDB" and a few other shufflings are noise in this change. Just take it out of here and apply it to main upfront and rebase and this change will be a lot more clear.

Lastly, have you tested radiotap after this?

sys/net80211/ieee80211_radiotap.c
457

You want ieee80211_get_vap_ifname() or at least if_name(vap->iv_ifp) here.

This revision now requires changes to proceed.Fri, Nov 21, 11:31 PM
In D53872#1230746, @bz wrote:

Lastly, have you tested radiotap after this?

If somebody (e.g. you or Adrian) provides me with a working scenario to test radio tap on unmodified main, I will convert this scenario into atf test and I will make sure radiotap works with the change.

There is tool to inject radio frames in tools/tools/net80211/wlaninject and there is also if_wtap, a virtual wifi. Neither is documented. As I'm not an expert in the area, I can't quickly come up with a working scenario, thus asking for help.

  • Rebase
  • Build with MAC
  • Address bz's comment