Deleted Added
full compact
command.c (50479) command.c (50867)
1/*
2 * PPP User command processing module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
1/*
2 * PPP User command processing module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
20 * $FreeBSD: head/usr.sbin/ppp/command.c 50479 1999-08-28 01:35:59Z peter $
20 * $FreeBSD: head/usr.sbin/ppp/command.c 50867 1999-09-04 00:00:21Z brian $
21 *
22 */
23#include <sys/param.h>
24#include <netinet/in_systm.h>
25#include <netinet/in.h>
26#include <netinet/ip.h>
27#include <arpa/inet.h>
28#include <sys/socket.h>

--- 88 unchanged lines hidden (view full) ---

117#define VAR_CBCP 25
118#define VAR_CHOKED 26
119#define VAR_SENDPIPE 27
120#define VAR_RECVPIPE 28
121#define VAR_RADIUS 29
122#define VAR_CD 30
123#define VAR_PARITY 31
124#define VAR_CRTSCTS 32
21 *
22 */
23#include <sys/param.h>
24#include <netinet/in_systm.h>
25#include <netinet/in.h>
26#include <netinet/ip.h>
27#include <arpa/inet.h>
28#include <sys/socket.h>

--- 88 unchanged lines hidden (view full) ---

117#define VAR_CBCP 25
118#define VAR_CHOKED 26
119#define VAR_SENDPIPE 27
120#define VAR_RECVPIPE 28
121#define VAR_RADIUS 29
122#define VAR_CD 30
123#define VAR_PARITY 31
124#define VAR_CRTSCTS 32
125#define VAR_URGENTPORTS 33
125
126/* ``accept|deny|disable|enable'' masks */
127#define NEG_HISMASK (1)
128#define NEG_MYMASK (2)
129
130/* ``accept|deny|disable|enable'' values */
131#define NEG_ACFCOMP 40
132#define NEG_CHAP05 41

--- 1237 unchanged lines hidden (view full) ---

