diff options
author | brian <brian@cvs.openbsd.org> | 1997-12-27 13:45:22 +0000 |
---|---|---|
committer | brian <brian@cvs.openbsd.org> | 1997-12-27 13:45:22 +0000 |
commit | 620782ad72dc562f184f5c57e4c66d5f16339a52 (patch) | |
tree | d6c65588447a905f2a0575966336e1c028513a82 /usr.sbin/ppp | |
parent | a572d36d1ef4f38506baacb05686c8e7db9fd534 (diff) |
Show who closes the diagnostic connection.
Show the IP range (if specified) in "show ipcp".
Close unused descriptors 0 and 2 in interactive mode.
Pass (size_t *) rather than (int *) to sysctl().
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r-- | usr.sbin/ppp/command.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/defs.c | 7 | ||||
-rw-r--r-- | usr.sbin/ppp/defs.h | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/ipcp.c | 7 | ||||
-rw-r--r-- | usr.sbin/ppp/main.c | 13 | ||||
-rw-r--r-- | usr.sbin/ppp/route.c | 10 |
6 files changed, 28 insertions, 17 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index c18822bf169..51ee9716418 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: command.c,v 1.14 1997/12/27 07:22:16 brian Exp $ + * $Id: command.c,v 1.15 1997/12/27 13:45:18 brian Exp $ * */ #include <sys/param.h> @@ -834,7 +834,7 @@ static int QuitCommand(struct cmdargs const *arg) { if (VarTerm) { - DropClient(); + DropClient(1); if (mode & MODE_INTER) Cleanup(EX_NORMAL); else if (arg->argc > 0 && !strcasecmp(*arg->argv, "all") && VarLocalAuth&LOCAL_AUTH) diff --git a/usr.sbin/ppp/defs.c b/usr.sbin/ppp/defs.c index 08937e68ab2..f73dec96f9d 100644 --- a/usr.sbin/ppp/defs.c +++ b/usr.sbin/ppp/defs.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: defs.c,v 1.4 1997/12/24 09:30:28 brian Exp $ + * $Id: defs.c,v 1.5 1997/12/27 13:45:18 brian Exp $ */ #include <sys/param.h> @@ -100,7 +100,7 @@ GetShortHost() } void -DropClient() +DropClient(int verbose) { FILE *oVarTerm; @@ -111,6 +111,7 @@ DropClient() fclose(oVarTerm); close(netfd); netfd = -1; - LogPrintf(LogPHASE, "Client connection closed.\n"); + if (verbose) + LogPrintf(LogPHASE, "Client connection dropped.\n"); } } diff --git a/usr.sbin/ppp/defs.h b/usr.sbin/ppp/defs.h index 7d3e846dc39..afeeeb95130 100644 --- a/usr.sbin/ppp/defs.h +++ b/usr.sbin/ppp/defs.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: defs.h,v 1.1 1997/11/23 20:27:33 brian Exp $ + * $Id: defs.h,v 1.2 1997/12/27 13:45:19 brian Exp $ * * TODO: */ @@ -92,4 +92,4 @@ extern void SetLabel(const char *); extern const char *GetLabel(void); extern void randinit(void); extern int GetShortHost(void); -extern void DropClient(void); +extern void DropClient(int); diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c index 3b81eecb4de..cbb777e61c5 100644 --- a/usr.sbin/ppp/ipcp.c +++ b/usr.sbin/ppp/ipcp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ipcp.c,v 1.8 1997/12/24 09:30:35 brian Exp $ + * $Id: ipcp.c,v 1.9 1997/12/27 13:45:19 brian Exp $ * * TODO: * o More RFC1772 backwoard compatibility @@ -153,7 +153,10 @@ ReportIpcpStatus(struct cmdargs const *arg) fprintf(VarTerm, "Defaults:\n"); fprintf(VarTerm, " My Address: %s/%d\n", inet_ntoa(DefMyAddress.ipaddr), DefMyAddress.width); - fprintf(VarTerm, " His Address: %s/%d\n", + if (iplist_isvalid(&DefHisChoice)) + fprintf(VarTerm, " His Address: %s\n", DefHisChoice.src); + else + fprintf(VarTerm, " His Address: %s/%d\n", inet_ntoa(DefHisAddress.ipaddr), DefHisAddress.width); if (HaveTriggerAddress) fprintf(VarTerm, " Negotiation(trigger): %s\n", inet_ntoa(TriggerAddress)); diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index 8d8b0fa96c1..45565e4a646 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: main.c,v 1.7 1997/12/24 09:30:41 brian Exp $ + * $Id: main.c,v 1.8 1997/12/27 13:45:20 brian Exp $ * * TODO: * o Add commands for traffic summary, version display, etc. @@ -183,7 +183,7 @@ TtyOldMode() void Cleanup(int excode) { - DropClient(); + DropClient(1); ServerClose(); OsInterfaceDown(1); HangupModem(1); @@ -535,12 +535,15 @@ main(int argc, char **argv) close(2); if (mode & MODE_DIRECT) + /* fd 0 gets used by OpenModem in DIRECT mode */ TtyInit(1); else if (mode & MODE_DAEMON) { setsid(); close(0); } } else { + close(0); + close(2); TtyInit(0); TtyCommandMode(1); } @@ -626,8 +629,10 @@ ReadTty(void) if (n) DecodeCommand(linebuff, n, IsInteractive(0) ? NULL : "Client"); Prompt(); - } else if (n <= 0) - DropClient(); + } else if (n <= 0) { + LogPrintf(LogPHASE, "Client connection closed.\n"); + DropClient(0); + } return; } diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c index 853406512f5..7b9cc293341 100644 --- a/usr.sbin/ppp/route.c +++ b/usr.sbin/ppp/route.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: route.c,v 1.8 1997/12/24 09:30:46 brian Exp $ + * $Id: route.c,v 1.9 1997/12/27 13:45:21 brian Exp $ * */ @@ -307,7 +307,8 @@ Index2Nam(int idx) static int nifs, debug_done; if (!nifs) { - int mib[6], needed, len; + int mib[6], len; + size_t needed; char *buf, *ptr, *end; struct sockaddr_dl *dl; struct if_msghdr *ifm; @@ -371,7 +372,7 @@ ShowRoute(struct cmdargs const *arg) struct rt_msghdr *rtm; struct sockaddr *sa_dst, *sa_gw, *sa_mask; char *sp, *ep, *cp, *wp; - int needed; + size_t needed; int mib[6]; if (!VarTerm) @@ -441,7 +442,8 @@ DeleteIfRoutes(int all) struct rt_msghdr *rtm; struct sockaddr *sa; struct in_addr sa_dst, sa_none; - int needed, pass; + int pass; + size_t needed; char *sp, *cp, *ep; int mib[6]; |