-
Notifications
You must be signed in to change notification settings - Fork 67
route: allow IPv6 gateway in IPv4 route #90
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
base: main
Are you sure you want to change the base?
Conversation
I don't link breaking API for this corner case. Please add If possible, please also provide example ip command showing it actual working. |
@hack3ric Hi! I'm also interested in this. Just wondering if you're planning to update this PR? If not, I might go ahead and open one myself. I'll also need the conditional |
Sure, I'll update the PR after the weekend. |
355ccce
to
a09ba72
Compare
a09ba72
to
c86090f
Compare
@rwestphal Done |
src/route/builder.rs
Outdated
@@ -168,6 +168,13 @@ impl RouteMessageBuilder<Ipv4Addr> { | |||
.push(RouteAttribute::Gateway(RouteAddress::Inet(addr))); | |||
self | |||
} | |||
|
|||
pub fn gateway6(mut self, addr: Ipv6Addr) -> Self { |
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.
Since we already patched gateway()
to support assigning ipv6 gateway to a ipv4 route, we do not need this function anymore.
For precise control, maybe change this function to pub fn via(mut self, via: RouteVia) -> Self
.
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.
Yes, anyone who wants an IPv4 route with an IPv6 nexthop should probably be using RouteMessageBuilder<IpAddr>
. I think this method could be dropped.
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.
Sorry for the late reply. Changed the function name to via
, as IMO it would be less consistent in regards of functionality between the Ipv4Addr
and IpAddr
builders, if removing this completely.
@hack3ric ping |
c86090f
to
afb6018
Compare
Linux supports it by using RTA_VIA instead of RTA_GATEWAY. Since it essentially acts as gateway, we extend the current API to allow it.
afb6018
to
ea13ce2
Compare
Linux supports it by using RTA_VIA instead of RTA_GATEWAY. Since it essentially acts as gateway, we extend the current API to allow it.