]> git.ozlabs.org Git - ppp.git/commitdiff
fix silly mistakes
authorPaul Mackerras <paulus@samba.org>
Mon, 8 Mar 1999 04:48:48 +0000 (04:48 +0000)
committerPaul Mackerras <paulus@samba.org>
Mon, 8 Mar 1999 04:48:48 +0000 (04:48 +0000)
pppd/sys-linux.c
pppd/sys-svr4.c

index 2d50977a9600f77c7cfcf2547337e41fd014e12d..061a94f0c3515f2eb150228224c8e65017ce4028 100644 (file)
@@ -1308,7 +1308,8 @@ static int defaultroute_exists (struct rtentry *rt)
 
 /*
  * have_route_to - determine if the system has any route to
 
 /*
  * have_route_to - determine if the system has any route to
- * a given IP address.
+ * a given IP address.  `addr' is in network byte order.
+ * Return value is 1 if yes, 0 if no, -1 if don't know.
  * For demand mode to work properly, we have to ignore routes
  * through our own interface.
  */
  * For demand mode to work properly, we have to ignore routes
  * through our own interface.
  */
@@ -1324,7 +1325,7 @@ int have_route_to(u_int32_t addr)
        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)
        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) {
+           == ((struct sockaddr_in *)&rt.rt_dst)->sin_addr.s_addr) {
            result = 1;
            break;
        }
            result = 1;
            break;
        }
index 17b208c87d17ffb688fd0b4e1cde447817a0e12c..7724bc6d31d9263d3902eaf9ecb5502132e339ab 100644 (file)
@@ -26,7 +26,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: sys-svr4.c,v 1.21 1999/03/08 01:46:49 paulus Exp $";
+static char rcsid[] = "$Id: sys-svr4.c,v 1.22 1999/03/08 04:48:48 paulus Exp $";
 #endif
 
 #include <limits.h>
 #endif
 
 #include <limits.h>
@@ -1729,6 +1729,7 @@ cifroute(u, our, his)
 /*
  * have_route_to - determine if the system has a route to the specified
  * IP address.  Returns 0 if not, 1 if so, -1 if we can't tell.
 /*
  * have_route_to - determine if the system has a route to the specified
  * IP address.  Returns 0 if not, 1 if so, -1 if we can't tell.
+ * `addr' is in network byte order.
  * For demand mode to work properly, we have to ignore routes
  * through our own interface.
  */
  * For demand mode to work properly, we have to ignore routes
  * through our own interface.
  */
@@ -1818,7 +1819,7 @@ have_route_to(addr)
                    syslog(LOG_DEBUG, "have_route_to: dest=%x gw=%x mask=%x\n",
                           rp->ipRouteDest, rp->ipRouteNextHop,
                           rp->ipRouteMask);
                    syslog(LOG_DEBUG, "have_route_to: dest=%x gw=%x mask=%x\n",
                           rp->ipRouteDest, rp->ipRouteNextHop,
                           rp->ipRouteMask);
-                   if (((addr ^ rp->ipRouteDest) && rp->ipRouteMask) == 0
+                   if (((addr ^ rp->ipRouteDest) & rp->ipRouteMask) == 0
                        && rp->ipRouteNextHop != remote_addr)
                        return 1;
                }
                        && rp->ipRouteNextHop != remote_addr)
                        return 1;
                }