mirror of
https://github.com/linuxboot/heads.git
synced 2025-01-29 15:44:07 +00:00
bin/network-init-recovery: generate random MAC and set it to eth0
network-init-reovery can be used to automatically set RTC clock to obtained NTP clock. The script would fail if other devices devices previously registered on the network with the same MAC. Consequently, maximized boards are detected here, and a full random MAC is generated and used instead of using hardcoded DE:AD:C0:FF:EE.
This commit is contained in:
parent
37a343a49c
commit
e60287fa1d
@ -1,5 +1,7 @@
|
||||
#!/bin/ash
|
||||
|
||||
. /etc/functions
|
||||
|
||||
# bring up the ethernet; maybe should do DHCP?
|
||||
ifconfig lo 127.0.0.1
|
||||
|
||||
@ -11,6 +13,16 @@ for module in `echo $network_modules`; do
|
||||
done
|
||||
|
||||
if [ -e /sys/class/net/eth0 ]; then
|
||||
#Randomize eth0 MAC address of maximized boards
|
||||
if echo "$CONFIG_BOARD" | grep -q maximized; then
|
||||
ifconfig eth0 down
|
||||
echo "Generating random MAC address (might take a while)..."
|
||||
mac=$(generate_random_mac_address)
|
||||
echo "Assigning randomly generated MAC: $mac to eth0..."
|
||||
ifconfig eth0 hw ether $mac
|
||||
ifconfig eth0 up
|
||||
fi
|
||||
|
||||
# Set up static IP
|
||||
if [ ! -z "$CONFIG_BOOT_STATIC_IP" ]; then
|
||||
ifconfig eth0 $CONFIG_BOOT_STATIC_IP
|
||||
|
Loading…
x
Reference in New Issue
Block a user