Fix bug in ip-in-use test

Need grep -wF instead of grep -w for IP test to avoid spurious match
against broadcast address in ifconfig output.
This commit is contained in:
William Erik Baxter
2022-12-04 05:47:15 -06:00
parent 0ee17be875
commit ec18847f3e
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -79,7 +79,7 @@ for _jail in ${JAILS}; do
## warn if matching configured (but not online) ip4.addr, ignore if there's no ip4.addr entry
ip=$(grep 'ip4.addr' "${bastille_jailsdir}/${_jail}/jail.conf" | awk '{print $3}' | sed 's/\;//g')
if [ -n "${ip}" ]; then
if ifconfig | grep -w "${ip}" >/dev/null; then
if ifconfig | grep -wF "${ip}" >/dev/null; then
error_notify "Error: IP address (${ip}) already in use."
continue
fi