wlan-ap-Telecominfraproject/feeds/wlan-ap/opensync/patches/11-schema-wifi-vif-captive-portal-conf.patch
Nagendrababu 88e8163410 package:openNDS
Implement a per-SSID embedded Captive Portal making use of OpenNDS
Authentication type:None
Fix for WIFI-596
Signed-off-by: Nagendrababu <nagendrababu.bonkuri@connectus.ai>
2020-09-07 11:38:33 +02:00

146 lines
5.0 KiB
Diff

--- a/interfaces/opensync.ovsschema
+++ b/interfaces/opensync.ovsschema
@@ -2115,6 +2115,26 @@
"min": 0,
"max": "unlimited"
}
+ },
+ "captive_allowlist": {
+ "type": {
+ "key": {
+ "type": "string"
+ },
+ "min": 0,
+ "max": "unlimited"
+ }
+ },
+ "captive_portal": {
+ "type": {
+ "key": "string",
+ "value": {
+ "type": "string",
+ "maxLength": 256
+ },
+ "min": 0,
+ "max": "unlimited"
+ }
}
},
"isRoot": true,
@@ -2482,6 +2502,26 @@
"min": 0,
"max": "unlimited"
}
+ },
+ "captive_allowlist": {
+ "type": {
+ "key": {
+ "type": "string"
+ },
+ "min": 0,
+ "max": "unlimited"
+ }
+ },
+ "captive_portal": {
+ "type": {
+ "key": "string",
+ "value": {
+ "type": "string",
+ "maxLength": 256
+ },
+ "min": 0,
+ "max": "unlimited"
+ }
}
},
"isRoot": true,
--- a/src/lib/schema/inc/schema_consts.h
+++ b/src/lib/schema/inc/schema_consts.h
@@ -149,4 +149,15 @@ typedef enum {
#define SCHEMA_CONSTS_CLIENT_RATE_DL "client_dl_limit"
#define SCHEMA_CONSTS_CLIENT_RATE_UL "client_ul_limit"
+/* Captive Portal */
+#define SCHEMA_CONSTS_SESSION_TIMEOUT "session_timeout"
+#define SCHEMA_CONSTS_BROWSER_TITLE "browser_title"
+#define SCHEMA_CONSTS_SPLASH_PAGE_LOGO "splash_page_logo"
+#define SCHEMA_CONSTS_SPLASH_PAGE_BACKGROUND_LOGO "splash_page_background_logo"
+#define SCHEMA_CONSTS_SPLASH_PAGE_TITLE "splash_page_title"
+#define SCHEMA_CONSTS_REDIRECT_URL "redirect_url"
+#define SCHEMA_CONSTS_AUTHENTICATION "authentication"
+#define SCHEMA_CONSTS_ACCEPTANCE_POLICY "acceptance_policy"
+#define SCHEMA_CONSTS_LOGIN_SUCCESS_TEXT "login_success_text"
+#define SCHEMA_CONSTS_PAGE_TITLE "page_title"
#endif /* SCHEMA_CONSTS_H_INCLUDED */
--- a/src/wm2/src/wm2_radio.c
+++ b/src/wm2/src/wm2_radio.c
@@ -555,6 +555,8 @@ wm2_vconf_changed(const struct schema_Wi
CMP(CHANGED_INT, wps_pbc);
CMP(CHANGED_STR, wps_pbc_key_id);
CMP(CHANGED_MAP_STRSTR, custom_options);
+ CMP(CHANGED_MAP_STRSTR, captive_portal);
+ CMP(CHANGED_SET_CASE, captive_allowlist);
if (changed)
LOGD("%s: changed (forced=%d)", conf->if_name, changedf->_uuid);
--- a/src/wm2/src/wm2_radio1.c
+++ b/src/wm2/src/wm2_radio1.c
@@ -950,6 +950,38 @@ wm2_vif_equal(
vconf_set->custom_options_len = vconf->custom_options_len;
}
}
+ if (ovsdb_update_changed(mon, SCHEMA_COLUMN(Wifi_VIF_Config, captive_portal))) {
+ if (vconf->captive_portal_len == vstate.captive_portal_len) {
+ for (index = 0; index < vconf->captive_portal_len; index++) {
+ VIF_EQUAL(SCHEMA_FIELD_CMP_MAP_STR(vconf, &vstate, captive_portal, index));
+ }
+ } else {
+ is_equal = false;
+ }
+ if (!is_equal) {
+ for (index = 0; index < vconf->captive_portal_len; index++) {
+ strcpy(vconf_set->captive_portal[index], vconf->captive_portal[index]);
+ strcpy(vconf_set->captive_portal_keys[index], vconf->captive_portal_keys[index]);
+ }
+ vconf_set->captive_portal_len = vconf->captive_portal_len;
+ }
+ }
+ if (ovsdb_update_changed(mon, SCHEMA_COLUMN(Wifi_VIF_Config, captive_allowlist))){
+ if (vconf->captive_allowlist_len == vstate.captive_allowlist_len) {
+ for (index = 0; index < vconf->captive_allowlist_len; index++) {
+ VIF_EQUAL(SCHEMA_FIELD_CMP_LIST_STR(vconf, &vstate, captive_allowlist, index));
+ }
+ } else {
+ is_equal = false;
+ }
+ if (!is_equal) {
+ for (index = 0; index < vconf->captive_allowlist_len; index++) {
+ STRSCPY(vconf_set->captive_allowlist[index], vconf->captive_allowlist[index]);
+ }
+ vconf_set->captive_allowlist_len = vconf->captive_allowlist_len;
+ }
+ }
+
#undef VIF_EQUAL
--- a/src/wm2/tests/unit.mk
+++ b/src/wm2/tests/unit.mk
@@ -34,4 +34,4 @@ UNIT_DEPS += src/lib/osa
UNIT_DEPS += src/lib/schema
UNIT_DEPS += src/lib/ovsdb
UNIT_LDFLAGS += -luci
-UNIT_LDFLAGS += -lnl-tiny -lubox -lubus -lblobmsg_json
+UNIT_LDFLAGS += -lnl-tiny -lubox -lubus -lblobmsg_json -lcurl
--- a/src/wm2/unit.mk
+++ b/src/wm2/unit.mk
@@ -47,7 +47,7 @@ UNIT_LDFLAGS += -ldl
UNIT_LDFLAGS += -lev
UNIT_LDFLAGS += -lrt
UNIT_LDFLAGS += -luci
-UNIT_LDFLAGS += -lnl-tiny -lubox -lubus -lblobmsg_json
+UNIT_LDFLAGS += -lnl-tiny -lubox -lubus -lblobmsg_json -lcurl
UNIT_EXPORT_CFLAGS := $(UNIT_CFLAGS)
UNIT_EXPORT_LDFLAGS := $(UNIT_LDFLAGS)