From b27ad0ccf2c21a39331d17236f815b9735c5b122 Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Sun, 10 Apr 2022 23:34:38 -0500 Subject: [PATCH] Add warning for subnet conflicts --- rootfs/standard/var/pynode/device_info.py | 6 ++++++ rootfs/standard/var/www/mynode/settings.py | 2 ++ .../var/www/mynode/templates/includes/info_table.html | 7 ++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/rootfs/standard/var/pynode/device_info.py b/rootfs/standard/var/pynode/device_info.py index f99f25d8..b2f3b661 100644 --- a/rootfs/standard/var/pynode/device_info.py +++ b/rootfs/standard/var/pynode/device_info.py @@ -363,6 +363,12 @@ def get_local_ip(): return local_ip +def get_local_ip_subnet_conflict(): + ip = get_local_ip() + if ip.startswith("172."): + return True + return False + def get_device_changelog(): changelog = "" try: diff --git a/rootfs/standard/var/www/mynode/settings.py b/rootfs/standard/var/www/mynode/settings.py index 00b0cae1..96648648 100644 --- a/rootfs/standard/var/www/mynode/settings.py +++ b/rootfs/standard/var/www/mynode/settings.py @@ -99,6 +99,7 @@ def page_settings(): "uptime": uptime, "date": date, "local_ip": local_ip, + "local_ip_subnet_conflit": get_local_ip_subnet_conflict(), "throttled_data": get_throttled_data(), "oom_error": has_oom_error(), "oom_info": get_oom_error_info(), @@ -289,6 +290,7 @@ def page_status(): "uptime": uptime, "date": date, "local_ip": local_ip, + "local_ip_subnet_conflit": get_local_ip_subnet_conflict(), "throttled_data": get_throttled_data(), "oom_error": has_oom_error(), "oom_info": get_oom_error_info(), diff --git a/rootfs/standard/var/www/mynode/templates/includes/info_table.html b/rootfs/standard/var/www/mynode/templates/includes/info_table.html index 2a645821..d4e75f2f 100644 --- a/rootfs/standard/var/www/mynode/templates/includes/info_table.html +++ b/rootfs/standard/var/www/mynode/templates/includes/info_table.html @@ -34,7 +34,12 @@ Local IP - {{local_ip}} + + {{local_ip}} + {% if local_ip_subnet_conflit %} +
*Your IP address may conflict with internal subnets and cause issues + {% endif %} + {% if throttled_data['RAW_DATA'] != "0x0" and throttled_data['RAW_DATA'] != "MISSING" %} {% if throttled_data['UNDERVOLTED'] or throttled_data['CAPPED'] or throttled_data['THROTTLED'] or throttled_data['SOFT_TEMPLIMIT'] %}