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

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

@@ -332,7 +333,10 @@ struct option general_options[] = {
OPT_A2PRINTER | OPT_NOPRINT, (void *)user_unsetprint },

{ "defaultroute-metric", o_int, &dfl_route_metric,
Copy link
Contributor Author

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;
Copy link
Contributor Author

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

@Neustradamus
Copy link
Member

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

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
2 participants