-
Notifications
You must be signed in to change notification settings - Fork 234
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
Rework default route handling. #544
base: master
Are you sure you want to change the base?
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.
There is also this reference to replacedefaultroute in pppd/ipcp.c in ipcp_clear_addrs:
2055 /* If replacedefaultroute, sifdefaultroute will be called soon
2056 * with replacedefaultroute set and that will overwrite the current
2057 * default route. This is the case only when doing demand, otherwise
2058 * during demand, this cifdefaultroute would restore the old default
2059 * route which is not what we want in this case. In the non-demand
2060 * case, we'll delete the default route and restore the old if there
2061 * is one saved by an sifdefaultroute with replacedefaultroute.
2062 */
I reckon this means further code adjustments may be required around there.
@@ -332,7 +333,10 @@ struct option general_options[] = { | |||
OPT_A2PRINTER | OPT_NOPRINT, (void *)user_unsetprint }, | |||
|
|||
{ "defaultroute-metric", o_int, &dfl_route_metric, |
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.
Need to add o_uint option.
|
||
nlreq.rtmsg.rtm_family = family; | ||
nlreq.rtmsg.rtm_table = RT_TABLE_MAIN; | ||
nlreq.rtmsg.rtm_protocol = RTPROT_UNSPEC; |
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.
By default iproute2 uses RTPROT_BOOT, somehow that doesn't seem right, but with this we get:
default *proto unspec* scope link metric 10000
strace from ip ro ad shows (reformatted for readability):
sendmsg(3, {
msg_name={
sa_family=AF_NETLINK,
nl_pid=0,
nl_groups=00000000
},
msg_namelen=12,
msg_iov=[
{iov_base=[
{
nlmsg_len=44,
nlmsg_type=RTM_NEWROUTE,
nlmsg_flags=NLM_F_REQUEST|NLM_F_ACK|NLM_F_CREATE|NLM_F_APPEND,
nlmsg_seq=1736279032,
nlmsg_pid=0
},
{
rtm_family=AF_INET,
rtm_dst_len=0,
rtm_src_len=0,
rtm_tos=0,
rtm_table=RT_TABLE_MAIN,
**rtm_protocol=RTPROT_BOOT**,
rtm_scope=RT_SCOPE_LINK,
rtm_type=RTN_UNICAST,
rtm_flags=0
},
[
[{nla_len=8, nla_type=RTA_PRIORITY}, 10000],
[{nla_len=8, nla_type=RTA_OIF}, if_nametoindex("ppp0")]
]
],
iov_len=44
}],
msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 44
@paulusmack, @sthibaul: Can you look this @jkroonza PR which solves one ticket :) |
1. replacedefaultroute option is being removed. 2. default route will now always be appended at defaultroute-metric (both IPv4 and IPv6) if defaultroute{.6} is given. Closes: ppp-project#473 Signed-off-by: Jaco Kroon <[email protected]>
3fc321e
to
1f88d4b
Compare
@paulusmack, @sthibaul: Can you look this @jkroonza PR which solves one ticket :) |
@paulusmack I would appreciate some feedback on this, especially in the light off the concept #546. Given that I'm wondering if the newly added netlink route/add options should take a prefix in addition. sockaddr_t + socklet_t + some unsigned option. Then a pair of sifroute functions for adding arbitrary routes which can be called from the radius module. Currently we handle static routes external to pppd in ip-up and ipv6 up, which is fine, and that can stay there, but we're going to need plumbing for IPv6 PDs anyway, so might just as well handle Framed-Route and IPv6-Framed-Route radius options too. |
Is 0 really a good choice for the default metric? Shouldn't the metric be somewhat reflective of the bandwidth of the network device (which is often lower for PPP links than other types of network)? |
That's the current default. And how do you know what the bandwidth on the client side of a ppp link will be? |
Closes: #473