aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ppp/command.c
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>1997-06-13 03:59:36 +0000
committerBrian Somers <brian@FreeBSD.org>1997-06-13 03:59:36 +0000
commite696ee3b80a7b42e777416b9fff6fc22de5155af (patch)
tree35887272c123f68f8ccac0af76d75cdfa77c9f4a /usr.sbin/ppp/command.c
parent94b3022ec7a648df613a83b213e32e3a54898465 (diff)
Notes
Diffstat (limited to 'usr.sbin/ppp/command.c')
-rw-r--r--usr.sbin/ppp/command.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index a80866974e54f..9d413a74d8c29 100644
--- a/usr.sbin/ppp/command.c
+++ b/usr.sbin/ppp/command.c
@@ -291,7 +291,7 @@ struct cmdtab const Commands[] = {
{ "close", NULL, CloseCommand, LOCAL_AUTH,
"Close connection", "close"},
{ "delete", NULL, DeleteCommand, LOCAL_AUTH,
- "delete route", "delete ALL | dest gateway [mask]"},
+ "delete route", "delete ALL | dest [gateway [mask]]"},
{ "deny", NULL, DenyCommand, LOCAL_AUTH,
"Deny option request", "deny option .."},
{ "dial", "call", DialCommand, LOCAL_AUTH,
@@ -1316,22 +1316,25 @@ char **argv;
{
struct in_addr dest, gateway, netmask;
- if (argc >= 2) {
+ if (argc == 1 && strcasecmp(argv[0], "all") == 0)
+ DeleteIfRoutes(0);
+ else if (argc > 0 && argc < 4) {
dest = GetIpAddr(argv[0]);
- if (strcasecmp(argv[1], "HISADDR") == 0)
- gateway = IpcpInfo.his_ipaddr;
- else
- gateway = GetIpAddr(argv[1]);
- netmask.s_addr = 0;
- if (argc == 3) {
- if (inet_aton(argv[2], &netmask) == 0) {
- LogPrintf(LogWARN, "Bad netmask value.\n");
- return -1;
+ netmask.s_addr = INADDR_ANY;
+ if (argc > 1) {
+ if (strcasecmp(argv[1], "HISADDR") == 0)
+ gateway = IpcpInfo.his_ipaddr;
+ else
+ gateway = GetIpAddr(argv[1]);
+ if (argc == 3) {
+ if (inet_aton(argv[2], &netmask) == 0) {
+ LogPrintf(LogWARN, "Bad netmask value.\n");
+ return -1;
+ }
}
- }
+ } else
+ gateway.s_addr = INADDR_ANY;
OsSetRoute(RTM_DELETE, dest, gateway, netmask);
- } else if (argc == 1 && strcasecmp(argv[0], "all") == 0) {
- DeleteIfRoutes(0);
} else
return -1;