blob: 7d8d9a2b13c027bd18a6bb205e4478439498d4c9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/bin/bash
# For arrays
net_if="$1"
net_ip="$(ip addr show dev "${net_if}" | grep -m1 '^\s*inet ' | awk -F " " '{print $2}' | awk -F "/" '{print $1}')"
declare -a udhcpc_opts
if [ -n "$net_ip" ]; then
udhcpc_opts+=( "-r" "$net_ip" )
fi
. /opt/openslx/config
primary="${SLX_BRIDGE:-br0}"
if [ "$primary" = "$net_if" ] && [ "$SLX_NET_DHCP_UUID" = "yes" ]; then
uid="$( dmidecode -s system-uuid | sed -r 's/^(..)(..)(..)(..)-(..)(..)-(..)(..)-(....)-/00\4\3\2\1\6\5\8\7\9/' )"
if [ "${#uid}" = 34 ]; then
echo "Using SMBIOS uid for DHCP"
udhcpc_opts+=( "-x" "0x3d:$uid" )
fi
fi
exec /opt/openslx/sbin/udhcpc "${udhcpc_opts[@]}" \
-O domain -O nissrv -O nisdomain -O wpad -O search -O wins \
-s /opt/openslx/scripts/udhcpc-openslx \
-i "${net_if}" -f -t 6 -T 5 -A 300
# ^ try 6 times, 5 seconds timeout each, then wait 5 minutes and repeat
slxlog "udhcpc" "Could not run 'udhcpc ${udhcpc_opts[*]}' on ${net_if}."
exit 1
|