diff options
author | reed <reed@pkgsrc.org> | 2008-12-11 21:18:41 +0000 |
---|---|---|
committer | reed <reed@pkgsrc.org> | 2008-12-11 21:18:41 +0000 |
commit | 216889d193719d965a6132ffabf137cd0a4b155e (patch) | |
tree | a6a43a79baa186591fb889b3e0556fa8d2e6dd68 /net | |
parent | 9bc8702ba5ea65c9625b86031fa8ddaea99d6df1 (diff) | |
download | pkgsrc-216889d193719d965a6132ffabf137cd0a4b155e.tar.gz |
Import new package: wpa_supplicant.
Note this is the development version and this package is not marked
-devel.
(The version in NetBSD -current is also a development version.)
The patch is based on changes as seen in NetBSD's custom driver_netbsd.c
(as compared to driver_bsd.c).
The wpa_supplicant package provides a wireless client daemon that supports
WPA, WPA2 (IEEE 802.11i / RSN), and WEP. It implements key
negotiation with a WPA Authenticator and it controls the roaming
and IEEE 802.11 authentication/association of the wlan driver. It
supports several EAP authentication methods.
This package also includes the wpa_cli console frontend.
Diffstat (limited to 'net')
-rw-r--r-- | net/wpa_supplicant/DESCR | 7 | ||||
-rw-r--r-- | net/wpa_supplicant/Makefile | 41 | ||||
-rw-r--r-- | net/wpa_supplicant/PLIST | 8 | ||||
-rw-r--r-- | net/wpa_supplicant/distinfo | 6 | ||||
-rw-r--r-- | net/wpa_supplicant/files/defconfig.NetBSD | 4 | ||||
-rw-r--r-- | net/wpa_supplicant/patches/patch-aa | 277 |
6 files changed, 343 insertions, 0 deletions
diff --git a/net/wpa_supplicant/DESCR b/net/wpa_supplicant/DESCR new file mode 100644 index 00000000000..e59a11bc3a8 --- /dev/null +++ b/net/wpa_supplicant/DESCR @@ -0,0 +1,7 @@ +The wpa_supplicant package provides a wireless client daemon that supports +WPA, WPA2 (IEEE 802.11i / RSN), and WEP. It implements key +negotiation with a WPA Authenticator and it controls the roaming +and IEEE 802.11 authentication/association of the wlan driver. It +supports several EAP authentication methods. + +This package also includes the wpa_cli console frontend. diff --git a/net/wpa_supplicant/Makefile b/net/wpa_supplicant/Makefile new file mode 100644 index 00000000000..fad4bc0095b --- /dev/null +++ b/net/wpa_supplicant/Makefile @@ -0,0 +1,41 @@ +# $NetBSD: Makefile,v 1.1.1.1 2008/12/11 21:18:41 reed Exp $ +# + +DISTNAME= wpa_supplicant-0.6.6 +CATEGORIES= net +MASTER_SITES= http://hostap.epitest.fi/releases/ + +MAINTAINER= reed@reedmedia.net +HOMEPAGE= http://hostap.epitest.fi/wpa_supplicant/ +COMMENT= Wireless connection client daemon for WPA, WPA2, and WEP + +USE_LANGUAGES= c +USE_TOOLS+= gmake + +INSTALLATION_DIRS= sbin ${PKGMANDIR}/man5 ${PKGMANDIR}/man8 + +post-extract: + cp ${FILESDIR}/defconfig.${OPSYS} ${WRKSRC}/wpa_supplicant/.config + +do-build: + cd ${WRKSRC}/wpa_supplicant && ${SETENV} ${MAKE_ENV} ${GMAKE} all + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/wpa_supplicant/wpa_cli \ + ${DESTDIR}/${PREFIX}/sbin/ + ${INSTALL_PROGRAM} ${WRKSRC}/wpa_supplicant/wpa_passphrase \ + ${DESTDIR}/${PREFIX}/sbin/ + ${INSTALL_PROGRAM} ${WRKSRC}/wpa_supplicant/wpa_supplicant \ + ${DESTDIR}/${PREFIX}/sbin/ + ${INSTALL_MAN} ${WRKSRC}/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5 \ + ${DESTDIR}/${PREFIX}/${PKGMANDIR}/man5/ + ${INSTALL_MAN} ${WRKSRC}/wpa_supplicant/doc/docbook/wpa_cli.8 \ + ${DESTDIR}/${PREFIX}/${PKGMANDIR}/man8/ + ${INSTALL_MAN} ${WRKSRC}/wpa_supplicant/doc/docbook/wpa_passphrase.8 \ + ${DESTDIR}/${PREFIX}/${PKGMANDIR}/man8/ + ${INSTALL_MAN} ${WRKSRC}/wpa_supplicant/doc/docbook/wpa_supplicant.8 \ + ${DESTDIR}/${PREFIX}/${PKGMANDIR}/man8/ + +.include "../../net/libpcap/buildlink3.mk" + +.include "../../mk/bsd.pkg.mk" diff --git a/net/wpa_supplicant/PLIST b/net/wpa_supplicant/PLIST new file mode 100644 index 00000000000..a6eb13d6247 --- /dev/null +++ b/net/wpa_supplicant/PLIST @@ -0,0 +1,8 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2008/12/11 21:18:41 reed Exp $ +man/man5/wpa_supplicant.conf.5 +man/man8/wpa_cli.8 +man/man8/wpa_passphrase.8 +man/man8/wpa_supplicant.8 +sbin/wpa_cli +sbin/wpa_passphrase +sbin/wpa_supplicant diff --git a/net/wpa_supplicant/distinfo b/net/wpa_supplicant/distinfo new file mode 100644 index 00000000000..65558d6aaf2 --- /dev/null +++ b/net/wpa_supplicant/distinfo @@ -0,0 +1,6 @@ +$NetBSD: distinfo,v 1.1.1.1 2008/12/11 21:18:41 reed Exp $ + +SHA1 (wpa_supplicant-0.6.6.tar.gz) = 28109b6ec134a846cba87b3a57145ac3ec63dc57 +RMD160 (wpa_supplicant-0.6.6.tar.gz) = 30c23fac6e553193817fbf0a48d25da28bf8eb09 +Size (wpa_supplicant-0.6.6.tar.gz) = 1024724 bytes +SHA1 (patch-aa) = fe22c4096983f7ab3f9e690abb69e324c228fb6c diff --git a/net/wpa_supplicant/files/defconfig.NetBSD b/net/wpa_supplicant/files/defconfig.NetBSD new file mode 100644 index 00000000000..cff99a53e86 --- /dev/null +++ b/net/wpa_supplicant/files/defconfig.NetBSD @@ -0,0 +1,4 @@ +# for NetBSD +CONFIG_DRIVER_BSD=y +CONFIG_DRIVER_WIRED=y +CONFIG_CTRL_IFACE=y diff --git a/net/wpa_supplicant/patches/patch-aa b/net/wpa_supplicant/patches/patch-aa new file mode 100644 index 00000000000..fbd9964ab96 --- /dev/null +++ b/net/wpa_supplicant/patches/patch-aa @@ -0,0 +1,277 @@ +$NetBSD: patch-aa,v 1.1.1.1 2008/12/11 21:18:41 reed Exp $ + +--- src/drivers/driver_bsd.c.orig 2008-11-23 07:02:06.000000000 -0800 ++++ src/drivers/driver_bsd.c 2008-12-11 12:30:26.000000000 -0800 +@@ -21,7 +21,13 @@ + #include "ieee802_11_defs.h" + + #include <net/if.h> ++ ++#ifdef __NetBSD__ ++#include <net/if_ether.h> ++#define COMPAT_FREEBSD_NET80211 ++#else + #include <net/ethernet.h> ++#endif + + #include <net80211/ieee80211.h> + #include <net80211/ieee80211_crypto.h> +@@ -32,6 +38,7 @@ + int route; /* routing socket for events */ + char ifname[IFNAMSIZ+1]; /* interface name */ + unsigned int ifindex; /* interface index */ ++ int flags; /* interface flags */ + void *ctx; + int prev_roaming; /* roaming state to restore on deinit */ + int prev_privacy; /* privacy state to restore on deinit */ +@@ -145,9 +152,18 @@ + wpa_driver_bsd_get_bssid(void *priv, u8 *bssid) + { + struct wpa_driver_bsd_data *drv = priv; ++#ifdef __NetBSD__ ++ struct ieee80211_bssid bs; + ++ strncpy(bs.i_name, drv->ifname, sizeof(bs.i_name)); ++ if (ioctl(drv->sock, SIOCG80211BSSID, &bs) < 0) ++ return -1; ++ memcpy(bssid, bs.i_bssid, sizeof(bs.i_bssid)); ++ return 0; ++#else + return get80211var(drv, IEEE80211_IOC_BSSID, + bssid, IEEE80211_ADDR_LEN) < 0 ? -1 : 0; ++#endif + } + + #if 0 +@@ -155,6 +171,7 @@ + wpa_driver_bsd_set_bssid(void *priv, const char *bssid) + { + struct wpa_driver_bsd_data *drv = priv; ++ struct ieee80211_bssid bs; + + return set80211var(drv, IEEE80211_IOC_BSSID, + bssid, IEEE80211_ADDR_LEN); +@@ -165,9 +182,22 @@ + wpa_driver_bsd_get_ssid(void *priv, u8 *ssid) + { + struct wpa_driver_bsd_data *drv = priv; ++#ifdef __NetBSD__ ++ struct ieee80211_nwid nwid; ++ struct ifreq ifr; + ++ memset(&ifr, 0, sizeof(ifr)); ++ strncpy(ifr.ifr_name, drv->ifname, sizeof(ifr.ifr_name)); ++ ifr.ifr_data = (void *)&nwid; ++ if (ioctl(drv->sock, SIOCG80211NWID, &ifr) < 0 || ++ nwid.i_len > IEEE80211_NWID_LEN) ++ return -1; ++ memcpy(ssid, nwid.i_nwid, nwid.i_len); ++ return nwid.i_len; ++#else + return get80211var(drv, IEEE80211_IOC_SSID, + ssid, IEEE80211_NWID_LEN); ++#endif + } + + static int +@@ -175,8 +205,19 @@ + size_t ssid_len) + { + struct wpa_driver_bsd_data *drv = priv; +- ++#ifdef __NetBSD__ ++ struct ieee80211_nwid nwid; ++ struct ifreq ifr; ++ ++ memcpy(nwid.i_nwid, ssid, ssid_len); ++ nwid.i_len = ssid_len; ++ memset(&ifr, 0, sizeof(ifr)); ++ (void)strncpy(ifr.ifr_name, drv->ifname, sizeof(ifr.ifr_name)); ++ ifr.ifr_data = (void *)&nwid; ++ return ioctl(drv->sock, SIOCS80211NWID, &ifr); ++#else + return set80211var(drv, IEEE80211_IOC_SSID, ssid, ssid_len); ++#endif + } + + static int +@@ -301,13 +342,23 @@ + if (bcmp(addr, "\xff\xff\xff\xff\xff\xff", IEEE80211_ADDR_LEN) == 0) { + wk.ik_flags |= IEEE80211_KEY_GROUP; + wk.ik_keyix = key_idx; ++#ifdef __NetBSD__ ++ if (set_tx) ++ wk.ik_flags |= IEEE80211_KEY_DEFAULT; ++ } else ++ wk.ik_keyix = IEEE80211_KEYIX_NONE; ++#else + } else { + wk.ik_keyix = (key_idx == 0 ? IEEE80211_KEYIX_NONE : key_idx); + } + if (wk.ik_keyix != IEEE80211_KEYIX_NONE && set_tx) + wk.ik_flags |= IEEE80211_KEY_DEFAULT; ++#endif + wk.ik_keylen = key_len; + os_memcpy(&wk.ik_keyrsc, seq, seq_len); ++#ifdef __NetBSD__ ++ wk.ik_keyrsc = le64toh(wk.ik_keyrsc); ++#endif + os_memcpy(wk.ik_keydata, key, key_len); + + return set80211var(drv, IEEE80211_IOC_WPAKEY, &wk, sizeof(wk)); +@@ -380,10 +431,12 @@ + /* XXX error handling is wrong but unclear what to do... */ + if (wpa_driver_bsd_set_wpa_ie(drv, params->wpa_ie, params->wpa_ie_len) < 0) + return -1; ++#ifndef __NetBSD + #ifndef NEW_FREEBSD_MLME_ASSOC + if (wpa_driver_bsd_set_ssid(drv, params->ssid, params->ssid_len) < 0) + return -1; + #endif ++#endif + + privacy = !(params->pairwise_suite == CIPHER_NONE && + params->group_suite == CIPHER_NONE && +@@ -449,7 +502,12 @@ + } + + #include <net/route.h> ++#if __FreeBSD__ + #include <net80211/ieee80211_freebsd.h> ++#endif ++#if __NetBSD__ ++#include <net80211/ieee80211_netbsd.h> ++#endif + + static void + wpa_driver_bsd_event_receive(int sock, void *ctx, void *sock_ctx) +@@ -487,15 +545,23 @@ + switch (ifan->ifan_what) { + case IFAN_DEPARTURE: + event.interface_status.ievent = EVENT_INTERFACE_REMOVED; ++#ifdef __NetBSD__ ++ break; ++#endif + default: ++#ifdef __NetBSD__ ++ event.interface_status.ievent = EVENT_INTERFACE_ADDED; ++ break; ++#else + return; ++#endif + } +- wpa_printf(MSG_DEBUG, "RTM_IFANNOUNCE: Interface '%s' %s", ++ wpa_printf(MSG_DEBUG, "RTM_IFANNOUNCE: Interface '%s' %s (%d)", + event.interface_status.ifname, + ifan->ifan_what == IFAN_DEPARTURE ? +- "removed" : "added"); ++ "removed" : "added", ifan->ifan_what); + wpa_supplicant_event(ctx, EVENT_INTERFACE_STATUS, &event); +- break; ++ return; + case RTM_IEEE80211: + ifan = (struct if_announcemsghdr *) rtm; + if (ifan->ifan_index != drv->ifindex) +@@ -503,15 +569,23 @@ + switch (ifan->ifan_what) { + case RTM_IEEE80211_ASSOC: + case RTM_IEEE80211_REASSOC: ++ wpa_printf(MSG_DEBUG, "RTM_IEEE80211: (re)assoc (%d)", ++ ifan->ifan_what); + wpa_supplicant_event(ctx, EVENT_ASSOC, NULL); + break; + case RTM_IEEE80211_DISASSOC: ++ wpa_printf(MSG_DEBUG, "RTM_IEEE80211: disassoc (%d)", ++ ifan->ifan_what); + wpa_supplicant_event(ctx, EVENT_DISASSOC, NULL); + break; + case RTM_IEEE80211_SCAN: ++ wpa_printf(MSG_DEBUG, "RTM_IEEE80211: scan result (%d)", ++ ifan->ifan_what); + wpa_supplicant_event(ctx, EVENT_SCAN_RESULTS, NULL); + break; + case RTM_IEEE80211_REPLAY: ++ wpa_printf(MSG_DEBUG, "RTM_IEEE80211: replay (%d)", ++ ifan->ifan_what); + /* ignore */ + break; + case RTM_IEEE80211_MICHAEL: +@@ -527,20 +601,48 @@ + wpa_supplicant_event(ctx, EVENT_MICHAEL_MIC_FAILURE, + &event); + break; ++ default: ++ wpa_printf(MSG_DEBUG, "RTM_IEEE80211: ??? (%d)", ++ ifan->ifan_what); ++ break; + } + break; + case RTM_IFINFO: + ifm = (struct if_msghdr *) rtm; + if (ifm->ifm_index != drv->ifindex) + break; +- if ((rtm->rtm_flags & RTF_UP) == 0) { ++ if ((ifm->ifm_flags & IFF_UP) == 0 && ++ (drv->flags & IFF_UP) != 0) { + strlcpy(event.interface_status.ifname, drv->ifname, + sizeof(event.interface_status.ifname)); + event.interface_status.ievent = EVENT_INTERFACE_REMOVED; + wpa_printf(MSG_DEBUG, "RTM_IFINFO: Interface '%s' DOWN", + event.interface_status.ifname); + wpa_supplicant_event(ctx, EVENT_INTERFACE_STATUS, &event); ++#ifdef __NetBSD__ ++ } else if ((ifm->ifm_flags & IFF_UP) != 0 && ++ (drv->flags & IFF_UP) == 0) { ++ strlcpy(event.interface_status.ifname, drv->ifname, ++ sizeof(event.interface_status.ifname)); ++ event.interface_status.ievent = EVENT_INTERFACE_ADDED; ++ wpa_printf(MSG_DEBUG, "RTM_IFINFO: Interface '%s' UP", ++ event.interface_status.ifname); ++ wpa_supplicant_event(ctx, EVENT_INTERFACE_STATUS, &event); ++ } else { ++ wpa_printf(MSG_DEBUG, "RTM_IFINFO: Interface '%s' " ++ "if=%x drv=%x", event.interface_status.ifname, ++ ifm->ifm_flags, drv->flags); ++#endif + } ++#ifdef __NetBSD__ ++ drv->flags = ifm->ifm_flags; ++ break; ++ case RTM_LOSING: ++ wpa_printf(MSG_DEBUG, "RTM_LOSING: %d", rtm->rtm_type); ++ break; ++ default: ++ wpa_printf(MSG_DEBUG, "RTM_???: %d", rtm->rtm_type); ++#endif + break; + } + } +@@ -632,8 +734,8 @@ + wsr->ssid_len = sr->isr_ssid_len; + wsr->freq = sr->isr_freq; + wsr->noise = sr->isr_noise; +- wsr->qual = sr->isr_rssi; +- wsr->level = 0; /* XXX? */ ++ wsr->qual = 0; ++ wsr->level = sr->isr_rssi; + wsr->caps = sr->isr_capinfo; + wsr->maxrate = getmaxrate(sr->isr_rates, sr->isr_nrates); + vp = (u_int8_t *)(sr+1); +@@ -691,6 +793,7 @@ + * This implies we do not support having wpa_supplicant + * wait for an interface to appear. This seems ok; that + * doesn't belong here; it's really the job of devd. ++ * XXXSCW: devd is FreeBSD-specific. + */ + drv->ifindex = if_nametoindex(ifname); + if (drv->ifindex == 0) { +@@ -752,7 +855,9 @@ + struct wpa_driver_bsd_data *drv = priv; + int flags; + ++#ifndef __NetBSD__ + eloop_unregister_read_sock(drv->route); ++#endif + + /* NB: mark interface down */ + if (getifflags(drv, &flags) == 0) |