net-snmp: fix 'bad number' warning when engineidtype is unset
authorMichael Pfeifroth <redacted>
Mon, 22 Jun 2026 15:05:07 +0000 (17:05 +0200)
committerFlorian Eckert <redacted>
Tue, 23 Jun 2026 07:12:16 +0000 (09:12 +0200)
Add a -n guard before the arithmetic comparison of engineidtype in
snmpd_engineid_add(). When the engineid UCI section exists but
engineidtype is not configured, the empty string is passed to
[ -ge ]/[ -le ] which causes 'sh: bad number' on every boot.

Signed-off-by: Michael Pfeifroth <redacted>
net/net-snmp/files/snmpd.init

index 4e3db12effca0485815d09f2631e121f9b287522..a602711eacb83fd3d3437ed264b66613b02743a6 100644 (file)
@@ -240,7 +240,7 @@ snmpd_engineid_add() {
        config_get engineid "$cfg" engineid
        [ -n "$engineid" ] && echo "engineID $engineid" >> $CONFIGFILE
        config_get engineidtype "$cfg" engineidtype
-       [ "$engineidtype" -ge 1 -a "$engineidtype" -le 3 ] && \
+       [ -n "$engineidtype" ] && [ "$engineidtype" -ge 1 -a "$engineidtype" -le 3 ] && \
                echo "engineIDType $engineidtype" >> $CONFIGFILE
        config_get engineidnic "$cfg" engineidnic
        [ -n "$engineidnic" ] && echo "engineIDNic $engineidnic" >> $CONFIGFILE
git clone https://git.99rst.org/PROJECT