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
| | #!/bin/execlineb -P
# SPDX-License-Identifier: EUPL-1.2+
# SPDX-FileCopyrightText: 2020-2022, 2025 Alyssa Ross <hi@alyssa.is>
background {
importas -Si INTERFACE
# Our IP is encoded in the NIC-specific portion of the interface's MAC
# address.
backtick -E LOCAL_IP {
awk -PF: "
BEGIN { ex = 1 }
$1 == \"02\" && $2 == \"00\" {
printf \"100.64.%d.%d\\n\", \"0x\" $5, \"0x\" $6
ex = 0
}
END { exit ex }
" /sys/class/net/${INTERFACE}/address
}
if { ip address add ${LOCAL_IP}/32 dev $INTERFACE }
if { ip link set $INTERFACE up }
if { ip route add 169.254.0.1 dev $INTERFACE }
ip route add default via 169.254.0.1 dev $INTERFACE
}
|