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 Mar 5, 2024
1 parent 845a737 commit d9a31ca
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` (string): The name of the interface.
- `mac` (string): The hardware address of the interface (if applicable).
- `mtu`: The MTU of the interface (if applicable).
- `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`.
- `socketPath` (string, optional): An absolute path to a socket file corresponding to this interface, if applicable.
- `pciID` (string, optional): The platform-specific identifier of the PCI device corresponding to this interface, if applicable.
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"`
SocketPath string `json:"socketPath,omitempty"`
PciID string `json:"pciID,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 @@ -52,6 +52,7 @@ func testResult() *current.Result {
{
Name: "eth0",
Mac: "00:11:22:33:44:55",
Mtu: 1500,
Sandbox: "/proc/3553/ns/net",
PciID: "8086:9a01",
SocketPath: "/path/to/vhost/fd",
Expand Down Expand Up @@ -107,6 +108,7 @@ var _ = Describe("Current types operations", func() {
{
"name": "eth0",
"mac": "00:11:22:33:44:55",
"mtu": 1500,
"sandbox": "/proc/3553/ns/net",
"pciID": "8086:9a01",
"socketPath": "/path/to/vhost/fd"
Expand Down

0 comments on commit d9a31ca

Please sign in to comment.