aboutsummaryrefslogtreecommitdiffstats
path: root/src/l2_packet/l2_packet_freebsd.c
diff options
context:
space:
mode:
authorMasashi Honma <honma@ictec.co.jp>2010-08-28 08:40:07 (GMT)
committerJouni Malinen <j@w1.fi>2010-08-28 08:40:07 (GMT)
commit60da5e0f3f78f35556912270ab08b522006d25f9 (patch)
treeb883e87b1c81d33d2fcb982483b71bf8b720f42f /src/l2_packet/l2_packet_freebsd.c
parent9ff80a10e8009c0dc65a4b7e08dcf1655cd2a483 (diff)
downloadhostap-60da5e0f3f78f35556912270ab08b522006d25f9.zip
hostap-60da5e0f3f78f35556912270ab08b522006d25f9.tar.gz
hostap-60da5e0f3f78f35556912270ab08b522006d25f9.tar.bz2
Solaris: Add support for wired IEEE 802.1X client
This patch adds support for wired IEEE 802.1X client on the Solaris. I have tested with these: OS : OpenSolaris 2009.06 EAP : EAP-MD5 Switch : Cisco Catalyst 2950
Diffstat (limited to 'src/l2_packet/l2_packet_freebsd.c')
-rw-r--r--src/l2_packet/l2_packet_freebsd.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/l2_packet/l2_packet_freebsd.c b/src/l2_packet/l2_packet_freebsd.c
index 009e02c..e24277c 100644
--- a/src/l2_packet/l2_packet_freebsd.c
+++ b/src/l2_packet/l2_packet_freebsd.c
@@ -20,7 +20,11 @@
#include <pcap.h>
#include <sys/ioctl.h>
+#ifdef __sun__
+#include <libdlpi.h>
+#else /* __sun__ */
#include <sys/sysctl.h>
+#endif /* __sun__ */
#include <net/if.h>
#include <net/if_dl.h>
@@ -139,6 +143,7 @@ static int l2_packet_init_libpcap(struct l2_packet_data *l2,
}
pcap_freecode(&pcap_fp);
+#ifndef __sun__
/*
* When libpcap uses BPF we must enable "immediate mode" to
* receive frames right away; otherwise the system may
@@ -153,6 +158,7 @@ static int l2_packet_init_libpcap(struct l2_packet_data *l2,
/* XXX should we fail? */
}
}
+#endif /* __sun__ */
eloop_register_read_sock(pcap_get_selectable_fd(l2->pcap),
l2_packet_receive, l2, l2->pcap);
@@ -163,6 +169,30 @@ static int l2_packet_init_libpcap(struct l2_packet_data *l2,
static int eth_get(const char *device, u8 ea[ETH_ALEN])
{
+#ifdef __sun__
+ dlpi_handle_t dh;
+ u32 physaddrlen = DLPI_PHYSADDR_MAX;
+ u8 physaddr[DLPI_PHYSADDR_MAX];
+ int retval;
+
+ retval = dlpi_open(device, &dh, 0);
+ if (retval != DLPI_SUCCESS) {
+ wpa_printf(MSG_ERROR, "dlpi_open error: %s",
+ dlpi_strerror(retval));
+ return -1;
+ }
+
+ retval = dlpi_get_physaddr(dh, DL_CURR_PHYS_ADDR, physaddr,
+ &physaddrlen);
+ if (retval != DLPI_SUCCESS) {
+ wpa_printf(MSG_ERROR, "dlpi_get_physaddr error: %s",
+ dlpi_strerror(retval));
+ dlpi_close(dh);
+ return -1;
+ }
+ os_memcpy(ea, physaddr, ETH_ALEN);
+ dlpi_close(dh);
+#else /* __sun__ */
struct if_msghdr *ifm;
struct sockaddr_dl *sdl;
u_char *p, *buf;
@@ -195,6 +225,7 @@ static int eth_get(const char *device, u8 ea[ETH_ALEN])
errno = ESRCH;
return -1;
}
+#endif /* __sun__ */
return 0;
}