summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/ppp/ppp/README.nat6
-rw-r--r--usr.sbin/ppp/ppp/alias.c4
-rw-r--r--usr.sbin/ppp/ppp/alias.h4
-rw-r--r--usr.sbin/ppp/ppp/alias_db.c4
-rw-r--r--usr.sbin/ppp/ppp/alias_ftp.c4
-rw-r--r--usr.sbin/ppp/ppp/alias_irc.c4
-rw-r--r--usr.sbin/ppp/ppp/alias_local.h4
-rw-r--r--usr.sbin/ppp/ppp/alias_proxy.c4
-rw-r--r--usr.sbin/ppp/ppp/alias_util.c4
-rw-r--r--usr.sbin/ppp/ppp/bundle.c13
-rw-r--r--usr.sbin/ppp/ppp/bundle.h3
-rw-r--r--usr.sbin/ppp/ppp/ccp.c7
-rw-r--r--usr.sbin/ppp/ppp/chat.c6
-rw-r--r--usr.sbin/ppp/ppp/command.c93
-rw-r--r--usr.sbin/ppp/ppp/command.h3
-rw-r--r--usr.sbin/ppp/ppp/defs.c19
-rw-r--r--usr.sbin/ppp/ppp/defs.h3
-rw-r--r--usr.sbin/ppp/ppp/iface.c4
-rw-r--r--usr.sbin/ppp/ppp/lcp.c4
-rw-r--r--usr.sbin/ppp/ppp/log.c8
-rw-r--r--usr.sbin/ppp/ppp/log.h3
-rw-r--r--usr.sbin/ppp/ppp/nat_cmd.c4
-rw-r--r--usr.sbin/ppp/ppp/nat_cmd.h4
-rw-r--r--usr.sbin/ppp/ppp/ppp.8.m417
-rw-r--r--usr.sbin/ppp/ppp/systems.h4
25 files changed, 147 insertions, 86 deletions
diff --git a/usr.sbin/ppp/ppp/README.nat b/usr.sbin/ppp/ppp/README.nat
index 562879f7f15..7c1c06270bc 100644
--- a/usr.sbin/ppp/ppp/README.nat
+++ b/usr.sbin/ppp/ppp/README.nat
@@ -1,4 +1,4 @@
-Copyright (c) 2001 Charles Mott <cmott@scientech.com>
+Copyright (c) 2001 Charles Mott <cm@linktel.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -22,7 +22,7 @@ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
- $OpenBSD: README.nat,v 1.1 2001/06/07 09:32:54 brian Exp $
+ $OpenBSD: README.nat,v 1.2 2001/11/23 11:17:03 brian Exp $
User PPP NAT (Packet Aliasing)
@@ -272,7 +272,7 @@ host address, outgoing NAT and incoming de-NATing).
5. Authors / Acknowledgements
-Charles Mott (cmott@srv.net) <versions 1.0 - 1.8, 2.0, 2.1>
+Charles Mott (cm@linktel.net) <versions 1.0 - 1.8, 2.0, 2.1>
Eivind Eklund (perhaps@yes.no) <versions 1.8b - 1.9, new ppp commands>
Listed below, in chronological order, are individuals who have provided
diff --git a/usr.sbin/ppp/ppp/alias.c b/usr.sbin/ppp/ppp/alias.c
index caef199faaa..2a2ef3730bf 100644
--- a/usr.sbin/ppp/ppp/alias.c
+++ b/usr.sbin/ppp/ppp/alias.c
@@ -1,7 +1,7 @@
/* -*- mode: c; tab-width: 8; c-basic-indent: 4; -*- */
/*-
- * Copyright (c) 2001 Charles Mott <cmott@scientech.com>
+ * Copyright (c) 2001 Charles Mott <cm@linktel.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: alias.c,v 1.16 2001/09/13 10:32:54 brian Exp $
+ * $OpenBSD: alias.c,v 1.17 2001/11/23 11:17:03 brian Exp $
*/
/*
diff --git a/usr.sbin/ppp/ppp/alias.h b/usr.sbin/ppp/ppp/alias.h
index fbd1aeb2edf..9f7e7313096 100644
--- a/usr.sbin/ppp/ppp/alias.h
+++ b/usr.sbin/ppp/ppp/alias.h
@@ -1,7 +1,7 @@
/* lint -save -library Flexelint comment for external headers */
/*-
- * Copyright (c) 2001 Charles Mott <cmott@scientech.com>
+ * Copyright (c) 2001 Charles Mott <cm@linktel.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: alias.h,v 1.10 2001/06/07 09:32:55 brian Exp $
+ * $OpenBSD: alias.h,v 1.11 2001/11/23 11:17:03 brian Exp $
*/
/*-
diff --git a/usr.sbin/ppp/ppp/alias_db.c b/usr.sbin/ppp/ppp/alias_db.c
index 59ff0ceb9fc..438f66a09f6 100644
--- a/usr.sbin/ppp/ppp/alias_db.c
+++ b/usr.sbin/ppp/ppp/alias_db.c
@@ -1,7 +1,7 @@
/* -*- mode: c; tab-width: 8; c-basic-indent: 4; -*- */
/*-
- * Copyright (c) 2001 Charles Mott <cmott@scientech.com>
+ * Copyright (c) 2001 Charles Mott <cm@linktel.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: alias_db.c,v 1.19 2001/08/21 04:09:15 brian Exp $
+ * $OpenBSD: alias_db.c,v 1.20 2001/11/23 11:17:03 brian Exp $
*/
/*
diff --git a/usr.sbin/ppp/ppp/alias_ftp.c b/usr.sbin/ppp/ppp/alias_ftp.c
index b327e1a1c5a..ffd06d9967f 100644
--- a/usr.sbin/ppp/ppp/alias_ftp.c
+++ b/usr.sbin/ppp/ppp/alias_ftp.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2001 Charles Mott <cmott@scientech.com>
+ * Copyright (c) 2001 Charles Mott <cm@linktel.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: alias_ftp.c,v 1.12 2001/10/24 10:01:07 brian Exp $
+ * $OpenBSD: alias_ftp.c,v 1.13 2001/11/23 11:17:03 brian Exp $
*/
/*
diff --git a/usr.sbin/ppp/ppp/alias_irc.c b/usr.sbin/ppp/ppp/alias_irc.c
index 17a7f5ef319..c8bbe199839 100644
--- a/usr.sbin/ppp/ppp/alias_irc.c
+++ b/usr.sbin/ppp/ppp/alias_irc.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2001 Charles Mott <cmott@scientech.com>
+ * Copyright (c) 2001 Charles Mott <cm@linktel.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: alias_irc.c,v 1.9 2001/09/13 10:32:56 brian Exp $
+ * $OpenBSD: alias_irc.c,v 1.10 2001/11/23 11:17:03 brian Exp $
*/
/* Alias_irc.c intercepts packages contain IRC CTCP commands, and
diff --git a/usr.sbin/ppp/ppp/alias_local.h b/usr.sbin/ppp/ppp/alias_local.h
index edd86c7526e..d4c5d9e6b30 100644
--- a/usr.sbin/ppp/ppp/alias_local.h
+++ b/usr.sbin/ppp/ppp/alias_local.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2001 Charles Mott <cmott@scientech.com>
+ * Copyright (c) 2001 Charles Mott <cm@linktel.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: alias_local.h,v 1.12 2001/06/07 09:32:55 brian Exp $
+ * $OpenBSD: alias_local.h,v 1.13 2001/11/23 11:17:03 brian Exp $
*/
/*
diff --git a/usr.sbin/ppp/ppp/alias_proxy.c b/usr.sbin/ppp/ppp/alias_proxy.c
index f50bad531f9..e589e1aebf9 100644
--- a/usr.sbin/ppp/ppp/alias_proxy.c
+++ b/usr.sbin/ppp/ppp/alias_proxy.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2001 Charles Mott <cmott@scientech.com>
+ * Copyright (c) 2001 Charles Mott <cm@linktel.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: alias_proxy.c,v 1.9 2001/06/07 09:32:55 brian Exp $
+ * $OpenBSD: alias_proxy.c,v 1.10 2001/11/23 11:17:03 brian Exp $
*/
/* file: alias_proxy.c
diff --git a/usr.sbin/ppp/ppp/alias_util.c b/usr.sbin/ppp/ppp/alias_util.c
index fc9cf7a772a..0a609b16901 100644
--- a/usr.sbin/ppp/ppp/alias_util.c
+++ b/usr.sbin/ppp/ppp/alias_util.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2001 Charles Mott <cmott@scientech.com>
+ * Copyright (c) 2001 Charles Mott <cm@linktel.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: alias_util.c,v 1.5 2001/06/07 09:32:55 brian Exp $
+ * $OpenBSD: alias_util.c,v 1.6 2001/11/23 11:17:03 brian Exp $
*/
/*
diff --git a/usr.sbin/ppp/ppp/bundle.c b/usr.sbin/ppp/ppp/bundle.c
index 5a8ccb34870..82517444018 100644
--- a/usr.sbin/ppp/ppp/bundle.c
+++ b/usr.sbin/ppp/ppp/bundle.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: bundle.c,v 1.61 2001/10/24 10:01:10 brian Exp $
+ * $OpenBSD: bundle.c,v 1.62 2001/11/23 11:17:03 brian Exp $
*/
#include <sys/param.h>
@@ -1034,7 +1034,7 @@ bundle_ShowStatus(struct cmdargs const *arg)
arg->bundle->iface->name, arg->bundle->bandwidth);
if (arg->bundle->upat) {
- int secs = time(NULL) - arg->bundle->upat;
+ int secs = bundle_Uptime(arg->bundle);
prompt_Printf(arg->prompt, ", up time %d:%02d:%02d", secs / 3600,
(secs / 60) % 60, secs % 60);
@@ -1925,3 +1925,12 @@ bundle_ChangedPID(struct bundle *bundle)
ioctl(bundle->dev.fd, TUNSIFPID, 0);
#endif
}
+
+int
+bundle_Uptime(struct bundle *bundle)
+{
+ if (bundle->upat)
+ return time(NULL) - bundle->upat;
+
+ return 0;
+}
diff --git a/usr.sbin/ppp/ppp/bundle.h b/usr.sbin/ppp/ppp/bundle.h
index e89ac659537..19404cd96a1 100644
--- a/usr.sbin/ppp/ppp/bundle.h
+++ b/usr.sbin/ppp/ppp/bundle.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: bundle.h,v 1.22 2001/08/19 23:22:17 brian Exp $
+ * $OpenBSD: bundle.h,v 1.23 2001/11/23 11:17:03 brian Exp $
*/
#define PHASE_DEAD 0 /* Link is dead */
@@ -192,3 +192,4 @@ extern void bundle_AutoAdjust(struct bundle *, int, int);
extern int bundle_WantAutoloadTimer(struct bundle *);
extern void bundle_ChangedPID(struct bundle *);
extern void bundle_Notify(struct bundle *, char);
+extern int bundle_Uptime(struct bundle *);
diff --git a/usr.sbin/ppp/ppp/ccp.c b/usr.sbin/ppp/ppp/ccp.c
index 0d2e64f5949..a8331ed427d 100644
--- a/usr.sbin/ppp/ppp/ccp.c
+++ b/usr.sbin/ppp/ppp/ccp.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: ccp.c,v 1.24 2001/08/19 23:22:17 brian Exp $
+ * $OpenBSD: ccp.c,v 1.25 2001/11/23 11:17:03 brian Exp $
*/
#include <sys/param.h>
@@ -134,8 +134,11 @@ protoname(int proto)
};
if (proto < 0 || proto > sizeof cftypes / sizeof *cftypes ||
- cftypes[proto] == NULL)
+ cftypes[proto] == NULL) {
+ if (proto == -1)
+ return "none";
return HexStr(proto, NULL, 0);
+ }
return cftypes[proto];
}
diff --git a/usr.sbin/ppp/ppp/chat.c b/usr.sbin/ppp/ppp/chat.c
index 7bb42098396..de50d212a7f 100644
--- a/usr.sbin/ppp/ppp/chat.c
+++ b/usr.sbin/ppp/ppp/chat.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: chat.c,v 1.16 2001/08/19 23:22:17 brian Exp $
+ * $OpenBSD: chat.c,v 1.17 2001/11/23 11:17:03 brian Exp $
*/
#include <sys/param.h>
@@ -716,8 +716,6 @@ ExecStr(struct physical *physical, char *command, char *out, int olen)
*out = '\0';
return;
}
- command_Expand(argv, argc, (char const *const *)vector,
- physical->dl->bundle, 0, getpid());
if (pipe(fids) < 0) {
log_Printf(LogCHAT, "Unable to create pipe in ExecStr: %s\n",
@@ -726,6 +724,8 @@ ExecStr(struct physical *physical, char *command, char *out, int olen)
return;
}
if ((pid = fork()) == 0) {
+ command_Expand(argv, argc, (char const *const *)vector,
+ physical->dl->bundle, 0, getpid());
close(fids[0]);
timer_TermService();
if (fids[1] == STDIN_FILENO)
diff --git a/usr.sbin/ppp/ppp/command.c b/usr.sbin/ppp/ppp/command.c
index 56c5b59849c..36929e07469 100644
--- a/usr.sbin/ppp/ppp/command.c
+++ b/usr.sbin/ppp/ppp/command.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: command.c,v 1.70 2001/10/24 10:01:12 brian Exp $
+ * $OpenBSD: command.c,v 1.71 2001/11/23 11:17:03 brian Exp $
*/
#include <sys/param.h>
@@ -255,22 +255,9 @@ HelpCommand(struct cmdargs const *arg)
static int
IdentCommand(struct cmdargs const *arg)
{
- int f, max, n, pos;
-
- *arg->cx->physical->link.lcp.cfg.ident = '\0';
- max = sizeof arg->cx->physical->link.lcp.cfg.ident;
-
- for (pos = 0, f = arg->argn; f < arg->argc && pos < max; f++) {
- n = snprintf(arg->cx->physical->link.lcp.cfg.ident + pos, max - pos,
- "%s%s", f == arg->argn ? "" : " ", arg->argv[f]);
- if (n < 0) {
- arg->cx->physical->link.lcp.cfg.ident[pos] = '\0';
- break;
- }
- if ((pos += n) >= max)
- break;
- }
-
+ Concatinate(arg->cx->physical->link.lcp.cfg.ident,
+ sizeof arg->cx->physical->link.lcp.cfg.ident,
+ arg->argc - arg->argn, arg->argv + arg->argn);
return 0;
}
@@ -333,7 +320,7 @@ RenameCommand(struct cmdargs const *arg)
return 1;
}
-int
+static int
LoadCommand(struct cmdargs const *arg)
{
const char *err;
@@ -365,10 +352,33 @@ LoadCommand(struct cmdargs const *arg)
return 0;
}
-int
+static int
+LogCommand(struct cmdargs const *arg)
+{
+ char buf[LINE_LEN];
+
+ if (arg->argn < arg->argc) {
+ char *argv[MAXARGS];
+ int argc = arg->argc - arg->argn;
+
+ if (argc >= sizeof argv / sizeof argv[0]) {
+ argc = sizeof argv / sizeof argv[0] - 1;
+ log_Printf(LogWARN, "Truncating log command to %d args\n", argc);
+ }
+ command_Expand(argv, argc, arg->argv + arg->argn, arg->bundle, 1, getpid());
+ Concatinate(buf, sizeof buf, argc, (const char *const *)argv);
+ log_Printf(LogLOG, "%s\n", buf);
+ command_Free(argc, argv);
+ return 0;
+ }
+
+ return -1;
+}
+
+static int
SaveCommand(struct cmdargs const *arg)
{
- log_Printf(LogWARN, "save command is not implemented (yet).\n");
+ log_Printf(LogWARN, "save command is not yet implemented.\n");
return 1;
}
@@ -452,7 +462,8 @@ void
command_Expand(char **nargv, int argc, char const *const *oargv,
struct bundle *bundle, int inc0, pid_t pid)
{
- int arg;
+ int arg, secs;
+ char buf[20];
char pidstr[12];
if (inc0)
@@ -494,10 +505,25 @@ command_Expand(char **nargv, int argc, char const *const *oargv,
inet_ntoa(bundle->ncp.ipcp.ns.dns[1]));
nargv[arg] = subst(nargv[arg], "VERSION", Version);
nargv[arg] = subst(nargv[arg], "COMPILATIONDATE", __DATE__);
+
+ secs = bundle_Uptime(bundle);
+ snprintf(buf, sizeof buf, "%d:%02d:%02d", secs / 3600, (secs / 60) % 60,
+ secs % 60);
+ nargv[arg] = subst(nargv[arg], "UPTIME", buf);
}
nargv[arg] = NULL;
}
+void
+command_Free(int argc, char **argv)
+{
+ while (argc) {
+ free(*argv);
+ argc--;
+ argv++;
+ }
+}
+
static int
ShellCommand(struct cmdargs const *arg, int bg)
{
@@ -750,6 +776,8 @@ static struct cmdtab const Commands[] = {
"Link specific commands", "link name command ..."},
{"load", NULL, LoadCommand, LOCAL_AUTH | LOCAL_CX_OPT,
"Load settings", "load [system ...]"},
+ {"log", NULL, LogCommand, LOCAL_AUTH | LOCAL_CX_OPT,
+ "log information", "log word ..."},
#ifndef NONAT
{"nat", "alias", RunListCommand, LOCAL_AUTH,
"NAT control", "nat option yes|no", NatCommands},
@@ -3046,8 +3074,8 @@ static int
SetProcTitle(struct cmdargs const *arg)
{
static char title[LINE_LEN];
- char *argv[MAXARGS], *ptr;
- int len, remaining, f, argc = arg->argc - arg->argn;
+ char *argv[MAXARGS];
+ int argc = arg->argc - arg->argn;
if (arg->argc == arg->argn) {
SetTitle(NULL);
@@ -3059,24 +3087,9 @@ SetProcTitle(struct cmdargs const *arg)
log_Printf(LogWARN, "Truncating proc title to %d args\n", argc);
}
command_Expand(argv, argc, arg->argv + arg->argn, arg->bundle, 1, getpid());
-
- ptr = title;
- remaining = sizeof title - 1;
- for (f = 0; f < argc && remaining; f++) {
- if (f) {
- *ptr++ = ' ';
- remaining--;
- }
- len = strlen(argv[f]);
- if (len > remaining)
- len = remaining;
- memcpy(ptr, argv[f], len);
- remaining -= len;
- ptr += len;
- }
- *ptr = '\0';
-
+ Concatinate(title, sizeof title, argc, (const char *const *)argv);
SetTitle(title);
+ command_Free(argc, argv);
return 0;
}
diff --git a/usr.sbin/ppp/ppp/command.h b/usr.sbin/ppp/ppp/command.h
index 03f153c5253..25cbbafcebb 100644
--- a/usr.sbin/ppp/ppp/command.h
+++ b/usr.sbin/ppp/ppp/command.h
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: command.h,v 1.8 2001/06/13 21:33:40 brian Exp $
+ * $OpenBSD: command.h,v 1.9 2001/11/23 11:17:03 brian Exp $
*/
struct cmdtab;
@@ -63,6 +63,7 @@ extern const char Version[];
extern void command_Expand(char **, int, char const *const *, struct bundle *,
int, pid_t);
+extern void command_Free(int, char **);
extern int command_Expand_Interpret(char *, int, char *vector[MAXARGS], int);
extern int command_Interpret(char *, int, char *vector[MAXARGS]);
extern void command_Run(struct bundle *, int, char const *const *,
diff --git a/usr.sbin/ppp/ppp/defs.c b/usr.sbin/ppp/ppp/defs.c
index 55e5d5f0b61..5548f8bcec5 100644
--- a/usr.sbin/ppp/ppp/defs.c
+++ b/usr.sbin/ppp/ppp/defs.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: defs.c,v 1.20 2001/06/15 13:58:16 brian Exp $
+ * $OpenBSD: defs.c,v 1.21 2001/11/23 11:17:03 brian Exp $
*/
@@ -387,3 +387,20 @@ zerofdset(fd_set *s)
{
memset(s, '\0', howmany(getdtablesize(), NFDBITS) * sizeof (fd_mask));
}
+
+void
+Concatinate(char *buf, size_t sz, int argc, const char *const *argv)
+{
+ int i, n, pos;
+
+ *buf = '\0';
+ for (pos = i = 0; i < argc; i++) {
+ n = snprintf(buf + pos, sz - pos, "%s%s", i ? " " : "", argv[i]);
+ if (n < 0) {
+ buf[pos] = '\0';
+ break;
+ }
+ if ((pos += n) >= sz)
+ break;
+ }
+}
diff --git a/usr.sbin/ppp/ppp/defs.h b/usr.sbin/ppp/ppp/defs.h
index 8a4359c454c..f209e2de761 100644
--- a/usr.sbin/ppp/ppp/defs.h
+++ b/usr.sbin/ppp/ppp/defs.h
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: defs.h,v 1.21 2001/06/13 21:33:40 brian Exp $
+ * $OpenBSD: defs.h,v 1.22 2001/11/23 11:17:03 brian Exp $
*/
/* Check the following definitions for your machine environment */
@@ -134,3 +134,4 @@ extern const char *ex_desc(int);
extern void SetTitle(const char *);
extern fd_set *mkfdset(void);
extern void zerofdset(fd_set *);
+extern void Concatinate(char *, size_t, int, const char *const *);
diff --git a/usr.sbin/ppp/ppp/iface.c b/usr.sbin/ppp/ppp/iface.c
index 4c3f3694859..bf9fa9e5b36 100644
--- a/usr.sbin/ppp/ppp/iface.c
+++ b/usr.sbin/ppp/ppp/iface.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: iface.c,v 1.20 2001/08/21 11:06:04 brian Exp $
+ * $OpenBSD: iface.c,v 1.21 2001/11/23 11:17:03 brian Exp $
*/
#include <sys/param.h>
@@ -343,7 +343,7 @@ iface_addr_Add(const char *name, struct iface_addr *addr, int s)
end, ncprange_ntoa(&addr->ifa), strerror(errno));
else {
snprintf(dst, sizeof dst, "%s", ncpaddr_ntoa(&addr->peer));
- log_Printf(LogWARN, "iface add: ioctl(SIOCDIFADDR%s, %s -> %s): %s\n",
+ log_Printf(LogWARN, "iface add: ioctl(SIOCAIFADDR%s, %s -> %s): %s\n",
end, ncprange_ntoa(&addr->ifa), dst, strerror(errno));
}
}
diff --git a/usr.sbin/ppp/ppp/lcp.c b/usr.sbin/ppp/ppp/lcp.c
index 73ba00eb84a..5ebe750d552 100644
--- a/usr.sbin/ppp/ppp/lcp.c
+++ b/usr.sbin/ppp/ppp/lcp.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: lcp.c,v 1.33 2001/10/24 10:01:15 brian Exp $
+ * $OpenBSD: lcp.c,v 1.34 2001/11/23 11:17:03 brian Exp $
*/
#include <sys/param.h>
@@ -518,7 +518,7 @@ lcp_SendIdentification(struct lcp *lcp)
msg + 4);
fsm_Output(&lcp->fsm, CODE_IDENT, id++, msg, 4 + strlen(msg + 4), MB_LCPOUT);
- free(exp[0]);
+ command_Free(1, exp);
return 1;
}
diff --git a/usr.sbin/ppp/ppp/log.c b/usr.sbin/ppp/ppp/log.c
index e47db071e76..eb07284696c 100644
--- a/usr.sbin/ppp/ppp/log.c
+++ b/usr.sbin/ppp/ppp/log.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: log.c,v 1.14 2001/08/19 23:22:18 brian Exp $
+ * $OpenBSD: log.c,v 1.15 2001/11/23 11:17:03 brian Exp $
*/
#include <sys/types.h>
@@ -194,6 +194,8 @@ static int
syslogLevel(int lev)
{
switch (lev) {
+ case LogLOG:
+ return LOG_INFO;
case LogDEBUG:
case LogTIMER:
return LOG_DEBUG;
@@ -210,6 +212,8 @@ syslogLevel(int lev)
const char *
log_Name(int id)
{
+ if (id == LogLOG)
+ return "LOG";
return id < LogMIN || id > LogMAX ? "Unknown" : LogNames[id - 1];
}
@@ -261,6 +265,8 @@ log_DiscardAllLocal(u_long *mask)
int
log_IsKept(int id)
{
+ if (id == LogLOG)
+ return LOG_KEPT_SYSLOG;
if (id < LogMIN || id > LogMAX)
return 0;
if (id > LogMAXCONF)
diff --git a/usr.sbin/ppp/ppp/log.h b/usr.sbin/ppp/ppp/log.h
index e1901e35c1c..c6089ad41e4 100644
--- a/usr.sbin/ppp/ppp/log.h
+++ b/usr.sbin/ppp/ppp/log.h
@@ -23,9 +23,10 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: log.h,v 1.9 2001/08/19 23:22:18 brian Exp $
+ * $OpenBSD: log.h,v 1.10 2001/11/23 11:17:03 brian Exp $
*/
+#define LogLOG (0)
#define LogMIN (1)
#define LogASYNC (1) /* syslog(LOG_INFO, ....) */
#define LogCBCP (2)
diff --git a/usr.sbin/ppp/ppp/nat_cmd.c b/usr.sbin/ppp/ppp/nat_cmd.c
index 42784d9ae93..edcc8e90ef1 100644
--- a/usr.sbin/ppp/ppp/nat_cmd.c
+++ b/usr.sbin/ppp/ppp/nat_cmd.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2001 Charles Mott <cmott@scientech.com>
+ * Copyright (c) 2001 Charles Mott <cm@linktel.net>
* Brian Somers <brian@Awfulhak.org>
* All rights reserved.
*
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: nat_cmd.c,v 1.20 2001/08/19 23:22:18 brian Exp $
+ * $OpenBSD: nat_cmd.c,v 1.21 2001/11/23 11:17:03 brian Exp $
*/
#include <sys/param.h>
diff --git a/usr.sbin/ppp/ppp/nat_cmd.h b/usr.sbin/ppp/ppp/nat_cmd.h
index a6c42d0ebef..4df604c807e 100644
--- a/usr.sbin/ppp/ppp/nat_cmd.h
+++ b/usr.sbin/ppp/ppp/nat_cmd.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2001 Charles Mott <cmott@scientech.com>
+ * Copyright (c) 2001 Charles Mott <cm@linktel.net>
* Brian Somers <brian@Awfulhak.org>
* All rights reserved.
*
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: nat_cmd.h,v 1.7 2001/08/19 23:22:18 brian Exp $
+ * $OpenBSD: nat_cmd.h,v 1.8 2001/11/23 11:17:03 brian Exp $
*/
struct cmdargs;
diff --git a/usr.sbin/ppp/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp/ppp.8.m4
index 99bdec5782c..f25859f24e1 100644
--- a/usr.sbin/ppp/ppp/ppp.8.m4
+++ b/usr.sbin/ppp/ppp/ppp.8.m4
@@ -25,7 +25,7 @@ changecom(,)dnl
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: ppp.8.m4,v 1.3 2001/09/13 10:08:30 brian Exp $
+.\" $OpenBSD: ppp.8.m4,v 1.4 2001/11/23 11:17:03 brian Exp $
.\"
.Dd September 20, 1995
.Dt PPP 8
@@ -3541,6 +3541,8 @@ This is replaced with the current process id.
.It Li VERSION
This is replaced with the current version number of
.Nm ppp .
+.It Li UPTIME
+This is replaced with the bundle uptime in HH:MM:SS format.
.It Li USER
This is replaced with the username that has been authenticated with PAP or
CHAP.
@@ -3549,8 +3551,11 @@ This value is available irrespective of whether utmp logging is enabled.
.El
.Pp
These substitutions are also done by the
-.Dq set proctitle
-command.
+.Dq set proctitle ,
+.Dq ident
+and
+.Dq log
+commands.
.Pp
If you wish to pause
.Nm
@@ -3823,6 +3828,12 @@ or
commands,
.Nm
will not attempt to make an immediate connection.
+.It log Ar word Ns No ...
+Send the given word(s) to the log file with the prefix
+.Dq LOG: .
+Word substitutions are done as explained under the
+.Dq !bg
+command above.
.It open Op lcp|ccp|ipcp
This is the opposite of the
.Dq close
diff --git a/usr.sbin/ppp/ppp/systems.h b/usr.sbin/ppp/ppp/systems.h
index efb8281835e..a5cce1aa954 100644
--- a/usr.sbin/ppp/ppp/systems.h
+++ b/usr.sbin/ppp/ppp/systems.h
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: systems.h,v 1.6 2001/06/13 21:33:42 brian Exp $
+ * $OpenBSD: systems.h,v 1.7 2001/11/23 11:17:03 brian Exp $
*/
struct prompt;
@@ -40,6 +40,4 @@ extern FILE *OpenSecret(const char *);
extern void CloseSecret(FILE *);
extern int AllowUsers(struct cmdargs const *);
extern int AllowModes(struct cmdargs const *);
-extern int LoadCommand(struct cmdargs const *);
-extern int SaveCommand(struct cmdargs const *);
extern const char *InterpretArg(const char *, char *);