summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2001-04-27 23:16:13 +0000
committerPaul Mackerras <paulus@samba.org>2001-04-27 23:16:13 +0000
commitffa027207fff95bd19cb529105bd549fb6ae1709 (patch)
tree0142f3b6c2f32ac5ee8538433bf2370302b15814
parentaac99e2604e20409d9f0538ceb8590c2f75220a0 (diff)
downloadppp-ffa027207fff95bd19cb529105bd549fb6ae1709.tar.gz
minor bugfixes, now 2.4.2b1, add pkts_in/out to pppd_stats,
finish transition to netif_set_mtu and tty_send/recv_config
-rw-r--r--pppd/main.c11
-rw-r--r--pppd/patchlevel.h6
-rw-r--r--pppd/pppd.h10
-rw-r--r--pppd/sys-linux.c43
-rw-r--r--pppd/sys-solaris.c14
-rw-r--r--pppd/sys-sunos4.c46
6 files changed, 59 insertions, 71 deletions
diff --git a/pppd/main.c b/pppd/main.c
index e0352f0..498f856 100644
--- a/pppd/main.c
+++ b/pppd/main.c
@@ -17,7 +17,7 @@
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define RCSID "$Id: main.c,v 1.105 2001/03/12 22:58:59 paulus Exp $"
+#define RCSID "$Id: main.c,v 1.106 2001/04/27 23:16:13 paulus Exp $"
#include <stdio.h>
#include <ctype.h>
@@ -1087,9 +1087,6 @@ static struct timeval timenow; /* Current time */
/*
* timeout - Schedule a timeout.
- *
- * Note that this timeout takes the number of milliseconds, NOT hz (as in
- * the kernel).
*/
void
timeout(func, arg, secs, usecs)
@@ -1098,10 +1095,10 @@ timeout(func, arg, secs, usecs)
int secs, usecs;
{
struct callout *newp, *p, **pp;
-
+
MAINDEBUG(("Timeout %p:%p in %d.%03d seconds.", func, arg,
- time / 1000, time % 1000));
-
+ secs, usecs/1000));
+
/*
* Allocate timeout.
*/
diff --git a/pppd/patchlevel.h b/pppd/patchlevel.h
index 5e55d25..5cdc40d 100644
--- a/pppd/patchlevel.h
+++ b/pppd/patchlevel.h
@@ -1,4 +1,4 @@
-/* $Id: patchlevel.h,v 1.53 2001/03/25 04:51:54 paulus Exp $ */
+/* $Id: patchlevel.h,v 1.54 2001/04/27 23:16:13 paulus Exp $ */
-#define VERSION "2.4.1"
-#define DATE "25 March 2001"
+#define VERSION "2.4.2b1"
+#define DATE "25 April 2001"
diff --git a/pppd/pppd.h b/pppd/pppd.h
index 38788ce..7d27c1c 100644
--- a/pppd/pppd.h
+++ b/pppd/pppd.h
@@ -16,7 +16,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: pppd.h,v 1.59 2001/03/12 22:58:59 paulus Exp $
+ * $Id: pppd.h,v 1.60 2001/04/27 23:16:13 paulus Exp $
*/
/*
@@ -147,6 +147,8 @@ struct permitted_ip {
struct pppd_stats {
unsigned int bytes_in;
unsigned int bytes_out;
+ unsigned int pkts_in;
+ unsigned int pkts_out;
};
/* Used for storing a sequence of words. Usually malloced. */
@@ -212,11 +214,15 @@ extern int unsuccess; /* # unsuccessful connection attempts */
extern int do_callback; /* set if we want to do callback next */
extern int doing_callback; /* set if this is a callback */
extern char ppp_devnam[MAXPATHLEN];
+extern int listen_time; /* time to listen first (ms) */
extern struct notifier *pidchange; /* for notifications of pid changing */
extern struct notifier *phasechange; /* for notifications of phase changes */
extern struct notifier *exitnotify; /* for notification that we're exiting */
extern struct notifier *sigreceived; /* notification of received signal */
-extern int listen_time; /* time to listen first (ms) */
+extern struct notifier *ip_up_notifier; /* IPCP has come up */
+extern struct notifier *ip_down_notifier; /* IPCP has gone down */
+extern struct notifier *auth_up_notifier; /* peer has authenticated */
+extern struct notifier *link_down_notifier; /* link has gone down */
/* Values for do_callback and doing_callback */
#define CALLBACK_DIALIN 1 /* we are expecting the call back */
diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c
index f1b4842..189b809 100644
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -182,7 +182,6 @@ static void decode_version (char *buf, int *version, int *mod, int *patch);
static int set_kdebugflag(int level);
static int ppp_registered(void);
static int make_ppp_unit(void);
-static void restore_loop(void); /* Transfer ppp unit back to loopback */
extern u_char inpacket_buf[]; /* borrowed from main.c */
@@ -499,8 +498,6 @@ int tty_establish_ppp (int tty_fd)
void tty_disestablish_ppp(int tty_fd)
{
- if (demand)
- restore_loop();
if (!hungup) {
/*
* Flush the tty output buffer so that the TIOCSETD doesn't hang.
@@ -531,10 +528,17 @@ void tty_disestablish_ppp(int tty_fd)
if (new_style_driver) {
close(ppp_fd);
ppp_fd = -1;
- if (!looped && ifunit >= 0 && ioctl(ppp_dev_fd, PPPIOCDETACH) < 0)
+ if (demand) {
+ set_flags(ppp_dev_fd, get_flags(ppp_dev_fd) | SC_LOOP_TRAFFIC);
+ looped = 1;
+ } else if (ifunit >= 0 && ioctl(ppp_dev_fd, PPPIOCDETACH) < 0)
error("Couldn't release PPP unit: %m");
if (!multilink)
remove_fd(ppp_dev_fd);
+ } else {
+ /* old-style driver */
+ if (demand)
+ set_ppp_fd(slave_fd);
}
}
@@ -1168,7 +1172,7 @@ int ccp_test (int unit, u_char *opt_ptr, int opt_len, int for_transmit)
void ccp_flags_set (int unit, int isopen, int isup)
{
- if (still_ppp()) {
+ if (still_ppp() && ifunit >= 0) {
int x = get_flags(ppp_dev_fd);
x = isopen? x | SC_CCP_OPEN : x &~ SC_CCP_OPEN;
x = isup? x | SC_CCP_UP : x &~ SC_CCP_UP;
@@ -1236,6 +1240,8 @@ get_ppp_stats(u, stats)
}
stats->bytes_in = req.stats.p.ppp_ibytes;
stats->bytes_out = req.stats.p.ppp_obytes;
+ stats->pkts_in = req.stats.p.ppp_ipackets;
+ stats->pkts_out = req.stats.p.ppp_opackets;
return 1;
}
@@ -2556,33 +2562,6 @@ open_ppp_loopback(void)
/********************************************************************
*
- * restore_loop - reattach the ppp unit to the loopback.
- *
- * The kernel ppp driver automatically reattaches the ppp unit to
- * the loopback if the serial port is set to a line discipline other
- * than ppp, or if it detects a modem hangup. The former will happen
- * in disestablish_ppp if the latter hasn't already happened, so we
- * shouldn't need to do anything.
- *
- * Just to be sure, set the real serial port to the normal discipline.
- */
-
-static void
-restore_loop(void)
-{
- looped = 1;
- if (new_style_driver) {
- set_flags(ppp_dev_fd, get_flags(ppp_dev_fd) | SC_LOOP_TRAFFIC);
- return;
- }
- if (ppp_fd != slave_fd) {
- (void) ioctl(ppp_fd, TIOCSETD, &tty_disc);
- set_ppp_fd(slave_fd);
- }
-}
-
-/********************************************************************
- *
* sifnpmode - Set the mode for handling packets for a given NP.
*/
diff --git a/pppd/sys-solaris.c b/pppd/sys-solaris.c
index 2cba082..ff9c7de 100644
--- a/pppd/sys-solaris.c
+++ b/pppd/sys-solaris.c
@@ -42,7 +42,7 @@
* OR MODIFICATIONS.
*/
-#define RCSID "$Id: sys-solaris.c,v 1.4 2001/03/12 22:59:00 paulus Exp $"
+#define RCSID "$Id: sys-solaris.c,v 1.5 2001/04/27 23:16:13 paulus Exp $"
#include <limits.h>
#include <stdio.h>
@@ -1520,7 +1520,7 @@ tty_send_config(mtu, asyncmap, pcomp, accomp)
}
/*
- * ppp_set_xaccm - set the extended transmit ACCM for the interface.
+ * tty_set_xaccm - set the extended transmit ACCM for the interface.
*/
void
tty_set_xaccm(accm)
@@ -1537,7 +1537,7 @@ tty_set_xaccm(accm)
}
/*
- * ppp_recv_config - configure the receive-side characteristics of
+ * tty_recv_config - configure the receive-side characteristics of
* the ppp interface.
*/
void
@@ -1629,6 +1629,8 @@ get_ppp_stats(u, stats)
}
stats->bytes_in = s.p.ppp_ibytes;
stats->bytes_out = s.p.ppp_obytes;
+ stats->pkts_in = s.p.ppp_ipackets;
+ stats->pkts_out = s.p.ppp_opackets;
return 1;
}
@@ -1956,12 +1958,6 @@ sifaddr(u, o, h, m)
error("Couldn't set remote IP address: %m");
ret = 0;
}
-#if 0 /* now done in ppp_send_config */
- ifr.ifr_metric = link_mtu;
- if (ioctl(ipfd, SIOCSIFMTU, &ifr) < 0) {
- error("Couldn't set IP MTU: %m");
- }
-#endif
remote_addr = h;
return ret;
diff --git a/pppd/sys-sunos4.c b/pppd/sys-sunos4.c
index 00f2ec5..9159b4c 100644
--- a/pppd/sys-sunos4.c
+++ b/pppd/sys-sunos4.c
@@ -25,7 +25,7 @@
* OR MODIFICATIONS.
*/
-#define RCSID "$Id: sys-sunos4.c,v 1.26 2001/03/12 22:59:00 paulus Exp $"
+#define RCSID "$Id: sys-sunos4.c,v 1.27 2001/04/27 23:16:13 paulus Exp $"
#include <stdio.h>
#include <stddef.h>
@@ -735,17 +735,33 @@ get_loop_output()
}
/*
- * ppp_send_config - configure the transmit characteristics of
- * the ppp interface.
+ * netif_set_mtu - set the MTU on the PPP network interface.
*/
void
-ppp_send_config(unit, mtu, asyncmap, pcomp, accomp)
+netif_set_mtu(unit, mtu)
int unit, mtu;
+{
+ struct ifreq ifr;
+
+ memset(&ifr, 0, sizeof(ifr));
+ strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
+ ifr.ifr_metric = link_mtu;
+ if (ioctl(sockfd, SIOCSIFMTU, &ifr) < 0) {
+ error("Couldn't set IP MTU: %m");
+ }
+}
+
+/*
+ * tty_send_config - configure the transmit characteristics of
+ * the ppp interface.
+ */
+void
+tty_send_config(mtu, asyncmap, pcomp, accomp)
+ int mtu;
u_int32_t asyncmap;
int pcomp, accomp;
{
int cf[2];
- struct ifreq ifr;
link_mtu = mtu;
if (strioctl(pppfd, PPPIO_MTU, &mtu, sizeof(mtu), 0) < 0) {
@@ -761,21 +777,13 @@ ppp_send_config(unit, mtu, asyncmap, pcomp, accomp)
if (strioctl(pppfd, PPPIO_CFLAGS, cf, sizeof(cf), sizeof(int)) < 0) {
error("Couldn't set prot/AC compression: %m");
}
-
- /* set mtu for ip as well */
- memset(&ifr, 0, sizeof(ifr));
- strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
- ifr.ifr_metric = link_mtu;
- if (ioctl(sockfd, SIOCSIFMTU, &ifr) < 0) {
- error("Couldn't set IP MTU: %m");
- }
}
/*
- * ppp_set_xaccm - set the extended transmit ACCM for the interface.
+ * tty_set_xaccm - set the extended transmit ACCM for the interface.
*/
void
-ppp_set_xaccm(unit, accm)
+tty_set_xaccm(unit, accm)
int unit;
ext_accm accm;
{
@@ -786,12 +794,12 @@ ppp_set_xaccm(unit, accm)
}
/*
- * ppp_recv_config - configure the receive-side characteristics of
+ * tty_recv_config - configure the receive-side characteristics of
* the ppp interface.
*/
void
-ppp_recv_config(unit, mru, asyncmap, pcomp, accomp)
- int unit, mru;
+tty_recv_config(mru, asyncmap, pcomp, accomp)
+ int mru;
u_int32_t asyncmap;
int pcomp, accomp;
{
@@ -872,6 +880,8 @@ get_ppp_stats(u, stats)
}
stats->bytes_in = s.p.ppp_ibytes;
stats->bytes_out = s.p.ppp_obytes;
+ stats->pkts_in = s.p.ppp_ipackets;
+ stats->pkts_out = s.p.ppp_opackets;
return 1;
}