Skip to content

Commit

Permalink
Add domacset capability
Browse files Browse the repository at this point in the history
1. This presumably adjusts passthrough macs.
2. Thank you George :)
3. See here why I am thanking:
https://forums.fogproject.org/topic/15885/hp-probook-430-g8-system-mac-not-passing-through-usb-type-c-dongle/11?page=1
  • Loading branch information
mastacontrola committed May 22, 2024
1 parent dc9656b commit b34c6b3
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions Buildroot/board/FOG/FOS/rootfs_overlay/etc/init.d/S40network
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ if [[ -n $has_usb_nic ]]; then
echo "Sleeping for 5 seconds to allow USB to sync back with system"
sleep 5
fi

# Geo-Grabbing kernel parameters because the variables are probably not set yet
for var in $(cat /proc/cmdline); do
var=$(echo "${var}" | awk -F= '{name=$1; gsub(/[+][_][+]/," ",$2); gsub(/"/,"\\\"", $2); value=$2; if (length($2) == 0 || $0 !~ /=/ || $0 ~ /nvme_core\.default_ps_max_latency_us=/) {print "";} else {printf("%s=%s", name, value)}}')
[[ -z $var ]] && continue;
eval "export ${var}" 2>/dev/null
done

# Enable loopback interface
echo -e "auto lo\niface lo inet loopback\n\n" > /etc/network/interfaces
/sbin/ip addr add 127.0.0.1/8 dev lo
Expand Down Expand Up @@ -43,9 +51,24 @@ for iface in $ifaces; do
# we know we have link so no need to continue on.
# NOTE: the link to web is kind of important, just
# exiting on dhcp request is not sufficient.
[[ $ustat -eq 0 && $cstat -eq 0 ]] && exit 0
if [[ $ustat -eq 0 && $cstat -eq 0 ]]; then
if [[ ! -z $mac && ! -z $domacset ]]; then
# Update the mac address if the DoMACSet flag
# has been raised
ip link set dev $iface down
ip link set dev $iface address $mac
ip link set dev $iface up
fi
fi
echo "Either DHCP failed or we were unable to access ${web}/index.php for connection testing."
sleep 1
# Geo-If we are on the 2nd loop, lets check too see if
# spanning tree is blocking dhcp
if [[ $seq -eq 2 ]]; then
echo "Waiting for Spanning Tree timeout on ${iface}..."
sleep 27
else
sleep 1
fi
done
echo "No DHCP response on interface $iface, skipping it."
done
Expand Down

0 comments on commit b34c6b3

Please sign in to comment.