Skip to content

Commit b4314ad

Browse files
committed
Add MTU to CNI result
This commit allow CNIs to expose the MTU of interface Signed-off-by: Sebastian Sch <[email protected]>
1 parent 845a737 commit b4314ad

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

SPEC.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@ Plugins must output a JSON object with the following keys upon a successful `ADD
567567
- `interfaces`: An array of all interfaces created by the attachment, including any host-level interfaces:
568568
- `name` (string): The name of the interface.
569569
- `mac` (string): The hardware address of the interface (if applicable).
570+
- `mtu`: (uint) The MTU of the interface (if applicable).
570571
- `sandbox` (string): The isolation domain reference (e.g. path to network namespace) for the interface, or empty if on the host. For interfaces created inside the container, this should be the value passed via `CNI_NETNS`.
571572
- `socketPath` (string, optional): An absolute path to a socket file corresponding to this interface, if applicable.
572573
- `pciID` (string, optional): The platform-specific identifier of the PCI device corresponding to this interface, if applicable.

pkg/types/100/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ func (r *Result) PrintTo(writer io.Writer) error {
270270
type Interface struct {
271271
Name string `json:"name"`
272272
Mac string `json:"mac,omitempty"`
273+
Mtu int `json:"mtu,omitempty"`
273274
Sandbox string `json:"sandbox,omitempty"`
274275
SocketPath string `json:"socketPath,omitempty"`
275276
PciID string `json:"pciID,omitempty"`

pkg/types/100/types_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ func testResult() *current.Result {
5252
{
5353
Name: "eth0",
5454
Mac: "00:11:22:33:44:55",
55+
Mtu: 1500,
5556
Sandbox: "/proc/3553/ns/net",
5657
PciID: "8086:9a01",
5758
SocketPath: "/path/to/vhost/fd",
@@ -107,6 +108,7 @@ var _ = Describe("Current types operations", func() {
107108
{
108109
"name": "eth0",
109110
"mac": "00:11:22:33:44:55",
111+
"mtu": 1500,
110112
"sandbox": "/proc/3553/ns/net",
111113
"pciID": "8086:9a01",
112114
"socketPath": "/path/to/vhost/fd"

0 commit comments

Comments
 (0)