blob: 49d0180ddcbbcbd371cf5488b5b3cadf39932f7b (
plain) (
tree)
|
|
#!/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 [ "${SLX_DHCP_SECONDARY:-yes}" != "yes" ]; then
echo "No DHCP on other NICs requested. Doing nothing."
exit 0
fi
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 8
slxlog "udhcpc" "Could not run 'udhcpc ${udhcpc_opts[*]}' on ${net_if}."
exit 1
|