X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsys-linux.c;h=2d50977a9600f77c7cfcf2547337e41fd014e12d;hp=af5164fe3e4be1cef3aab5b30a85d8561cdb4af6;hb=e15bba841ee500abc715fccf876fed4dd2462b1b;hpb=0c752a555e174a838a30b7e8632fbffc58ba00a6 diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index af5164f..2d50977 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -1309,6 +1309,8 @@ static int defaultroute_exists (struct rtentry *rt) /* * have_route_to - determine if the system has any route to * a given IP address. + * For demand mode to work properly, we have to ignore routes + * through our own interface. */ int have_route_to(u_int32_t addr) { @@ -1319,7 +1321,7 @@ int have_route_to(u_int32_t addr) return -1; /* don't know */ while (read_route_table(&rt)) { - if ((rt.rt_flags & RTF_UP) == 0) + if ((rt.rt_flags & RTF_UP) == 0 || strcmp(rt.rt_dev, ifname) == 0) continue; if ((addr & ((struct sockaddr_in *)&rt.rt_genmask)->sin_addr.s_addr) == ((struct sockaddr_in *)&rt.rt_genmask)->sin_addr.s_addr) {