opensync: add radius nas ip config

Add functionality to configure nas ip.

Fixes: WIFI-1715

Signed-off-by: Arif Alam <arif.alam@netexperience.com>
This commit is contained in:
Arif Alam
2021-03-22 09:39:40 -04:00
committed by Rick Sommerville
parent 58793d4349
commit debb9aad7f
2 changed files with 14 additions and 1 deletions

View File

@@ -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);

View File

@@ -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 },