1370
1371 return 0;
1372}
1373
1374static int
1375SetVariable(struct cmdargs const *arg)
1376{
1377 long long_val, param = (long)arg->cmd->args;
126
127/* ``accept|deny|disable|enable'' masks */
128#define NEG_HISMASK (1)
129#define NEG_MYMASK (2)
130
131/* ``accept|deny|disable|enable'' values */
132#define NEG_ACFCOMP 40
133#define NEG_CHAP05 41

--- 1237 unchanged lines hidden (view full) ---

1371
1372 return 0;
1373}
1374
1375static int
1376SetVariable(struct cmdargs const *arg)
1377{
1378 long long_val, param = (long)arg->cmd->args;
1378 int mode, dummyint;
1379 int mode, dummyint, f;
1379 const char *argp;
1380 struct datalink *cx = arg->cx; /* LOCAL_CX uses this */
1381 const char *err = NULL;
1382 struct link *l = command_ChooseLink(arg); /* LOCAL_CX_OPT uses this */
1383 struct in_addr dummyaddr, *addr;
1384
1385 if (arg->argc > arg->argn)
1386 argp = arg->argv[arg->argn];

--- 395 unchanged lines hidden (view full) ---

1782 physical_SetRtsCts(arg->cx->physical, 1);
1783 else if (strcasecmp(argp, "off") == 0)
1784 physical_SetRtsCts(arg->cx->physical, 0);
1785 else {
1786 err = "RTS/CTS value must be on or off\n";
1787 log_Printf(LogWARN, err);
1788 }
1789 break;
1380 const char *argp;
1381 struct datalink *cx = arg->cx; /* LOCAL_CX uses this */
1382 const char *err = NULL;
1383 struct link *l = command_ChooseLink(arg); /* LOCAL_CX_OPT uses this */
1384 struct in_addr dummyaddr, *addr;
1385
1386 if (arg->argc > arg->argn)
1387 argp = arg->argv[arg->argn];

--- 395 unchanged lines hidden (view full) ---

1783 physical_SetRtsCts(arg->cx->physical, 1);
1784 else if (strcasecmp(argp, "off") == 0)
1785 physical_SetRtsCts(arg->cx->physical, 0);
1786 else {
1787 err = "RTS/CTS value must be on or off\n";
1788 log_Printf(LogWARN, err);
1789 }
1790 break;
1791
1792 case VAR_URGENTPORTS:
1793 if (arg->argn == arg->argc)
1794 ipcp_ClearUrgentPorts(&arg->bundle->ncp.ipcp);
1795 else for (f = arg->argn; f < arg->argc; f++)
1796 if (*arg->argv[f] == '+')
1797 ipcp_AddUrgentPort(&arg->bundle->ncp.ipcp, atoi(arg->argv[f] + 1));
1798 else if (*arg->argv[f] == '-')
1799 ipcp_RemoveUrgentPort(&arg->bundle->ncp.ipcp, atoi(arg->argv[f] + 1));
1800 else {
1801 if (f == arg->argn)
1802 ipcp_ClearUrgentPorts(&arg->bundle->ncp.ipcp);
1803 ipcp_AddUrgentPort(&arg->bundle->ncp.ipcp, atoi(arg->argv[f]));
1804 }
1805 break;
1790 }
1791
1792 return err ? 1 : 0;
1793}
1794
1795static struct cmdtab const SetCommands[] = {
1796 {"accmap", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
1797 "accmap value", "set accmap hex-value", (const void *)VAR_ACCMAP},
1798 {"authkey", "key", SetVariable, LOCAL_AUTH,
1799 "authentication key", "set authkey|key key", (const void *)VAR_AUTHKEY},
1800 {"authname", NULL, SetVariable, LOCAL_AUTH,
1801 "authentication name", "set authname name", (const void *)VAR_AUTHNAME},
1802 {"autoload", NULL, SetVariable, LOCAL_AUTH,
1803 "auto link [de]activation", "set autoload maxtime maxload mintime minload",
1804 (const void *)VAR_AUTOLOAD},
1806 }
1807
1808 return err ? 1 : 0;
1809}
1810
1811static struct cmdtab const SetCommands[] = {
1812 {"accmap", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
1813 "accmap value", "set accmap hex-value", (const void *)VAR_ACCMAP},
1814 {"authkey", "key", SetVariable, LOCAL_AUTH,
1815 "authentication key", "set authkey|key key", (const void *)VAR_AUTHKEY},
1816 {"authname", NULL, SetVariable, LOCAL_AUTH,
1817 "authentication name", "set authname name", (const void *)VAR_AUTHNAME},
1818 {"autoload", NULL, SetVariable, LOCAL_AUTH,
1819 "auto link [de]activation", "set autoload maxtime maxload mintime minload",
1820 (const void *)VAR_AUTOLOAD},
1821 {"bandwidth", NULL, mp_SetDatalinkBandwidth, LOCAL_AUTH | LOCAL_CX,
1822 "datalink bandwidth", "set bandwidth value"},
1805 {"callback", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
1806 "callback control", "set callback [none|auth|cbcp|"
1807 "E.164 *|number[,number]...]...", (const void *)VAR_CALLBACK},
1808 {"cbcp", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
1809 "CBCP control", "set cbcp [*|phone[,phone...] [delay [timeout]]]",
1810 (const void *)VAR_CBCP},
1811 {"ccpretry", "ccpretries", SetVariable, LOCAL_AUTH | LOCAL_CX_OPT,
1812 "CCP retries", "set ccpretry value [attempts]", (const void *)VAR_CCPRETRY},

--- 75 unchanged lines hidden (view full) ---

1888 {"server", "socket", SetServer, LOCAL_AUTH,
1889 "server port", "set server|socket TcpPort|LocalName|none password [mask]"},
1890 {"speed", NULL, SetModemSpeed, LOCAL_AUTH | LOCAL_CX,
1891 "physical speed", "set speed value|sync"},
1892 {"stopped", NULL, SetStoppedTimeout, LOCAL_AUTH | LOCAL_CX,
1893 "STOPPED timeouts", "set stopped [LCPseconds [CCPseconds]]"},
1894 {"timeout", NULL, SetVariable, LOCAL_AUTH, "Idle timeout",
1895 "set timeout idletime", (const void *)VAR_IDLETIMEOUT},
1823 {"callback", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
1824 "callback control", "set callback [none|auth|cbcp|"
1825 "E.164 *|number[,number]...]...", (const void *)VAR_CALLBACK},
1826 {"cbcp", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
1827 "CBCP control", "set cbcp [*|phone[,phone...] [delay [timeout]]]",
1828 (const void *)VAR_CBCP},
1829 {"ccpretry", "ccpretries", SetVariable, LOCAL_AUTH | LOCAL_CX_OPT,
1830 "CCP retries", "set ccpretry value [attempts]", (const void *)VAR_CCPRETRY},

--- 75 unchanged lines hidden (view full) ---

1906 {"server", "socket", SetServer, LOCAL_AUTH,
1907 "server port", "set server|socket TcpPort|LocalName|none password [mask]"},
1908 {"speed", NULL, SetModemSpeed, LOCAL_AUTH | LOCAL_CX,
1909 "physical speed", "set speed value|sync"},
1910 {"stopped", NULL, SetStoppedTimeout, LOCAL_AUTH | LOCAL_CX,
1911 "STOPPED timeouts", "set stopped [LCPseconds [CCPseconds]]"},
1912 {"timeout", NULL, SetVariable, LOCAL_AUTH, "Idle timeout",
1913 "set timeout idletime", (const void *)VAR_IDLETIMEOUT},
1914 {"urgent", NULL, SetVariable, LOCAL_AUTH,
1915 "urgent ports", "set urgent [+|-]port...", (const void *)VAR_URGENTPORTS},
1896 {"vj", NULL, ipcp_vjset, LOCAL_AUTH,
1897 "vj values", "set vj slots|slotcomp [value]"},
1916 {"vj", NULL, ipcp_vjset, LOCAL_AUTH,
1917 "vj values", "set vj slots|slotcomp [value]"},
1898 {"bandwidth", NULL, mp_SetDatalinkBandwidth, LOCAL_AUTH | LOCAL_CX,
1899 "datalink bandwidth", "set bandwidth value"},
1900 {"help", "?", HelpCommand, LOCAL_AUTH | LOCAL_NO_AUTH,
1901 "Display this message", "set help|? [command]", SetCommands},
1902 {NULL, NULL, NULL},
1903};
1904
1905static int
1906SetCommand(struct cmdargs const *arg)
1907{

--- 687 unchanged lines hidden ---
1918 {"help", "?", HelpCommand, LOCAL_AUTH | LOCAL_NO_AUTH,
1919 "Display this message", "set help|? [command]", SetCommands},
1920 {NULL, NULL, NULL},
1921};
1922
1923static int
1924SetCommand(struct cmdargs const *arg)
1925{

--- 687 unchanged lines hidden ---