Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Fix CNI networking issues (MAC duplication + bridge ageing) #638

Merged
merged 3 commits into from
Jul 9, 2020

Conversation

twelho
Copy link
Contributor

@twelho twelho commented Jul 9, 2020

This implements downstream fixes for the two issues mentioned in #633. It

With this I'm able to connect VMs to Flannel and have networking working out of the box.

Resolves #633, resolves #628, closes #634.

cc @luxas, @stealthybox, @darkowlzz

Signed-off-by: Dennis Marttinen <dennis@weave.works>
Signed-off-by: Dennis Marttinen <dennis@weave.works>
@twelho twelho requested review from stealthybox and luxas July 9, 2020 12:06
Copy link
Contributor

@luxas luxas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work 🎉🎉✨! Thank you very much

LGTM!

@@ -8,6 +8,9 @@ replace (
k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c
)

// TODO: Remove this when https://github.com/vishvananda/netlink/pull/554 is merged
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can comment go.mod??? TIL, thx 🤯

Copy link
Contributor Author

@twelho twelho Jul 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It ought to be possible, go.mod files seem to just be regular go sources with some special sauce builtins.

go.mod Outdated
@@ -8,6 +8,9 @@ replace (
k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c
)

// TODO: Remove this when https://github.com/vishvananda/netlink/pull/554 is merged
replace github.com/vishvananda/netlink => github.com/twelho/netlink v1.1.1-0.20200709104403-94a3428ca41d
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could tag your repo to sth like v1.1.2-rc.1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do that, I'll just need come up with a tag that doesn't hinder upstream's versioning conventions.


if handle, err = netlink.NewHandle(); err != nil {
if eth, err = netlink.LinkByIndex(iface.Index); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I prefer := on the line before errcheck and no var declaration

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is using named returns, if I do that then it won't assign the error to the named err but create a new block-specific one, and that's a bug. But I'll refactor this to not use named returns, they don't benefit this function anymore.


// getMAC fetches the generated MAC address for the given link
func getMAC(link netlink.Link) (addr net.HardwareAddr, err error) {
if link, err = netlink.LinkByIndex(link.Attrs().Index); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you "overwriting" this variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The passed link is the "constructor" and has no hardware address since we want it to be generated by the network subsystem, so I need to "reload" the link by requesting the properties from the system after it has been created, which fills all the fields. I'll add a comment to avoid confusion.

Signed-off-by: Dennis Marttinen <dennis@weave.works>
@luxas luxas self-assigned this Jul 9, 2020
@luxas luxas merged commit 2db00c6 into weaveworks:master Jul 9, 2020
@twelho twelho deleted the fix-networking branch July 10, 2020 10:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants