Remove direct driver calls from vlan_init.c

This commit is contained in:
Jouni Malinen 2009-12-25 00:17:07 +02:00
parent 677449b97e
commit 36592d31c1
3 changed files with 22 additions and 6 deletions

View file

@ -238,6 +238,18 @@ static int hostapd_set_beacon(const char *ifname, 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);
}
static int hostapd_vlan_if_remove(struct hostapd_data *hapd,
const char *ifname)
{
return hostapd_if_remove(hapd, WPA_IF_AP_VLAN, ifname);
}
void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
{
ops->set_ap_wps_ie = hostapd_set_ap_wps_ie;
@ -253,4 +265,6 @@ void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
ops->set_radius_acl_expire = hostapd_set_radius_acl_expire;
ops->set_bss_params = hostapd_set_bss_params;
ops->set_beacon = hostapd_set_beacon;
ops->vlan_if_add = hostapd_vlan_if_add;
ops->vlan_if_remove = hostapd_vlan_if_remove;
}

View file

@ -74,6 +74,8 @@ struct hostapd_driver_ops {
const u8 *head, size_t head_len,
const u8 *tail, size_t tail_len, int dtim_period,
int beacon_int);
int (*vlan_if_add)(struct hostapd_data *hapd, const char *ifname);
int (*vlan_if_remove)(struct hostapd_data *hapd, const char *ifname);
};
/**

View file

@ -2,6 +2,7 @@
* hostapd / VLAN initialization
* Copyright 2003, Instant802 Networks, Inc.
* Copyright 2005-2006, Devicescape Software, Inc.
* Copyright (c) 2009, Jouni Malinen <j@w1.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
@ -17,7 +18,7 @@
#include "common.h"
#include "hostapd.h"
#include "driver_i.h"
#include "config.h"
#include "vlan_init.h"
@ -680,8 +681,7 @@ static int vlan_dynamic_add(struct hostapd_data *hapd,
{
while (vlan) {
if (vlan->vlan_id != VLAN_ID_WILDCARD &&
hostapd_if_add(hapd, WPA_IF_AP_VLAN, vlan->ifname, NULL,
NULL)) {
hapd->drv.vlan_if_add(hapd, vlan->ifname)) {
if (errno != EEXIST) {
printf("Could not add VLAN iface: %s: %s\n",
vlan->ifname, strerror(errno));
@ -705,7 +705,7 @@ static void vlan_dynamic_remove(struct hostapd_data *hapd,
next = vlan->next;
if (vlan->vlan_id != VLAN_ID_WILDCARD &&
hostapd_if_remove(hapd, WPA_IF_AP_VLAN, vlan->ifname)) {
hapd->drv.vlan_if_remove(hapd, vlan->ifname)) {
printf("Could not remove VLAN iface: %s: %s\n",
vlan->ifname, strerror(errno));
}
@ -776,7 +776,7 @@ struct hostapd_vlan * vlan_add_dynamic(struct hostapd_data *hapd,
pos);
os_free(ifname);
if (hostapd_if_add(hapd, WPA_IF_AP_VLAN, n->ifname, NULL, NULL)) {
if (hapd->drv.vlan_if_add(hapd, n->ifname)) {
os_free(n);
return NULL;
}
@ -808,7 +808,7 @@ int vlan_remove_dynamic(struct hostapd_data *hapd, int vlan_id)
return 1;
if (vlan->dynamic_vlan == 0)
hostapd_if_remove(hapd, WPA_IF_AP_VLAN, vlan->ifname);
hapd->drv.vlan_if_remove(hapd, vlan->ifname);
return 0;
}