From: Eric McDonald Date: Sat, 7 Mar 2026 21:51:25 +0000 (-0800) Subject: net-snmp: add early return when HostIP is unset X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=1215e7e87a3e1a2082bc1e55a1ee4e642976ed1a;p=openwrt-packages.git net-snmp: add early return when HostIP is unset snmpd_access_HostIP_add would write unintended output to the config file if the HostIP option is not specified. Add an early return to prevent writing in that case. This is a breaking change for configs where HostIP is unset. Previously, an empty HostIP option would result in a malformed directive containing a bare /mask with no guaranteed newline, the exact form of which depended on the values of other options. Now, no directive is written. Signed-off-by: Eric McDonald --- diff --git a/net/net-snmp/files/snmpd.init b/net/net-snmp/files/snmpd.init index 7c1a7429b..b1e13edb1 100644 --- a/net/net-snmp/files/snmpd.init +++ b/net/net-snmp/files/snmpd.init @@ -158,6 +158,7 @@ snmpd_access_HostName_add() { snmpd_access_HostIP_add() { local cfg="$1" config_get host_ip "$cfg" HostIP + [ -n "$host_ip" ] || return 0 config_get ip_mask "$cfg" IPMask config_get mode "$cfg" Mode [ -n "$mode" ] || return 0