]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-linux.c
Ignore routes through our own interface in have_route_to
[ppp.git] / pppd / sys-linux.c
index abe71ce58cec1098533a020fb9b4861e0b93fdcc..2d50977a9600f77c7cfcf2547337e41fd014e12d 100644 (file)
@@ -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) {
@@ -1835,7 +1837,7 @@ int ppp_available(void)
          "This system lacks kernel support for PPP.  This could be because\n"
          "the PPP kernel module is not loaded, or because the kernel is\n"
          "not configured for PPP.  See the README.linux file in the\n"
-         "ppp-2.3.5 distribution.\n";
+         "ppp-2.3.6 distribution.\n";
     }
 /*
  *  This is the PPP device. Validate the version of the driver at this