cp_get_netaddr || true
NETADDR="$RET"
IGNOREIP=$(grep '^ignoreip' "$CONF")
- if ! echo "$IGNOREIP" | grep -q "$NETADDR"; then
- echo "CN: Enabling local IP ranges exclusion..."
- cp_check_and_sed '^ignoreip' \
- "s;^\(ignoreip.*\)$;\1 $NETADDR;g" "$CONF" || true
- fi
+ if grep -q '^ignoreip' "$CONF"; then
+ IGNOREIP=$(grep '^ignoreip' "$CONF")
+ if ! echo "$IGNOREIP" | grep -q "$NETADDR"; then
+ echo "CN: Enabling local IP ranges exclusion..."
+ cp_check_and_sed '^ignoreip' \
+ "s;^\(ignoreip.*\)$;\1 $NETADDR;g" "$CONF" || true
+ fi
+ elif grep -q '^#ignoreip' "$CONF"; then
+ echo "CN: Enabling local IP ranges exclusion..."
+ cp_check_and_sed '^#ignoreip' \
+ "s;^#ignoreip.*$;ignoreip = $NETADDR;g" "$CONF" || true
+ fi
fi
# restart the services