X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fsys-linux.c;h=061a94f0c3515f2eb150228224c8e65017ce4028;hb=ac19750e0fb64986870e9bd9bad52d5ae46e2551;hp=280ce890b1db45d2a422db65f0f77f067b61c15f;hpb=bfa20ccde2a70b1252dbb614132f1a4cbee815d4;p=ppp.git diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index 280ce89..061a94f 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -808,14 +808,13 @@ void output (int unit, unsigned char *p, int len) if (write(ppp_fd, p, len) < 0) { if (errno == EWOULDBLOCK || errno == ENOBUFS - || errno == ENXIO || errno == EIO) + || errno == ENXIO || errno == EIO || errno == EINTR) { - syslog(LOG_WARNING, "write: warning: %m(%d)", errno); + syslog(LOG_WARNING, "write: warning: %m (%d)", errno); } else { - syslog(LOG_ERR, "write: %m(%d)", errno); - die(1); + syslog(LOG_ERR, "write: %m (%d)", errno); } } } @@ -1309,7 +1308,10 @@ 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. */ int have_route_to(u_int32_t addr) { @@ -1320,10 +1322,10 @@ 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) { + == ((struct sockaddr_in *)&rt.rt_dst)->sin_addr.s_addr) { result = 1; break; } @@ -1836,7 +1838,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