-
Notifications
You must be signed in to change notification settings - Fork 93
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
forwarder: update the condition for default route #1631
Conversation
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. 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.
LGTM
Just curious why image build/push is triggered in a PR's CI? |
So I think it is in order to ensure we are testing with the latest image build, however we could potentially do it another way and if the podvm files aren't touched then we fall back to using the latest |
@genjuro214 - can you rebase your branch and then we can get the libvirt ci tests running to double-check this change. Thanks! |
@genjuro214 thank you very much for the investigation! It looks like the root cause of the problem is my misuse of the zero value of netip.Prefix here. cloud-api-adaptor/pkg/util/netops/netops.go Lines 769 to 773 in afe662c
I think returning the valid "0.0.0.0/0" representation will fix the issue as well.
Bits() returns a consistent value in both go1.20 and go1.21. https://go.dev/play/p/0seUd4F1OIA I think changing the |
@yoheiueda , yes that's more reasonable fix for this issue. I updated the PR according to your suggestion, thanks! |
rebase the branch to pickup 2 new commits from main |
please check the fail ut.
|
Old condition returns different results if building with different Go versions(1.20 and 1.21). Update the condition to return consistent results. Fixes #1630 Signed-off-by: Lei Li <[email protected]> Signed-off-by: Lei Li <[email protected]>
maybe need waiting #1634 to fix the e2e related fail. |
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. Thank you very much!
34805fa
into
confidential-containers:main
Fixes #1630
The problem is
r.Destination.Bits()
may return different results if building with different Go versionsr.Destination.Bits()
return 0 for go1.20.5, but return -1 for go1.21.1I tried to change the condition to
!r.Destination.IsValid()
because it returns consistent results.The code of
IsValid()
for go1.20.5:The code of
IsValid()
for go1.21.1:I think the purpose of the code here is to judge if the route Destination is the default prefix "0.0.0.0/0". However, the route Destination here is
Destination:netip.Prefix{ip:netip.Addr{addr:netip.uint128{hi:0x0, lo:0x0}, z:(*intern.Value)(nil)}, bits:0}
for go1.20.5 andDestination:netip.Prefix{ip:netip.Addr{addr:netip.uint128{hi:0x0, lo:0x0}, z:(*intern.Value)(nil)}, bitsPlusOne:0x0}
for go1.21.1Because the z is nil, the
Addr.isZero()
returns true, andAddr.IsUnspecified()
returns false.The z is nil, because the route Destination is from nil. In https://github.com/confidential-containers/cloud-api-adaptor/blob/main/pkg/util/netops/netops.go#L539, the
r.Dst
is nil, because in https://github.com/confidential-containers/cloud-api-adaptor/blob/main/pkg/util/netops/netops.go#L458, we just set Dst ifdst.Bits() > 0
. If change the condition toif dst.Bits() >= 0
,ns.handle.RouteListFiltered
will return nil. Not sure why, it's the 3rd party code of "github.com/vishvananda/netlink"