bridge: add group_fwd_mask support for multicast forwarding (PTP)#1247
bridge: add group_fwd_mask support for multicast forwarding (PTP)#1247VaishnavSreekumar wants to merge 1 commit intocontainernetworking:mainfrom
Conversation
02d0508 to
93b8244
Compare
93b8244 to
7fc3cd3
Compare
|
Thank you so much for the PR! We also need document modification because we maintain the document side as well, which is in https://github.com/containernetworking/cni.dev Could you please create doc PR as well? |
squeed
left a comment
There was a problem hiding this comment.
Could you add tests? Otherwise, seems reasonable.
| *.test | ||
| *.prof | ||
|
|
||
| /bridge |
There was a problem hiding this comment.
This seems unnecessary? You can set .git/info/exclude for local files (doc)
| return nil, nil, fmt.Errorf("groupFwdMask must be between 0 and 65535") | ||
| } | ||
|
|
||
| path := fmt.Sprintf("/sys/class/net/%s/bridge/group_fwd_mask", n.BrName) |
There was a problem hiding this comment.
Is n.BrName sanitized here? Could it contain ..? That would be... bad.
|
Is this useful for other kinds of interfaces? Should we also add this setting to the tuning plugin? |
78e4793 to
b0c2a24
Compare
|
I have
Also added a unit test for validation logic |
|
Added documentation PR Please let me know if those matches what u had in mind |
That’s a good point. My understanding is that group_fwd_mask is specific to Linux bridge interfaces, which is why I implemented it in the bridge plugin. For other interface types, this setting wudnt apply in the same way with that if there are scenario where similar control is useful across different interfaces extending it via the tuning plugin could make sense as a followup enhancement. Happy to explore that separately if needed. |
squeed
left a comment
There was a problem hiding this comment.
It looks like you checked in some extra files. Please remove them from the commit.
| return nil, nil, err | ||
| } | ||
|
|
||
| safeName := filepath.Base(n.BrName) |
There was a problem hiding this comment.
Ah, good idea. Let's also exclude the name of .. just to be paranoid.
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { |
There was a problem hiding this comment.
I think it's better to add tests in bridge_test.go following the existing pattern. You can verify that an add command with this config succeeds, or fails when the value is invalid.
Signed-off-by: Vaishnav Sreekumar <vaishnavsreekumar301@gmail.com>
b0c2a24 to
bdb3c8f
Compare
Adds support for configuring the group_fwd_mask attribute in the bridge CNI plugin. This allows the Linux bridge to forward specific link-local multicast frames (e.g., LLDP, PTP, or LACP) that are typically dropped by default.
Why is this needed?
Currently, the Linux kernel allows overriding default bridge behavior via /sys/class/net//bridge/group_fwd_mask, but the CNI bridge plugin lacks an interface to expose this configuration. This is a blocker for high-precision networking environments, specifically:
PTP (IEEE 1588): Used for sub-microsecond clock synchronization.
Telecom Profiles: Environments utilizing G.8275.1 that require specific multicast forwarding.
Changes
Schema Update: Added GroupFwdMask as an optional integer field to the NetConf struct.
Sysfs Integration: Implemented logic to write the user-defined mask to the bridge's sysfs path during setup.
Validation: Included checks to ensure the value is only applied when explicitly set, maintaining default kernel behavior otherwise.
Proposed Configuration
Users can now specify the mask in their CNI configuration file:
JSON
Technical Details
Backward Compatibility: Fully backward compatible; if the field is omitted, no changes are made to the bridge mask.
Target Version: Intended for integration into upcoming Kubernetes network driver releases.
Testing Done
Verified that the group_fwd_mask file in /sys is correctly updated when the CNI is invoked.
Confirmed that PTP traffic (multicast MAC 01-80-C2-00-00-0E) is forwarded when the mask is set appropriately.
Release note