summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-12-27 13:45:57 +0000
committerbrian <brian@FreeBSD.org>1997-12-27 13:45:57 +0000
commitddf3da84955259f875ffc03f9b8945fb9e36d3a5 (patch)
tree29676590de1cf3ab7926a067f5898dde1345e653
parentd03808004927d9310c50fb5885b4908a0d39c340 (diff)
downloadFreeBSD-src-ddf3da84955259f875ffc03f9b8945fb9e36d3a5.zip
FreeBSD-src-ddf3da84955259f875ffc03f9b8945fb9e36d3a5.tar.gz
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().
-rw-r--r--usr.sbin/ppp/command.c4
-rw-r--r--usr.sbin/ppp/defs.c7
-rw-r--r--usr.sbin/ppp/defs.h4
-rw-r--r--usr.sbin/ppp/ipcp.c7
-rw-r--r--usr.sbin/ppp/main.c13
-rw-r--r--usr.sbin/ppp/route.c10
6 files changed, 28 insertions, 17 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index 76c686b..dc4f9cf 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.118 1997/12/24 09:28:54 brian Exp $
+ * $Id: command.c,v 1.119 1997/12/27 07:22:12 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 b23d7d9c..7ef92c3 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.7 1997/12/23 22:38:53 brian Exp $
+ * $Id: defs.c,v 1.8 1997/12/24 09:28:56 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 164c88e..da64229 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.27 1997/11/18 00:19:31 brian Exp $
+ * $Id: defs.h,v 1.28 1997/11/22 03:37:29 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 c3b048a..f85fbc9 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.44 1997/12/24 09:28:11 brian Exp $
+ * $Id: ipcp.c,v 1.45 1997/12/24 09:29:02 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 7aa9dca..67e7c7e 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.110 1997/12/22 02:28:18 brian Exp $
+ * $Id: main.c,v 1.111 1997/12/24 09:29:06 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 7d4daf1..dc00dbc 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.34 1997/12/17 21:22:05 brian Exp $
+ * $Id: route.c,v 1.35 1997/12/24 09:29:12 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];
OpenPOWER on IntegriCloud