opensync: Enable Proxy ARP and mcast to unicast

Add custom options to enable proxy arp and
mcast to ucast, this is used for Hotspot 2.0.
It is tested for ipv4.

Signed-off-by: Chaitanya Godavarthi <chaitanya.kiran@netexperience.com>
This commit is contained in:
Chaitanya Godavarthi
2021-04-22 18:04:02 -04:00
committed by Rick Sommerville
parent 6021a14426
commit 593f654d3c
4 changed files with 76 additions and 6 deletions

View File

@@ -320,6 +320,7 @@ hostapd_common_add_bss_config() {
config_add_array airtime_sta_weight
config_add_int airtime_bss_weight airtime_bss_limit
config_add_int rts_threshold
config_add_boolean multicast_to_unicast proxy_arp
}
hostapd_set_vlan_file() {
@@ -486,7 +487,8 @@ hostapd_set_bss_options() {
bss_load_update_period chan_util_avg_period sae_require_mfp \
multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \
airtime_bss_weight airtime_bss_limit airtime_sta_weight \
rssi_reject_assoc_rssi rssi_ignore_probe_request rts_threshold
rssi_reject_assoc_rssi rssi_ignore_probe_request rts_threshold \
proxy_arp multicast_to_unicast
set_default isolate 0
set_default maxassoc 0
@@ -509,7 +511,8 @@ hostapd_set_bss_options() {
set_default rssi_reject_assoc_rssi 0
set_default rssi_ignore_probe_request 0
set_default rts_threshold -1
set_default proxy_arp 0
set_default multicast_to_unicast 0
append bss_conf "ctrl_interface=/var/run/hostapd"
if [ "$isolate" -gt 0 ]; then
append bss_conf "ap_isolate=$isolate" "$N"
@@ -538,6 +541,9 @@ hostapd_set_bss_options() {
append bss_conf "rssi_ignore_probe_request=$rssi_ignore_probe_request" "$N"
append bss_conf "rts_threshold=$rts_threshold" "$N"
[ -n "$proxy_arp" ] && append bss_conf "proxy_arp=$proxy_arp" "$N"
[ -n "$multicast_to_unicast" ] && append bss_conf "multicast_to_unicast=$multicast_to_unicast" "$N"
[ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N"
[ "$wpa" -gt 0 ] && {

View File

@@ -304,6 +304,8 @@ hostapd_common_add_bss_config() {
config_add_int rts_threshold
config_add_array radius_auth_req_attr
config_add_array radius_acct_req_attr
config_add_boolean multicast_to_unicast proxy_arp
}
hostapd_set_vlan_file() {
@@ -447,7 +449,8 @@ hostapd_set_bss_options() {
bss_load_update_period chan_util_avg_period sae_require_mfp \
multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \
airtime_bss_weight airtime_bss_limit \
rssi_reject_assoc_rssi rssi_ignore_probe_request rts_threshold
rssi_reject_assoc_rssi rssi_ignore_probe_request rts_threshold \
proxy_arp multicast_to_unicast
set_default isolate 0
set_default maxassoc 0
@@ -475,6 +478,9 @@ hostapd_set_bss_options() {
set_default signal_poll_time 5
set_default signal_drop_reason 3
set_default signal_strikes 3
set_default proxy_arp 0
set_default multicast_to_unicast 0
append bss_conf "ctrl_interface=/var/run/hostapd"
if [ "$isolate" -gt 0 ]; then
@@ -508,6 +514,9 @@ hostapd_set_bss_options() {
append bss_conf "signal_strikes=$signal_strikes" "$N"
append bss_conf "signal_drop_reason=$signal_drop_reason" "$N"
[ -n "$proxy_arp" ] && append bss_conf "proxy_arp=$proxy_arp" "$N"
[ -n "$multicast_to_unicast" ] && append bss_conf "multicast_to_unicast=$multicast_to_unicast" "$N"
[ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N"
[ "$wpa" -gt 0 ] && {

View File

@@ -0,0 +1,13 @@
Index: opensync-2.0.5.0/src/lib/schema/inc/schema_consts.h
===================================================================
--- opensync-2.0.5.0.orig/src/lib/schema/inc/schema_consts.h
+++ opensync-2.0.5.0/src/lib/schema/inc/schema_consts.h
@@ -155,6 +155,8 @@ typedef enum {
#define SCHEMA_CONSTS_IEEE80211k "ieee80211k"
#define SCHEMA_CONSTS_DYNAMIC_VLAN "dynamic_vlan"
#define SCHEMA_CONSTS_RADPROXY "radproxy"
+#define SCHEMA_CONSTS_PROXY_ARP "proxy_arp"
+#define SCHEMA_CONSTS_MCAST_TO_UCAST "mcast_to_ucast"
/* radio Custom options */
#define SCHEMA_CONSTS_LOCAL_PWR_CONSTRAINT "local_pwr_constraint"

View File

@@ -132,6 +132,8 @@ enum {
WIF_ATTR_11R_R0KH,
WIF_ATTR_11R_R1KH,
WIF_ATTR_RADPROXY,
WIF_ATTR_PROXY_ARP,
WIF_ATTR_MCAST_TO_UCAST,
__WIF_ATTR_MAX,
};
@@ -226,6 +228,8 @@ static const struct blobmsg_policy wifi_iface_policy[__WIF_ATTR_MAX] = {
[WIF_ATTR_11R_R0KH] = { .name = "r0kh", BLOBMSG_TYPE_STRING },
[WIF_ATTR_11R_R1KH] = { .name = "r1kh", BLOBMSG_TYPE_STRING },
[WIF_ATTR_RADPROXY] = { .name = "radproxy", BLOBMSG_TYPE_STRING },
[WIF_ATTR_PROXY_ARP] = { .name = "proxy_arp", BLOBMSG_TYPE_BOOL },
[WIF_ATTR_MCAST_TO_UCAST] = { .name = "multicast_to_unicast", BLOBMSG_TYPE_BOOL },
};
const struct uci_blob_param_list wifi_iface_param = {
@@ -323,7 +327,7 @@ extern unsigned int radproxy_apc;
/* Custom options table */
#define SCHEMA_CUSTOM_OPT_SZ 20
#define SCHEMA_CUSTOM_OPTS_MAX 13
#define SCHEMA_CUSTOM_OPTS_MAX 15
const char custom_options_table[SCHEMA_CUSTOM_OPTS_MAX][SCHEMA_CUSTOM_OPT_SZ] =
{
@@ -340,6 +344,8 @@ const char custom_options_table[SCHEMA_CUSTOM_OPTS_MAX][SCHEMA_CUSTOM_OPT_SZ] =
SCHEMA_CONSTS_RADIUS_NAS_IP,
SCHEMA_CONSTS_DYNAMIC_VLAN,
SCHEMA_CONSTS_RADPROXY,
SCHEMA_CONSTS_PROXY_ARP,
SCHEMA_CONSTS_MCAST_TO_UCAST,
};
static bool vif_config_custom_opt_get_proxy(
@@ -654,8 +660,19 @@ static void vif_config_custom_opt_set(struct blob_buf *b, struct blob_buf *del,
strncpy(value, "br-wan.", 20);
blobmsg_add_string(del, "vlan_bridge", value);
}
} else if (strcmp(opt, "radproxy") == 0)
} else if (strcmp(opt, "radproxy") == 0) {
blobmsg_add_string(b, "radproxy", value);
} else if (strcmp(opt, "proxy_arp") == 0) {
if (strcmp(value, "1") == 0)
blobmsg_add_bool(b, "proxy_arp", 1);
else if (strcmp(value, "0") == 0)
blobmsg_add_bool(del, "proxy_arp", 1);
} else if (strcmp(opt, "mcast_to_ucast") == 0) {
if (strcmp(value, "1") == 0)
blobmsg_add_bool(b, "multicast_to_unicast", 1);
else if (strcmp(value, "0") == 0)
blobmsg_add_bool(del, "multicast_to_unicast", 1);
}
}
/* No NASID was found from blob, so use BSSID as NASID */
@@ -805,8 +822,33 @@ static void vif_state_custom_options_get(struct schema_Wifi_VIF_State *vstate,
custom_options_table[i],
buf);
}
}
} else if (strcmp(opt, "proxy_arp") == 0) {
if (tb[WIF_ATTR_PROXY_ARP]) {
if (blobmsg_get_bool(tb[WIF_ATTR_PROXY_ARP])) {
set_custom_option_state(vstate, &index,
custom_options_table[i],
"1");
} else {
set_custom_option_state(vstate, &index,
custom_options_table[i],
"0");
}
}
} else if (strcmp(opt, "mcast_to_ucast") == 0) {
if (tb[WIF_ATTR_MCAST_TO_UCAST]) {
if (blobmsg_get_bool(tb[WIF_ATTR_MCAST_TO_UCAST])) {
set_custom_option_state(vstate, &index,
custom_options_table[i],
"1");
} else {
set_custom_option_state(vstate, &index,
custom_options_table[i],
"0");
}
}
}
}
}