Skip to content

Finalize ietf-interfaces.yang: last-change, higher-layer-if, lower-layer-if - #1635

Open
troglobit wants to merge 4 commits into
mainfrom
ifaces
Open

troglobit wants to merge 4 commits into
mainfrom
ifaces

Conversation

@troglobit

@troglobit troglobit commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Description

Last interface change

Completes #514 with the remaining ietf-interfaces.yang status leaves. Both CLI and WebUI support.

  • higher-layer-if and lower-layer-if come from the kernel's
    upper_/lower_ links in sysfs, covering bridge ports, LAG
    members, VLAN parents and any other netdev adjacency.
  • last-change is tracked by statd over rtnetlink in an in-memory
    map keyed by interface name. Interfaces whose state predates
    statd have no last-change, per RFC 8343.
  • show interface <name> prints last change and the layer lists.

Note

As per RFC8343, the last-change node is not shown (included) "If the current state was entered prior to the last re-initialization of the local network management subsystem". I.e., on startup.

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

@troglobit
troglobit requested a review from jovatn September 14, 2026 17:15
The ietf-interfaces leaf-lists higher-layer-if and lower-layer-if were
never populated, so operational data gave no general view of how
interfaces stack.  Only the VLAN augment carried its lower-layer-if.

The kernel already keeps this adjacency in sysfs, as upper_<name> and
lower_<name> links in each interface directory.  Read them per
interface and drop references to interfaces hidden from operational
(group internal, CAN) so no leafref points at a missing entry.

Part of issue #514.

Signed-off-by: Joachim Wiberg <[email protected]>
The mDNS neighbor code has a private formatter for YANG date-and-time
strings.  More operational leaves need the same encoding, so give it a
home in shared.c and let callers pass the time to format.

Signed-off-by: Joachim Wiberg <[email protected]>
The ietf-interfaces leaf last-change, the time an interface entered its
current operational state, was missing.  Nothing on the system keeps it:
the kernel has no ifLastChange and statd only reads state on demand.

Track it in statd.  A netlink socket in the RTMGRP_LINK group feeds an
in-memory map keyed by interface name, stamping every operational state
change with the monotonic clock.  The interfaces callback adds the leaf
to yanger's output for each interface with a recorded change, converting
to wall-clock time at that point so a later NTP step does not skew old
stamps.  Interfaces whose state predates statd get no last-change, as
RFC 8343 requires.

Part of issue #514.

Signed-off-by: Joachim Wiberg <[email protected]>
The interface detail page lists a fixed set of status fields, so the
new ietf-interfaces leaves did not show up.  Add last change with its
age, and the lower and higher layer interfaces linked to their own
pages.

Signed-off-by: Joachim Wiberg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants