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

Restore adding a default route with different metric #472

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions pppd/sys-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -2193,11 +2193,27 @@ int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway, bool replac
* - this is normally only the case the doing demand: */
if (defaultroute_exists(&tmp_rt, -1))
del_rt = &tmp_rt;
} else if (!replace) {
/*
* We don't want to replace an existing route.
* We may however add our route along an existing route with a different
* metric.
*/
if (defaultroute_exists(&rt, dfl_route_metric) && strcmp(rt.rt_dev, ifname) != 0) {
if (rt.rt_flags & RTF_GATEWAY)
error("not replacing existing default route via %I with metric %d",
SIN_ADDR(rt.rt_gateway), dfl_route_metric);
else
error("not replacing existing default route through %s with metric %d",
rt.rt_dev, dfl_route_metric);
return 0;
}
} else if (defaultroute_exists(&old_def_rt, -1 ) &&
strcmp( old_def_rt.rt_dev, ifname) != 0) {
/*
* We did not yet replace an existing default route, let's
* check if we should save and replace a default route:
* We want to replace an existing route and did not replace an existing
* default route yet, let's check if we should save and replace an
* existing default route:
*/
u_int32_t old_gateway = SIN_ADDR(old_def_rt.rt_gateway);

Expand Down