-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multicast route configuration and support for join/leave transport node #2835
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2835 +/- ##
==========================================
+ Coverage 59.45% 60.39% +0.93%
==========================================
Files 298 302 +4
Lines 25589 36115 +10526
==========================================
+ Hits 15215 21812 +6597
- Misses 8738 12482 +3744
- Partials 1636 1821 +185
Flags with carried forward coverage won't be shown. Click here to find out more.
|
c0167c6
to
6fc942f
Compare
068e23e
to
b78862c
Compare
23ac04f
to
c808f85
Compare
43ce322
to
9b207e8
Compare
9b207e8
to
eb792e4
Compare
This pull request introduces 2 alerts when merging eb792e4 into db0c92d - view on LGTM.com new alerts:
|
pkg/agent/multicast/vif_allocator.go
Outdated
"k8s.io/klog/v2" | ||
) | ||
|
||
type vifAllocator struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is VIF a term in the Linux IGMP or mroute implementation? Probably you should add comments to explain what is a VIF too.
And probably you should use VIF rather than Vif in names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment added.
VIF stands for virtual interface in the context of multicast https://github.com/torvalds/linux/blob/d58071a8a76d779eedab38033ae4c821c30295a5/include/uapi/linux/mroute.h#L21 . The interface should be added as VIF first before configuring multicast routing related to this interface
eb792e4
to
6987f32
Compare
This pull request introduces 2 alerts when merging 6987f32 into c135609 - view on LGTM.com new alerts:
|
9b52d8c
to
827df45
Compare
This pull request introduces 2 alerts when merging 827df45 into c135609 - view on LGTM.com new alerts:
|
_, ok := interfacesMap[iface.Name] | ||
// the interface should be multicast enabled | ||
// and not in the ifaceStore | ||
if ok || !strings.Contains(iface.Flags.String(), "multicast") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a more efficient way to check this? At least define a constant for "multicast".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After offline discussion with @wenyingd , we agreed allowing users manually set external multicast interfaces in the antrea config file would be a better and simpler solution. If set in the antrea config file, this method could be removed and no need to detect and handle the multicast interfaces change. what's your opinion? Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds good to me. But considering in many cases the Node just has one interface, do we have a way to look up and use that interface by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you the one interface
you mentioned is transportInterface. I have added externalMulticastInterface
in the antrea agent config file. Basically the result of externalMulticastInterface union TransportInterface
will be the multicast interfaces we will use to route multicast traffic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, TransportInterface is also optional. When the Node has only one interface, TransportInterface parameter is useless, and so will not be set either.
BTW, when externalMulticastInterface is set, we should just use it; only when it is not set we consider TransportInterface next.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Basically, we need one interface to route multicast traffic to remote Nodes base on the order of transportInterface
, transportInterfaceCIDRs
and The Node IP
, which is NodeTransportName
calculated in NodeConfig
. Also user can specify externalMulticastInterfaces
to route multicast traffic to the outside world. the result of externalMulticastInterface union [NodeTransportName]
will be all the multicast interfaces to route multicast traffic.
Please correct me If I understand it incorrectly, thanks.
827df45
to
b88d040
Compare
This pull request introduces 2 alerts when merging b88d040 into 9a52de9 - view on LGTM.com new alerts:
|
b88d040
to
f3544fb
Compare
third_party/unix/ztypes_linux.go
Outdated
Wrong_if uint32 | ||
Expire int32 | ||
} | ||
type Vifctl struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Insert a line in front of it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
third_party/unix/ztypes_linux.go
Outdated
// go run mksyscall.go -l32 -arm -tags linux,arm syscall_linux.go syscall_linux_arm.go | ||
// Code generated by the command above; see README.md. DO NOT EDIT. | ||
Modifies: | ||
- All the consts and types defined below are addition to the original code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use empty lines to separate the command and modfifies, otherwise it's hard to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
third_party/unix/syscall_unix.go
Outdated
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
Modifies: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
third_party/unix/zerrors_linux.go
Outdated
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
Modifies: | ||
- All the consts defined below are copied from the original code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The geneted files has both "DO NOT EDIT" and "Modifies", have they been updated manually?
Asking for the maintain of such code, could you make README more complete to list what files are written by us and what files are gererated, and the whole steps to generate the code. I think Jianjun has this concern too: #2835 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README updated. Modifies are added by myself. compile command and DO NOT EDIT are copied from the original file, for instance, https://github.com/golang/sys/blob/5a964db013201115fcba5c3d31ade965d0969335/unix/ztypes_linux_amd64.go#L2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we do update them? The "DO NOT EDIT" warning will confuse people. Since you already remove many code, why don't remove the confusing comment which is false here.
Better to have a link of the original code.
You didn't link mention your update in this file in README, could you add it and anything missing if there is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zerrors_linux.go
has already removed
85f0737
to
83ebb08
Compare
/test-all |
third_party/unix/syscall_unix.go
Outdated
return e | ||
} | ||
|
||
func SetsockoptViMfcctl(fd, level, opt int, mfcctl *Mfcctl) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "Vi" stand for? Should we just name the func SetsockoptMfcctl()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
83ebb08
to
b298c0d
Compare
/test-all |
third_party/unix/README
Outdated
@@ -0,0 +1,11 @@ | |||
The code from Package unix is generated by running GOOS=linux GOARCH=amd64 ./mkall.sh from [golang/sys/internal-branch.go1.17-vendor](https://github.com/golang/sys/tree/internal-branch.go1.17-vendor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please name the file README.md so that it will be rendered as markdown by github.
Please wrap the lines like other documents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README.md updated.
third_party/unix/linux/types.go
Outdated
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
Modifies: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved third_party/unix to pkg/util/syscall. Modifies:
sections are removed.
third_party/unix/zerrors_linux.go
Outdated
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
Modifies: | ||
- All the consts defined below are copied from the original code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we do update them? The "DO NOT EDIT" warning will confuse people. Since you already remove many code, why don't remove the confusing comment which is false here.
Better to have a link of the original code.
You didn't link mention your update in this file in README, could you add it and anything missing if there is?
b298c0d
to
988f161
Compare
Moved
|
ac9081e
to
9b942b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except the place of syscall package
pkg/util/syscall/linux/types.go
Outdated
@@ -0,0 +1,53 @@ | |||
//go:build ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently pkg/util
contains utils that may be used for both controller and agent while pkg/agent/util
contains utils specific to agent like iptables, route, arp tools. As this is about syscall, which it's unlikely to be required by controller, I would suggest to move it to the latter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
df265a6
to
486f858
Compare
1. Add and delete static multicast route entries for inbound and outbound multicast traffic. 2. Configure OVS bridge to support multicast snooping and disable flooding of unregistered multicast packets to all ports. 3. Add an iptables rule to prevent multicast traffic masquerade. Signed-off-by: Ruochen Shen <[email protected]>
486f858
to
32d3bef
Compare
/test-e2e |
1 similar comment
/test-e2e |
/test-networkpolicy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/test-windows-e2e |
1 similar comment
/test-windows-e2e |
1. Add and delete static multicast route entries for inbound and outbound multicast traffic. 2. Configure OVS bridge to support multicast snooping and disable flooding of unregistered multicast packets to all ports. 3. Add an iptables rule to prevent multicast traffic masquerade. Signed-off-by: Ruochen Shen <[email protected]>
This pr creates multicast route client with multicast socket, which handles IGMPMSG_NOCACHE messages:
Also the multicast client delete the multicast routes and configure the interfaces to join/leave multicast groups for the following circumstances: