diff --git a/include/Prefs.h b/include/Prefs.h index 9b26060726..a1df3dca84 100644 --- a/include/Prefs.h +++ b/include/Prefs.h @@ -68,7 +68,7 @@ class Prefs { bool enable_dropped_flows_alerts, enable_device_protocols_alerts; bool enable_syslog_alerts, external_notifications_enabled; bool enabled_malware_alerts; - bool enable_captive_portal, enable_informative_captive_portal; + bool enable_captive_portal, enable_informative_captive_portal, mac_based_captive_portal; bool dump_flow_alerts_when_iface_alerted; bool override_dst_with_post_nat_dst, override_src_with_post_nat_src; bool routing_mode_enabled, global_dns_forging_enabled; @@ -316,6 +316,7 @@ class Prefs { inline bool isCaptivePortalEnabled() { return(enable_captive_portal); } inline bool isInformativeCaptivePortalEnabled() { return(enable_informative_captive_portal); } + inline bool isMacBasedCaptivePortal() { return(mac_based_captive_portal); } const char * const getCaptivePortalUrl(); inline u_int8_t getDefaultl7Policy() { return(default_l7policy); } diff --git a/include/ntop_defines.h b/include/ntop_defines.h index 0dbe3c314a..8f9ea3cfca 100644 --- a/include/ntop_defines.h +++ b/include/ntop_defines.h @@ -471,6 +471,7 @@ #define CONST_PROFILES_PREFS NTOPNG_PREFS_PREFIX".profiles" #define CONST_PROFILES_COUNTERS "ntopng.profiles_counters.ifid_%i" #define CONST_PREFS_CAPTIVE_PORTAL NTOPNG_PREFS_PREFIX".enable_captive_portal" +#define CONST_PREFS_MAC_CAPTIVE_PORTAL NTOPNG_PREFS_PREFIX".mac_based_captive_portal" #define CONST_PREFS_INFORM_CAPTIVE_PORTAL NTOPNG_PREFS_PREFIX".enable_informative_captive_portal" #define CONST_PREFS_DEFAULT_L7_POLICY NTOPNG_PREFS_PREFIX".default_l7_policy" #define CONST_PREFS_GLOBAL_DNS_FORGING_ENABLED NTOPNG_PREFS_PREFIX".global_dns_forging" diff --git a/scripts/locales/en.lua b/scripts/locales/en.lua index 0ff597495a..d16a5605d0 100644 --- a/scripts/locales/en.lua +++ b/scripts/locales/en.lua @@ -2231,6 +2231,8 @@ local lang = { ["default_snmp_community_title"] = "Default SNMP Community", ["default_snmp_proto_version_description"] = "The default SNMP protocol version.", ["default_snmp_proto_version_title"] = "Default SNMP Version", + ["device_identifier"] = "Device Identifier", + ["device_identifier_descr"] = "Usually devices are identified by MAC address. However, if devices are behind a router, IP identification is desiderable instead.", ["disable_alerts_generation_description"] = "Toggle the overall generation of alerts.", ["disable_alerts_generation_title"] = "Enable Alerts", ["dns"] = "DNS", diff --git a/scripts/lua/modules/http_lint.lua b/scripts/lua/modules/http_lint.lua index ae6b167ccc..6bfdfedc2b 100644 --- a/scripts/lua/modules/http_lint.lua +++ b/scripts/lua/modules/http_lint.lua @@ -1154,6 +1154,7 @@ local known_parameters = { ["send_test_email"] = validateEmpty, ["send_test_slack"] = validateEmpty, ["network_discovery_interval"] = validateNumber, + ["captive_portal_id_method"] = validateChoiceInline({"mac", "ip"}), -- -- TRAFFIC RECORDING diff --git a/src/Prefs.cpp b/src/Prefs.cpp index 9b20def02c..6b3c163031 100755 --- a/src/Prefs.cpp +++ b/src/Prefs.cpp @@ -46,7 +46,7 @@ Prefs::Prefs(Ntop *_ntop) { enable_mining_alerts = CONST_DEFAULT_ALERT_MINING_ENABLED, enable_remote_to_remote_alerts = true, enable_dropped_flows_alerts = true, enable_device_protocols_alerts = false, - enable_syslog_alerts = false, enable_captive_portal = false, + enable_syslog_alerts = false, enable_captive_portal = false, mac_based_captive_portal = false, enabled_malware_alerts = true, enable_informative_captive_portal = false, external_notifications_enabled = false, dump_flow_alerts_when_iface_alerted = false, @@ -582,6 +582,7 @@ void Prefs::reloadPrefsFromRedis() { ewma_alpha_percent = getDefaultPrefsValue(CONST_EWMA_ALPHA_PERCENT, CONST_DEFAULT_EWMA_ALPHA_PERCENT); enable_captive_portal = getDefaultBoolPrefsValue(CONST_PREFS_CAPTIVE_PORTAL, false), + mac_based_captive_portal = getDefaultBoolPrefsValue(CONST_PREFS_MAC_CAPTIVE_PORTAL, true), enable_informative_captive_portal = getDefaultBoolPrefsValue(CONST_PREFS_INFORM_CAPTIVE_PORTAL, false), default_l7policy = getDefaultPrefsValue(CONST_PREFS_DEFAULT_L7_POLICY, PASS_ALL_SHAPER_ID),