Page MenuHomeDevCentral

Allow to discover IPv6 gateway for Online servers
AcceptedPublic

Authored by dereckson on Sun, Aug 31, 16:07.
Tags
None
Referenced Files
F11687347: D3651.diff
Wed, Sep 10, 14:11
F11685243: D3651.diff
Wed, Sep 10, 08:06
F11682741: D3651.id9446.diff
Wed, Sep 10, 01:17
Unknown Object (File)
Mon, Sep 8, 22:37
Unknown Object (File)
Mon, Sep 8, 08:15
Unknown Object (File)
Sun, Sep 7, 11:45
Unknown Object (File)
Sun, Sep 7, 06:02
Unknown Object (File)
Sun, Sep 7, 06:02
Subscribers
None
Tokens
"Y So Serious" token, awarded by dereckson.

Details

Reviewers
DorianWinty
Summary

Online doesn't document gateway for IPv6 blocks.

Normally, inet6 -ifdisabled accept_rtadv up and the DHCPv6 request
to authenticate the right to use the block with DUID should be enough.

If we want to explicitly set a gateway in the routing table, we can
discover it through neighbour discovery protocol (NDP): this will be
the only IP adress not associated to a known MAC address.

With that informatino, gateway can then be declared on NetBox
by an ops running the query-ndp-for-ipv6-neighbor.sh script.

Test Plan

sh utils/query-ndp-for-ipv6-neighbor.sh on WindRiver

Diff Detail

Repository
rOPS Nasqueron Operations
Lint
Lint Passed
Unit
No Test Coverage
Branch
detect-gw-query-ndp
Build Status
Buildable 5837
Build 6119: arc lint + arc unit

Event Timeline

dereckson created this revision.

The ndp parsing code has been written by a GPT model, offering to forget about awk.

For reference, the following script generated by GPT 5 works too, but only with GNU awk:

#!/bin/sh

# Collect local MAC addresses
LOCAL_MACS=$(ifconfig | awk '/ether/ {print $2}')

# Scan ndp table
ndp -an | gawk -v macs="$LOCAL_MACS" '
NR == 1 { next }

BEGIN {
    split(macs, arr)
    for (i in arr) {
        local[arr[i]] = 1
    }
}
# Fields: IPv6, MAC, iface, ...
{
    mac = $2
    if (mac == "(incomplete)") next
    if (!(mac in local)) {
        ip = $1
        sub(/%.*/, "", ip)
        print ip
        exit 0
    }
}
'
This revision is now accepted and ready to land.Thu, Sep 4, 17:06