summaryrefslogtreecommitdiff
path: root/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/reconfig-net-interface
blob: b3582301ecce591e8ba76297fd0d6155ca7b04ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

to_local_admin_mac() {
    # Set sencond bit of first byte
    modified_byte=$((16#${1:0:2} | 0x02))
    modified_mac="$(printf "%02X" "$modified_byte")${1:2}"
    echo "$modified_mac"
}

INTF=$1

networkctl down "$INTF"

# Set interface to local Admin MAC
local_mac=$(to_local_admin_mac "$(cat /sys/class/net/"$INTF"/address)")
ip link set dev "$INTF" address "$local_mac"

networkctl up "$INTF"

# wait getting address from NC-SI
systemctl restart network-wait-ipv6-ll@"$INTF".service

networkctl reconfigure "$INTF"