Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jkroonza
Copy link
Contributor

@jkroonza jkroonza commented Jan 7, 2025

  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: #473

Copy link
Contributor Author

@jkroonza jkroonza left a 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.

pppd/options.c Outdated Show resolved Hide resolved
pppd/sys-linux.c Outdated Show resolved Hide resolved
@Neustradamus
Copy link
Member

@paulusmack, @sthibaul: Can you look this @jkroonza PR which solves one ticket :)

@Neustradamus
Copy link
Member

@paulusmack, @sthibaul: Can you look this @jkroonza PR which solves one ticket :)

@jkroonza
Copy link
Contributor Author

@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.

@paulusmack
Copy link
Collaborator

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)?

@jkroonza
Copy link
Contributor Author

That's the current default. And how do you know what the bandwidth on the client side of a ppp link will be?

pppd/options.c Outdated Show resolved Hide resolved
{ "noreplacedefaultroute", o_bool,
&ipcp_wantoptions[0].replace_default_route,
"Do not replace default route", 0 },
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I prefer not to break existing working setups by removing options, if it is reasonable for the option to become a no-op (or at worst emit a warning). Could these be made no-ops?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why I can't reply by the 2^31 issue, the kernel type is unsigned, but sure, as long as we can restrict to positive integer that's fine by me. If you need metrics >=2^31 you can do the relevant patching.

Re no-op, will handle. Normally I'd argue for "let it break so that someone knows something need to change", but in this case since it might well relate to something that the admin needs to gain access to the system ... I'm happy to concede.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulusmack please check if you're happy with the change.

I took the opportunity to move options out of pppd/options.c and into the NCPs where they belong at the same time (at least those that I touched). I trust this will be in-order as it honestly makes more sense to have IPCP options reside in ipcp.c and IPv6CP options in ipv6cp.c.

I did (from the initial PR) include some whitespace only changes into the PR. If that's an issue I can rework to exclude that. Didn't make the same mistake on other files (vim automatically cleans up trailing whitespace and a few others on my system).

pppd/pppd.8 Outdated Show resolved Hide resolved
@paulusmack
Copy link
Collaborator

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.

I think being able to have multiple default routes in the system makes this easier, actually, in that we can add a default route and remove it (as long as we are sure to remove the one we added) and leave the system as it was before. So that whole comment can probably be deleted.

1.  replacedefaultroute option is no longer functional.
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]>
@jkroonza jkroonza force-pushed the pppd-default-rework branch from 1f88d4b to 99151ea Compare February 11, 2025 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

rethinking the ppp defaultroute* options
3 participants