Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion base-system/usrroot/usr/lib/systemd/system/ipman.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ After=network.target

[Service]
ExecStart=/usr/sbin/ipman
Restart=on-failure
RestartSec=10
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target
10 changes: 7 additions & 3 deletions base-system/usrroot/usr/sbin/ipman
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ else
ONES=$((2 ** 32 - 2 ** (32 - IP_MASK)))
SUBNET_MASK=$(printf "%d.%d.%d.%d\n" $((ONES >> 24 & 255)) $((ONES >> 16 & 255)) $((ONES >> 8 & 255)) $((ONES & 255)))
fi
# Convert subnet mask decimal form to the subnet mask octal form

# Test if any of the required fields is empty
if [ -z "$IP_ADDRESS" ]; then
Expand Down Expand Up @@ -64,9 +63,14 @@ for INTERFACE in $INTERFACES; do

# Test for network connection with a ping to the gateway,
# if it's successful, we're on the network
echo "Testing connection to the gateway"
echo "Testing connection to the gateway and to the directives server"
if [ -n "$DIRECTIVES_SERVER_IP" ] && ping -q -c 3 -W 5 "$DIRECTIVES_SERVER_IP" >/dev/null; then
echo "Network connection to $DIRECTIVES_SERVER_IP is working, exiting"
exit 0
fi

if ping -q -c 3 -W 5 "$IP_GATEWAY" >/dev/null; then
echo "Network connection is working, exiting"
echo "Network connection to $IP_GATEWAY is working, exiting"
exit 0
else
echo "No network connection, falling back to DHCP"
Expand Down