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().
This commit is contained in:
brian 1997-12-27 13:45:57 +00:00
parent 75038f611f
commit 5d0e5c05ac
6 changed files with 28 additions and 17 deletions

View File

@ -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)

View File

@ -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");
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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;
}

View File

@ -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];