Fwd: new wired driver code

Jouke Witteveen j.witteveen
Mon Dec 4 13:09:22 PST 2006


After some inspection of some sourcecode of the OS I found the following:
---net/if.c------
/* Don't let users screw up protocols' entries. */
if (ifr->ifr_addr.sa_family != AF_LINK)
	return (EINVAL);
------
and:
---net/if_fddisubr.c------
if ((e_addr[0] & 1) != 1)
	return (EADDRNOTAVAIL);
------
So I changed some more in driver_wired.c (see previous mail too):
---driver_wired.c------
#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_LINK;
        memcpy(ifr.ifr_addr.sa_data, addr, ETH_ALEN);
        printf("Expected result: %x\n", // for debugging
                ((caddr_t) &(ifr.ifr_addr.sa_data))[0] & 1);
#endif /* __linux__ */
------
Though the expected result is 1 (I believe that is good) I still get
the EADDRNOTAVAIL:
---wpa_supplicant output (excerpt)------
(...)
Initializing interface (2) 'xl0'
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
Expected result: 1
ioctl[SIOC{ADD/DEL}MULTI]: Can't assign requested address
(...)
------
I think I con really use some help on how to get my 802.1X authentication going.
Has anyone succeeded in doing so on FreeBSD using a wired card?

Regards,
- Jouke


---------- Forwarded message ----------
From: Jouke Witteveen <j.witteveen at gmail.com>
Date: Dec 2, 2006 7:41 PM
Subject: new wired driver code
To: hostap at shmoo.com


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