Simplify driver_ops for virtual interface add/remove

There is no absolute requirement for separating address allocation
into separate functions, so simplify the driver wrapper interface
to use just if_add and if_remove instead of adding the new
alloc_interface_addr() and release_interface_addr() functions.

if_add() can now indicate if the driver forced a different interface
name or address on the virtual interface.
This commit is contained in:
Jouni Malinen 2010-04-11 19:23:09 +03:00 committed by Jouni Malinen
parent 977b11747f
commit f3585c8a85
8 changed files with 56 additions and 111 deletions

View file

@ -242,7 +242,10 @@ static int hostapd_set_beacon(struct hostapd_data *hapd,
static int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname)
{
return hostapd_if_add(hapd, WPA_IF_AP_VLAN, ifname, NULL, NULL, NULL);
char force_ifname[IFNAMSIZ];
u8 if_addr[ETH_ALEN];
return hostapd_if_add(hapd, WPA_IF_AP_VLAN, ifname, NULL, NULL, NULL,
force_ifname, if_addr);
}
static int hostapd_vlan_if_remove(struct hostapd_data *hapd,
@ -404,12 +407,12 @@ int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len)
int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
const char *ifname, const u8 *addr, void *bss_ctx,
void **drv_priv)
void **drv_priv, char *force_ifname, u8 *if_addr)
{
if (hapd->driver == NULL || hapd->driver->if_add == NULL)
return -1;
return hapd->driver->if_add(hapd->drv_priv, type, ifname, addr,
bss_ctx, drv_priv);
bss_ctx, drv_priv, force_ifname, if_addr);
}