Error: cfg80211: exports duplicate symbol __cfg80211_alloc_event_skb (owned by kernel)

I'm trying to play around with the mechanism proposed by Johannes Berg in these patches:
1, 2, 3

It introduces the BPF program type wifimon which should allow hooking into the RX path of mac80211.
I'm able to build an image but I get the following error during boot:

[   14.484493] cfg80211: exports duplicate symbol __cfg80211_alloc_event_skb (owned by kernel)
[...]
[   14.584634] cfg80211: exports duplicate symbol __cfg80211_alloc_event_skb (owned by kernel)
[   14.627063] kmodloader: 8 modules could not be probed
[   14.632483] kmodloader: dependency not loaded cfg80211
[   14.637970] kmodloader: - ath - 1
[   14.641523] kmodloader: dependency not loaded mac80211
[   14.646994] kmodloader: dependency not loaded cfg80211
[   14.652335] kmodloader: dependency not loaded ath
[   14.657325] kmodloader: - ath10k_core - 3
[   14.661632] kmodloader: dependency not loaded ath10k_core
[   14.667195] kmodloader: - ath10k_pci - 1
[   14.671429] kmodloader: dependency not loaded mac80211
[   14.676840] kmodloader: dependency not loaded ath9k_hw
[   14.682309] kmodloader: dependency not loaded ath9k_common
[   14.688211] kmodloader: dependency not loaded cfg80211
[   14.693817] kmodloader: dependency not loaded ath
[   14.698896] kmodloader: - ath9k - 5
[   14.702616] kmodloader: dependency not loaded cfg80211
[   14.708068] kmodloader: dependency not loaded ath9k_hw
[   14.713628] kmodloader: dependency not loaded ath
[   14.718568] kmodloader: - ath9k_common - 3
[   14.723004] kmodloader: dependency not loaded ath
[   14.728027] kmodloader: - ath9k_hw - 1
[   14.731981] kmodloader: - cfg80211 - 0
[   14.736049] kmodloader: dependency not loaded cfg80211
[   14.741522] kmodloader: - mac80211 - 1

From what I've gathered it is some sort of conflict between the kernel's integrated mac80211 and another mac80211 kernel module both exporting __cfg80211_alloc_event_skb.
I have close to no experience with kernel programming and so have no idea on how to go about fixing this. Any help is greatly appreciated.

The in-kernel wireless subsystem and drivers are completely disabled in OpenWrt, in favour of using a newer backports suite of these. Accordingly you need to modify the mac80211 package and its configuration, not the kernel itself.

Thank you! I wasn't aware of that.
Does that mean that I have to make sure all the bpf*.h headers are present in build_dir/[...]/backports-xxxx/include/linux/? Or is it enough if they are in build_dir/[...]/linux-5.4.87/include/linux? I'm not sure how there two locations interact.

I've tried making the patches alter the backported stuff but this has only resulted in the symbol that's being exported switching from __cfg80211_alloc_event_skb to bridge_tunnel_header. As I've said, I'm just guessing since I don't really know how the kernel and the backported stuff interact.

These are the parts I'm touching right now:

/openwrt/target/linux/generic/backport-5.4/830-wirelress-add-wifimon-program-type.patch

  • /include/linux/bpf_types.h
  • /include/uapi/linux/bpf.h
  • /net/core/filter.c
  • /net/wireless/Kconfig

/openwrt/package/kernel/mac80211/patches/subsys/600-cfg80211-add-api-to-attach-monitor-filter-program.patch

  • /include/net/cfg80211.h
  • /include/uapi/linux/nl80211.h
  • /net/wireless/core.c
  • /net/wireless/nl80211.c

/openwrt/package/kernel/mac80211/patches/subsys/601-mac80211-support-bpf-monitor-filter.patch

  • /net/mac80211/Kconfig
  • /net/mac80211/cfg.c
  • /net/mac80211/ieee80211_i.h
  • /net/mac80211/iface.c
  • /net/mac80211/main.c
  • /net/mac80211/rx.c

Am I doing something wrong?

I've gotten some help from @nbd and was able to fix it.
Somewhere along the way, I had enabled cfg80211 in the kernel which clashed with the backported mac80211.
I ran make kernel_menuconfig and disabled cfg80211.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.