2 * options.c - handles option processing for PPP.
4 * Copyright (c) 1989 Carnegie Mellon University.
7 * Redistribution and use in source and binary forms are permitted
8 * provided that the above copyright notice and this paragraph are
9 * duplicated in all such forms and that any documentation,
10 * advertising materials, and other materials related to such
11 * distribution and use acknowledge that the software was developed
12 * by Carnegie Mellon University. The name of the
13 * University may not be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 static char rcsid[] = "$Id: options.c,v 1.39 1997/07/14 03:53:34 paulus Exp $";
35 #include <sys/types.h>
37 #include <netinet/in.h>
38 #include <arpa/inet.h>
41 #include <pcap-int.h> /* XXX: To get struct pcap */
45 #include "pathnames.h"
46 #include "patchlevel.h"
59 #endif /* IPX_CHANGE */
61 #include <net/ppp-comp.h>
66 #if defined(ultrix) || defined(NeXT)
67 char *strdup __P((char *));
71 #define GIDSET_TYPE gid_t
75 * Option variables and default values.
78 int dflag = 0; /* Tell libpcap we want debugging */
80 int debug = 0; /* Debug flag */
81 int kdebugflag = 0; /* Tell kernel to print debug messages */
82 int default_device = 1; /* Using /dev/tty or equivalent */
83 char devnam[MAXPATHLEN] = "/dev/tty"; /* Device name */
84 int crtscts = 0; /* Use hardware flow control */
85 int modem = 1; /* Use modem control lines */
86 int inspeed = 0; /* Input/Output speed requested */
87 u_int32_t netmask = 0; /* IP netmask to set on interface */
88 int lockflag = 0; /* Create lock file to lock the serial dev */
89 int nodetach = 0; /* Don't detach from controlling tty */
90 char *connector = NULL; /* Script to establish physical link */
91 char *disconnector = NULL; /* Script to disestablish physical link */
92 char *welcomer = NULL; /* Script to run after phys link estab. */
93 int maxconnect = 0; /* Maximum connect time */
94 char user[MAXNAMELEN]; /* Username for PAP */
95 char passwd[MAXSECRETLEN]; /* Password for PAP */
96 int auth_required = 0; /* Peer is required to authenticate */
97 int defaultroute = 0; /* assign default route through interface */
98 int proxyarp = 0; /* Set up proxy ARP entry for peer */
99 int persist = 0; /* Reopen link after it goes down */
100 int uselogin = 0; /* Use /etc/passwd for checking PAP */
101 int lcp_echo_interval = 0; /* Interval between LCP echo-requests */
102 int lcp_echo_fails = 0; /* Tolerance to unanswered echo-requests */
103 char our_name[MAXNAMELEN]; /* Our name for authentication purposes */
104 char remote_name[MAXNAMELEN]; /* Peer's name for authentication */
105 int explicit_remote = 0; /* User specified explicit remote name */
106 int usehostname = 0; /* Use hostname for our_name */
107 int disable_defaultip = 0; /* Don't use hostname for default IP adrs */
108 int demand = 0; /* do dial-on-demand */
109 char *ipparam = NULL; /* Extra parameter for ip up/down scripts */
110 int cryptpap; /* Passwords in pap-secrets are encrypted */
111 int idle_time_limit = 0; /* Disconnect if idle for this many seconds */
112 int holdoff = 30; /* # seconds to pause before reconnecting */
113 int refuse_pap = 0; /* Set to say we won't do PAP */
114 int refuse_chap = 0; /* Set to say we won't do CHAP */
117 int ms_lanman = 0; /* Nonzero if use LanMan password instead of NT */
118 /* Has meaning only with MS-CHAP challenges */
121 struct option_info auth_req_info;
122 struct option_info connector_info;
123 struct option_info disconnector_info;
124 struct option_info welcomer_info;
125 struct option_info devnam_info;
127 struct bpf_program pass_filter;/* Filter program for packets to pass */
128 struct bpf_program active_filter; /* Filter program for link-active pkts */
129 pcap_t pc; /* Fake struct pcap so we can compile expr */
135 static int setdevname __P((char *, int));
136 static int setipaddr __P((char *));
137 static int setspeed __P((char *));
138 static int setdebug __P((char **));
139 static int setkdebug __P((char **));
140 static int setpassive __P((char **));
141 static int setsilent __P((char **));
142 static int noopt __P((char **));
143 static int setnovj __P((char **));
144 static int setnovjccomp __P((char **));
145 static int setvjslots __P((char **));
146 static int reqpap __P((char **));
147 static int nopap __P((char **));
149 static int setupapfile __P((char **));
151 static int nochap __P((char **));
152 static int reqchap __P((char **));
153 static int noaccomp __P((char **));
154 static int noasyncmap __P((char **));
155 static int noip __P((char **));
156 static int nomagicnumber __P((char **));
157 static int setasyncmap __P((char **));
158 static int setescape __P((char **));
159 static int setmru __P((char **));
160 static int setmtu __P((char **));
162 static int setcbcp __P((char *));
164 static int nomru __P((char **));
165 static int nopcomp __P((char **));
166 static int setconnector __P((char **));
167 static int setdisconnector __P((char **));
168 static int setwelcomer __P((char **));
169 static int setmaxconnect __P((char **));
170 static int setdomain __P((char **));
171 static int setnetmask __P((char **));
172 static int setcrtscts __P((char **));
173 static int setnocrtscts __P((char **));
174 static int setxonxoff __P((char **));
175 static int setnodetach __P((char **));
176 static int setmodem __P((char **));
177 static int setlocal __P((char **));
178 static int setlock __P((char **));
179 static int setname __P((char **));
180 static int setuser __P((char **));
181 static int setremote __P((char **));
182 static int setauth __P((char **));
183 static int setnoauth __P((char **));
184 static int readfile __P((char **));
185 static int callfile __P((char **));
186 static int setdefaultroute __P((char **));
187 static int setnodefaultroute __P((char **));
188 static int setproxyarp __P((char **));
189 static int setnoproxyarp __P((char **));
190 static int setpersist __P((char **));
191 static int setnopersist __P((char **));
192 static int setdologin __P((char **));
193 static int setusehostname __P((char **));
194 static int setnoipdflt __P((char **));
195 static int setlcptimeout __P((char **));
196 static int setlcpterm __P((char **));
197 static int setlcpconf __P((char **));
198 static int setlcpfails __P((char **));
199 static int setipcptimeout __P((char **));
200 static int setipcpterm __P((char **));
201 static int setipcpconf __P((char **));
202 static int setipcpfails __P((char **));
203 static int setpaptimeout __P((char **));
204 static int setpapreqs __P((char **));
205 static int setpapreqtime __P((char **));
206 static int setchaptimeout __P((char **));
207 static int setchapchal __P((char **));
208 static int setchapintv __P((char **));
209 static int setipcpaccl __P((char **));
210 static int setipcpaccr __P((char **));
211 static int setlcpechointv __P((char **));
212 static int setlcpechofails __P((char **));
213 static int noccp __P((char **));
214 static int setbsdcomp __P((char **));
215 static int setnobsdcomp __P((char **));
216 static int setdeflate __P((char **));
217 static int setnodeflate __P((char **));
218 static int setdemand __P((char **));
219 static int setpred1comp __P((char **));
220 static int setnopred1comp __P((char **));
221 static int setipparam __P((char **));
222 static int setpapcrypt __P((char **));
223 static int setidle __P((char **));
224 static int setholdoff __P((char **));
225 static int setdnsaddr __P((char **));
226 static int resetipxproto __P((char **));
227 static int setwinsaddr __P((char **));
228 static int showversion __P((char **));
229 static int showhelp __P((char **));
232 static int setpdebug __P((char **));
233 static int setpassfilter __P((char **));
234 static int setactivefilter __P((char **));
238 static int setipxproto __P((char **));
239 static int setipxanet __P((char **));
240 static int setipxalcl __P((char **));
241 static int setipxarmt __P((char **));
242 static int setipxnetwork __P((char **));
243 static int setipxnode __P((char **));
244 static int setipxrouter __P((char **));
245 static int setipxname __P((char **));
246 static int setipxcptimeout __P((char **));
247 static int setipxcpterm __P((char **));
248 static int setipxcpconf __P((char **));
249 static int setipxcpfails __P((char **));
250 #endif /* IPX_CHANGE */
253 static int setmslanman __P((void));
256 static int number_option __P((char *, u_int32_t *, int));
257 static int int_option __P((char *, int *));
258 static int readable __P((int fd));
266 int (*cmd_func) __P((char **));
268 {"-all", 0, noopt}, /* Don't request/allow any options (useless) */
269 {"noaccomp", 0, noaccomp}, /* Disable Address/Control compression */
270 {"-ac", 0, noaccomp}, /* Disable Address/Control compress */
271 {"default-asyncmap", 0, noasyncmap}, /* Disable asyncmap negoatiation */
272 {"-am", 0, noasyncmap}, /* Disable asyncmap negotiation */
273 {"-as", 1, setasyncmap}, /* set the desired async map */
274 {"-d", 0, setdebug}, /* Increase debugging level */
275 {"nodetach", 0, setnodetach}, /* Don't detach from controlling tty */
276 {"-detach", 0, setnodetach}, /* don't fork */
277 {"noip", 0, noip}, /* Disable IP and IPCP */
278 {"-ip", 0, noip}, /* Disable IP and IPCP */
279 {"nomagic", 0, nomagicnumber}, /* Disable magic number negotiation */
280 {"-mn", 0, nomagicnumber}, /* Disable magic number negotiation */
281 {"default-mru", 0, nomru}, /* Disable MRU negotiation */
282 {"-mru", 0, nomru}, /* Disable mru negotiation */
283 {"-p", 0, setpassive}, /* Set passive mode */
284 {"nopcomp", 0, nopcomp}, /* Disable protocol field compression */
285 {"-pc", 0, nopcomp}, /* Disable protocol field compress */
287 {"+ua", 1, setupapfile}, /* Get PAP user and password from file */
289 {"require-pap", 0, reqpap}, /* Require PAP authentication from peer */
290 {"+pap", 0, reqpap}, /* Require PAP auth from peer */
291 {"refuse-pap", 0, nopap}, /* Don't agree to auth to peer with PAP */
292 {"-pap", 0, nopap}, /* Don't allow UPAP authentication with peer */
293 {"require-chap", 0, reqchap}, /* Require CHAP authentication from peer */
294 {"+chap", 0, reqchap}, /* Require CHAP authentication from peer */
295 {"refuse-chap", 0, nochap}, /* Don't agree to auth to peer with CHAP */
296 {"-chap", 0, nochap}, /* Don't allow CHAP authentication with peer */
297 {"novj", 0, setnovj}, /* Disable VJ compression */
298 {"-vj", 0, setnovj}, /* disable VJ compression */
299 {"novjccomp", 0, setnovjccomp}, /* disable VJ connection-ID compression */
300 {"-vjccomp", 0, setnovjccomp}, /* disable VJ connection-ID compression */
301 {"vj-max-slots", 1, setvjslots}, /* Set maximum VJ header slots */
302 {"asyncmap", 1, setasyncmap}, /* set the desired async map */
303 {"escape", 1, setescape}, /* set chars to escape on transmission */
304 {"connect", 1, setconnector}, /* A program to set up a connection */
305 {"disconnect", 1, setdisconnector}, /* program to disconnect serial dev. */
306 {"welcome", 1, setwelcomer},/* Script to welcome client */
307 {"maxconnect", 1, setmaxconnect}, /* specify a maximum connect time */
308 {"crtscts", 0, setcrtscts}, /* set h/w flow control */
309 {"nocrtscts", 0, setnocrtscts}, /* clear h/w flow control */
310 {"-crtscts", 0, setnocrtscts}, /* clear h/w flow control */
311 {"xonxoff", 0, setxonxoff}, /* set s/w flow control */
312 {"debug", 0, setdebug}, /* Increase debugging level */
313 {"kdebug", 1, setkdebug}, /* Enable kernel-level debugging */
314 {"domain", 1, setdomain}, /* Add given domain name to hostname*/
315 {"mru", 1, setmru}, /* Set MRU value for negotiation */
316 {"mtu", 1, setmtu}, /* Set our MTU */
318 {"callback", 1, setcbcp}, /* Ask for callback */
320 {"netmask", 1, setnetmask}, /* set netmask */
321 {"passive", 0, setpassive}, /* Set passive mode */
322 {"silent", 0, setsilent}, /* Set silent mode */
323 {"modem", 0, setmodem}, /* Use modem control lines */
324 {"local", 0, setlocal}, /* Don't use modem control lines */
325 {"lock", 0, setlock}, /* Lock serial device (with lock file) */
326 {"name", 1, setname}, /* Set local name for authentication */
327 {"user", 1, setuser}, /* Set name for auth with peer */
328 {"usehostname", 0, setusehostname}, /* Must use hostname for auth. */
329 {"remotename", 1, setremote}, /* Set remote name for authentication */
330 {"auth", 0, setauth}, /* Require authentication from peer */
331 {"noauth", 0, setnoauth}, /* Don't require peer to authenticate */
332 {"file", 1, readfile}, /* Take options from a file */
333 {"call", 1, callfile}, /* Take options from a privileged file */
334 {"defaultroute", 0, setdefaultroute}, /* Add default route */
335 {"nodefaultroute", 0, setnodefaultroute}, /* disable defaultroute option */
336 {"-defaultroute", 0, setnodefaultroute}, /* disable defaultroute option */
337 {"proxyarp", 0, setproxyarp}, /* Add proxy ARP entry */
338 {"noproxyarp", 0, setnoproxyarp}, /* disable proxyarp option */
339 {"-proxyarp", 0, setnoproxyarp}, /* disable proxyarp option */
340 {"persist", 0, setpersist}, /* Keep on reopening connection after close */
341 {"nopersist", 0, setnopersist}, /* Turn off persist option */
342 {"demand", 0, setdemand}, /* Dial on demand */
343 {"login", 0, setdologin}, /* Use system password database for UPAP */
344 {"noipdefault", 0, setnoipdflt}, /* Don't use name for default IP adrs */
345 {"lcp-echo-failure", 1, setlcpechofails}, /* consecutive echo failures */
346 {"lcp-echo-interval", 1, setlcpechointv}, /* time for lcp echo events */
347 {"lcp-restart", 1, setlcptimeout}, /* Set timeout for LCP */
348 {"lcp-max-terminate", 1, setlcpterm}, /* Set max #xmits for term-reqs */
349 {"lcp-max-configure", 1, setlcpconf}, /* Set max #xmits for conf-reqs */
350 {"lcp-max-failure", 1, setlcpfails}, /* Set max #conf-naks for LCP */
351 {"ipcp-restart", 1, setipcptimeout}, /* Set timeout for IPCP */
352 {"ipcp-max-terminate", 1, setipcpterm}, /* Set max #xmits for term-reqs */
353 {"ipcp-max-configure", 1, setipcpconf}, /* Set max #xmits for conf-reqs */
354 {"ipcp-max-failure", 1, setipcpfails}, /* Set max #conf-naks for IPCP */
355 {"pap-restart", 1, setpaptimeout}, /* Set retransmit timeout for PAP */
356 {"pap-max-authreq", 1, setpapreqs}, /* Set max #xmits for auth-reqs */
357 {"pap-timeout", 1, setpapreqtime}, /* Set time limit for peer PAP auth. */
358 {"chap-restart", 1, setchaptimeout}, /* Set timeout for CHAP */
359 {"chap-max-challenge", 1, setchapchal}, /* Set max #xmits for challenge */
360 {"chap-interval", 1, setchapintv}, /* Set interval for rechallenge */
361 {"ipcp-accept-local", 0, setipcpaccl}, /* Accept peer's address for us */
362 {"ipcp-accept-remote", 0, setipcpaccr}, /* Accept peer's address for it */
363 {"noccp", 0, noccp}, /* Disable CCP negotiation */
364 {"-ccp", 0, noccp}, /* Disable CCP negotiation */
365 {"bsdcomp", 1, setbsdcomp}, /* request BSD-Compress */
366 {"nobsdcomp", 0, setnobsdcomp}, /* don't allow BSD-Compress */
367 {"-bsdcomp", 0, setnobsdcomp}, /* don't allow BSD-Compress */
368 {"deflate", 1, setdeflate}, /* request Deflate compression */
369 {"nodeflate", 0, setnodeflate}, /* don't allow Deflate compression */
370 {"-deflate", 0, setnodeflate}, /* don't allow Deflate compression */
371 {"predictor1", 0, setpred1comp}, /* request Predictor-1 */
372 {"nopredictor1", 0, setnopred1comp},/* don't allow Predictor-1 */
373 {"-predictor1", 0, setnopred1comp}, /* don't allow Predictor-1 */
374 {"ipparam", 1, setipparam}, /* set ip script parameter */
375 {"papcrypt", 0, setpapcrypt}, /* PAP passwords encrypted */
376 {"idle", 1, setidle}, /* idle time limit (seconds) */
377 {"holdoff", 1, setholdoff}, /* set holdoff time (seconds) */
378 {"ms-dns", 1, setdnsaddr}, /* DNS address for the peer's use */
379 {"ms-wins", 1, setwinsaddr}, /* Nameserver for SMB over TCP/IP for peer */
380 {"noipx", 0, resetipxproto}, /* Disable IPXCP (and IPX) */
381 {"-ipx", 0, resetipxproto}, /* Disable IPXCP (and IPX) */
382 {"--version", 0, showversion}, /* Show version number */
383 {"--help", 0, showhelp}, /* Show brief listing of options */
384 {"-h", 0, showhelp}, /* ditto */
387 {"pdebug", 1, setpdebug}, /* libpcap debugging */
388 {"pass-filter", 1, setpassfilter}, /* set filter for packets to pass */
389 {"active-filter", 1, setactivefilter}, /* set filter for active pkts */
393 {"ipx-network", 1, setipxnetwork}, /* IPX network number */
394 {"ipxcp-accept-network", 0, setipxanet}, /* Accept peer netowrk */
395 {"ipx-node", 1, setipxnode}, /* IPX node number */
396 {"ipxcp-accept-local", 0, setipxalcl}, /* Accept our address */
397 {"ipxcp-accept-remote", 0, setipxarmt}, /* Accept peer's address */
398 {"ipx-routing", 1, setipxrouter}, /* IPX routing proto number */
399 {"ipx-router-name", 1, setipxname}, /* IPX router name */
400 {"ipxcp-restart", 1, setipxcptimeout}, /* Set timeout for IPXCP */
401 {"ipxcp-max-terminate", 1, setipxcpterm}, /* max #xmits for term-reqs */
402 {"ipxcp-max-configure", 1, setipxcpconf}, /* max #xmits for conf-reqs */
403 {"ipxcp-max-failure", 1, setipxcpfails}, /* max #conf-naks for IPXCP */
405 {"ipx-compression", 1, setipxcompression}, /* IPX compression number */
407 {"ipx", 0, setipxproto}, /* Enable IPXCP (and IPX) */
408 {"+ipx", 0, setipxproto}, /* Enable IPXCP (and IPX) */
409 #endif /* IPX_CHANGE */
412 {"ms-lanman", 0, setmslanman}, /* Use LanMan psswd when using MS-CHAP */
419 #ifndef IMPLEMENTATION
420 #define IMPLEMENTATION ""
423 static char *usage_string = "\
424 pppd version %s patch level %d%s\n\
425 Usage: %s [ options ], where options are:\n\
426 <device> Communicate over the named device\n\
427 <speed> Set the baud rate to <speed>\n\
428 <loc>:<rem> Set the local and/or remote interface IP\n\
429 addresses. Either one may be omitted.\n\
430 asyncmap <n> Set the desired async map to hex <n>\n\
431 auth Require authentication from peer\n\
432 connect <p> Invoke shell command <p> to set up the serial line\n\
433 crtscts Use hardware RTS/CTS flow control\n\
434 defaultroute Add default route through interface\n\
435 file <f> Take options from file <f>\n\
436 modem Use modem control lines\n\
437 mru <n> Set MRU value to <n> for negotiation\n\
438 See pppd(8) for more options.\n\
441 static char *current_option; /* the name of the option being parsed */
442 static int privileged_option; /* set iff the current option came from root */
443 static char *option_source; /* string saying where the option came from */
446 * parse_args - parse a string of arguments from the command line.
449 parse_args(argc, argv)
457 privileged_option = privileged;
458 option_source = "command line";
464 * First see if it's a command.
466 for (cmdp = cmds; cmdp->cmd_name; cmdp++)
467 if (!strcmp(arg, cmdp->cmd_name))
470 if (cmdp->cmd_name != NULL) {
471 if (argc < cmdp->num_args) {
472 option_error("too few parameters for option %s", arg);
475 current_option = arg;
476 if (!(*cmdp->cmd_func)(argv))
478 argc -= cmdp->num_args;
479 argv += cmdp->num_args;
483 * Maybe a tty name, speed or IP address?
485 if ((ret = setdevname(arg, 0)) == 0
486 && (ret = setspeed(arg)) == 0
487 && (ret = setipaddr(arg)) == 0) {
488 option_error("unrecognized option '%s'", arg);
492 if (ret < 0) /* error */
500 * scan_args - scan the command line arguments to get the tty name,
504 scan_args(argc, argv)
515 /* Skip options and their arguments */
516 for (cmdp = cmds; cmdp->cmd_name; cmdp++)
517 if (!strcmp(arg, cmdp->cmd_name))
520 if (cmdp->cmd_name != NULL) {
521 argc -= cmdp->num_args;
522 argv += cmdp->num_args;
526 /* Check if it's a tty name and copy it if so */
527 (void) setdevname(arg, 1);
532 * usage - print out a message telling how to use the program.
537 if (phase == PHASE_INITIALIZE)
538 fprintf(stderr, usage_string, VERSION, PATCHLEVEL, IMPLEMENTATION,
543 * showhelp - print out usage message and exit.
549 if (phase == PHASE_INITIALIZE) {
557 * showversion - print out the version number and exit.
563 if (phase == PHASE_INITIALIZE) {
564 fprintf(stderr, "pppd version %s patch level %d%s\n",
565 VERSION, PATCHLEVEL, IMPLEMENTATION);
572 * options_from_file - Read a string of options from a file,
573 * and interpret them.
576 options_from_file(filename, must_exist, check_prot, priv)
587 char args[MAXARGS][MAXWORDLEN];
588 char cmd[MAXWORDLEN];
590 if ((f = fopen(filename, "r")) == NULL) {
591 if (!must_exist && errno == ENOENT)
593 option_error("Can't open options file %s: %m", filename);
596 if (check_prot && !readable(fileno(f))) {
597 option_error("Can't open options file %s: access denied", filename);
602 oldpriv = privileged_option;
603 privileged_option = priv;
605 while (getword(f, cmd, &newline, filename)) {
607 * First see if it's a command.
609 for (cmdp = cmds; cmdp->cmd_name; cmdp++)
610 if (!strcmp(cmd, cmdp->cmd_name))
613 if (cmdp->cmd_name != NULL) {
614 for (i = 0; i < cmdp->num_args; ++i) {
615 if (!getword(f, args[i], &newline, filename)) {
617 "In file %s: too few parameters for option '%s'",
623 current_option = cmd;
624 if (!(*cmdp->cmd_func)(argv))
629 * Maybe a tty name, speed or IP address?
631 if ((i = setdevname(cmd, 0)) == 0
632 && (i = setspeed(cmd)) == 0
633 && (i = setipaddr(cmd)) == 0) {
634 option_error("In file %s: unrecognized option '%s'",
638 if (i < 0) /* error */
646 privileged_option = oldpriv;
651 * options_from_user - See if the use has a ~/.ppprc file,
652 * and if so, interpret options from it.
657 char *user, *path, *file;
661 pw = getpwuid(getuid());
662 if (pw == NULL || (user = pw->pw_dir) == NULL || user[0] == 0)
664 file = _PATH_USEROPT;
665 path = malloc(strlen(user) + strlen(file) + 2);
667 novm("init file name");
671 ret = options_from_file(path, 0, 1, privileged);
677 * options_for_tty - See if an options file exists for the serial
678 * device, and if so, interpret options from it.
683 char *dev, *path, *p;
687 if (strncmp(dev, "/dev/", 5) == 0)
689 if (strcmp(dev, "tty") == 0)
690 return 1; /* don't look for /etc/ppp/options.tty */
691 path = malloc(strlen(_PATH_TTYOPT) + strlen(dev) + 1);
693 novm("tty init file name");
694 strcpy(path, _PATH_TTYOPT);
695 /* Turn slashes into dots, for Solaris case (e.g. /dev/term/a) */
696 for (p = path + strlen(path); *dev != 0; ++dev)
697 *p++ = (*dev == '/'? '.': *dev);
699 ret = options_from_file(path, 0, 0, 1);
705 * option_error - print a message about an error in an option.
706 * The message is logged, and also sent to
707 * stderr if phase == PHASE_INITIALIZE.
710 option_error __V((char *fmt, ...))
720 fmt = va_arg(args, char *);
722 vfmtmsg(buf, sizeof(buf), fmt, args);
724 if (phase == PHASE_INITIALIZE)
725 fprintf(stderr, "%s: %s\n", progname, buf);
726 syslog(LOG_ERR, "%s", buf);
730 * readable - check if a file is readable by the real user.
739 GIDSET_TYPE groups[NGROUPS_MAX];
744 if (fstat(fd, &sbuf) != 0)
746 if (sbuf.st_uid == uid)
747 return sbuf.st_mode & S_IRUSR;
748 if (sbuf.st_gid == getgid())
749 return sbuf.st_mode & S_IRGRP;
750 ngroups = getgroups(NGROUPS_MAX, groups);
751 for (i = 0; i < ngroups; ++i)
752 if (sbuf.st_gid == groups[i])
753 return sbuf.st_mode & S_IRGRP;
754 return sbuf.st_mode & S_IROTH;
758 * Read a word from a file.
759 * Words are delimited by white-space or by quotes (" or ').
760 * Quotes, white-space and \ may be escaped with \.
761 * \<newline> is ignored.
764 getword(f, word, newlinep, filename)
772 int value, digit, got, n;
774 #define isoctal(c) ((c) >= '0' && (c) < '8')
782 * First skip white-space and comments.
790 * A newline means the end of a comment; backslash-newline
791 * is ignored. Note that we cannot have escape && comment.
803 * Ignore characters other than newline in a comment.
809 * If this character is escaped, we have a word start.
815 * If this is the escape character, look at the next character.
823 * If this is the start of a comment, ignore the rest of the line.
831 * A non-whitespace character is the start of a word.
838 * Save the delimiter for quoted strings.
840 if (!escape && (c == '"' || c == '\'')) {
847 * Process characters until the end of the word.
852 * This character is escaped: backslash-newline is ignored,
853 * various other characters indicate particular values
854 * as for C backslash-escapes.
889 * \ddd octal sequence
892 for (n = 0; n < 3 && isoctal(c); ++n) {
893 value = (value << 3) + (c & 07);
902 * \x<hex_string> sequence
906 for (n = 0; n < 2 && isxdigit(c); ++n) {
907 digit = toupper(c) - '0';
909 digit += '0' + 10 - 'A';
910 value = (value << 4) + digit;
918 * Otherwise the character stands for itself.
925 * Store the resulting character for the escape sequence.
927 if (len < MAXWORDLEN-1)
938 * Not escaped: see if we've reached the end of the word.
944 if (isspace(c) || c == '#') {
951 * Backslash starts an escape sequence.
960 * An ordinary character: store it in the word and get another.
962 if (len < MAXWORDLEN-1)
970 * End of the word: check for errors.
976 option_error("Error reading %s: %m", filename);
980 * If len is zero, then we didn't find a word before the
988 * Warn if the word was too long, and append a terminating null.
990 if (len >= MAXWORDLEN) {
991 option_error("warning: word in file %s too long (%.20s...)",
993 len = MAXWORDLEN - 1;
1004 * number_option - parse an unsigned numeric parameter for an option.
1007 number_option(str, valp, base)
1014 *valp = strtoul(str, &ptr, base);
1016 option_error("invalid numeric parameter '%s' for %s option",
1017 str, current_option);
1025 * int_option - like number_option, but valp is int *,
1026 * the base is assumed to be 0, and *valp is not changed
1027 * if there is an error.
1030 int_option(str, valp)
1036 if (!number_option(str, &v, 0))
1044 * The following procedures parse options.
1048 * readfile - take commands from a file.
1054 return options_from_file(*argv, 1, 1, privileged_option);
1058 * callfile - take commands from /etc/ppp/peers/<name>.
1059 * Name may not contain /../, start with / or ../, or end in /..
1065 char *fname, *arg, *p;
1070 if (arg[0] == '/' || arg[0] == 0)
1073 for (p = arg; *p != 0; ) {
1074 if (p[0] == '.' && p[1] == '.' && (p[2] == '/' || p[2] == 0)) {
1078 while (*p != '/' && *p != 0)
1085 option_error("call option value may not contain .. or start with /");
1089 l = strlen(arg) + strlen(_PATH_PEERFILES) + 1;
1090 if ((fname = (char *) malloc(l)) == NULL)
1091 novm("call file name");
1092 strcpy(fname, _PATH_PEERFILES);
1095 ok = options_from_file(fname, 1, 1, 1);
1103 * setdebug - Set debug (command line argument).
1114 * setkdebug - Set kernel debugging level.
1120 return int_option(*argv, &kdebugflag);
1125 * setpdebug - Set libpcap debugging level.
1131 return int_option(*argv, &dflag);
1135 * setpassfilter - Set the pass filter for packets
1141 pc.linktype = DLT_PPP;
1142 pc.snapshot = PPP_HDRLEN;
1144 if (pcap_compile(&pc, &pass_filter, *argv, 1, netmask) == 0)
1146 option_error("error in pass-filter expression: %s\n", pcap_geterr(&pc));
1151 * setactivefilter - Set the active filter for packets
1154 setactivefilter(argv)
1157 pc.linktype = DLT_PPP;
1158 pc.snapshot = PPP_HDRLEN;
1160 if (pcap_compile(&pc, &active_filter, *argv, 1, netmask) == 0)
1162 option_error("error in active-filter expression: %s\n", pcap_geterr(&pc));
1168 * noopt - Disable all options.
1174 BZERO((char *) &lcp_wantoptions[0], sizeof (struct lcp_options));
1175 BZERO((char *) &lcp_allowoptions[0], sizeof (struct lcp_options));
1176 BZERO((char *) &ipcp_wantoptions[0], sizeof (struct ipcp_options));
1177 BZERO((char *) &ipcp_allowoptions[0], sizeof (struct ipcp_options));
1180 BZERO((char *) &ipxcp_wantoptions[0], sizeof (struct ipxcp_options));
1181 BZERO((char *) &ipxcp_allowoptions[0], sizeof (struct ipxcp_options));
1182 #endif /* IPX_CHANGE */
1188 * noaccomp - Disable Address/Control field compression negotiation.
1194 lcp_wantoptions[0].neg_accompression = 0;
1195 lcp_allowoptions[0].neg_accompression = 0;
1201 * noasyncmap - Disable async map negotiation.
1207 lcp_wantoptions[0].neg_asyncmap = 0;
1208 lcp_allowoptions[0].neg_asyncmap = 0;
1214 * noip - Disable IP and IPCP.
1220 ipcp_protent.enabled_flag = 0;
1226 * nomagicnumber - Disable magic number negotiation.
1232 lcp_wantoptions[0].neg_magicnumber = 0;
1233 lcp_allowoptions[0].neg_magicnumber = 0;
1239 * nomru - Disable mru negotiation.
1245 lcp_wantoptions[0].neg_mru = 0;
1246 lcp_allowoptions[0].neg_mru = 0;
1252 * setmru - Set MRU for negotiation.
1260 if (!number_option(*argv, &mru, 0))
1262 lcp_wantoptions[0].mru = mru;
1263 lcp_wantoptions[0].neg_mru = 1;
1269 * setmru - Set the largest MTU we'll use.
1277 if (!number_option(*argv, &mtu, 0))
1279 if (mtu < MINMRU || mtu > MAXMRU) {
1280 option_error("mtu option value of %u is too %s", mtu,
1281 (mtu < MINMRU? "small": "large"));
1284 lcp_allowoptions[0].mru = mtu;
1293 lcp_wantoptions[0].neg_cbcp = 1;
1294 cbcp_protent.enabled_flag = 1;
1295 cbcp[0].us_number = strdup(*argv);
1296 if (cbcp[0].us_number == 0)
1297 novm("callback number");
1298 cbcp[0].us_type |= (1 << CB_CONF_USER);
1299 cbcp[0].us_type |= (1 << CB_CONF_ADMIN);
1305 * nopcomp - Disable Protocol field compression negotiation.
1311 lcp_wantoptions[0].neg_pcompression = 0;
1312 lcp_allowoptions[0].neg_pcompression = 0;
1318 * setpassive - Set passive mode (don't give up if we time out sending
1319 * LCP configure-requests).
1325 lcp_wantoptions[0].passive = 1;
1331 * setsilent - Set silent mode (don't start sending LCP configure-requests
1332 * until we get one from the peer).
1338 lcp_wantoptions[0].silent = 1;
1344 * nopap - Disable PAP authentication with peer.
1356 * reqpap - Require PAP authentication from peer.
1362 lcp_wantoptions[0].neg_upap = 1;
1369 * setupapfile - specifies UPAP info for authenticating with peer.
1378 lcp_allowoptions[0].neg_upap = 1;
1380 /* open user info file */
1381 if ((ufile = fopen(*argv, "r")) == NULL) {
1382 option_error("unable to open user login data file %s", *argv);
1385 if (!readable(fileno(ufile))) {
1386 option_error("%s: access denied", *argv);
1389 check_access(ufile, *argv);
1392 if (fgets(user, MAXNAMELEN - 1, ufile) == NULL
1393 || fgets(passwd, MAXSECRETLEN - 1, ufile) == NULL){
1394 option_error("unable to read user login data file %s", *argv);
1399 /* get rid of newlines */
1401 if (l > 0 && user[l-1] == '\n')
1404 if (l > 0 && passwd[l-1] == '\n')
1412 * nochap - Disable CHAP authentication with peer.
1424 * reqchap - Require CHAP authentication from peer.
1430 lcp_wantoptions[0].neg_chap = 1;
1437 * setnovj - disable vj compression
1443 ipcp_wantoptions[0].neg_vj = 0;
1444 ipcp_allowoptions[0].neg_vj = 0;
1450 * setnovjccomp - disable VJ connection-ID compression
1456 ipcp_wantoptions[0].cflag = 0;
1457 ipcp_allowoptions[0].cflag = 0;
1463 * setvjslots - set maximum number of connection slots for VJ compression
1471 if (!int_option(*argv, &value))
1473 if (value < 2 || value > 16) {
1474 option_error("vj-max-slots value must be between 2 and 16");
1477 ipcp_wantoptions [0].maxslotindex =
1478 ipcp_allowoptions[0].maxslotindex = value - 1;
1484 * setconnector - Set a program to connect to a serial line
1490 connector = strdup(*argv);
1491 if (connector == NULL)
1492 novm("connect script");
1493 connector_info.priv = privileged_option;
1494 connector_info.source = option_source;
1500 * setdisconnector - Set a program to disconnect from the serial line
1503 setdisconnector(argv)
1506 disconnector = strdup(*argv);
1507 if (disconnector == NULL)
1508 novm("disconnect script");
1509 disconnector_info.priv = privileged_option;
1510 disconnector_info.source = option_source;
1516 * setwelcomer - Set a program to welcome a client after connection
1522 welcomer = strdup(*argv);
1523 if (welcomer == NULL)
1524 novm("welcome script");
1525 welcomer_info.priv = privileged_option;
1526 welcomer_info.source = option_source;
1532 * setmaxconnect - Set the maximum connect time
1540 if (!int_option(*argv, &value))
1543 option_error("maxconnect time must be positive");
1546 if (maxconnect > 0 && (value == 0 || value > maxconnect)) {
1547 option_error("maxconnect time cannot be increased");
1555 * setdomain - Set domain name to append to hostname
1561 if (!privileged_option) {
1562 option_error("using the domain option requires root privilege");
1565 gethostname(hostname, MAXNAMELEN);
1568 strncat(hostname, ".", MAXNAMELEN - strlen(hostname));
1569 strncat(hostname, *argv, MAXNAMELEN - strlen(hostname));
1571 hostname[MAXNAMELEN-1] = 0;
1577 * setasyncmap - add bits to asyncmap (what we request peer to escape).
1585 if (!number_option(*argv, &asyncmap, 16))
1587 lcp_wantoptions[0].asyncmap |= asyncmap;
1588 lcp_wantoptions[0].neg_asyncmap = 1;
1594 * setescape - add chars to the set we escape on transmission.
1606 n = strtol(p, &endp, 16);
1608 option_error("escape parameter contains invalid hex number '%s'",
1613 if (n < 0 || (0x20 <= n && n <= 0x3F) || n == 0x5E || n > 0xFF) {
1614 option_error("can't escape character 0x%x", n);
1617 xmit_accm[0][n >> 5] |= 1 << (n & 0x1F);
1618 while (*p == ',' || *p == ' ')
1626 * setspeed - Set the speed.
1635 spd = strtol(arg, &ptr, 0);
1636 if (ptr == arg || *ptr != 0 || spd == 0)
1644 * setdevname - Set the device name.
1647 setdevname(cp, quiet)
1651 struct stat statbuf;
1652 char dev[MAXPATHLEN];
1657 if (strncmp("/dev/", cp, 5) != 0) {
1658 strcpy(dev, "/dev/");
1659 strncat(dev, cp, MAXPATHLEN - 5);
1660 dev[MAXPATHLEN-1] = 0;
1665 * Check if there is a device by this name.
1667 if (stat(cp, &statbuf) < 0) {
1668 if (errno == ENOENT || quiet)
1670 option_error("Couldn't stat %s: %m", cp);
1674 (void) strncpy(devnam, cp, MAXPATHLEN);
1675 devnam[MAXPATHLEN-1] = 0;
1676 default_device = FALSE;
1677 devnam_info.priv = privileged_option;
1678 devnam_info.source = option_source;
1685 * setipaddr - Set the IP address
1693 u_int32_t local, remote;
1694 ipcp_options *wo = &ipcp_wantoptions[0];
1697 * IP address pair separated by ":".
1699 if ((colon = strchr(arg, ':')) == NULL)
1703 * If colon first character, then no local addr.
1707 if ((local = inet_addr(arg)) == -1) {
1708 if ((hp = gethostbyname(arg)) == NULL) {
1709 option_error("unknown host: %s", arg);
1712 local = *(u_int32_t *)hp->h_addr;
1715 if (bad_ip_adrs(local)) {
1716 option_error("bad local IP address %s", ip_ntoa(local));
1720 wo->ouraddr = local;
1725 * If colon last character, then no remote addr.
1727 if (*++colon != '\0') {
1728 if ((remote = inet_addr(colon)) == -1) {
1729 if ((hp = gethostbyname(colon)) == NULL) {
1730 option_error("unknown host: %s", colon);
1733 remote = *(u_int32_t *)hp->h_addr;
1734 if (remote_name[0] == 0) {
1735 strncpy(remote_name, colon, MAXNAMELEN);
1736 remote_name[MAXNAMELEN-1] = 0;
1740 if (bad_ip_adrs(remote)) {
1741 option_error("bad remote IP address %s", ip_ntoa(remote));
1745 wo->hisaddr = remote;
1753 * setnoipdflt - disable setipdefault()
1759 disable_defaultip = 1;
1765 * setipcpaccl - accept peer's idea of our address
1771 ipcp_wantoptions[0].accept_local = 1;
1777 * setipcpaccr - accept peer's idea of its address
1783 ipcp_wantoptions[0].accept_remote = 1;
1789 * setnetmask - set the netmask to be used on the interface.
1800 * Unfortunately, if we use inet_addr, we can't tell whether
1801 * a result of all 1s is an error or a valid 255.255.255.255.
1807 b = strtoul(p, &endp, 0);
1810 if (b < 0 || b > 255) {
1812 /* accept e.g. 0xffffff00 */
1818 mask |= b << (n * 8);
1820 if (*p != '.' || n == 0)
1827 if (*p != 0 || (netmask & ~mask) != 0) {
1828 option_error("invalid netmask value '%s'", *argv);
1856 lcp_wantoptions[0].asyncmap |= 0x000A0000; /* escape ^S and ^Q */
1857 lcp_wantoptions[0].neg_asyncmap = 1;
1905 setusehostname(argv)
1916 if (!privileged_option) {
1917 option_error("using the name option requires root privilege");
1920 strncpy(our_name, argv[0], MAXNAMELEN);
1921 our_name[MAXNAMELEN-1] = 0;
1929 strncpy(user, argv[0], MAXNAMELEN);
1930 user[MAXNAMELEN-1] = 0;
1938 strncpy(remote_name, argv[0], MAXNAMELEN);
1939 remote_name[MAXNAMELEN-1] = 0;
1948 if (privileged_option > auth_req_info.priv) {
1949 auth_req_info.priv = privileged_option;
1950 auth_req_info.source = option_source;
1959 if (auth_required && privileged_option < auth_req_info.priv) {
1960 option_error("cannot override auth option set by %s",
1961 auth_req_info.source);
1969 setdefaultroute(argv)
1972 if (!ipcp_allowoptions[0].default_route) {
1973 option_error("defaultroute option is disabled");
1976 ipcp_wantoptions[0].default_route = 1;
1981 setnodefaultroute(argv)
1984 ipcp_allowoptions[0].default_route = 0;
1985 ipcp_wantoptions[0].default_route = 0;
1993 if (!ipcp_allowoptions[0].proxy_arp) {
1994 option_error("proxyarp option is disabled");
1997 ipcp_wantoptions[0].proxy_arp = 1;
2005 ipcp_wantoptions[0].proxy_arp = 0;
2006 ipcp_allowoptions[0].proxy_arp = 0;
2035 * Functions to set the echo interval for modem-less monitors
2039 setlcpechointv(argv)
2042 return int_option(*argv, &lcp_echo_interval);
2046 setlcpechofails(argv)
2049 return int_option(*argv, &lcp_echo_fails);
2053 * Functions to set timeouts, max transmits, etc.
2059 return int_option(*argv, &lcp_fsm[0].timeouttime);
2066 return int_option(*argv, &lcp_fsm[0].maxtermtransmits);
2073 return int_option(*argv, &lcp_fsm[0].maxconfreqtransmits);
2080 return int_option(*argv, &lcp_fsm[0].maxnakloops);
2084 setipcptimeout(argv)
2087 return int_option(*argv, &ipcp_fsm[0].timeouttime);
2094 return int_option(*argv, &ipcp_fsm[0].maxtermtransmits);
2101 return int_option(*argv, &ipcp_fsm[0].maxconfreqtransmits);
2108 return int_option(*argv, &lcp_fsm[0].maxnakloops);
2115 return int_option(*argv, &upap[0].us_timeouttime);
2122 return int_option(*argv, &upap[0].us_reqtimeout);
2129 return int_option(*argv, &upap[0].us_maxtransmits);
2133 setchaptimeout(argv)
2136 return int_option(*argv, &chap[0].timeouttime);
2143 return int_option(*argv, &chap[0].max_transmits);
2150 return int_option(*argv, &chap[0].chal_interval);
2157 ccp_protent.enabled_flag = 0;
2169 abits = rbits = strtol(str, &endp, 0);
2170 if (endp != str && *endp == ',') {
2172 abits = strtol(str, &endp, 0);
2174 if (*endp != 0 || endp == str) {
2175 option_error("invalid parameter '%s' for bsdcomp option", *argv);
2178 if ((rbits != 0 && (rbits < BSD_MIN_BITS || rbits > BSD_MAX_BITS))
2179 || (abits != 0 && (abits < BSD_MIN_BITS || abits > BSD_MAX_BITS))) {
2180 option_error("bsdcomp option values must be 0 or %d .. %d",
2181 BSD_MIN_BITS, BSD_MAX_BITS);
2185 ccp_wantoptions[0].bsd_compress = 1;
2186 ccp_wantoptions[0].bsd_bits = rbits;
2188 ccp_wantoptions[0].bsd_compress = 0;
2190 ccp_allowoptions[0].bsd_compress = 1;
2191 ccp_allowoptions[0].bsd_bits = abits;
2193 ccp_allowoptions[0].bsd_compress = 0;
2201 ccp_wantoptions[0].bsd_compress = 0;
2202 ccp_allowoptions[0].bsd_compress = 0;
2214 abits = rbits = strtol(str, &endp, 0);
2215 if (endp != str && *endp == ',') {
2217 abits = strtol(str, &endp, 0);
2219 if (*endp != 0 || endp == str) {
2220 option_error("invalid parameter '%s' for deflate option", *argv);
2223 if ((rbits != 0 && (rbits < DEFLATE_MIN_SIZE || rbits > DEFLATE_MAX_SIZE))
2224 || (abits != 0 && (abits < DEFLATE_MIN_SIZE
2225 || abits > DEFLATE_MAX_SIZE))) {
2226 option_error("deflate option values must be 0 or %d .. %d",
2227 DEFLATE_MIN_SIZE, DEFLATE_MAX_SIZE);
2231 ccp_wantoptions[0].deflate = 1;
2232 ccp_wantoptions[0].deflate_size = rbits;
2234 ccp_wantoptions[0].deflate = 0;
2236 ccp_allowoptions[0].deflate = 1;
2237 ccp_allowoptions[0].deflate_size = abits;
2239 ccp_allowoptions[0].deflate = 0;
2247 ccp_wantoptions[0].deflate = 0;
2248 ccp_allowoptions[0].deflate = 0;
2256 ccp_wantoptions[0].predictor_1 = 1;
2257 ccp_allowoptions[0].predictor_1 = 1;
2262 setnopred1comp(argv)
2265 ccp_wantoptions[0].predictor_1 = 0;
2266 ccp_allowoptions[0].predictor_1 = 0;
2274 ipparam = strdup(*argv);
2275 if (ipparam == NULL)
2276 novm("ipparam string");
2293 return int_option(*argv, &idle_time_limit);
2300 return int_option(*argv, &holdoff);
2304 * setdnsaddr - set the dns address(es)
2313 dns = inet_addr(*argv);
2315 if ((hp = gethostbyname(*argv)) == NULL) {
2316 option_error("invalid address parameter '%s' for ms-dns option",
2320 dns = *(u_int32_t *)hp->h_addr;
2323 if (ipcp_allowoptions[0].dnsaddr[0] == 0) {
2324 ipcp_allowoptions[0].dnsaddr[0] = dns;
2326 ipcp_allowoptions[0].dnsaddr[1] = dns;
2333 * setwinsaddr - set the wins address(es)
2334 * This is primrarly used with the Samba package under UNIX or for pointing
2335 * the caller to the existing WINS server on a Windows NT platform.
2344 wins = inet_addr(*argv);
2346 if ((hp = gethostbyname(*argv)) == NULL) {
2347 option_error("invalid address parameter '%s' for ms-wins option",
2351 wins = *(u_int32_t *)hp->h_addr;
2354 if (ipcp_allowoptions[0].winsaddr[0] == 0) {
2355 ipcp_allowoptions[0].winsaddr[0] = wins;
2357 ipcp_allowoptions[0].winsaddr[1] = wins;
2368 ipxcp_wantoptions[0].neg_router = 1;
2369 ipxcp_allowoptions[0].neg_router = 1;
2370 return int_option(*argv, &ipxcp_wantoptions[0].router);
2377 char *dest = ipxcp_wantoptions[0].name;
2382 ipxcp_wantoptions[0].neg_name = 1;
2383 ipxcp_allowoptions[0].neg_name = 1;
2384 memset (dest, '\0', sizeof (ipxcp_wantoptions[0].name));
2389 if (! isalnum (ch) && ch != '_') {
2390 option_error("IPX router name must be alphanumeric or _");
2394 if (count >= sizeof (ipxcp_wantoptions[0].name)) {
2395 option_error("IPX router name is limited to %d characters",
2396 sizeof (ipxcp_wantoptions[0].name) - 1);
2400 dest[count++] = toupper (ch);
2407 setipxcptimeout (argv)
2410 return int_option(*argv, &ipxcp_fsm[0].timeouttime);
2417 return int_option(*argv, &ipxcp_fsm[0].maxtermtransmits);
2424 return int_option(*argv, &ipxcp_fsm[0].maxconfreqtransmits);
2428 setipxcpfails (argv)
2431 return int_option(*argv, &ipxcp_fsm[0].maxnakloops);
2440 if (!number_option(*argv, &v, 16))
2443 ipxcp_wantoptions[0].our_network = (int) v;
2444 ipxcp_wantoptions[0].neg_nn = 1;
2452 ipxcp_wantoptions[0].accept_network = 1;
2453 ipxcp_allowoptions[0].accept_network = 1;
2460 ipxcp_wantoptions[0].accept_local = 1;
2461 ipxcp_allowoptions[0].accept_local = 1;
2468 ipxcp_wantoptions[0].accept_remote = 1;
2469 ipxcp_allowoptions[0].accept_remote = 1;
2473 setipxnodevalue(src,dst)
2480 if (!isxdigit (*src))
2483 for (indx = 0; indx < 5; ++indx) {
2485 dst[indx] |= (dst[indx + 1] >> 4) & 0x0F;
2488 item = toupper (*src) - '0';
2492 dst[5] = (dst[5] << 4) | item;
2504 memset (&ipxcp_wantoptions[0].our_node[0], 0, 6);
2505 memset (&ipxcp_wantoptions[0].his_node[0], 0, 6);
2507 end = setipxnodevalue (*argv, &ipxcp_wantoptions[0].our_node[0]);
2509 end = setipxnodevalue (++end, &ipxcp_wantoptions[0].his_node[0]);
2512 ipxcp_wantoptions[0].neg_node = 1;
2516 option_error("invalid parameter '%s' for ipx-node option", *argv);
2524 ipxcp_protent.enabled_flag = 1;
2532 ipxcp_protent.enabled_flag = 0;
2543 #endif /* IPX_CHANGE */