| 1 | pppd: Retain foreign default routes on Linux |
| 2 | |
| 3 | On Linux, when pppd attempts to delete its default route it does not fill |
| 4 | the rt_dev field of the struct rtentry used to match the system default route. |
| 5 | As a consequence, pppd happily deletes any default route even if it belongs |
| 6 | to another interface. |
| 7 | |
| 8 | This patch makes pppd fill out the rt_dev field so that only own default |
| 9 | routes are ever matched. |
| 10 | |
| 11 | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> |
| 12 | |
| 13 | --- a/pppd/sys-linux.c |
| 14 | +++ b/pppd/sys-linux.c |
| 15 | @@ -1755,6 +1755,7 @@ int cifdefaultroute (int unit, u_int32_t |
| 16 | SIN_ADDR(rt.rt_genmask) = 0L; |
| 17 | } |
| 18 | |
| 19 | + rt.rt_dev = ifname; |
| 20 | rt.rt_flags = RTF_UP; |
| 21 | if (ioctl(sock_fd, SIOCDELRT, &rt) < 0 && errno != ESRCH) { |
| 22 | if (still_ppp()) { |
| 23 | |