wpa_supplicant won't compile with nl80211 [and pcap] enabled

Jouni Malinen j at w1.fi
Fri Jan 1 06:55:11 PST 2016

On Thu, Dec 31, 2015 at 11:13:05AM -0500, jrun wrote:
> it will compile if i disable pcap. so to summarise:
> nl80211 + pcap won't compile
> nl80211 - pcap will  compile

It looks like CONFIG_L2_PACKET=pcap case was not updated when
l2_packet_init_bridge() was added. The patch below fixes this.

Do you have a specific reason for using libpcap/libdnet
(CONFIG_L2_PACKET=pcap) instead of the default l2_packet_linux.c
implementation (direct use of Linux packet sockets)? libdnet is not
exactly very actively maintained package and it does not seem to be
available in number of Linux distros without manual installation. As
such, I would have expected there to be very minimal, if any, actual use
of l2_packet_pcap.c with wpa_supplicant.

[PATCH] Fix wpa_supplicant build with CONFIG_L2_PACKET=pcap

Commit e6dd8196e5daf39e4204ef8ecd26dd50fdca6040 ('Work around Linux
packet socket regression') forgot to add the l2_packet_init_bridge()
wrapper for l2_packet_pcap.c while updating all the other l2_packet
options. This resulted in wpa_supplicant build failing due to missing
l2_packet_init_bridge() function when using CONFIG_L2_PACKET=pcap in
wpa_supplicant/.config. Fix this by adding the wrapper function.

Signed-off-by: Jouni Malinen <j at w1.fi>
 src/l2_packet/l2_packet_pcap.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/l2_packet/l2_packet_pcap.c b/src/l2_packet/l2_packet_pcap.c
index bb4f4a3..423c099 100644
--- a/src/l2_packet/l2_packet_pcap.c
+++ b/src/l2_packet/l2_packet_pcap.c
@@ -312,6 +312,18 @@ struct l2_packet_data * l2_packet_init(
+struct l2_packet_data * l2_packet_init_bridge(
+	const char *br_ifname, const char *ifname, const u8 *own_addr,
+	unsigned short protocol,
+	void (*rx_callback)(void *ctx, const u8 *src_addr,
+			    const u8 *buf, size_t len),
+	void *rx_callback_ctx, int l2_hdr)
+	return l2_packet_init(br_ifname, own_addr, protocol, rx_callback,
+			      rx_callback_ctx, l2_hdr);
 void l2_packet_deinit(struct l2_packet_data *l2)
 	if (l2 == NULL)

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list