AP: Add support for setting bridge network parameter
This allows setting a network parameter on the bridge that the BSS belongs to. This commit adds the needed functionality in driver_nl80211.c for the Linux bridge implementation. In theory, this could be shared with multiple Linux driver interfaces, but for now, only the main nl80211 interface is supported. Signed-off-by: Kyeyoon Park <kyeyoonp@qca.qualcomm.com>
This commit is contained in:
parent
73d2294fbe
commit
7565752d47
3 changed files with 65 additions and 0 deletions
|
@ -310,6 +310,16 @@ static inline int hostapd_drv_br_port_set_attr(struct hostapd_data *hapd,
|
||||||
return hapd->driver->br_port_set_attr(hapd->drv_priv, attr, val);
|
return hapd->driver->br_port_set_attr(hapd->drv_priv, attr, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int hostapd_drv_br_set_net_param(struct hostapd_data *hapd,
|
||||||
|
enum drv_br_net_param param,
|
||||||
|
unsigned int val)
|
||||||
|
{
|
||||||
|
if (hapd->driver == NULL || hapd->drv_priv == NULL ||
|
||||||
|
hapd->driver->br_set_net_param == NULL)
|
||||||
|
return -1;
|
||||||
|
return hapd->driver->br_set_net_param(hapd->drv_priv, param, val);
|
||||||
|
}
|
||||||
|
|
||||||
static inline int hostapd_drv_vendor_cmd(struct hostapd_data *hapd,
|
static inline int hostapd_drv_vendor_cmd(struct hostapd_data *hapd,
|
||||||
int vendor_id, int subcmd,
|
int vendor_id, int subcmd,
|
||||||
const u8 *data, size_t data_len,
|
const u8 *data, size_t data_len,
|
||||||
|
|
|
@ -1378,6 +1378,10 @@ enum drv_br_port_attr {
|
||||||
DRV_BR_PORT_ATTR_HAIRPIN_MODE,
|
DRV_BR_PORT_ATTR_HAIRPIN_MODE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum drv_br_net_param {
|
||||||
|
DRV_BR_NET_PARAM_GARP_ACCEPT,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct wpa_driver_ops - Driver interface API definition
|
* struct wpa_driver_ops - Driver interface API definition
|
||||||
|
@ -2633,6 +2637,15 @@ struct wpa_driver_ops {
|
||||||
int (*br_port_set_attr)(void *priv, enum drv_br_port_attr attr,
|
int (*br_port_set_attr)(void *priv, enum drv_br_port_attr attr,
|
||||||
unsigned int val);
|
unsigned int val);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* br_port_set_attr - Set a bridge network parameter
|
||||||
|
* @param: Bridge parameter to set
|
||||||
|
* @val: Value to be set
|
||||||
|
* Returns: 0 on success, negative (<0) on failure
|
||||||
|
*/
|
||||||
|
int (*br_set_net_param)(void *priv, enum drv_br_net_param param,
|
||||||
|
unsigned int val);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set_wowlan - Set wake-on-wireless triggers
|
* set_wowlan - Set wake-on-wireless triggers
|
||||||
* @priv: Private driver interface data
|
* @priv: Private driver interface data
|
||||||
|
|
|
@ -9035,6 +9035,47 @@ static int wpa_driver_br_port_set_attr(void *priv, enum drv_br_port_attr attr,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const char * drv_br_net_param_str(enum drv_br_net_param param)
|
||||||
|
{
|
||||||
|
switch (param) {
|
||||||
|
case DRV_BR_NET_PARAM_GARP_ACCEPT:
|
||||||
|
return "arp_accept";
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int wpa_driver_br_set_net_param(void *priv, enum drv_br_net_param param,
|
||||||
|
unsigned int val)
|
||||||
|
{
|
||||||
|
struct i802_bss *bss = priv;
|
||||||
|
char path[128];
|
||||||
|
const char *param_txt;
|
||||||
|
int ip_version = 4;
|
||||||
|
|
||||||
|
param_txt = drv_br_net_param_str(param);
|
||||||
|
if (param_txt == NULL)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
switch (param) {
|
||||||
|
case DRV_BR_NET_PARAM_GARP_ACCEPT:
|
||||||
|
ip_version = 4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
os_snprintf(path, sizeof(path), "/proc/sys/net/ipv%d/conf/%s/%s",
|
||||||
|
ip_version, bss->brname, param_txt);
|
||||||
|
|
||||||
|
if (linux_write_system_file(path, val))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
|
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
|
||||||
.name = "nl80211",
|
.name = "nl80211",
|
||||||
.desc = "Linux nl80211/cfg80211",
|
.desc = "Linux nl80211/cfg80211",
|
||||||
|
@ -9136,4 +9177,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
|
||||||
.br_add_ip_neigh = wpa_driver_br_add_ip_neigh,
|
.br_add_ip_neigh = wpa_driver_br_add_ip_neigh,
|
||||||
.br_delete_ip_neigh = wpa_driver_br_delete_ip_neigh,
|
.br_delete_ip_neigh = wpa_driver_br_delete_ip_neigh,
|
||||||
.br_port_set_attr = wpa_driver_br_port_set_attr,
|
.br_port_set_attr = wpa_driver_br_port_set_attr,
|
||||||
|
.br_set_net_param = wpa_driver_br_set_net_param,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue