Skip to content

Commit

Permalink
Add MTU to CNI result
Browse files Browse the repository at this point in the history
This commit allow CNIs to expose the MTU of interface

Signed-off-by: Sebastian Sch <[email protected]>
  • Loading branch information
SchSeba committed Feb 1, 2024
1 parent b62753a commit 568e3c8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ Plugins must output a JSON object with the following keys upon a successful `ADD
- `interfaces`: An array of all interfaces created by the attachment, including any host-level interfaces:
- `name`: The name of the interface.
- `mac`: The hardware address of the interface (if applicable).
- `mtu`: The MTU of the interface (if applicable).
- `sandbox`: 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`.
- `ips`: IPs assigned by this attachment. Plugins may include IPs assigned external to the container.
- `address` (string): an IP address in CIDR notation (eg "192.168.1.3/24").
Expand Down
1 change: 1 addition & 0 deletions pkg/types/100/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ func (r *Result) PrintTo(writer io.Writer) error {
type Interface struct {
Name string `json:"name"`
Mac string `json:"mac,omitempty"`
Mtu int `json:"mtu,omitempty"`
Sandbox string `json:"sandbox,omitempty"`
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/types/100/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func testResult() *current.Result {
{
Name: "eth0",
Mac: "00:11:22:33:44:55",
Mtu: 1500,
Sandbox: "/proc/3553/ns/net",
},
},
Expand Down Expand Up @@ -106,6 +107,7 @@ var _ = Describe("Current types operations", func() {
{
"name": "eth0",
"mac": "00:11:22:33:44:55",
"mtu": 1500,
"sandbox": "/proc/3553/ns/net"
}
],
Expand Down

0 comments on commit 568e3c8

Please sign in to comment.