Add mtu option for network attachments#1267
Open
realrajaryan wants to merge 1 commit intoapple:mainfrom
Open
Conversation
jglogan
requested changes
Feb 25, 2026
| public let macAddress: MACAddress? | ||
|
|
||
| public init(hostname: String, macAddress: MACAddress? = nil) { | ||
| /// The MTU for the network interface (optional). Defaults to 1280 if not specified. |
Contributor
There was a problem hiding this comment.
It doesn't default to 1280 here, so I wouldn't mention anything about a default.
| macAddress: attachment.macAddress, | ||
| // https://github.com/apple/containerization/pull/38 | ||
| mtu: 1280 | ||
| mtu: attachment.mtu ?? 1280 |
Contributor
There was a problem hiding this comment.
Could we just set the mtu default in Utility? That's where most of the opinion about container containers is today.
| return AttachmentConfiguration( | ||
| network: item.element.name, | ||
| options: AttachmentOptions(hostname: containerId, macAddress: macAddress) | ||
| options: AttachmentOptions(hostname: containerId, macAddress: macAddress, mtu: item.element.mtu) |
Contributor
There was a problem hiding this comment.
Just above the guard:
let mtu = item.element.mtu ?? 1280
| private let log: Logger | ||
| private var allocator: AttachmentAllocator | ||
| private var macAddresses: [UInt32: MACAddress] | ||
| private var mtus: [UInt32: UInt32] |
Contributor
There was a problem hiding this comment.
What is the point of keeping track of mtu values here? I don't think mtu needs to touch the network helper at all.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Motivation and Context
This PR adds
mtu=VALUEas a--networkattachment option for container run/create, defaulting to 1280 when unspecified, with validation (1280–65535) and full plumbing through the XPC/sandbox stack to the guest kernel interface.Testing