[PATCH] Use SOCK_DGRAM type PF_PACKET socket for Linux
Sun Aug 28 20:16:47 PDT 2005
On Mon, Aug 29, 2005 at 09:34:42AM +0800, Zhu Yi wrote:
> On Sun, 2005-08-28 at 11:06 -0700, Jouni Malinen wrote:
> > 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.
> Do you plan to change hostapd in a near future? I haven't looked at the
> hostapd code. But I think it shouldn't be too difficult to change. It
> should now get the src mac from ll.ll_addr. But this also causes
> inconsistent between Linux and Freebsd, NDIS. Do you think it's
I took a look at this again and remembered why I did not do this change
the last time I was considering it.. hostapd needs to know the
destination address of the RSN pre-authentication frames, not just the
source address. In addition, it needs to be able to set source address
of the transmitted frames. These addresses may not always be the same
as the hwaddr of the interface they are being received from. This can
happen, e.g., when this interface is a bridge interface.
As far as I can tell, PF_PACKET with SOCK_DGRAM does not include the
local address (destination for RX and source for TX). Are you aware of
any way of getting these? If not, it looks like l2_packet will need to
continue supporting the SOCK_RAW case.
It should be possible to make l2_packet_linux.c switch socket types
based on the rx_l2_hdr variable. In other words, start with SOCK_DGRAM
and if l2_packet_set_rx_l2_hdr(l2, 1) is used, switch to SOCK_RAW. This
adds some complexity, but that may be necessary in order to be able to
meet requirements for both hostapd and wpa_supplicant.
Jouni Malinen PGP id EFC895FA
More information about the Hostap