aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/driver_bsd.c
Commit message (Collapse)AuthorAgeFilesLines
* BSD: Fix the maximum size of a route(4) msg to 2048Roy Marples2020-02-021-28/+3
| | | | | | | | | | | The size of a single route(4) message cannot be derived from either the size of the AF_INET or AF_INET6 routing tables. Both could be empty or very large. As such revert back to a buffer size of 2048 which mirrors other programs which parse the routing socket. Signed-off-by: Roy Marples <roy@marples.name>
* BSD: Remove an outdated commentRoy Marples2020-02-021-6/+0
| | | | | | | With interface matching support, wpa_supplicant can wait for an interface to appear. Signed-off-by: Roy Marples <roy@marples.name>
* BSD: Don't set or remove IFF_UPRoy Marples2020-02-021-38/+8
| | | | | | | | | Now that both hostapd and wpa_supplicant react to interface flag changes, there is no need to set or remove IFF_UP. It should be an administrative flag only. Signed-off-by: Roy Marples <roy@marples.name>
* BSD: Share route(4) processing with hostapd and wpa_supplicant.Roy Marples2020-02-021-227/+148
| | | | | | | There is little point in having both and it brings interface addition/removal and IFF_UP notifications to hostapd. Signed-off-by: Roy Marples <roy@marples.name>
* BSD: Driver does not need to know about both wpa and hostap contextsRoy Marples2020-02-021-7/+6
| | | | | | | It will either be one or the other. Fold hapd into ctx to match other drivers. Signed-off-by: Roy Marples <roy@marples.name>
* driver: Move set_key() parameters into a structJouni Malinen2020-01-081-3/+9
| | | | | | | | This makes it more convenient to add, remove, and modify the parameters without always having to update every single driver_*.c implementation of this callback function. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
* BSD: Add support for route(4) message filteringRoy Marples2019-09-191-0/+26
| | | | | | | | | | | hostapd is only interested in RTM_IEEE80211. wpa_supplicant is only interested in RTM_IEEE80211, RTM_IFINFO and RTM_IFANNOUNCE. This supports the NetBSD RO_MSGFILTER interface and the alternative DragonFlyBSD/OpenBSD interface ROUTE_MSGFILTER. Signed-off-by: Roy Marples <roy@marples.name>
* Replace int status/reason_code with u16 variableJouni Malinen2019-04-221-4/+4
| | | | | | | | | These cases are for the IEEE 802.11 Status Code and Reason Code and those fields are unsigned 16 bit values, so use the more appropriate type consistently. This is mainly to document the uses and to make the source code easier to understand. Signed-off-by: Jouni Malinen <j@w1.fi>
* bsd: Fix a typo in error messageRyo ONODERA2019-04-131-1/+1
| | | | | | | When SIOCG80211 failed, show error message with SIOCG80211 instead of SIOCS80211. Signed-off-by: Ryo ONODERA <ryo@tetera.org>
* Remove trailing whitespaceJouni Malinen2016-12-281-1/+1
| | | | Signed-off-by: Jouni Malinen <j@w1.fi>
* bsd: Set level correctly for non FreeBSD systemsRoy Marples2016-04-171-0/+5
| | | | | | | Only FreeBSD treats rssi as dBm, other BSD have no special meaning to rssi. Signed-off-by: Roy Marples <roy@marples.name>
* Find correct driver for interface additions/removalsRoy Marples2016-03-221-11/+50
| | | | | | | | | Interface additions/removals are not guaranteed to be for the driver listening to the kernel events. As such, send the events to wpa_supplicant_event_global() which can then pick the correct interface registered with wpa_supplicant to send the event to. Signed-off-by: Roy Marples <roy@marples.name>
* BSD: Only down the interface once we are sure we can work with itRoy Marples2016-03-201-4/+4
| | | | Signed-off-by: Roy Marples <roy@marples.name>
* BSD: Zero ifindex on interface removalRoy Marples2016-02-051-8/+19
| | | | | | | If an interface is removed, zero the remembered ifindex. Don't try to set properties on the interface when it is removed. Signed-off-by: Roy Marples <roy@marples.name>
* BSD: Disable interface on downRoy Marples2016-02-051-7/+15
| | | | | | | Instead of removing the interface when downed, disable it. Enable it when it comes back up again. Signed-off-by: Roy Marples <roy@marples.name>
* BSD: Use correct ifindex from route messagesRoy Marples2016-02-051-16/+25
| | | | | | | Use the interface index from the correct structure according to the message instead of assuming rtm_index is correct. Signed-off-by: Roy Marples <roy@marples.name>
* BSD: __FUNCTION__ -> __func__Roy Marples2016-02-051-2/+2
| | | | Signed-off-by: Roy Marples <roy@marples.name>
* bsd: Optimize socket useRoy Marples2016-01-121-89/+129
| | | | | | | | Create global init to handle socket calls and route messages. Register each interface inside the global driver so that routing messages can find the interface based on rtm_ifindex. Signed-off-by: Roy Marples <roy@marples.name>
* drivers: Use unsigned arguments for sta_set_flags()Jouni Malinen2015-07-071-1/+2
| | | | | | | Since BIT() is now returning unsigned int, these functions need to match that to avoid compiler warnings. Signed-off-by: Jouni Malinen <j@w1.fi>
* bsd: Remove redundant NULL check in bsd_init()Jouni Malinen2015-06-231-2/+1
| | | | | | | drv cannot be NULL here (it is dereferenced even on the preceding line) and anyway, os_free(NULL) is allowed, so remove the redundant check. Signed-off-by: Jouni Malinen <j@w1.fi>
* bsd: Fix parsing of ieee80211req_scan_result on FreeBSD and DragonFlyImre Vadasz2015-01-101-0/+5
| | | | | | | | | | | On FreeBSD and DragonFly BSD, we additionally need to skip the isr_meshid_len bytes of the MESH ID, to get the correct address for copying the IE data. The isr_meshid_len field was added in the FreeBSD svn revision r195618 in 2009, so I don't think we need to check the FreeBSD version here. Signed-off-by: Imre Vadász <imre@vdsz.com>
* Clean up debug prints to use wpa_printf()Jouni Malinen2014-12-261-19/+29
| | | | | | | This converts most of the remaining perror() and printf() calls from hostapd and wpa_supplicant to use wpa_printf(). Signed-off-by: Jouni Malinen <j@w1.fi>
* bsd: Fix hostapd compiler warningMasashi Honma2014-02-031-58/+54
| | | | | | | | | | | The hostapd compilation displays a below warning On NetBSD 6.1.2. ../src/drivers/driver_bsd.c:72:1: warning: 'get80211opmode' defined but not used This patch solves it and moves other functions to appropriate position to reduce #ifdef. Signed-hostap: Masashi Honma <masashi.honma@gmail.com>
* bsd: Fix NULL pointer dereference on error pathJouni Malinen2014-01-071-2/+2
| | | | | | | | | The error path in bsd_init() on struct bsd_driver_data allocation was jumping to location where drv is dereferenced. That will crash and it is easier to just return from the function since no cleanup steps are needed in this case. Signed-hostap: Jouni Malinen <j@w1.fi>
* bsd: Prepare event buffer on init processMasashi Honma2014-01-071-32/+30
| | | | | | | | | | | | | | | Currently these three steps runs for each event. 1. get buffer size via system 2. allocate a memory for event 3. free the memory The wpa_supplicant receives 4 events from boot to be connected. So this patch prepare the event buffer at the init process. I have tested wpa_supplicant on NetBSD 6.1.2. But I could not tested hostapd because I do not have AP enabled device. Signed-hostap: Masashi Honma <masashi.honma@gmail.com>
* Get rid of duplicated cipher suite and AKM definitionsJouni Malinen2013-12-311-3/+3
| | | | | | | | | | | | | WPA_CIPHER_* and CIPHER_* are used for the exact same set of cipher suites with the main difference being that the WPA_CIPHER_* version is suitable to be used as a bitfield. Similarly, WPA_KEY_MGMT_* and KEY_MGMT_* have similar design for AKMs. There is no need to maintain two separate copies of the definitions since the bitfield compatible version can be used for both needs. Get rid of the CIPHER_* and KEY_MGMT_* versions to clean up the implementation by getting rid of unnecessary mapping functions. Signed-hostap: Jouni Malinen <j@w1.fi>
* bsd: Fix compilation error for NetBSDMasashi Honma2013-12-081-0/+6
| | | | | | | Commit 5dd82c634cb5e24500ac4d1374f806fb37dd88bb causes compilation error on NetBSD 6.1.2. Fix compilation with #ifdef blocks. Signed-hostap: Masashi Honma <masashi.honma@gmail.com>
* Replace remainining strncpy() uses with strlcpy()Jouni Malinen2013-10-261-1/+1
| | | | Signed-hostap: Jouni Malinen <j@w1.fi>
* bsd: Add a commit routineRui Paulo2013-08-071-0/+9
| | | | Signed-hostap: Rui Paulo <rpaulo@FreeBSD.org>
* bsd: Mark define sta_set_flags() only for hostapdRui Paulo2013-08-071-1/+3
| | | | Signed-hostap: Rui Paulo <rpaulo@FreeBSD.org>
* bsd: Mark the interface down before opening the routing socketRui Paulo2013-08-071-5/+6
| | | | Signed-hostap: Rui Paulo <rpaulo@FreeBSD.org>
* bsd: Compute the RSSI levelRui Paulo2013-08-071-0/+5
| | | | Signed-hostap: Rui Paulo <rpaulo@FreeBSD.org>
* bsd: Set IEEE80211_KEY_NOREPLAY in IBSS/AHDEMO modeRui Paulo2013-08-071-0/+38
| | | | Signed-hostap: Rui Paulo <rpaulo@FreeBSD.org>
* bsd: Skip SIOCSIFFFLAGS ioctl when there is no change.Rui Paulo2013-08-071-2/+7
| | | | | | Don't issue SIOCSIFFLAGS if the interface is already up or already down. Signed-hostap: Rui Paulo <rpaulo@FreeBSD.org>
* Remove unused disassociate() driver_opsJouni Malinen2012-11-141-8/+0
| | | | | | | | | Commits 07783eaaa05c07e2c0071780ed3ebf7d0abfe4b5 and 3da372fae8b25a4aec12245b05680646f3bd0ccd removed the only users of the disassociate() driver operation, so these driver wrapper functions can also be removed now. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
* Convert os_realloc() for an array to use os_realloc_array()Jouni Malinen2012-08-131-2/+2
| | | | Signed-hostap: Jouni Malinen <j@w1.fi>
* Update license notification in files initially contributed by SamJouni Malinen2012-06-301-8/+2
| | | | | | | | This updates these files to use the license notification that uses only the BSD license. The changes were acknowledged by email (Sam Leffler <sam@errno.com>, Sat, 30 Jun 2012 07:57:53 -0700). Signed-hostap: Jouni Malinen <j@w1.fi>
* bsd: Fix set_key() sequence number endian issueZhu Yi2011-06-231-1/+13
| | | | | | | | In set_key handler, the seq[8] is in little endian order defined by WPA. BSD kernel uses a u_int64_t value ik_keyrsc to represent it internally. The kernel expects the native endian order for the value. Thus, we need to detect the endian order and swap bytes when necessary.
* bsd: Add support for setting HT values in IFM_MMASKYi Zhu2011-04-141-5/+14
|
* bsd: Fix buffer size for routing socket with IPv6 disabledYi Zhu2011-04-121-7/+3
| | | | | | AF_INET6 is not always enabled by default, so use AF_INET instead. In addition, use the old fixed length, 2048, as a failover value if the sysctl fails for any reason.
* nl80211: Send EAPOL frames as QoS data frames for QoS aware clientsFelix Fietkau2011-04-021-1/+1
| | | | | | | | | | | This should fix EAPOL reauthentication and rekeying timeout issues with Intel clients when using WMM (e.g., with IEEE 802.11n). These stations do not seem to be able to handle EAPOL data frames as non-QoS Data frames after the initial setup. This adds STA flags to hapd_send_eapol() driver op to allow driver_nl80211.c to mark the EAPOL frames as QoS Data frame when injecting it through the monitor interface.
* Indicate assoc vs. reassoc in association eventShan Palanisamy2011-03-061-1/+1
| | | | | | This allows driver wrappers to indicate whether the association was done using Association Request/Response or with Reassociation Request/Response frames.
* bsd: Use correct size for routing socketMasashi Honma2011-02-271-12/+57
| | | | | | | The buffer size for routing socket is fixed to 2048. This patch fix it to obtain the size from OS. This patch worked on x86 platform with NetBSD 5.0.2.
* Use set_key addr to distinguish default and multicast keysJouni Malinen2011-01-091-5/+2
| | | | | | | | Previously, both NULL and ff:ff:ff:ff:ff:ff addr were used in various places to indicate default/broadcast keys. Make this more consistent and useful by defining NULL to mean default key (i.e., used both for unicast and broadcast) and ff:ff:ff:ff:ff:ff to indicate broadcast key (i.e., used only with broadcast).
* Use more consistent set_key seq value when nothing is being setJouni Malinen2011-01-091-1/+2
| | | | | | Use NULL instead of (u8 *) "" as the seq value and make sure the driver wrapper implementations can handle NULL value. This was previously already done in number of places, but not everywhere.
* bsd: Fix receive buffer alignment issueYi Zhu2010-12-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | wpa_supplicant seems to crash from time to time on a NetBSD 4.0 MIPS platform. The root cause turned out to be a MIPS alignment issue. In my wpa_supplicant crash case, in function wpa_driver_bsd_event_receive (from driver_bsd.c), the buf[2048] address is started from i.e. 0x7fffd546, which is not 4 bytes aligned. Later when it is casted to (struct if_msghdr *), and rtm->rtm_flags is used. rtm->rtm_flags is "int" type, but its address is not 4 bytes aligned. This is because the start address of rtm is not 4 bytes aligned. Unfortunately in NetBSD MIPS kernel (unlike Linux MIPS kernel emulates unaligned access in its exception handler), the default behavior is to generate a memory fault to the application that accesses unaligned memory address. Thus comes the early mentioned wpa_supplicant crash. An interesting note is when I'm using the wpa_supplicant version 0.4.9, I never saw this problem. Maybe the stack layout is different. But I didn't look into details. I used below patch to resolve this problem. Now it runs correctly for at least several hours. But you might have a better fix (maybe we can use malloc/free so that it is at least cache line aligned?). I'm also not sure if other drivers should have the same problem.
* Fix driver_bsd.c compile errorYi Zhu2010-12-301-0/+1
| | | | | I got an error for WPA_KEY_RSC_LEN is not defined when compiling the driver_bsd.c on NetBSD 4.0. Below patch fixed it.
* bsd: Use set_freq() API for AP mode wpa_supplicantMasashi Honma2010-05-231-22/+4
| | | | | | | Previous version driver_bsd.c switches the channel in wpa_driver_bsd_associate(). This patch changes it to use set_freq(). I have tested this patch on FreeBSD 8.0/NetBSD 5.0.2 with hostapd, wpa_supplicant(AP) and wpa_supplicant(STA).
* NetBSD: Fix driver_bsd.c buildMasashi Honma2010-03-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | On NetBSD 5.0.2, wpa_supplicant build results in messages below. ../src/drivers/driver_bsd.c: In function 'wpa_driver_bsd_get_ssid': ../src/drivers/driver_bsd.c:876: warning: passing argument 2 of 'bsd_get_ssid' from incompatible pointer type ../src/drivers/driver_bsd.c:876: warning: passing argument 3 of 'bsd_get_ssid' makes integer from pointer without a cast ../src/drivers/driver_bsd.c:876: error: too many arguments to function 'bsd_get_ssid' ../src/drivers/driver_bsd.c: In function 'wpa_driver_bsd_scan': ../src/drivers/driver_bsd.c:1125: warning: passing argument 2 of 'bsd_set_ssid' from incompatible pointer type ../src/drivers/driver_bsd.c:1125: warning: passing argument 3 of 'bsd_set_ssid' makes integer from pointer without a cast ../src/drivers/driver_bsd.c:1125: error: too many arguments to function 'bsd_set_ssid' gmake: *** [../src/drivers/driver_bsd.o] Error 1 This patch solves this issue.
* Remove unnecessary ifname parameter to sta_set_flags() driver opJouni Malinen2010-03-071-1/+1
|