nodogsplash: fix config generation in the init script

Three problems in the generated configuration:

- The error message for a missing configuration file prints $file,
  which is never set, instead of $val, which holds the path.
- The warning for the unsupported FAS options prints the value of
  the option instead of its name, so the message does not say which
  option is unsupported.
- gatewayinterface is emitted twice: once resolved to a device via
  network_get_device() as "GatewayInterface", and once more by the
  generic option loop with the raw UCI value. When the value names a
  network section rather than a device, the second line overrides
  the resolved device with a name nodogsplash cannot use.

Reported-by: openwrt-ai[bot]
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Josef SchlehoferandClaude Fable 5 committed 2026-08-15 23:31:16 +02:00
1 parent dcde8f0270
commit b8dc6c7077
1 file changed
+3 -3
+3 -3
View File
@@ -119,7 +119,7 @@ generate_uci_config() {
config_get val "$cfg" config
if [ -n "$val" ]; then
if [ ! -f "$val" ]; then
echo "Configuration file '$file' doesn't exist." >&2
echo "Configuration file '$val' doesn't exist." >&2
return 1
fi
addline "$(cat $val)"
@@ -142,7 +142,7 @@ generate_uci_config() {
addline "GatewayInterface $ifname"
for option in preauth binauth \
daemon debuglevel maxclients gatewayname gatewayinterface gatewayiprange \
daemon debuglevel maxclients gatewayname gatewayiprange \
gatewayaddress gatewayport webroot splashpage statuspage \
redirecturl sessiontimeout preauthidletimeout authidletimeout checkinterval \
setmss mssvalue trafficcontrol downloadlimit uploadlimit \
@@ -158,7 +158,7 @@ generate_uci_config() {
for option in fasport fasremoteip faspath fas_secure_enabled ; do
config_get val "$cfg" "$option"
if [ -n "$val" ]; then
echo "Warning: nodogsplash does not support $val"
echo "Warning: nodogsplash does not support $option"
return 1
fi
done