mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
Add alloc_interface_addr() drv op option for specifying ifname
Some drivers may need to use a specific ifname for the virtual interface, so allow them to do this with a new parameter passed to the alloc_interface_addr() handler.
This commit is contained in:
parent
01b350ed74
commit
b7a2b0b68c
@ -1624,6 +1624,7 @@ struct wpa_driver_ops {
|
||||
* alloc_interface_addr - Allocate a virtual interface address
|
||||
* @priv: Private driver interface data
|
||||
* @addr: Buffer for returning the address
|
||||
* @ifname: Buffer for returning interface name (if needed)
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* This command pre-allocates an interface address for a new virtual
|
||||
@ -1631,12 +1632,15 @@ struct wpa_driver_ops {
|
||||
* the interface mode (e.g., AP vs. station) is not yet known, but the
|
||||
* address of the virtual interface is already needed. This helps with
|
||||
* drivers that cannot change interface mode without destroying and
|
||||
* re-creating the interface.
|
||||
* re-creating the interface. If the driver requires a specific
|
||||
* interface name to be used, the ifname buffer (up to IFNAMSIZ
|
||||
* characters) will be used to indicate which name must be used for
|
||||
* this virtual interface.
|
||||
*
|
||||
* The allocated address can be used in a bss_add() call to request a
|
||||
* The allocated address can be used in a if_add() call to request a
|
||||
* specific bssid.
|
||||
*/
|
||||
int (*alloc_interface_addr)(void *priv, u8 *addr);
|
||||
int (*alloc_interface_addr)(void *priv, u8 *addr, char *ifname);
|
||||
|
||||
/**
|
||||
* release_interface_addr - Release a virtual interface address
|
||||
@ -1645,7 +1649,7 @@ struct wpa_driver_ops {
|
||||
*
|
||||
* This command is used to release a virtual interface address that was
|
||||
* allocated with alloc_interface_addr(), but has not yet been used
|
||||
* with bss_add() to actually create the interface. This allows the
|
||||
* with if_add() to actually create the interface. This allows the
|
||||
* driver to release the pending allocation for a new interface.
|
||||
*/
|
||||
void (*release_interface_addr)(void *priv, const u8 *addr);
|
||||
|
@ -4705,10 +4705,14 @@ static int wpa_driver_nl80211_probe_req_report(void *priv, int report)
|
||||
}
|
||||
|
||||
|
||||
static int wpa_driver_nl80211_alloc_interface_addr(void *priv, u8 *addr)
|
||||
static int wpa_driver_nl80211_alloc_interface_addr(void *priv, u8 *addr,
|
||||
char *ifname)
|
||||
{
|
||||
struct wpa_driver_nl80211_data *drv = priv;
|
||||
|
||||
if (ifname)
|
||||
ifname[0] = '\0';
|
||||
|
||||
if (linux_get_ifhwaddr(drv->ioctl_sock, drv->ifname, addr) < 0)
|
||||
return -1;
|
||||
|
||||
|
@ -2632,9 +2632,14 @@ static int wpa_driver_test_send_action(void *priv, unsigned int freq,
|
||||
}
|
||||
|
||||
|
||||
static int wpa_driver_test_alloc_interface_addr(void *priv, u8 *addr)
|
||||
static int wpa_driver_test_alloc_interface_addr(void *priv, u8 *addr,
|
||||
char *ifname)
|
||||
{
|
||||
struct wpa_driver_test_data *drv = priv;
|
||||
|
||||
if (ifname)
|
||||
ifname[0] = '\0';
|
||||
|
||||
drv->alloc_iface_idx++;
|
||||
addr[0] = 0x02; /* locally administered */
|
||||
sha1_prf(drv->own_addr, ETH_ALEN, "hostapd test addr generation",
|
||||
|
@ -397,11 +397,11 @@ static inline int wpa_drv_send_action(struct wpa_supplicant *wpa_s,
|
||||
}
|
||||
|
||||
static inline int wpa_drv_alloc_interface_addr(struct wpa_supplicant *wpa_s,
|
||||
u8 *addr)
|
||||
u8 *addr, char *ifname)
|
||||
{
|
||||
if (wpa_s->driver->alloc_interface_addr)
|
||||
return wpa_s->driver->alloc_interface_addr(wpa_s->drv_priv,
|
||||
addr);
|
||||
addr, ifname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user