-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
backend/vxlan: Add support for "direct routing" #787
Conversation
74b4346
to
802887f
Compare
This skips vxlan encapsulation if the hosts are on the same subnet
802887f
to
bd001e1
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.
a question about cleanup during subnet.EventRemoved
continue | ||
} | ||
if len(routes) == 1 && routes[0].Gw == nil { |
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.
wonder if you can use any of netlink.Route
's attributes to determine if it's a directly connected?
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.
Isn't that what I'm doing with my .Gw == nil
test?
I could also check to see if the FLAG_ONLINK
flag is set on the flags
attribute if you think that would be better?
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 would be nice but not necessary since your comments are pretty clear
continue | ||
} | ||
if len(routes) == 1 && routes[0].Gw == nil { |
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.
how would this condition set directRoutingOK
to true
for subnet.EventRemoved
event? maybe I'm missing something, but when we get the EventAdded
we program the directRoute
which has Gw: attrs.PublicIP.ToIP(),
then we get EventRemoved
for the same one and if we check this condition where we see if Gw==nil
, so the clean up in L173 won't happen?
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 directRoutingOK check is seeing if there's a direct route to the public IP address of other host. If there is, then we add a route to the IP range for that host using the public IP address as the gateway. The "route" to the public IP address for that host is unchanged; it's still directly connected.
So when the remove comes in, the public IP is still directly connected and we can remove the route to the network which uses the public IP as the gateway. Make sense?
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.
yeah that makes sense, I misunderstood the direct link checking logic and thought directRoutingOk flag will stay false for delete, but it doesn't, so all good now :)
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!
This skips vxlan encapsulation if the hosts are on the same subnet