From debb9aad7f2ef531477d0e6441e1ee4a79876816 Mon Sep 17 00:00:00 2001 From: Arif Alam Date: Mon, 22 Mar 2021 09:39:40 -0400 Subject: [PATCH] opensync: add radius nas ip config Add functionality to configure nas ip. Fixes: WIFI-1715 Signed-off-by: Arif Alam --- .../src/platform/openwrt/src/lib/target/inc/vif.h | 1 + .../src/platform/openwrt/src/lib/target/src/vif.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/feeds/wlan-ap/opensync/src/platform/openwrt/src/lib/target/inc/vif.h b/feeds/wlan-ap/opensync/src/platform/openwrt/src/lib/target/inc/vif.h index c80c9dc65..64b25c92f 100644 --- a/feeds/wlan-ap/opensync/src/platform/openwrt/src/lib/target/inc/vif.h +++ b/feeds/wlan-ap/opensync/src/platform/openwrt/src/lib/target/inc/vif.h @@ -29,6 +29,7 @@ #define SCHEMA_CONSTS_RADIUS_NAS_ID "radius_nas_id" #define SCHEMA_CONSTS_RADIUS_OPER_NAME "radius_oper_name" +#define SCHEMA_CONSTS_RADIUS_NAS_IP "radius_nas_ip" bool vif_get_security(struct schema_Wifi_VIF_State *vstate, char *mode, char *encryption, char *radiusServerIP, char *password, char *port); extern bool vif_state_update(struct uci_section *s, struct schema_Wifi_VIF_Config *vconf); diff --git a/feeds/wlan-ap/opensync/src/platform/openwrt/src/lib/target/src/vif.c b/feeds/wlan-ap/opensync/src/platform/openwrt/src/lib/target/src/vif.c index 5219c5487..0e1763344 100755 --- a/feeds/wlan-ap/opensync/src/platform/openwrt/src/lib/target/src/vif.c +++ b/feeds/wlan-ap/opensync/src/platform/openwrt/src/lib/target/src/vif.c @@ -118,6 +118,7 @@ enum { WIF_ATTR_BEACON_RATE, WIF_ATTR_MCAST_RATE, WIF_ATTR_RADIUS_NAS_ID_ATTR, + WIF_ATTR_RADIUS_NAS_IP_ATTR, WIF_ATTR_RADIUS_AUTH_REQ_ATTR, WIF_ATTR_RADIUS_ACCT_REQ_ATTR, WIF_ATTR_MESH_ID, @@ -208,6 +209,7 @@ static const struct blobmsg_policy wifi_iface_policy[__WIF_ATTR_MAX] = { [WIF_ATTR_BEACON_RATE] = { .name = "bcn_rate", .type = BLOBMSG_TYPE_INT32 }, [WIF_ATTR_MCAST_RATE] = { .name = "mcast_rate", .type = BLOBMSG_TYPE_INT32 }, [WIF_ATTR_RADIUS_NAS_ID_ATTR] = { .name = "nasid", BLOBMSG_TYPE_STRING }, + [WIF_ATTR_RADIUS_NAS_IP_ATTR] = { .name = "ownip", BLOBMSG_TYPE_STRING }, [WIF_ATTR_RADIUS_AUTH_REQ_ATTR] = { .name = "radius_auth_req_attr", BLOBMSG_TYPE_ARRAY }, [WIF_ATTR_RADIUS_ACCT_REQ_ATTR] = { .name = "radius_acct_req_attr", BLOBMSG_TYPE_ARRAY }, [WIF_ATTR_MESH_ID] = { .name = "mesh_id", BLOBMSG_TYPE_STRING }, @@ -454,7 +456,7 @@ out_none: /* Custom options table */ #define SCHEMA_CUSTOM_OPT_SZ 20 -#define SCHEMA_CUSTOM_OPTS_MAX 11 +#define SCHEMA_CUSTOM_OPTS_MAX 12 const char custom_options_table[SCHEMA_CUSTOM_OPTS_MAX][SCHEMA_CUSTOM_OPT_SZ] = { @@ -468,6 +470,7 @@ const char custom_options_table[SCHEMA_CUSTOM_OPTS_MAX][SCHEMA_CUSTOM_OPT_SZ] = SCHEMA_CONSTS_DTIM_PERIOD, SCHEMA_CONSTS_RADIUS_OPER_NAME, SCHEMA_CONSTS_RADIUS_NAS_ID, + SCHEMA_CONSTS_RADIUS_NAS_IP, SCHEMA_CONSTS_DYNAMIC_VLAN, }; @@ -516,6 +519,8 @@ static void vif_config_custom_opt_set(struct blob_buf *b, struct blob_buf *del, blobmsg_add_string(b, "dtim_period", value); else if (strcmp(opt, "radius_nas_id") == 0) blobmsg_add_string(b, "nasid", value); + else if (strcmp(opt, "radius_nas_ip") == 0) + blobmsg_add_string(b, "ownip", value); else if (strcmp(opt, "radius_oper_name") == 0 && strlen(value) > 0) { memset(operator_name, '\0', sizeof(operator_name)); @@ -645,6 +650,13 @@ static void vif_state_custom_options_get(struct schema_Wifi_VIF_State *vstate, custom_options_table[i], buf); } + } else if (strcmp(opt, "radius_nas_ip") == 0) { + if (tb[WIF_ATTR_RADIUS_NAS_IP_ATTR]) { + buf = blobmsg_get_string(tb[WIF_ATTR_RADIUS_NAS_IP_ATTR]); + set_custom_option_state(vstate, &index, + custom_options_table[i], + buf); + } } else if (strcmp(opt, "radius_oper_name") == 0) { static struct blobmsg_policy policy[1] = { { .type = BLOBMSG_TYPE_STRING },