From: Paul Mackerras Date: Mon, 8 Mar 1999 04:48:48 +0000 (+0000) Subject: fix silly mistakes X-Git-Tag: RELEASE_2_3_6~6 X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=1fff4aeb733a37d80c2902920ac06914f0da7ba7;ds=sidebyside fix silly mistakes --- diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index 2d50977..061a94f 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -1308,7 +1308,8 @@ static int defaultroute_exists (struct rtentry *rt) /* * 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. */ @@ -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) - == ((struct sockaddr_in *)&rt.rt_genmask)->sin_addr.s_addr) { + == ((struct sockaddr_in *)&rt.rt_dst)->sin_addr.s_addr) { result = 1; break; } diff --git a/pppd/sys-svr4.c b/pppd/sys-svr4.c index 17b208c..7724bc6 100644 --- a/pppd/sys-svr4.c +++ b/pppd/sys-svr4.c @@ -26,7 +26,7 @@ */ #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 @@ -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. + * `addr' is in network byte order. * 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); - if (((addr ^ rp->ipRouteDest) && rp->ipRouteMask) == 0 + if (((addr ^ rp->ipRouteDest) & rp->ipRouteMask) == 0 && rp->ipRouteNextHop != remote_addr) return 1; }