VRF association in NetClassIface

オープン
#405 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 5 日以内に返信

@cvas22 がすでに取り組んでいます。

2026年10月23日 から。

  • #891 @cvas22 による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
go, linux

調査の方向性

NetClassIface の実装と、既存の /sys/class/net の読み取りから始め、そのアプローチを、ip link show type vrf を使う issue の netlink の例と比較します。インターフェースの VRF 関連付けを確実に公開でき、VRF インターフェースを識別するための設計が解決されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

enhancement

Hi,

One metric dimension that I am missing from Node Exporter is the VRF association for interfaces.

It looks like the current implementation relies on reading /sys/class/net. For VRFs this is visible as a generic upper (or master) / lower hierarchy.

Example:

bluecmd@adele:/sys/class/net/Ethernet92$ ls -lah
total 0
drwxr-xr-x   5 root root    0 Aug  2 15:06 .
drwxr-xr-x 122 root root    0 Aug  2 15:06 ..
-r--r--r--   1 root root 4.0K Aug  2 15:06 addr_assign_type
-r--r--r--   1 root root 4.0K Aug  2 15:06 address
[..]
-r--r--r--   1 root root 4.0K Aug  2 15:06 iflink
-r--r--r--   1 root root 4.0K Aug  2 15:06 link_mode
lrwxrwxrwx   1 root root    0 Aug  2 15:06 master -> ../VrfKamel
-rw-r--r--   1 root root 4.0K Aug  2 15:06 mtu
[..]
-rw-r--r--   1 root root 4.0K Aug  2 15:06 uevent
lrwxrwxrwx   1 root root    0 Aug  2 15:06 upper_VrfKamel -> ../VrfKamel

However, sadly, the VrfKamel master directory does not contain anything saying that it is a VRF interface. The type file would be my first guess but that appears to be more "What kind of protocol does this interface handle?" which is both 1 for EthernetX and VrfX.

The better way appears to use netlink to find the VRFs:

bluecmd@adele:/sys/class/net/eth0$ ip link show type vrf
9: mgmt: <NOARP,MASTER,UP,LOWER_UP> mtu 65536 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether d6:1e:f6:a2:87:b9 brd ff:ff:ff:ff:ff:ff
12: VrfKamel: <NOARP,MASTER,UP,LOWER_UP> mtu 65536 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 66:d8:f1:b8:0f:96 brd ff:ff:ff:ff:ff:ff
14: VrfMainframe: <NOARP,MASTER,UP,LOWER_UP> mtu 65536 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 8e:37:34:f5:bd:e3 brd ff:ff:ff:ff:ff:ff

Happy to take any questions or suggestions! Might even end up making a PR for it if the stars align and we can figure out a design :-).

主要言語
Go
スター
886
フォーク
403
平均マージ
4日 10時間
マージ済み PR(30日)
8

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

prometheus/procfs のほかの issue

prometheus/procfs の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。