-
Notifications
You must be signed in to change notification settings - Fork 747
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
Patch to allow for 'ip route add table XXX unreachable default metric… #743
base: main
Are you sure you want to change the base?
Conversation
doesn't using |
No, unfortunately it does not. It was the first thing I checked. The reason is that we need the logic that follows the |
ya you are right, it looks like this pkg requires us to provide any of that - but we don't necessarily need it. Lines 732 to 735 in e5fd1f8
but i managed to work around that using 0.0.0.0 as the Gw:
netlink message (strace):
and here is how the netlink message for the
git blame points to the initial commit of the package, so maybe instead of handling that attribute specifically, we can revisit that validation |
we can definitely update the nil check. Is there any other type besides unreachable that you could use for the default route without a gw or src? I'm thinking that we can just add a type != unreachable into that check. |
there are quite a few route types that don't need a gateway or src. an example is a P2P link (GRE tunnel), where you can just specify the interface with in my view is better to just get rid of that check, and let netlink return the error message to the library in case it gets something invalid and pass that error back to the user. edit: oops, i didn't see it was @vishvananda replying to this heh |
Ok, I have reviewed the comments, and on balance I like my approach best :-) The route to 0.0.0.0/0 with the family inferred from the dst type I think is preferable to specifying it explicitly and providing a non-nil gateway. (If your family and gateway type does not match, then you are in trouble for instance). Similarly, I think the check to omit the OIF attribute when the link is unset is the best approach. But I accept that if the PR is not merged the functionality can still be dragged out of the module... :-) Happy to add checks for RTN_BLACKHOLE and RTN_PROHIBIT in addition to RTN_UNREACHABLE and flatten commit if desired. |
I'm ok with this approach, but could you please squash into a single commit? |
@vishvananda Cool.... leave it with me. I'll do that shortly. |
… XXX' type constructions
@vishvananda All done |
@vishvananda Anything else I can offer to do on this PR? /Lasse |
@lasselj |
It occurs to me that to create constructions below which allows multicast in vrfs we can't blindly add RTA_DST and RTA_OIF attributes. In some instances they must be omitted.