dhcpcd.exe: Only set gateway when we have received one

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2022-12-01 17:23:04 +00:00
committed by Peter Müller
parent 11f6226f65
commit 36914cce70

View File

@@ -54,10 +54,12 @@ dhcpcd_up()
#Get IP Address
echo -n "$new_ip_address" > /var/ipfire/red/local-ipaddress
#Get default gateway
# Get default gateway
if [ -n "${new_routers}" ]; then
grep -v -E "\<gateway\>" /etc/hosts > /tmp/hosts
echo "$new_routers gateway" >> /tmp/hosts
mv /tmp/hosts /etc/hosts
fi
if [ $update ]; then
[ -e "/var/ipfire/red/active" ] || touch /var/ipfire/red/active