diff options
Diffstat (limited to 'contrib/hostapd')
-rw-r--r-- | contrib/hostapd/FREEBSD-Xlist | 4 | ||||
-rw-r--r-- | contrib/hostapd/FREEBSD-upgrade | 8 | ||||
-rw-r--r-- | contrib/hostapd/eap.c | 2 | ||||
-rw-r--r-- | contrib/hostapd/eap.h | 2 | ||||
-rw-r--r-- | contrib/hostapd/eapol_sm.c | 2 | ||||
-rw-r--r-- | contrib/hostapd/hostapd_ctrl.c | 188 | ||||
-rw-r--r-- | contrib/hostapd/hostapd_ctrl.h | 18 | ||||
-rw-r--r-- | contrib/hostapd/ieee802_1x.c | 8 | ||||
-rw-r--r-- | contrib/hostapd/ieee802_1x.h | 2 | ||||
-rw-r--r-- | contrib/hostapd/wpa.c | 4 |
10 files changed, 23 insertions, 215 deletions
diff --git a/contrib/hostapd/FREEBSD-Xlist b/contrib/hostapd/FREEBSD-Xlist index cba8df0..00330b3 100644 --- a/contrib/hostapd/FREEBSD-Xlist +++ b/contrib/hostapd/FREEBSD-Xlist @@ -4,7 +4,9 @@ driver.c driver_bsd.c driver_madwifi.c driver_prism54.c -l2_packet.c +l2_packet_freebsd.c +l2_packet_linux.c +l2_packet_pcap.c prism54.h priv_netlink.h wireless_copy.h diff --git a/contrib/hostapd/FREEBSD-upgrade b/contrib/hostapd/FREEBSD-upgrade index 5efe2f5..8286ce4 100644 --- a/contrib/hostapd/FREEBSD-upgrade +++ b/contrib/hostapd/FREEBSD-upgrade @@ -6,12 +6,12 @@ WPA/802.1x Authenticator For the import files and directories were pruned by: - tar -X FREEBSD-Xlist -zxf hostapd-0.3.7.tar.gz + tar -X FREEBSD-Xlist -zxf hostapd-0.4.8.tar.gz then imported by: - cvs import -m 'Import of hostapd 0.3.7' \ - src/contrib/hostapd MALINEN v0_3_7 + cvs import -m 'Import of hostapd 0.4.8' \ + src/contrib/hostapd MALINEN v0_4_8 To make local changes to hostapd, simply patch and commit to the main branch (aka HEAD). Never make local changes on the vendor @@ -21,4 +21,4 @@ All local changes should be submitted to Jouni Malinen for inclusion in the next vendor release. sam@FreeBSD.org -4-June-2005 +6-March-2006 diff --git a/contrib/hostapd/eap.c b/contrib/hostapd/eap.c index a20147e..b321ea6 100644 --- a/contrib/hostapd/eap.c +++ b/contrib/hostapd/eap.c @@ -10,6 +10,8 @@ * license. * * See README and COPYING for more details. + * + * $FreeBSD$ */ #include <stdlib.h> diff --git a/contrib/hostapd/eap.h b/contrib/hostapd/eap.h index c5c62eb..ce49b07 100644 --- a/contrib/hostapd/eap.h +++ b/contrib/hostapd/eap.h @@ -1,3 +1,5 @@ +/* $FreeBSD$ */ + #ifndef EAP_H #define EAP_H diff --git a/contrib/hostapd/eapol_sm.c b/contrib/hostapd/eapol_sm.c index f2d5ec7..4ded7e7 100644 --- a/contrib/hostapd/eapol_sm.c +++ b/contrib/hostapd/eapol_sm.c @@ -11,6 +11,8 @@ * license. * * See README and COPYING for more details. + * + * $FreeBSD$ */ #include <stdlib.h> diff --git a/contrib/hostapd/hostapd_ctrl.c b/contrib/hostapd/hostapd_ctrl.c deleted file mode 100644 index 55b6904..0000000 --- a/contrib/hostapd/hostapd_ctrl.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * hostapd - hostapd control interface library - * Copyright (c) 2004, Jouni Malinen <jkmaline@cc.hut.fi> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/time.h> -#include <sys/un.h> - -#include "hostapd_ctrl.h" - - -struct hostapd_ctrl { - int s; - struct sockaddr_un local; - struct sockaddr_un dest; -}; - - -struct hostapd_ctrl * hostapd_ctrl_open(const char *ctrl_path) -{ - struct hostapd_ctrl *ctrl; - static int counter = 0; - - ctrl = malloc(sizeof(*ctrl)); - if (ctrl == NULL) - return NULL; - memset(ctrl, 0, sizeof(*ctrl)); - - ctrl->s = socket(PF_UNIX, SOCK_DGRAM, 0); - if (ctrl->s < 0) { - free(ctrl); - return NULL; - } - - ctrl->local.sun_family = AF_UNIX; - snprintf(ctrl->local.sun_path, sizeof(ctrl->local.sun_path), - "/tmp/hostapd_ctrl_%d-%d", getpid(), counter++); - if (bind(ctrl->s, (struct sockaddr *) &ctrl->local, - sizeof(ctrl->local.sun_family) + - strlen(ctrl->local.sun_path)) < 0) { - close(ctrl->s); - free(ctrl); - return NULL; - } - - ctrl->dest.sun_family = AF_UNIX; - strncpy(ctrl->dest.sun_path, ctrl_path, sizeof(ctrl->dest.sun_path)); - if (connect(ctrl->s, (struct sockaddr *) &ctrl->dest, - sizeof(ctrl->dest.sun_family) + - strlen(ctrl->dest.sun_path)) < 0) { - close(ctrl->s); - unlink(ctrl->local.sun_path); - free(ctrl); - return NULL; - } - - return ctrl; -} - - -void hostapd_ctrl_close(struct hostapd_ctrl *ctrl) -{ - unlink(ctrl->local.sun_path); - close(ctrl->s); - free(ctrl); -} - - -int hostapd_ctrl_request(struct hostapd_ctrl *ctrl, char *cmd, size_t cmd_len, - char *reply, size_t *reply_len, - void (*msg_cb)(char *msg, size_t len)) -{ - struct timeval tv; - int res; - fd_set rfds; - - if (send(ctrl->s, cmd, cmd_len, 0) < 0) - return -1; - - for (;;) { - tv.tv_sec = 2; - tv.tv_usec = 0; - FD_ZERO(&rfds); - FD_SET(ctrl->s, &rfds); - res = select(ctrl->s + 1, &rfds, NULL, NULL, &tv); - if (FD_ISSET(ctrl->s, &rfds)) { - res = recv(ctrl->s, reply, *reply_len, 0); - if (res < 0) - return res; - if (res > 0 && reply[0] == '<') { - /* This is an unsolicited message from - * wpa_supplicant, not the reply to the - * request. Use msg_cb to report this to the - * caller. */ - if (msg_cb) { - /* Make sure the message is nul - * terminated. */ - if (res == *reply_len) - res = (*reply_len) - 1; - reply[res] = '\0'; - msg_cb(reply, res); - } - continue; - } - *reply_len = res; - break; - } else { - return -2; - } - } - return 0; -} - - -static int hostapd_ctrl_attach_helper(struct hostapd_ctrl *ctrl, int attach) -{ - char buf[10]; - int ret; - size_t len = 10; - - ret = hostapd_ctrl_request(ctrl, attach ? "ATTACH" : "DETACH", 6, - buf, &len, NULL); - if (ret < 0) - return ret; - if (len == 3 && memcmp(buf, "OK\n", 3) == 0) - return 0; - return -1; -} - - -int hostapd_ctrl_attach(struct hostapd_ctrl *ctrl) -{ - return hostapd_ctrl_attach_helper(ctrl, 1); -} - - -int hostapd_ctrl_detach(struct hostapd_ctrl *ctrl) -{ - return hostapd_ctrl_attach_helper(ctrl, 0); -} - - -int hostapd_ctrl_recv(struct hostapd_ctrl *ctrl, char *reply, - size_t *reply_len) -{ - int res; - - res = recv(ctrl->s, reply, *reply_len, 0); - if (res < 0) - return res; - *reply_len = res; - return 0; -} - - -int hostapd_ctrl_pending(struct hostapd_ctrl *ctrl) -{ - struct timeval tv; - int res; - fd_set rfds; - tv.tv_sec = 0; - tv.tv_usec = 0; - FD_ZERO(&rfds); - FD_SET(ctrl->s, &rfds); - res = select(ctrl->s + 1, &rfds, NULL, NULL, &tv); - return FD_ISSET(ctrl->s, &rfds); -} - - -int hostapd_ctrl_get_fd(struct hostapd_ctrl *ctrl) -{ - return ctrl->s; -} diff --git a/contrib/hostapd/hostapd_ctrl.h b/contrib/hostapd/hostapd_ctrl.h deleted file mode 100644 index 7ba221e..0000000 --- a/contrib/hostapd/hostapd_ctrl.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef HOSTAPD_CTRL_H -#define HOSTAPD_CTRL_H - -struct hostapd_ctrl; - -struct hostapd_ctrl * hostapd_ctrl_open(const char *ctrl_path); -void hostapd_ctrl_close(struct hostapd_ctrl *ctrl); -int hostapd_ctrl_request(struct hostapd_ctrl *ctrl, char *cmd, size_t cmd_len, - char *reply, size_t *reply_len, - void (*msg_cb)(char *msg, size_t len)); -int hostapd_ctrl_attach(struct hostapd_ctrl *ctrl); -int hostapd_ctrl_detach(struct hostapd_ctrl *ctrl); -int hostapd_ctrl_recv(struct hostapd_ctrl *ctrl, char *reply, - size_t *reply_len); -int hostapd_ctrl_pending(struct hostapd_ctrl *ctrl); -int hostapd_ctrl_get_fd(struct hostapd_ctrl *ctrl); - -#endif /* HOSTAPD_CTRL_H */ diff --git a/contrib/hostapd/ieee802_1x.c b/contrib/hostapd/ieee802_1x.c index f3fc311..c8b1602 100644 --- a/contrib/hostapd/ieee802_1x.c +++ b/contrib/hostapd/ieee802_1x.c @@ -11,6 +11,8 @@ * license. * * See README and COPYING for more details. + * + * $FreeBSD$ */ #include <stdlib.h> @@ -74,7 +76,7 @@ static void ieee802_1x_send(hostapd *hapd, struct sta_info *sta, u8 type, #endif xhdr = (struct ieee802_1x_hdr *) buf; - xhdr->version = hapd->conf->eapol_version; + xhdr->version = EAPOL_VERSION; xhdr->type = type; xhdr->length = htons(datalen); @@ -322,7 +324,7 @@ static void ieee802_1x_tx_key_one(hostapd *hapd, struct sta_info *sta, /* This header is needed here for HMAC-MD5, but it will be regenerated * in ieee802_1x_send() */ - hdr->version = hapd->conf->eapol_version; + hdr->version = EAPOL_VERSION; hdr->type = IEEE802_1X_TYPE_EAPOL_KEY; hdr->length = htons(len); hmac_md5(sm->eapol_key_sign, sm->eapol_key_sign_len, @@ -1663,7 +1665,7 @@ int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta, "dot1xPaePortInitialize=%d\n" "dot1xPaePortReauthenticate=FALSE\n", sta->aid, - hapd->conf->eapol_version, + EAPOL_VERSION, sm->initialize); /* dot1xAuthConfigTable */ diff --git a/contrib/hostapd/ieee802_1x.h b/contrib/hostapd/ieee802_1x.h index 0ac06b2..90cc2ce 100644 --- a/contrib/hostapd/ieee802_1x.h +++ b/contrib/hostapd/ieee802_1x.h @@ -1,3 +1,5 @@ +/* $FreeBSD$ */ + #ifndef IEEE802_1X_H #define IEEE802_1X_H diff --git a/contrib/hostapd/wpa.c b/contrib/hostapd/wpa.c index 98eef20..ec07b35 100644 --- a/contrib/hostapd/wpa.c +++ b/contrib/hostapd/wpa.c @@ -11,6 +11,8 @@ * license. * * See README and COPYING for more details. + * + * $FreeBSD$ */ #include <stdlib.h> @@ -1853,7 +1855,7 @@ static void wpa_send_eapol(struct hostapd_data *hapd, struct sta_info *sta, if (hdr == NULL) return; memset(hdr, 0, len); - hdr->version = hapd->conf->eapol_version; + hdr->version = EAPOL_VERSION; hdr->type = IEEE802_1X_TYPE_EAPOL_KEY; hdr->length = htons(len - sizeof(*hdr)); key = (struct wpa_eapol_key *) (hdr + 1); |