new wired driver code

Jouke Witteveen j.witteveen
Sat Dec 2 10:41:16 PST 2006


Hello,

For some stupid reason my ISP uses WPA on its connection. So in order
to get my FreeBSD box on the net I need to make driver_wired.c from
the wpa_supplicant work in BSD. I downloaded the source (v0.4.8) and
tried to compile. A few days of reading a lot of c code in order to
lean c later I came up with the following changes:

BSD doesn't provide the following include, and the code that uses it
is __linux__ only anyway, so I added the following if block:
---driver_wired.c------
#ifdef __linux__
#include <netpacket/packet.h>
#endif /* __linux__ */
------

Next I searched for all non-BSD compliant code and found that ifreq
has no ifr_hwaddr in BSD (this is used in wpa_driver_wired_multi). The
following adjustment however does not work though I'm pretty positive
something alike should do the trick) because the ioctl complains about
invalid arguments during runtime:
---driver_wired.c (wpa_driver_wired_multi)------
#ifdef __linux__
        ifr.ifr_hwaddr.sa_family = AF_UNSPEC;
        memcpy(ifr.ifr_hwaddr.sa_data, addr, ETH_ALEN);
#else /* __linux__ */
        ifr.ifr_addr.sa_family = AF_UNSPEC;
        memcpy(ifr.ifr_addr.sa_data, addr, ETH_ALEN);
#endif /* __linux__ */

        if (ioctl(s, add ? SIOCADDMULTI : SIOCDELMULTI, (caddr_t) &ifr) < 0) {
                perror("ioctl[SIOC{ADD/DEL}MULTI]");
                close(s);
                return -1;
        }
------

Can anyone help me getting the wired driver to work in FreeBSD? I
would be most grateful, not only with solutions, but also with
suggestions.

Regards,
- Jouke




More information about the Hostap mailing list