]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-linux.c
Remove the requirement that redistributions in binary form reproduce
[ppp.git] / pppd / sys-linux.c
index 8ec9ba70e7051e50957709ebf98e8a698140ab15..26cadc6e7c797778ca45ca5d80b6eed8f8489b5b 100644 (file)
@@ -2,7 +2,7 @@
  * sys-linux.c - System-dependent procedures for setting up
  * PPP interfaces on Linux systems
  *
- * Copyright (c) 1994-2002 Paul Mackerras. All rights reserved.
+ * Copyright (c) 1994-2004 Paul Mackerras. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The name(s) of the authors of this software must not be used to
+ * 2. The name(s) of the authors of this software must not be used to
  *    endorse or promote products derived from this software without
  *    prior written permission.
  *
- * 4. Redistributions of any form whatsoever must retain the following
+ * 3. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
  *    "This product includes software developed by Paul Mackerras
  *     <paulus@samba.org>".
 #endif /* IPX_CHANGE */
 
 #ifdef PPP_FILTER
-#include <net/bpf.h>
+#include <pcap-bpf.h>
 #include <linux/filter.h>
 #endif /* PPP_FILTER */
 
@@ -956,8 +951,8 @@ void set_up_tty(int tty_fd, int local)
            fatal("Baud rate for %s is 0; need explicit baud rate", devnam);
     }
 
-    if (tcsetattr(tty_fd, TCSAFLUSH, &tios) < 0)
-       if (!ok_error(errno))
+    while (tcsetattr(tty_fd, TCSAFLUSH, &tios) < 0 && !ok_error(errno))
+       if (errno != EINTR)
            fatal("tcsetattr: %m (line %d)", __LINE__);
 
     baud_rate    = baud_rate_of(speed);
@@ -1025,7 +1020,7 @@ void output (int unit, unsigned char *p, int len)
            fd = ppp_dev_fd;
     }
     if (write(fd, p, len) < 0) {
-       if (errno == EWOULDBLOCK || errno == ENOBUFS
+       if (errno == EWOULDBLOCK || errno == EAGAIN || errno == ENOBUFS
            || errno == ENXIO || errno == EIO || errno == EINTR)
            warn("write: warning: %m (%d)", errno);
        else
@@ -1091,7 +1086,8 @@ int read_packet (unsigned char *buf)
     nr = -1;
     if (ppp_fd >= 0) {
        nr = read(ppp_fd, buf, len);
-       if (nr < 0 && errno != EWOULDBLOCK && errno != EIO && errno != EINTR)
+       if (nr < 0 && errno != EWOULDBLOCK && errno != EAGAIN
+           && errno != EIO && errno != EINTR)
            error("read: %m");
        if (nr < 0 && errno == ENXIO)
            return 0;
@@ -1099,7 +1095,8 @@ int read_packet (unsigned char *buf)
     if (nr < 0 && new_style_driver && ppp_dev_fd >= 0) {
        /* N.B. we read ppp_fd first since LCP packets come in there. */
        nr = read(ppp_dev_fd, buf, len);
-       if (nr < 0 && errno != EWOULDBLOCK && errno != EIO && errno != EINTR)
+       if (nr < 0 && errno != EWOULDBLOCK && errno != EAGAIN
+           && errno != EIO && errno != EINTR)
            error("read /dev/ppp: %m");
        if (nr < 0 && errno == ENXIO)
            return 0;
@@ -1133,7 +1130,7 @@ get_loop_output(void)
     if (n == 0)
        fatal("eof on loopback");
 
-    if (errno != EWOULDBLOCK)
+    if (errno != EWOULDBLOCK && errno != EAGAIN)
        fatal("read from loopback: %m(%d)", errno);
 
     return rv;
@@ -1231,7 +1228,7 @@ void tty_recv_config(int mru, u_int32_t asyncmap, int pcomp, int accomp)
  * which may be done. Just return without incident.
  */
        if (!still_ppp())
-               return 0;
+               return;
 /*
  * Set the receiver parameters
  */