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.41 1998/03/25 01:29:05 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 setnodeflatedraft __P((char **));
219 static int setdemand __P((char **));
220 static int setpred1comp __P((char **));
221 static int setnopred1comp __P((char **));
222 static int setipparam __P((char **));
223 static int setpapcrypt __P((char **));
224 static int setidle __P((char **));
225 static int setholdoff __P((char **));
226 static int setdnsaddr __P((char **));
227 static int resetipxproto __P((char **));
228 static int setwinsaddr __P((char **));
229 static int showversion __P((char **));
230 static int showhelp __P((char **));
233 static int setpdebug __P((char **));
234 static int setpassfilter __P((char **));
235 static int setactivefilter __P((char **));
239 static int setipxproto __P((char **));
240 static int setipxanet __P((char **));
241 static int setipxalcl __P((char **));
242 static int setipxarmt __P((char **));
243 static int setipxnetwork __P((char **));
244 static int setipxnode __P((char **));
245 static int setipxrouter __P((char **));
246 static int setipxname __P((char **));
247 static int setipxcptimeout __P((char **));
248 static int setipxcpterm __P((char **));
249 static int setipxcpconf __P((char **));
250 static int setipxcpfails __P((char **));
251 #endif /* IPX_CHANGE */
254 static int setmslanman __P((char **));
257 static int number_option __P((char *, u_int32_t *, int));
258 static int int_option __P((char *, int *));
259 static int readable __P((int fd));
267 int (*cmd_func) __P((char **));
269 {"-all", 0, noopt}, /* Don't request/allow any options (useless) */
270 {"noaccomp", 0, noaccomp}, /* Disable Address/Control compression */
271 {"-ac", 0, noaccomp}, /* Disable Address/Control compress */
272 {"default-asyncmap", 0, noasyncmap}, /* Disable asyncmap negoatiation */
273 {"-am", 0, noasyncmap}, /* Disable asyncmap negotiation */
274 {"-as", 1, setasyncmap}, /* set the desired async map */
275 {"-d", 0, setdebug}, /* Increase debugging level */
276 {"nodetach", 0, setnodetach}, /* Don't detach from controlling tty */
277 {"-detach", 0, setnodetach}, /* don't fork */
278 {"noip", 0, noip}, /* Disable IP and IPCP */
279 {"-ip", 0, noip}, /* Disable IP and IPCP */
280 {"nomagic", 0, nomagicnumber}, /* Disable magic number negotiation */
281 {"-mn", 0, nomagicnumber}, /* Disable magic number negotiation */
282 {"default-mru", 0, nomru}, /* Disable MRU negotiation */
283 {"-mru", 0, nomru}, /* Disable mru negotiation */
284 {"-p", 0, setpassive}, /* Set passive mode */
285 {"nopcomp", 0, nopcomp}, /* Disable protocol field compression */
286 {"-pc", 0, nopcomp}, /* Disable protocol field compress */
288 {"+ua", 1, setupapfile}, /* Get PAP user and password from file */
290 {"require-pap", 0, reqpap}, /* Require PAP authentication from peer */
291 {"+pap", 0, reqpap}, /* Require PAP auth from peer */
292 {"refuse-pap", 0, nopap}, /* Don't agree to auth to peer with PAP */
293 {"-pap", 0, nopap}, /* Don't allow UPAP authentication with peer */
294 {"require-chap", 0, reqchap}, /* Require CHAP authentication from peer */
295 {"+chap", 0, reqchap}, /* Require CHAP authentication from peer */
296 {"refuse-chap", 0, nochap}, /* Don't agree to auth to peer with CHAP */
297 {"-chap", 0, nochap}, /* Don't allow CHAP authentication with peer */
298 {"novj", 0, setnovj}, /* Disable VJ compression */
299 {"-vj", 0, setnovj}, /* disable VJ compression */
300 {"novjccomp", 0, setnovjccomp}, /* disable VJ connection-ID compression */
301 {"-vjccomp", 0, setnovjccomp}, /* disable VJ connection-ID compression */
302 {"vj-max-slots", 1, setvjslots}, /* Set maximum VJ header slots */
303 {"asyncmap", 1, setasyncmap}, /* set the desired async map */
304 {"escape", 1, setescape}, /* set chars to escape on transmission */
305 {"connect", 1, setconnector}, /* A program to set up a connection */
306 {"disconnect", 1, setdisconnector}, /* program to disconnect serial dev. */
307 {"welcome", 1, setwelcomer},/* Script to welcome client */
308 {"maxconnect", 1, setmaxconnect}, /* specify a maximum connect time */
309 {"crtscts", 0, setcrtscts}, /* set h/w flow control */
310 {"nocrtscts", 0, setnocrtscts}, /* clear h/w flow control */
311 {"-crtscts", 0, setnocrtscts}, /* clear h/w flow control */
312 {"xonxoff", 0, setxonxoff}, /* set s/w flow control */
313 {"debug", 0, setdebug}, /* Increase debugging level */
314 {"kdebug", 1, setkdebug}, /* Enable kernel-level debugging */
315 {"domain", 1, setdomain}, /* Add given domain name to hostname*/
316 {"mru", 1, setmru}, /* Set MRU value for negotiation */
317 {"mtu", 1, setmtu}, /* Set our MTU */
319 {"callback", 1, setcbcp}, /* Ask for callback */
321 {"netmask", 1, setnetmask}, /* set netmask */
322 {"passive", 0, setpassive}, /* Set passive mode */
323 {"silent", 0, setsilent}, /* Set silent mode */
324 {"modem", 0, setmodem}, /* Use modem control lines */
325 {"local", 0, setlocal}, /* Don't use modem control lines */
326 {"lock", 0, setlock}, /* Lock serial device (with lock file) */
327 {"name", 1, setname}, /* Set local name for authentication */
328 {"user", 1, setuser}, /* Set name for auth with peer */
329 {"usehostname", 0, setusehostname}, /* Must use hostname for auth. */
330 {"remotename", 1, setremote}, /* Set remote name for authentication */
331 {"auth", 0, setauth}, /* Require authentication from peer */
332 {"noauth", 0, setnoauth}, /* Don't require peer to authenticate */
333 {"file", 1, readfile}, /* Take options from a file */
334 {"call", 1, callfile}, /* Take options from a privileged file */
335 {"defaultroute", 0, setdefaultroute}, /* Add default route */
336 {"nodefaultroute", 0, setnodefaultroute}, /* disable defaultroute option */
337 {"-defaultroute", 0, setnodefaultroute}, /* disable defaultroute option */
338 {"proxyarp", 0, setproxyarp}, /* Add proxy ARP entry */
339 {"noproxyarp", 0, setnoproxyarp}, /* disable proxyarp option */
340 {"-proxyarp", 0, setnoproxyarp}, /* disable proxyarp option */
341 {"persist", 0, setpersist}, /* Keep on reopening connection after close */
342 {"nopersist", 0, setnopersist}, /* Turn off persist option */
343 {"demand", 0, setdemand}, /* Dial on demand */
344 {"login", 0, setdologin}, /* Use system password database for UPAP */
345 {"noipdefault", 0, setnoipdflt}, /* Don't use name for default IP adrs */
346 {"lcp-echo-failure", 1, setlcpechofails}, /* consecutive echo failures */
347 {"lcp-echo-interval", 1, setlcpechointv}, /* time for lcp echo events */
348 {"lcp-restart", 1, setlcptimeout}, /* Set timeout for LCP */
349 {"lcp-max-terminate", 1, setlcpterm}, /* Set max #xmits for term-reqs */
350 {"lcp-max-configure", 1, setlcpconf}, /* Set max #xmits for conf-reqs */
351 {"lcp-max-failure", 1, setlcpfails}, /* Set max #conf-naks for LCP */
352 {"ipcp-restart", 1, setipcptimeout}, /* Set timeout for IPCP */
353 {"ipcp-max-terminate", 1, setipcpterm}, /* Set max #xmits for term-reqs */
354 {"ipcp-max-configure", 1, setipcpconf}, /* Set max #xmits for conf-reqs */
355 {"ipcp-max-failure", 1, setipcpfails}, /* Set max #conf-naks for IPCP */
356 {"pap-restart", 1, setpaptimeout}, /* Set retransmit timeout for PAP */
357 {"pap-max-authreq", 1, setpapreqs}, /* Set max #xmits for auth-reqs */
358 {"pap-timeout", 1, setpapreqtime}, /* Set time limit for peer PAP auth. */
359 {"chap-restart", 1, setchaptimeout}, /* Set timeout for CHAP */
360 {"chap-max-challenge", 1, setchapchal}, /* Set max #xmits for challenge */
361 {"chap-interval", 1, setchapintv}, /* Set interval for rechallenge */
362 {"ipcp-accept-local", 0, setipcpaccl}, /* Accept peer's address for us */
363 {"ipcp-accept-remote", 0, setipcpaccr}, /* Accept peer's address for it */
364 {"noccp", 0, noccp}, /* Disable CCP negotiation */
365 {"-ccp", 0, noccp}, /* Disable CCP negotiation */
366 {"bsdcomp", 1, setbsdcomp}, /* request BSD-Compress */
367 {"nobsdcomp", 0, setnobsdcomp}, /* don't allow BSD-Compress */
368 {"-bsdcomp", 0, setnobsdcomp}, /* don't allow BSD-Compress */
369 {"deflate", 1, setdeflate}, /* request Deflate compression */
370 {"nodeflate", 0, setnodeflate}, /* don't allow Deflate compression */
371 {"-deflate", 0, setnodeflate}, /* don't allow Deflate compression */
372 {"nodeflatedraft", 0, setnodeflatedraft}, /* don't use draft deflate # */
373 {"predictor1", 0, setpred1comp}, /* request Predictor-1 */
374 {"nopredictor1", 0, setnopred1comp},/* don't allow Predictor-1 */
375 {"-predictor1", 0, setnopred1comp}, /* don't allow Predictor-1 */
376 {"ipparam", 1, setipparam}, /* set ip script parameter */
377 {"papcrypt", 0, setpapcrypt}, /* PAP passwords encrypted */
378 {"idle", 1, setidle}, /* idle time limit (seconds) */
379 {"holdoff", 1, setholdoff}, /* set holdoff time (seconds) */
380 {"ms-dns", 1, setdnsaddr}, /* DNS address for the peer's use */
381 {"ms-wins", 1, setwinsaddr}, /* Nameserver for SMB over TCP/IP for peer */
382 {"noipx", 0, resetipxproto}, /* Disable IPXCP (and IPX) */
383 {"-ipx", 0, resetipxproto}, /* Disable IPXCP (and IPX) */
384 {"--version", 0, showversion}, /* Show version number */
385 {"--help", 0, showhelp}, /* Show brief listing of options */
386 {"-h", 0, showhelp}, /* ditto */
389 {"pdebug", 1, setpdebug}, /* libpcap debugging */
390 {"pass-filter", 1, setpassfilter}, /* set filter for packets to pass */
391 {"active-filter", 1, setactivefilter}, /* set filter for active pkts */
395 {"ipx-network", 1, setipxnetwork}, /* IPX network number */
396 {"ipxcp-accept-network", 0, setipxanet}, /* Accept peer netowrk */
397 {"ipx-node", 1, setipxnode}, /* IPX node number */
398 {"ipxcp-accept-local", 0, setipxalcl}, /* Accept our address */
399 {"ipxcp-accept-remote", 0, setipxarmt}, /* Accept peer's address */
400 {"ipx-routing", 1, setipxrouter}, /* IPX routing proto number */
401 {"ipx-router-name", 1, setipxname}, /* IPX router name */
402 {"ipxcp-restart", 1, setipxcptimeout}, /* Set timeout for IPXCP */
403 {"ipxcp-max-terminate", 1, setipxcpterm}, /* max #xmits for term-reqs */
404 {"ipxcp-max-configure", 1, setipxcpconf}, /* max #xmits for conf-reqs */
405 {"ipxcp-max-failure", 1, setipxcpfails}, /* max #conf-naks for IPXCP */
407 {"ipx-compression", 1, setipxcompression}, /* IPX compression number */
409 {"ipx", 0, setipxproto}, /* Enable IPXCP (and IPX) */
410 {"+ipx", 0, setipxproto}, /* Enable IPXCP (and IPX) */
411 #endif /* IPX_CHANGE */
414 {"ms-lanman", 0, setmslanman}, /* Use LanMan psswd when using MS-CHAP */
421 #ifndef IMPLEMENTATION
422 #define IMPLEMENTATION ""
425 static char *usage_string = "\
426 pppd version %s patch level %d%s\n\
427 Usage: %s [ options ], where options are:\n\
428 <device> Communicate over the named device\n\
429 <speed> Set the baud rate to <speed>\n\
430 <loc>:<rem> Set the local and/or remote interface IP\n\
431 addresses. Either one may be omitted.\n\
432 asyncmap <n> Set the desired async map to hex <n>\n\
433 auth Require authentication from peer\n\
434 connect <p> Invoke shell command <p> to set up the serial line\n\
435 crtscts Use hardware RTS/CTS flow control\n\
436 defaultroute Add default route through interface\n\
437 file <f> Take options from file <f>\n\
438 modem Use modem control lines\n\
439 mru <n> Set MRU value to <n> for negotiation\n\
440 See pppd(8) for more options.\n\
443 static char *current_option; /* the name of the option being parsed */
444 static int privileged_option; /* set iff the current option came from root */
445 static char *option_source; /* string saying where the option came from */
448 * parse_args - parse a string of arguments from the command line.
451 parse_args(argc, argv)
459 privileged_option = privileged;
460 option_source = "command line";
466 * First see if it's a command.
468 for (cmdp = cmds; cmdp->cmd_name; cmdp++)
469 if (!strcmp(arg, cmdp->cmd_name))
472 if (cmdp->cmd_name != NULL) {
473 if (argc < cmdp->num_args) {
474 option_error("too few parameters for option %s", arg);
477 current_option = arg;
478 if (!(*cmdp->cmd_func)(argv))
480 argc -= cmdp->num_args;
481 argv += cmdp->num_args;
485 * Maybe a tty name, speed or IP address?
487 if ((ret = setdevname(arg, 0)) == 0
488 && (ret = setspeed(arg)) == 0
489 && (ret = setipaddr(arg)) == 0) {
490 option_error("unrecognized option '%s'", arg);
494 if (ret < 0) /* error */
502 * scan_args - scan the command line arguments to get the tty name,
506 scan_args(argc, argv)
517 /* Skip options and their arguments */
518 for (cmdp = cmds; cmdp->cmd_name; cmdp++)
519 if (!strcmp(arg, cmdp->cmd_name))
522 if (cmdp->cmd_name != NULL) {
523 argc -= cmdp->num_args;
524 argv += cmdp->num_args;
528 /* Check if it's a tty name and copy it if so */
529 (void) setdevname(arg, 1);
534 * usage - print out a message telling how to use the program.
539 if (phase == PHASE_INITIALIZE)
540 fprintf(stderr, usage_string, VERSION, PATCHLEVEL, IMPLEMENTATION,
545 * showhelp - print out usage message and exit.
551 if (phase == PHASE_INITIALIZE) {
559 * showversion - print out the version number and exit.
565 if (phase == PHASE_INITIALIZE) {
566 fprintf(stderr, "pppd version %s patch level %d%s\n",
567 VERSION, PATCHLEVEL, IMPLEMENTATION);
574 * options_from_file - Read a string of options from a file,
575 * and interpret them.
578 options_from_file(filename, must_exist, check_prot, priv)
589 char args[MAXARGS][MAXWORDLEN];
590 char cmd[MAXWORDLEN];
592 if ((f = fopen(filename, "r")) == NULL) {
593 if (!must_exist && errno == ENOENT)
595 option_error("Can't open options file %s: %m", filename);
598 if (check_prot && !readable(fileno(f))) {
599 option_error("Can't open options file %s: access denied", filename);
604 oldpriv = privileged_option;
605 privileged_option = priv;
607 while (getword(f, cmd, &newline, filename)) {
609 * First see if it's a command.
611 for (cmdp = cmds; cmdp->cmd_name; cmdp++)
612 if (!strcmp(cmd, cmdp->cmd_name))
615 if (cmdp->cmd_name != NULL) {
616 for (i = 0; i < cmdp->num_args; ++i) {
617 if (!getword(f, args[i], &newline, filename)) {
619 "In file %s: too few parameters for option '%s'",
625 current_option = cmd;
626 if (!(*cmdp->cmd_func)(argv))
631 * Maybe a tty name, speed or IP address?
633 if ((i = setdevname(cmd, 0)) == 0
634 && (i = setspeed(cmd)) == 0
635 && (i = setipaddr(cmd)) == 0) {
636 option_error("In file %s: unrecognized option '%s'",
640 if (i < 0) /* error */
648 privileged_option = oldpriv;
653 * options_from_user - See if the use has a ~/.ppprc file,
654 * and if so, interpret options from it.
659 char *user, *path, *file;
663 pw = getpwuid(getuid());
664 if (pw == NULL || (user = pw->pw_dir) == NULL || user[0] == 0)
666 file = _PATH_USEROPT;
667 path = malloc(strlen(user) + strlen(file) + 2);
669 novm("init file name");
673 ret = options_from_file(path, 0, 1, privileged);
679 * options_for_tty - See if an options file exists for the serial
680 * device, and if so, interpret options from it.
685 char *dev, *path, *p;
689 if (strncmp(dev, "/dev/", 5) == 0)
691 if (strcmp(dev, "tty") == 0)
692 return 1; /* don't look for /etc/ppp/options.tty */
693 path = malloc(strlen(_PATH_TTYOPT) + strlen(dev) + 1);
695 novm("tty init file name");
696 strcpy(path, _PATH_TTYOPT);
697 /* Turn slashes into dots, for Solaris case (e.g. /dev/term/a) */
698 for (p = path + strlen(path); *dev != 0; ++dev)
699 *p++ = (*dev == '/'? '.': *dev);
701 ret = options_from_file(path, 0, 0, 1);
707 * option_error - print a message about an error in an option.
708 * The message is logged, and also sent to
709 * stderr if phase == PHASE_INITIALIZE.
712 option_error __V((char *fmt, ...))
722 fmt = va_arg(args, char *);
724 vfmtmsg(buf, sizeof(buf), fmt, args);
726 if (phase == PHASE_INITIALIZE)
727 fprintf(stderr, "%s: %s\n", progname, buf);
728 syslog(LOG_ERR, "%s", buf);
732 * readable - check if a file is readable by the real user.
741 GIDSET_TYPE groups[NGROUPS_MAX];
746 if (fstat(fd, &sbuf) != 0)
748 if (sbuf.st_uid == uid)
749 return sbuf.st_mode & S_IRUSR;
750 if (sbuf.st_gid == getgid())
751 return sbuf.st_mode & S_IRGRP;
752 ngroups = getgroups(NGROUPS_MAX, groups);
753 for (i = 0; i < ngroups; ++i)
754 if (sbuf.st_gid == groups[i])
755 return sbuf.st_mode & S_IRGRP;
756 return sbuf.st_mode & S_IROTH;
760 * Read a word from a file.
761 * Words are delimited by white-space or by quotes (" or ').
762 * Quotes, white-space and \ may be escaped with \.
763 * \<newline> is ignored.
766 getword(f, word, newlinep, filename)
774 int value, digit, got, n;
776 #define isoctal(c) ((c) >= '0' && (c) < '8')
784 * First skip white-space and comments.
792 * A newline means the end of a comment; backslash-newline
793 * is ignored. Note that we cannot have escape && comment.
805 * Ignore characters other than newline in a comment.
811 * If this character is escaped, we have a word start.
817 * If this is the escape character, look at the next character.
825 * If this is the start of a comment, ignore the rest of the line.
833 * A non-whitespace character is the start of a word.
840 * Save the delimiter for quoted strings.
842 if (!escape && (c == '"' || c == '\'')) {
849 * Process characters until the end of the word.
854 * This character is escaped: backslash-newline is ignored,
855 * various other characters indicate particular values
856 * as for C backslash-escapes.
891 * \ddd octal sequence
894 for (n = 0; n < 3 && isoctal(c); ++n) {
895 value = (value << 3) + (c & 07);
904 * \x<hex_string> sequence
908 for (n = 0; n < 2 && isxdigit(c); ++n) {
909 digit = toupper(c) - '0';
911 digit += '0' + 10 - 'A';
912 value = (value << 4) + digit;
920 * Otherwise the character stands for itself.
927 * Store the resulting character for the escape sequence.
929 if (len < MAXWORDLEN-1)
940 * Not escaped: see if we've reached the end of the word.
946 if (isspace(c) || c == '#') {
953 * Backslash starts an escape sequence.
962 * An ordinary character: store it in the word and get another.
964 if (len < MAXWORDLEN-1)
972 * End of the word: check for errors.
978 option_error("Error reading %s: %m", filename);
982 * If len is zero, then we didn't find a word before the
990 * Warn if the word was too long, and append a terminating null.
992 if (len >= MAXWORDLEN) {
993 option_error("warning: word in file %s too long (%.20s...)",
995 len = MAXWORDLEN - 1;
1006 * number_option - parse an unsigned numeric parameter for an option.
1009 number_option(str, valp, base)
1016 *valp = strtoul(str, &ptr, base);
1018 option_error("invalid numeric parameter '%s' for %s option",
1019 str, current_option);
1027 * int_option - like number_option, but valp is int *,
1028 * the base is assumed to be 0, and *valp is not changed
1029 * if there is an error.
1032 int_option(str, valp)
1038 if (!number_option(str, &v, 0))
1046 * The following procedures parse options.
1050 * readfile - take commands from a file.
1056 return options_from_file(*argv, 1, 1, privileged_option);
1060 * callfile - take commands from /etc/ppp/peers/<name>.
1061 * Name may not contain /../, start with / or ../, or end in /..
1067 char *fname, *arg, *p;
1072 if (arg[0] == '/' || arg[0] == 0)
1075 for (p = arg; *p != 0; ) {
1076 if (p[0] == '.' && p[1] == '.' && (p[2] == '/' || p[2] == 0)) {
1080 while (*p != '/' && *p != 0)
1087 option_error("call option value may not contain .. or start with /");
1091 l = strlen(arg) + strlen(_PATH_PEERFILES) + 1;
1092 if ((fname = (char *) malloc(l)) == NULL)
1093 novm("call file name");
1094 strcpy(fname, _PATH_PEERFILES);
1097 ok = options_from_file(fname, 1, 1, 1);
1105 * setdebug - Set debug (command line argument).
1116 * setkdebug - Set kernel debugging level.
1122 return int_option(*argv, &kdebugflag);
1127 * setpdebug - Set libpcap debugging level.
1133 return int_option(*argv, &dflag);
1137 * setpassfilter - Set the pass filter for packets
1143 pc.linktype = DLT_PPP;
1144 pc.snapshot = PPP_HDRLEN;
1146 if (pcap_compile(&pc, &pass_filter, *argv, 1, netmask) == 0)
1148 option_error("error in pass-filter expression: %s\n", pcap_geterr(&pc));
1153 * setactivefilter - Set the active filter for packets
1156 setactivefilter(argv)
1159 pc.linktype = DLT_PPP;
1160 pc.snapshot = PPP_HDRLEN;
1162 if (pcap_compile(&pc, &active_filter, *argv, 1, netmask) == 0)
1164 option_error("error in active-filter expression: %s\n", pcap_geterr(&pc));
1170 * noopt - Disable all options.
1176 BZERO((char *) &lcp_wantoptions[0], sizeof (struct lcp_options));
1177 BZERO((char *) &lcp_allowoptions[0], sizeof (struct lcp_options));
1178 BZERO((char *) &ipcp_wantoptions[0], sizeof (struct ipcp_options));
1179 BZERO((char *) &ipcp_allowoptions[0], sizeof (struct ipcp_options));
1182 BZERO((char *) &ipxcp_wantoptions[0], sizeof (struct ipxcp_options));
1183 BZERO((char *) &ipxcp_allowoptions[0], sizeof (struct ipxcp_options));
1184 #endif /* IPX_CHANGE */
1190 * noaccomp - Disable Address/Control field compression negotiation.
1196 lcp_wantoptions[0].neg_accompression = 0;
1197 lcp_allowoptions[0].neg_accompression = 0;
1203 * noasyncmap - Disable async map negotiation.
1209 lcp_wantoptions[0].neg_asyncmap = 0;
1210 lcp_allowoptions[0].neg_asyncmap = 0;
1216 * noip - Disable IP and IPCP.
1222 ipcp_protent.enabled_flag = 0;
1228 * nomagicnumber - Disable magic number negotiation.
1234 lcp_wantoptions[0].neg_magicnumber = 0;
1235 lcp_allowoptions[0].neg_magicnumber = 0;
1241 * nomru - Disable mru negotiation.
1247 lcp_wantoptions[0].neg_mru = 0;
1248 lcp_allowoptions[0].neg_mru = 0;
1254 * setmru - Set MRU for negotiation.
1262 if (!number_option(*argv, &mru, 0))
1264 lcp_wantoptions[0].mru = mru;
1265 lcp_wantoptions[0].neg_mru = 1;
1271 * setmru - Set the largest MTU we'll use.
1279 if (!number_option(*argv, &mtu, 0))
1281 if (mtu < MINMRU || mtu > MAXMRU) {
1282 option_error("mtu option value of %u is too %s", mtu,
1283 (mtu < MINMRU? "small": "large"));
1286 lcp_allowoptions[0].mru = mtu;
1295 lcp_wantoptions[0].neg_cbcp = 1;
1296 cbcp_protent.enabled_flag = 1;
1297 cbcp[0].us_number = strdup(*argv);
1298 if (cbcp[0].us_number == 0)
1299 novm("callback number");
1300 cbcp[0].us_type |= (1 << CB_CONF_USER);
1301 cbcp[0].us_type |= (1 << CB_CONF_ADMIN);
1307 * nopcomp - Disable Protocol field compression negotiation.
1313 lcp_wantoptions[0].neg_pcompression = 0;
1314 lcp_allowoptions[0].neg_pcompression = 0;
1320 * setpassive - Set passive mode (don't give up if we time out sending
1321 * LCP configure-requests).
1327 lcp_wantoptions[0].passive = 1;
1333 * setsilent - Set silent mode (don't start sending LCP configure-requests
1334 * until we get one from the peer).
1340 lcp_wantoptions[0].silent = 1;
1346 * nopap - Disable PAP authentication with peer.
1358 * reqpap - Require PAP authentication from peer.
1364 lcp_wantoptions[0].neg_upap = 1;
1371 * setupapfile - specifies UPAP info for authenticating with peer.
1380 lcp_allowoptions[0].neg_upap = 1;
1382 /* open user info file */
1383 if ((ufile = fopen(*argv, "r")) == NULL) {
1384 option_error("unable to open user login data file %s", *argv);
1387 if (!readable(fileno(ufile))) {
1388 option_error("%s: access denied", *argv);
1391 check_access(ufile, *argv);
1394 if (fgets(user, MAXNAMELEN - 1, ufile) == NULL
1395 || fgets(passwd, MAXSECRETLEN - 1, ufile) == NULL){
1396 option_error("unable to read user login data file %s", *argv);
1401 /* get rid of newlines */
1403 if (l > 0 && user[l-1] == '\n')
1406 if (l > 0 && passwd[l-1] == '\n')
1414 * nochap - Disable CHAP authentication with peer.
1426 * reqchap - Require CHAP authentication from peer.
1432 lcp_wantoptions[0].neg_chap = 1;
1439 * setnovj - disable vj compression
1445 ipcp_wantoptions[0].neg_vj = 0;
1446 ipcp_allowoptions[0].neg_vj = 0;
1452 * setnovjccomp - disable VJ connection-ID compression
1458 ipcp_wantoptions[0].cflag = 0;
1459 ipcp_allowoptions[0].cflag = 0;
1465 * setvjslots - set maximum number of connection slots for VJ compression
1473 if (!int_option(*argv, &value))
1475 if (value < 2 || value > 16) {
1476 option_error("vj-max-slots value must be between 2 and 16");
1479 ipcp_wantoptions [0].maxslotindex =
1480 ipcp_allowoptions[0].maxslotindex = value - 1;
1486 * setconnector - Set a program to connect to a serial line
1492 connector = strdup(*argv);
1493 if (connector == NULL)
1494 novm("connect script");
1495 connector_info.priv = privileged_option;
1496 connector_info.source = option_source;
1502 * setdisconnector - Set a program to disconnect from the serial line
1505 setdisconnector(argv)
1508 disconnector = strdup(*argv);
1509 if (disconnector == NULL)
1510 novm("disconnect script");
1511 disconnector_info.priv = privileged_option;
1512 disconnector_info.source = option_source;
1518 * setwelcomer - Set a program to welcome a client after connection
1524 welcomer = strdup(*argv);
1525 if (welcomer == NULL)
1526 novm("welcome script");
1527 welcomer_info.priv = privileged_option;
1528 welcomer_info.source = option_source;
1534 * setmaxconnect - Set the maximum connect time
1542 if (!int_option(*argv, &value))
1545 option_error("maxconnect time must be positive");
1548 if (maxconnect > 0 && (value == 0 || value > maxconnect)) {
1549 option_error("maxconnect time cannot be increased");
1557 * setdomain - Set domain name to append to hostname
1563 if (!privileged_option) {
1564 option_error("using the domain option requires root privilege");
1567 gethostname(hostname, MAXNAMELEN);
1570 strncat(hostname, ".", MAXNAMELEN - strlen(hostname));
1571 strncat(hostname, *argv, MAXNAMELEN - strlen(hostname));
1573 hostname[MAXNAMELEN-1] = 0;
1579 * setasyncmap - add bits to asyncmap (what we request peer to escape).
1587 if (!number_option(*argv, &asyncmap, 16))
1589 lcp_wantoptions[0].asyncmap |= asyncmap;
1590 lcp_wantoptions[0].neg_asyncmap = 1;
1596 * setescape - add chars to the set we escape on transmission.
1608 n = strtol(p, &endp, 16);
1610 option_error("escape parameter contains invalid hex number '%s'",
1615 if (n < 0 || (0x20 <= n && n <= 0x3F) || n == 0x5E || n > 0xFF) {
1616 option_error("can't escape character 0x%x", n);
1619 xmit_accm[0][n >> 5] |= 1 << (n & 0x1F);
1620 while (*p == ',' || *p == ' ')
1628 * setspeed - Set the speed.
1637 spd = strtol(arg, &ptr, 0);
1638 if (ptr == arg || *ptr != 0 || spd == 0)
1646 * setdevname - Set the device name.
1649 setdevname(cp, quiet)
1653 struct stat statbuf;
1654 char dev[MAXPATHLEN];
1659 if (strncmp("/dev/", cp, 5) != 0) {
1660 strcpy(dev, "/dev/");
1661 strncat(dev, cp, MAXPATHLEN - 5);
1662 dev[MAXPATHLEN-1] = 0;
1667 * Check if there is a device by this name.
1669 if (stat(cp, &statbuf) < 0) {
1670 if (errno == ENOENT || quiet)
1672 option_error("Couldn't stat %s: %m", cp);
1676 (void) strncpy(devnam, cp, MAXPATHLEN);
1677 devnam[MAXPATHLEN-1] = 0;
1678 default_device = FALSE;
1679 devnam_info.priv = privileged_option;
1680 devnam_info.source = option_source;
1687 * setipaddr - Set the IP address
1695 u_int32_t local, remote;
1696 ipcp_options *wo = &ipcp_wantoptions[0];
1699 * IP address pair separated by ":".
1701 if ((colon = strchr(arg, ':')) == NULL)
1705 * If colon first character, then no local addr.
1709 if ((local = inet_addr(arg)) == -1) {
1710 if ((hp = gethostbyname(arg)) == NULL) {
1711 option_error("unknown host: %s", arg);
1714 local = *(u_int32_t *)hp->h_addr;
1717 if (bad_ip_adrs(local)) {
1718 option_error("bad local IP address %s", ip_ntoa(local));
1722 wo->ouraddr = local;
1727 * If colon last character, then no remote addr.
1729 if (*++colon != '\0') {
1730 if ((remote = inet_addr(colon)) == -1) {
1731 if ((hp = gethostbyname(colon)) == NULL) {
1732 option_error("unknown host: %s", colon);
1735 remote = *(u_int32_t *)hp->h_addr;
1736 if (remote_name[0] == 0) {
1737 strncpy(remote_name, colon, MAXNAMELEN);
1738 remote_name[MAXNAMELEN-1] = 0;
1742 if (bad_ip_adrs(remote)) {
1743 option_error("bad remote IP address %s", ip_ntoa(remote));
1747 wo->hisaddr = remote;
1755 * setnoipdflt - disable setipdefault()
1761 disable_defaultip = 1;
1767 * setipcpaccl - accept peer's idea of our address
1773 ipcp_wantoptions[0].accept_local = 1;
1779 * setipcpaccr - accept peer's idea of its address
1785 ipcp_wantoptions[0].accept_remote = 1;
1791 * setnetmask - set the netmask to be used on the interface.
1802 * Unfortunately, if we use inet_addr, we can't tell whether
1803 * a result of all 1s is an error or a valid 255.255.255.255.
1809 b = strtoul(p, &endp, 0);
1812 if (b < 0 || b > 255) {
1814 /* accept e.g. 0xffffff00 */
1820 mask |= b << (n * 8);
1822 if (*p != '.' || n == 0)
1829 if (*p != 0 || (netmask & ~mask) != 0) {
1830 option_error("invalid netmask value '%s'", *argv);
1858 lcp_wantoptions[0].asyncmap |= 0x000A0000; /* escape ^S and ^Q */
1859 lcp_wantoptions[0].neg_asyncmap = 1;
1907 setusehostname(argv)
1918 if (!privileged_option) {
1919 option_error("using the name option requires root privilege");
1922 strncpy(our_name, argv[0], MAXNAMELEN);
1923 our_name[MAXNAMELEN-1] = 0;
1931 strncpy(user, argv[0], MAXNAMELEN);
1932 user[MAXNAMELEN-1] = 0;
1940 strncpy(remote_name, argv[0], MAXNAMELEN);
1941 remote_name[MAXNAMELEN-1] = 0;
1950 if (privileged_option > auth_req_info.priv) {
1951 auth_req_info.priv = privileged_option;
1952 auth_req_info.source = option_source;
1961 if (auth_required && privileged_option < auth_req_info.priv) {
1962 option_error("cannot override auth option set by %s",
1963 auth_req_info.source);
1971 setdefaultroute(argv)
1974 if (!ipcp_allowoptions[0].default_route) {
1975 option_error("defaultroute option is disabled");
1978 ipcp_wantoptions[0].default_route = 1;
1983 setnodefaultroute(argv)
1986 ipcp_allowoptions[0].default_route = 0;
1987 ipcp_wantoptions[0].default_route = 0;
1995 if (!ipcp_allowoptions[0].proxy_arp) {
1996 option_error("proxyarp option is disabled");
1999 ipcp_wantoptions[0].proxy_arp = 1;
2007 ipcp_wantoptions[0].proxy_arp = 0;
2008 ipcp_allowoptions[0].proxy_arp = 0;
2037 * Functions to set the echo interval for modem-less monitors
2041 setlcpechointv(argv)
2044 return int_option(*argv, &lcp_echo_interval);
2048 setlcpechofails(argv)
2051 return int_option(*argv, &lcp_echo_fails);
2055 * Functions to set timeouts, max transmits, etc.
2061 return int_option(*argv, &lcp_fsm[0].timeouttime);
2068 return int_option(*argv, &lcp_fsm[0].maxtermtransmits);
2075 return int_option(*argv, &lcp_fsm[0].maxconfreqtransmits);
2082 return int_option(*argv, &lcp_fsm[0].maxnakloops);
2086 setipcptimeout(argv)
2089 return int_option(*argv, &ipcp_fsm[0].timeouttime);
2096 return int_option(*argv, &ipcp_fsm[0].maxtermtransmits);
2103 return int_option(*argv, &ipcp_fsm[0].maxconfreqtransmits);
2110 return int_option(*argv, &lcp_fsm[0].maxnakloops);
2117 return int_option(*argv, &upap[0].us_timeouttime);
2124 return int_option(*argv, &upap[0].us_reqtimeout);
2131 return int_option(*argv, &upap[0].us_maxtransmits);
2135 setchaptimeout(argv)
2138 return int_option(*argv, &chap[0].timeouttime);
2145 return int_option(*argv, &chap[0].max_transmits);
2152 return int_option(*argv, &chap[0].chal_interval);
2159 ccp_protent.enabled_flag = 0;
2171 abits = rbits = strtol(str, &endp, 0);
2172 if (endp != str && *endp == ',') {
2174 abits = strtol(str, &endp, 0);
2176 if (*endp != 0 || endp == str) {
2177 option_error("invalid parameter '%s' for bsdcomp option", *argv);
2180 if ((rbits != 0 && (rbits < BSD_MIN_BITS || rbits > BSD_MAX_BITS))
2181 || (abits != 0 && (abits < BSD_MIN_BITS || abits > BSD_MAX_BITS))) {
2182 option_error("bsdcomp option values must be 0 or %d .. %d",
2183 BSD_MIN_BITS, BSD_MAX_BITS);
2187 ccp_wantoptions[0].bsd_compress = 1;
2188 ccp_wantoptions[0].bsd_bits = rbits;
2190 ccp_wantoptions[0].bsd_compress = 0;
2192 ccp_allowoptions[0].bsd_compress = 1;
2193 ccp_allowoptions[0].bsd_bits = abits;
2195 ccp_allowoptions[0].bsd_compress = 0;
2203 ccp_wantoptions[0].bsd_compress = 0;
2204 ccp_allowoptions[0].bsd_compress = 0;
2216 abits = rbits = strtol(str, &endp, 0);
2217 if (endp != str && *endp == ',') {
2219 abits = strtol(str, &endp, 0);
2221 if (*endp != 0 || endp == str) {
2222 option_error("invalid parameter '%s' for deflate option", *argv);
2225 if ((rbits != 0 && (rbits < DEFLATE_MIN_SIZE || rbits > DEFLATE_MAX_SIZE))
2226 || (abits != 0 && (abits < DEFLATE_MIN_SIZE
2227 || abits > DEFLATE_MAX_SIZE))) {
2228 option_error("deflate option values must be 0 or %d .. %d",
2229 DEFLATE_MIN_SIZE, DEFLATE_MAX_SIZE);
2233 ccp_wantoptions[0].deflate = 1;
2234 ccp_wantoptions[0].deflate_size = rbits;
2236 ccp_wantoptions[0].deflate = 0;
2238 ccp_allowoptions[0].deflate = 1;
2239 ccp_allowoptions[0].deflate_size = abits;
2241 ccp_allowoptions[0].deflate = 0;
2249 ccp_wantoptions[0].deflate = 0;
2250 ccp_allowoptions[0].deflate = 0;
2255 setnodeflatedraft(argv)
2258 ccp_wantoptions[0].deflate_draft = 0;
2259 ccp_allowoptions[0].deflate_draft = 0;
2267 ccp_wantoptions[0].predictor_1 = 1;
2268 ccp_allowoptions[0].predictor_1 = 1;
2273 setnopred1comp(argv)
2276 ccp_wantoptions[0].predictor_1 = 0;
2277 ccp_allowoptions[0].predictor_1 = 0;
2285 ipparam = strdup(*argv);
2286 if (ipparam == NULL)
2287 novm("ipparam string");
2304 return int_option(*argv, &idle_time_limit);
2311 return int_option(*argv, &holdoff);
2315 * setdnsaddr - set the dns address(es)
2324 dns = inet_addr(*argv);
2326 if ((hp = gethostbyname(*argv)) == NULL) {
2327 option_error("invalid address parameter '%s' for ms-dns option",
2331 dns = *(u_int32_t *)hp->h_addr;
2334 /* if there is no primary then update it. */
2335 if (ipcp_allowoptions[0].dnsaddr[0] == 0)
2336 ipcp_allowoptions[0].dnsaddr[0] = dns;
2338 /* always set the secondary address value to the same value. */
2339 ipcp_allowoptions[0].dnsaddr[1] = dns;
2345 * setwinsaddr - set the wins address(es)
2346 * This is primrarly used with the Samba package under UNIX or for pointing
2347 * the caller to the existing WINS server on a Windows NT platform.
2356 wins = inet_addr(*argv);
2358 if ((hp = gethostbyname(*argv)) == NULL) {
2359 option_error("invalid address parameter '%s' for ms-wins option",
2363 wins = *(u_int32_t *)hp->h_addr;
2366 /* if there is no primary then update it. */
2367 if (ipcp_allowoptions[0].winsaddr[0] == 0)
2368 ipcp_allowoptions[0].winsaddr[0] = wins;
2370 /* always set the secondary address value to the same value. */
2371 ipcp_allowoptions[0].winsaddr[1] = wins;
2381 ipxcp_wantoptions[0].neg_router = 1;
2382 ipxcp_allowoptions[0].neg_router = 1;
2383 return int_option(*argv, &ipxcp_wantoptions[0].router);
2390 char *dest = ipxcp_wantoptions[0].name;
2395 ipxcp_wantoptions[0].neg_name = 1;
2396 ipxcp_allowoptions[0].neg_name = 1;
2397 memset (dest, '\0', sizeof (ipxcp_wantoptions[0].name));
2402 if (! isalnum (ch) && ch != '_') {
2403 option_error("IPX router name must be alphanumeric or _");
2407 if (count >= sizeof (ipxcp_wantoptions[0].name)) {
2408 option_error("IPX router name is limited to %d characters",
2409 sizeof (ipxcp_wantoptions[0].name) - 1);
2413 dest[count++] = toupper (ch);
2420 setipxcptimeout (argv)
2423 return int_option(*argv, &ipxcp_fsm[0].timeouttime);
2430 return int_option(*argv, &ipxcp_fsm[0].maxtermtransmits);
2437 return int_option(*argv, &ipxcp_fsm[0].maxconfreqtransmits);
2441 setipxcpfails (argv)
2444 return int_option(*argv, &ipxcp_fsm[0].maxnakloops);
2453 if (!number_option(*argv, &v, 16))
2456 ipxcp_wantoptions[0].our_network = (int) v;
2457 ipxcp_wantoptions[0].neg_nn = 1;
2465 ipxcp_wantoptions[0].accept_network = 1;
2466 ipxcp_allowoptions[0].accept_network = 1;
2474 ipxcp_wantoptions[0].accept_local = 1;
2475 ipxcp_allowoptions[0].accept_local = 1;
2483 ipxcp_wantoptions[0].accept_remote = 1;
2484 ipxcp_allowoptions[0].accept_remote = 1;
2489 setipxnodevalue(src,dst)
2496 if (!isxdigit (*src))
2499 for (indx = 0; indx < 5; ++indx) {
2501 dst[indx] |= (dst[indx + 1] >> 4) & 0x0F;
2504 item = toupper (*src) - '0';
2508 dst[5] = (dst[5] << 4) | item;
2520 memset (&ipxcp_wantoptions[0].our_node[0], 0, 6);
2521 memset (&ipxcp_wantoptions[0].his_node[0], 0, 6);
2523 end = setipxnodevalue (*argv, &ipxcp_wantoptions[0].our_node[0]);
2525 end = setipxnodevalue (++end, &ipxcp_wantoptions[0].his_node[0]);
2528 ipxcp_wantoptions[0].neg_node = 1;
2532 option_error("invalid parameter '%s' for ipx-node option", *argv);
2540 ipxcp_protent.enabled_flag = 1;
2548 ipxcp_protent.enabled_flag = 0;
2559 #endif /* IPX_CHANGE */