[PATCH] Use SOCK_DGRAM type PF_PACKET socket for Linux

Jouni Malinen jkmaline at cc.hut.fi
Sun Aug 28 14:06:54 EDT 2005


On Thu, Aug 25, 2005 at 04:15:33PM +0800, Zhu Yi wrote:

> This patch replaces SOCK_RAW type PF_PACKET socket with cooked packet
> (SOCK_DGRAM) type to send link layer packets on Linux. This way,
> wpa_supplicant doesn't need to worry about the layer 2 header format
> hence it will work with native 802.11 stack in the future.

Thanks! This is something I have consider on doing. However..

> Patch against wpa_supplicant-0.4.4, please apply or comment.

This breaks hostapd as far as RSN pre-authentication is concerned and as
such, I cannot apply this before either hostapd gets changed or support
for both modes are added. hostapd uses l2_packet with an Ethernet (or
bridge) interface and expects that layer 2 header is included in the
frames.

> diff -urp wpa_supplicant-0.4.4/l2_packet_linux.c wpa_supplicant-0.4.4-ieee80211/l2_packet_linux.c
> --- wpa_supplicant-0.4.4/l2_packet_linux.c	2005-06-19 03:42:26.000000000 +0800
> +++ wpa_supplicant-0.4.4-ieee80211/l2_packet_linux.c	2005-08-25 15:47:42.000000000 +0800
> @@ -49,20 +50,33 @@ int l2_packet_get_own_addr(struct l2_pac
>  }
>  
>  
> -void l2_packet_set_rx_l2_hdr(struct l2_packet_data *l2, int rx_l2_hdr)
> +int l2_packet_set_rx_l2_hdr(struct l2_packet_data *l2, int rx_l2_hdr)
>  {
> -	l2->rx_l2_hdr = rx_l2_hdr;
> +	if (!rx_l2_hdr)
> +		return 0;
> +
> +	wpa_printf(MSG_ERROR, "Including layer 2 header is not supported.");
> +	return 1;
>  }

This part is not ok without fully removing need for including layer 2
headers (i.e., hostapd changes).

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the HostAP mailing list