aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKyeyoon Park <kyeyoonp@qca.qualcomm.com>2014-09-27 04:09:54 (GMT)
committerJouni Malinen <j@w1.fi>2014-10-27 23:08:29 (GMT)
commit7565752d4725f00b782a3be59e147946684479a3 (patch)
tree7bcfcd5e81d1ce40d9586b3f5aa7116f1460a356 /src
parent73d2294fbe0a0880bd90c5e5da1c469b6d5ee867 (diff)
downloadhostap-7565752d4725f00b782a3be59e147946684479a3.zip
hostap-7565752d4725f00b782a3be59e147946684479a3.tar.gz
hostap-7565752d4725f00b782a3be59e147946684479a3.tar.bz2
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>
Diffstat (limited to 'src')
-rw-r--r--src/ap/ap_drv_ops.h10
-rw-r--r--src/drivers/driver.h13
-rw-r--r--src/drivers/driver_nl80211.c42
3 files changed, 65 insertions, 0 deletions
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
index 7cea317..e9f6618 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -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);
}
+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,
int vendor_id, int subcmd,
const u8 *data, size_t data_len,
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 4c9bbc8..4645e9a 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1378,6 +1378,10 @@ enum drv_br_port_attr {
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
@@ -2634,6 +2638,15 @@ struct wpa_driver_ops {
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
* @priv: Private driver interface data
* @triggers: wowlan triggers
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index d40a44a..68afcf0 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -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 = {
.name = "nl80211",
.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_delete_ip_neigh = wpa_driver_br_delete_ip_neigh,
.br_port_set_attr = wpa_driver_br_port_set_attr,
+ .br_set_net_param = wpa_driver_br_set_net_param,
};