patches and low-level development discussion
 help / color / mirror / code / Atom feed
blob 95f2fa876b555a851c50526946cc006d1823e123 695 bytes (raw)
name: img/app/image/etc/mdev/iface 	 # note: path name is non-authoritative(*)

 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
}

debug log:

solving 95f2fa8 ...
found 95f2fa8 in https://spectrum-os.org/git/spectrum

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).