minor adjustments to add dhcp section as needed

This commit is contained in:
Christopher Landwehr
2025-08-15 23:34:21 -04:00
parent 09daba4ad5
commit 0e60336199

View File

@@ -7,7 +7,7 @@ menu() {
echo -e "\e[92m1) Enable/Disable Single IP DMZ Passthrough Mode\e[0m" # Green echo -e "\e[92m1) Enable/Disable Single IP DMZ Passthrough Mode\e[0m" # Green
echo -e "\e[94m2) Set Gateway Address\e[0m" # Blue echo -e "\e[94m2) Set Gateway Address\e[0m" # Blue
echo -e "\e[93m3) Set DHCP Start/Limit Range\e[0m" # Yellow echo -e "\e[93m3) Set DHCP Start/Limit Range\e[0m" # Yellow
echo -e "\e[96m4) Set Custom DNS\e[0m" # Cyan echo -e "\e[96m4) Set Custom DNS (Recommended to be connected through ADB over USB)(Network restart required)\e[0m" # Cyan
echo -e "\e[95m5) Use Provider's DNS (IPv4 only)\e[0m" # Magenta echo -e "\e[95m5) Use Provider's DNS (IPv4 only)\e[0m" # Magenta
echo -e "\e[92m6) Enable/Disable IP Passthrough with NAT (Access to modem's LAN locally)\e[0m" # Green echo -e "\e[92m6) Enable/Disable IP Passthrough with NAT (Access to modem's LAN locally)\e[0m" # Green
echo -e "\e[91m7) Exit\e[0m" # Red echo -e "\e[91m7) Exit\e[0m" # Red
@@ -26,7 +26,7 @@ apply_changes() {
# Function to check if IPPT is enabled by inspecting the MPDN rules # Function to check if IPPT is enabled by inspecting the MPDN rules
is_ippt_enabled() { is_ippt_enabled() {
local mpdn_output=$(atcmd 'AT+QMAP="mpdn_rule"') local mpdn_output=$(sms_tool at -t 3 'AT+QMAP="mpdn_rule"')
echo "$mpdn_output" echo "$mpdn_output"
# Check if any MPDN rule has IPPT enabled (non-zero second-to-last value) # Check if any MPDN rule has IPPT enabled (non-zero second-to-last value)
@@ -210,14 +210,15 @@ toggle_custom_dns() {
get_current_settings "$interface" get_current_settings "$interface"
local dns=$(prompt "Enter DNS servers (comma-separated)" "$CURRENT_DNS") local dns=$(prompt "Enter DNS servers (comma-separated)" "$CURRENT_DNS")
# @Cameron if uci set properties does not exist will uci create it?
if uci get dhcp.$interface.dhcp_option &>/dev/null; then if uci show dhcp.$interface &>/dev/null; then
echo -e "\e[93mSetting DNS to: $dns\e[0m" # Yellow echo -e "\e[93mSetting DNS to: $dns\e[0m" # Yellow
uci set dhcp.$interface.dhcp_option="6,$dns"
apply_changes
else else
echo -e "\e[91m$interface DHCP_Option Setting not found with UCI. Not setting. \e[0m" # Red uci add dhcp.$interface
echo -e "\e[91m$interface section not found with UCI. Created and set dhcp_option to 6,$dns. \e[0m" # Red
fi fi
uci set dhcp.$interface.dhcp_option="6,$dns"
apply_changes
} }
# Function to use the provider's DNS (IPv4 only) # Function to use the provider's DNS (IPv4 only)