]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/capi4k-utils-2004-10-06_ppp-2.4.3.patch
Wir kehren zurueck zu Kudzu, da hwinfo noch mehr Aerger macht.
[people/teissler/ipfire-2.x.git] / src / patches / capi4k-utils-2004-10-06_ppp-2.4.3.patch
1 diff -Naur capi4k-utils.old/pppdcapiplugin/Makefile capi4k-utils/pppdcapiplugin/Makefile
2 --- capi4k-utils.old/pppdcapiplugin/Makefile Mon Feb 23 18:30:39 2004
3 +++ capi4k-utils/pppdcapiplugin/Makefile Wed Nov 24 22:19:36 2004
4 @@ -18,7 +18,7 @@
5 PPPSRCDIRS=/src/isdn/pppd
6
7 ifeq ($(PPPVERSIONS),)
8 -PPPVERSIONS = 2.3.11 2.4.0 2.4.1 2.4.1b1 2.4.1b2 2.4.2b3 2.4.2
9 +PPPVERSIONS = 2.3.11 2.4.0 2.4.1 2.4.1b1 2.4.1b2 2.4.2b3 2.4.2 2.4.3
10 endif
11
12 PEERDIR=${DESTDIR}/etc/ppp/peers/isdn
13 diff -Naur capi4k-utils.old/pppdcapiplugin/ppp-2.4.3/Makefile capi4k-utils/pppdcapiplugin/ppp-2.4.3/Makefile
14 --- capi4k-utils.old/pppdcapiplugin/ppp-2.4.3/Makefile Thu Jan 1 01:00:00 1970
15 +++ capi4k-utils/pppdcapiplugin/ppp-2.4.3/Makefile Sun May 18 21:11:16 2003
16 @@ -0,0 +1,14 @@
17 +# Makefile for the capiplugin for pppd(8).
18 +#
19 +# Copyright 2000 Carsten Paeth (calle@calle.in-berlin.de)
20 +# Copyright 2000 AVM GmbH Berlin (info@avm.de)
21 +#
22 +# This program is free software; you can redistribute it and/or
23 +# modify it under the terms of the GNU General Public License
24 +# as published by the Free Software Foundation; either version
25 +# 2 of the License, or (at your option) any later version.
26 +
27 +PLUGINDIR=${DESTDIR}/usr/lib/pppd/$(PPPVERSION)
28 +
29 +include $(TOPDIR)/Rules.make
30 +
31 diff -Naur capi4k-utils.old/pppdcapiplugin/ppp-2.4.3/pppd/patchlevel.h capi4k-utils/pppdcapiplugin/ppp-2.4.3/pppd/patchlevel.h
32 --- capi4k-utils.old/pppdcapiplugin/ppp-2.4.3/pppd/patchlevel.h Thu Jan 1 01:00:00 1970
33 +++ capi4k-utils/pppdcapiplugin/ppp-2.4.3/pppd/patchlevel.h Sat Nov 13 12:08:02 2004
34 @@ -0,0 +1,4 @@
35 +/* $Id: capi4k-utils-2004-10-06_ppp-2.4.3.patch,v 1.1.2.1 2004/11/24 23:27:29 gespinasse Exp $ */
36 +
37 +#define VERSION "2.4.3"
38 +#define DATE "13 November 2004"
39 diff -Naur capi4k-utils.old/pppdcapiplugin/ppp-2.4.3/pppd/pppd.h capi4k-utils/pppdcapiplugin/ppp-2.4.3/pppd/pppd.h
40 --- capi4k-utils.old/pppdcapiplugin/ppp-2.4.3/pppd/pppd.h Thu Jan 1 01:00:00 1970
41 +++ capi4k-utils/pppdcapiplugin/ppp-2.4.3/pppd/pppd.h Sat Nov 13 12:02:22 2004
42 @@ -0,0 +1,905 @@
43 +/*
44 + * pppd.h - PPP daemon global declarations.
45 + *
46 + * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
47 + *
48 + * Redistribution and use in source and binary forms, with or without
49 + * modification, are permitted provided that the following conditions
50 + * are met:
51 + *
52 + * 1. Redistributions of source code must retain the above copyright
53 + * notice, this list of conditions and the following disclaimer.
54 + *
55 + * 2. Redistributions in binary form must reproduce the above copyright
56 + * notice, this list of conditions and the following disclaimer in
57 + * the documentation and/or other materials provided with the
58 + * distribution.
59 + *
60 + * 3. The name "Carnegie Mellon University" must not be used to
61 + * endorse or promote products derived from this software without
62 + * prior written permission. For permission or any legal
63 + * details, please contact
64 + * Office of Technology Transfer
65 + * Carnegie Mellon University
66 + * 5000 Forbes Avenue
67 + * Pittsburgh, PA 15213-3890
68 + * (412) 268-4387, fax: (412) 268-7395
69 + * tech-transfer@andrew.cmu.edu
70 + *
71 + * 4. Redistributions of any form whatsoever must retain the following
72 + * acknowledgment:
73 + * "This product includes software developed by Computing Services
74 + * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
75 + *
76 + * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
77 + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
78 + * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
79 + * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
80 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
81 + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
82 + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
83 + *
84 + * $Id: capi4k-utils-2004-10-06_ppp-2.4.3.patch,v 1.1.2.1 2004/11/24 23:27:29 gespinasse Exp $
85 + */
86 +
87 +/*
88 + * TODO:
89 + */
90 +
91 +#ifndef __PPPD_H__
92 +#define __PPPD_H__
93 +
94 +#include <stdio.h> /* for FILE */
95 +#include <limits.h> /* for NGROUPS_MAX */
96 +#include <sys/param.h> /* for MAXPATHLEN and BSD4_4, if defined */
97 +#include <sys/types.h> /* for u_int32_t, if defined */
98 +#include <sys/time.h> /* for struct timeval */
99 +#include <net/ppp_defs.h>
100 +#include "patchlevel.h"
101 +
102 +#if defined(__STDC__)
103 +#include <stdarg.h>
104 +#define __V(x) x
105 +#else
106 +#include <varargs.h>
107 +#define __V(x) (va_alist) va_dcl
108 +#define const
109 +#define volatile
110 +#endif
111 +
112 +#ifdef INET6
113 +#include "eui64.h"
114 +#endif
115 +
116 +/*
117 + * Limits.
118 + */
119 +
120 +#define NUM_PPP 1 /* One PPP interface supported (per process) */
121 +#define MAXWORDLEN 1024 /* max length of word in file (incl null) */
122 +#define MAXARGS 1 /* max # args to a command */
123 +#define MAXNAMELEN 256 /* max length of hostname or name for auth */
124 +#define MAXSECRETLEN 256 /* max length of password or secret */
125 +
126 +/*
127 + * Option descriptor structure.
128 + */
129 +
130 +typedef unsigned char bool;
131 +
132 +enum opt_type {
133 + o_special_noarg = 0,
134 + o_special = 1,
135 + o_bool,
136 + o_int,
137 + o_uint32,
138 + o_string,
139 + o_wild
140 +};
141 +
142 +typedef struct {
143 + char *name; /* name of the option */
144 + enum opt_type type;
145 + void *addr;
146 + char *description;
147 + unsigned int flags;
148 + void *addr2;
149 + int upper_limit;
150 + int lower_limit;
151 + const char *source;
152 + short int priority;
153 + short int winner;
154 +} option_t;
155 +
156 +/* Values for flags */
157 +#define OPT_VALUE 0xff /* mask for presupplied value */
158 +#define OPT_HEX 0x100 /* int option is in hex */
159 +#define OPT_NOARG 0x200 /* option doesn't take argument */
160 +#define OPT_OR 0x400 /* OR in argument to value */
161 +#define OPT_INC 0x800 /* increment value */
162 +#define OPT_A2OR 0x800 /* for o_bool, OR arg to *(u_char *)addr2 */
163 +#define OPT_PRIV 0x1000 /* privileged option */
164 +#define OPT_STATIC 0x2000 /* string option goes into static array */
165 +#define OPT_LLIMIT 0x4000 /* check value against lower limit */
166 +#define OPT_ULIMIT 0x8000 /* check value against upper limit */
167 +#define OPT_LIMITS (OPT_LLIMIT|OPT_ULIMIT)
168 +#define OPT_ZEROOK 0x10000 /* 0 value is OK even if not within limits */
169 +#define OPT_HIDE 0x10000 /* for o_string, print value as ?????? */
170 +#define OPT_A2LIST 0x10000 /* for o_special, keep list of values */
171 +#define OPT_A2CLRB 0x10000 /* o_bool, clr val bits in *(u_char *)addr2 */
172 +#define OPT_NOINCR 0x20000 /* value mustn't be increased */
173 +#define OPT_ZEROINF 0x40000 /* with OPT_NOINCR, 0 == infinity */
174 +#define OPT_PRIO 0x80000 /* process option priorities for this option */
175 +#define OPT_PRIOSUB 0x100000 /* subsidiary member of priority group */
176 +#define OPT_ALIAS 0x200000 /* option is alias for previous option */
177 +#define OPT_A2COPY 0x400000 /* addr2 -> second location to rcv value */
178 +#define OPT_ENABLE 0x800000 /* use *addr2 as enable for option */
179 +#define OPT_A2CLR 0x1000000 /* clear *(bool *)addr2 */
180 +#define OPT_PRIVFIX 0x2000000 /* user can't override if set by root */
181 +#define OPT_INITONLY 0x4000000 /* option can only be set in init phase */
182 +#define OPT_DEVEQUIV 0x8000000 /* equiv to device name */
183 +#define OPT_DEVNAM (OPT_INITONLY | OPT_DEVEQUIV)
184 +#define OPT_A2PRINTER 0x10000000 /* *addr2 is a fn for printing option */
185 +#define OPT_A2STRVAL 0x20000000 /* *addr2 points to current string value */
186 +#define OPT_NOPRINT 0x40000000 /* don't print this option at all */
187 +
188 +#define OPT_VAL(x) ((x) & OPT_VALUE)
189 +
190 +/* Values for priority */
191 +#define OPRIO_DEFAULT 0 /* a default value */
192 +#define OPRIO_CFGFILE 1 /* value from a configuration file */
193 +#define OPRIO_CMDLINE 2 /* value from the command line */
194 +#define OPRIO_SECFILE 3 /* value from options in a secrets file */
195 +#define OPRIO_ROOT 100 /* added to priority if OPT_PRIVFIX && root */
196 +
197 +#ifndef GIDSET_TYPE
198 +#define GIDSET_TYPE gid_t
199 +#endif
200 +
201 +/* Structure representing a list of permitted IP addresses. */
202 +struct permitted_ip {
203 + int permit; /* 1 = permit, 0 = forbid */
204 + u_int32_t base; /* match if (addr & mask) == base */
205 + u_int32_t mask; /* base and mask are in network byte order */
206 +};
207 +
208 +/*
209 + * Unfortunately, the linux kernel driver uses a different structure
210 + * for statistics from the rest of the ports.
211 + * This structure serves as a common representation for the bits
212 + * pppd needs.
213 + */
214 +struct pppd_stats {
215 + unsigned int bytes_in;
216 + unsigned int bytes_out;
217 + unsigned int pkts_in;
218 + unsigned int pkts_out;
219 +};
220 +
221 +/* Used for storing a sequence of words. Usually malloced. */
222 +struct wordlist {
223 + struct wordlist *next;
224 + char *word;
225 +};
226 +
227 +/* An endpoint discriminator, used with multilink. */
228 +#define MAX_ENDP_LEN 20 /* maximum length of discriminator value */
229 +struct epdisc {
230 + unsigned char class;
231 + unsigned char length;
232 + unsigned char value[MAX_ENDP_LEN];
233 +};
234 +
235 +/* values for epdisc.class */
236 +#define EPD_NULL 0 /* null discriminator, no data */
237 +#define EPD_LOCAL 1
238 +#define EPD_IP 2
239 +#define EPD_MAC 3
240 +#define EPD_MAGIC 4
241 +#define EPD_PHONENUM 5
242 +
243 +typedef void (*notify_func) __P((void *, int));
244 +
245 +struct notifier {
246 + struct notifier *next;
247 + notify_func func;
248 + void *arg;
249 +};
250 +
251 +/*
252 + * Global variables.
253 + */
254 +
255 +extern int hungup; /* Physical layer has disconnected */
256 +extern int ifunit; /* Interface unit number */
257 +extern char ifname[]; /* Interface name */
258 +extern char hostname[]; /* Our hostname */
259 +extern u_char outpacket_buf[]; /* Buffer for outgoing packets */
260 +extern int devfd; /* fd of underlying device */
261 +extern int fd_ppp; /* fd for talking PPP */
262 +extern int phase; /* Current state of link - see values below */
263 +extern int baud_rate; /* Current link speed in bits/sec */
264 +extern char *progname; /* Name of this program */
265 +extern int redirect_stderr;/* Connector's stderr should go to file */
266 +extern char peer_authname[];/* Authenticated name of peer */
267 +extern int auth_done[NUM_PPP]; /* Methods actually used for auth */
268 +extern int privileged; /* We were run by real-uid root */
269 +extern int need_holdoff; /* Need holdoff period after link terminates */
270 +extern char **script_env; /* Environment variables for scripts */
271 +extern int detached; /* Have detached from controlling tty */
272 +extern GIDSET_TYPE groups[NGROUPS_MAX]; /* groups the user is in */
273 +extern int ngroups; /* How many groups valid in groups */
274 +extern struct pppd_stats link_stats; /* byte/packet counts etc. for link */
275 +extern int link_stats_valid; /* set if link_stats is valid */
276 +extern unsigned link_connect_time; /* time the link was up for */
277 +extern int using_pty; /* using pty as device (notty or pty opt.) */
278 +extern int log_to_fd; /* logging to this fd as well as syslog */
279 +extern bool log_default; /* log_to_fd is default (stdout) */
280 +extern char *no_ppp_msg; /* message to print if ppp not in kernel */
281 +extern volatile int status; /* exit status for pppd */
282 +extern bool devnam_fixed; /* can no longer change devnam */
283 +extern int unsuccess; /* # unsuccessful connection attempts */
284 +extern int do_callback; /* set if we want to do callback next */
285 +extern int doing_callback; /* set if this is a callback */
286 +extern int error_count; /* # of times error() has been called */
287 +extern char ppp_devnam[MAXPATHLEN];
288 +extern char remote_number[MAXNAMELEN]; /* Remote telephone number, if avail. */
289 +extern int ppp_session_number; /* Session number (eg PPPoE session) */
290 +extern int fd_devnull; /* fd open to /dev/null */
291 +
292 +extern int listen_time; /* time to listen first (ms) */
293 +extern bool doing_multilink;
294 +extern bool multilink_master;
295 +extern bool bundle_eof;
296 +extern bool bundle_terminating;
297 +
298 +extern struct notifier *pidchange; /* for notifications of pid changing */
299 +extern struct notifier *phasechange; /* for notifications of phase changes */
300 +extern struct notifier *exitnotify; /* for notification that we're exiting */
301 +extern struct notifier *sigreceived; /* notification of received signal */
302 +extern struct notifier *ip_up_notifier; /* IPCP has come up */
303 +extern struct notifier *ip_down_notifier; /* IPCP has gone down */
304 +extern struct notifier *auth_up_notifier; /* peer has authenticated */
305 +extern struct notifier *link_down_notifier; /* link has gone down */
306 +extern struct notifier *fork_notifier; /* we are a new child process */
307 +
308 +/* Values for do_callback and doing_callback */
309 +#define CALLBACK_DIALIN 1 /* we are expecting the call back */
310 +#define CALLBACK_DIALOUT 2 /* we are dialling out to call back */
311 +
312 +/*
313 + * Variables set by command-line options.
314 + */
315 +
316 +extern int debug; /* Debug flag */
317 +extern int kdebugflag; /* Tell kernel to print debug messages */
318 +extern int default_device; /* Using /dev/tty or equivalent */
319 +extern char devnam[MAXPATHLEN]; /* Device name */
320 +extern int crtscts; /* Use hardware flow control */
321 +extern bool modem; /* Use modem control lines */
322 +extern int inspeed; /* Input/Output speed requested */
323 +extern u_int32_t netmask; /* IP netmask to set on interface */
324 +extern bool lockflag; /* Create lock file to lock the serial dev */
325 +extern bool nodetach; /* Don't detach from controlling tty */
326 +extern bool updetach; /* Detach from controlling tty when link up */
327 +extern char *initializer; /* Script to initialize physical link */
328 +extern char *connect_script; /* Script to establish physical link */
329 +extern char *disconnect_script; /* Script to disestablish physical link */
330 +extern char *welcomer; /* Script to welcome client after connection */
331 +extern char *ptycommand; /* Command to run on other side of pty */
332 +extern int maxconnect; /* Maximum connect time (seconds) */
333 +extern char user[MAXNAMELEN];/* Our name for authenticating ourselves */
334 +extern char passwd[MAXSECRETLEN]; /* Password for PAP or CHAP */
335 +extern bool auth_required; /* Peer is required to authenticate */
336 +extern bool persist; /* Reopen link after it goes down */
337 +extern bool uselogin; /* Use /etc/passwd for checking PAP */
338 +extern char our_name[MAXNAMELEN];/* Our name for authentication purposes */
339 +extern char remote_name[MAXNAMELEN]; /* Peer's name for authentication */
340 +extern bool explicit_remote;/* remote_name specified with remotename opt */
341 +extern bool demand; /* Do dial-on-demand */
342 +extern char *ipparam; /* Extra parameter for ip up/down scripts */
343 +extern bool cryptpap; /* Others' PAP passwords are encrypted */
344 +extern int idle_time_limit;/* Shut down link if idle for this long */
345 +extern int holdoff; /* Dead time before restarting */
346 +extern bool holdoff_specified; /* true if user gave a holdoff value */
347 +extern bool notty; /* Stdin/out is not a tty */
348 +extern char *pty_socket; /* Socket to connect to pty */
349 +extern char *record_file; /* File to record chars sent/received */
350 +extern bool sync_serial; /* Device is synchronous serial device */
351 +extern int maxfail; /* Max # of unsuccessful connection attempts */
352 +extern char linkname[MAXPATHLEN]; /* logical name for link */
353 +extern bool tune_kernel; /* May alter kernel settings as necessary */
354 +extern int connect_delay; /* Time to delay after connect script */
355 +extern int max_data_rate; /* max bytes/sec through charshunt */
356 +extern int req_unit; /* interface unit number to use */
357 +extern bool multilink; /* enable multilink operation */
358 +extern bool noendpoint; /* don't send or accept endpt. discrim. */
359 +extern char *bundle_name; /* bundle name for multilink */
360 +extern bool dump_options; /* print out option values */
361 +extern bool dryrun; /* check everything, print options, exit */
362 +extern int child_wait; /* # seconds to wait for children at end */
363 +
364 +#ifdef MAXOCTETS
365 +extern unsigned int maxoctets; /* Maximum octetes per session (in bytes) */
366 +extern int maxoctets_dir; /* Direction :
367 + 0 - in+out (default)
368 + 1 - in
369 + 2 - out
370 + 3 - max(in,out) */
371 +extern int maxoctets_timeout; /* Timeout for check of octets limit */
372 +#define PPP_OCTETS_DIRECTION_SUM 0
373 +#define PPP_OCTETS_DIRECTION_IN 1
374 +#define PPP_OCTETS_DIRECTION_OUT 2
375 +#define PPP_OCTETS_DIRECTION_MAXOVERAL 3
376 +/* same as previos, but little different on RADIUS side */
377 +#define PPP_OCTETS_DIRECTION_MAXSESSION 4
378 +#endif
379 +
380 +#ifdef PPP_FILTER
381 +extern struct bpf_program pass_filter; /* Filter for pkts to pass */
382 +extern struct bpf_program active_filter; /* Filter for link-active pkts */
383 +#endif
384 +
385 +#ifdef MSLANMAN
386 +extern bool ms_lanman; /* Use LanMan password instead of NT */
387 + /* Has meaning only with MS-CHAP challenges */
388 +#endif
389 +
390 +/* Values for auth_pending, auth_done */
391 +#define PAP_WITHPEER 0x1
392 +#define PAP_PEER 0x2
393 +#define CHAP_WITHPEER 0x4
394 +#define CHAP_PEER 0x8
395 +#define EAP_WITHPEER 0x10
396 +#define EAP_PEER 0x20
397 +
398 +/* Values for auth_done only */
399 +#define CHAP_MD5_WITHPEER 0x40
400 +#define CHAP_MD5_PEER 0x80
401 +#define CHAP_MS_SHIFT 8 /* LSB position for MS auths */
402 +#define CHAP_MS_WITHPEER 0x100
403 +#define CHAP_MS_PEER 0x200
404 +#define CHAP_MS2_WITHPEER 0x400
405 +#define CHAP_MS2_PEER 0x800
406 +
407 +extern char *current_option; /* the name of the option being parsed */
408 +extern int privileged_option; /* set iff the current option came from root */
409 +extern char *option_source; /* string saying where the option came from */
410 +extern int option_priority; /* priority of current options */
411 +
412 +/*
413 + * Values for phase.
414 + */
415 +#define PHASE_DEAD 0
416 +#define PHASE_INITIALIZE 1
417 +#define PHASE_SERIALCONN 2
418 +#define PHASE_DORMANT 3
419 +#define PHASE_ESTABLISH 4
420 +#define PHASE_AUTHENTICATE 5
421 +#define PHASE_CALLBACK 6
422 +#define PHASE_NETWORK 7
423 +#define PHASE_RUNNING 8
424 +#define PHASE_TERMINATE 9
425 +#define PHASE_DISCONNECT 10
426 +#define PHASE_HOLDOFF 11
427 +#define PHASE_MASTER 12
428 +
429 +/*
430 + * The following struct gives the addresses of procedures to call
431 + * for a particular protocol.
432 + */
433 +struct protent {
434 + u_short protocol; /* PPP protocol number */
435 + /* Initialization procedure */
436 + void (*init) __P((int unit));
437 + /* Process a received packet */
438 + void (*input) __P((int unit, u_char *pkt, int len));
439 + /* Process a received protocol-reject */
440 + void (*protrej) __P((int unit));
441 + /* Lower layer has come up */
442 + void (*lowerup) __P((int unit));
443 + /* Lower layer has gone down */
444 + void (*lowerdown) __P((int unit));
445 + /* Open the protocol */
446 + void (*open) __P((int unit));
447 + /* Close the protocol */
448 + void (*close) __P((int unit, char *reason));
449 + /* Print a packet in readable form */
450 + int (*printpkt) __P((u_char *pkt, int len,
451 + void (*printer) __P((void *, char *, ...)),
452 + void *arg));
453 + /* Process a received data packet */
454 + void (*datainput) __P((int unit, u_char *pkt, int len));
455 + bool enabled_flag; /* 0 iff protocol is disabled */
456 + char *name; /* Text name of protocol */
457 + char *data_name; /* Text name of corresponding data protocol */
458 + option_t *options; /* List of command-line options */
459 + /* Check requested options, assign defaults */
460 + void (*check_options) __P((void));
461 + /* Configure interface for demand-dial */
462 + int (*demand_conf) __P((int unit));
463 + /* Say whether to bring up link for this pkt */
464 + int (*active_pkt) __P((u_char *pkt, int len));
465 +};
466 +
467 +/* Table of pointers to supported protocols */
468 +extern struct protent *protocols[];
469 +
470 +/*
471 + * This struct contains pointers to a set of procedures for
472 + * doing operations on a "channel". A channel provides a way
473 + * to send and receive PPP packets - the canonical example is
474 + * a serial port device in PPP line discipline (or equivalently
475 + * with PPP STREAMS modules pushed onto it).
476 + */
477 +struct channel {
478 + /* set of options for this channel */
479 + option_t *options;
480 + /* find and process a per-channel options file */
481 + void (*process_extra_options) __P((void));
482 + /* check all the options that have been given */
483 + void (*check_options) __P((void));
484 + /* get the channel ready to do PPP, return a file descriptor */
485 + int (*connect) __P((void));
486 + /* we're finished with the channel */
487 + void (*disconnect) __P((void));
488 + /* put the channel into PPP `mode' */
489 + int (*establish_ppp) __P((int));
490 + /* take the channel out of PPP `mode', restore loopback if demand */
491 + void (*disestablish_ppp) __P((int));
492 + /* set the transmit-side PPP parameters of the channel */
493 + void (*send_config) __P((int, u_int32_t, int, int));
494 + /* set the receive-side PPP parameters of the channel */
495 + void (*recv_config) __P((int, u_int32_t, int, int));
496 + /* cleanup on error or normal exit */
497 + void (*cleanup) __P((void));
498 + /* close the device, called in children after fork */
499 + void (*close) __P((void));
500 +};
501 +
502 +extern struct channel *the_channel;
503 +
504 +/*
505 + * Prototypes.
506 + */
507 +
508 +/* Procedures exported from main.c. */
509 +void set_ifunit __P((int)); /* set stuff that depends on ifunit */
510 +void detach __P((void)); /* Detach from controlling tty */
511 +void die __P((int)); /* Cleanup and exit */
512 +void quit __P((void)); /* like die(1) */
513 +void novm __P((char *)); /* Say we ran out of memory, and die */
514 +void timeout __P((void (*func)(void *), void *arg, int s, int us));
515 + /* Call func(arg) after s.us seconds */
516 +void untimeout __P((void (*func)(void *), void *arg));
517 + /* Cancel call to func(arg) */
518 +void record_child __P((int, char *, void (*) (void *), void *));
519 +pid_t safe_fork __P((int, int, int)); /* Fork & close stuff in child */
520 +int device_script __P((char *cmd, int in, int out, int dont_wait));
521 + /* Run `cmd' with given stdin and stdout */
522 +pid_t run_program __P((char *prog, char **args, int must_exist,
523 + void (*done)(void *), void *arg));
524 + /* Run program prog with args in child */
525 +void reopen_log __P((void)); /* (re)open the connection to syslog */
526 +void print_link_stats __P((void)); /* Print stats, if available */
527 +void reset_link_stats __P((int)); /* Reset (init) stats when link goes up */
528 +void update_link_stats __P((int)); /* Get stats at link termination */
529 +void script_setenv __P((char *, char *, int)); /* set script env var */
530 +void script_unsetenv __P((char *)); /* unset script env var */
531 +void new_phase __P((int)); /* signal start of new phase */
532 +void add_notifier __P((struct notifier **, notify_func, void *));
533 +void remove_notifier __P((struct notifier **, notify_func, void *));
534 +void notify __P((struct notifier *, int));
535 +int ppp_send_config __P((int, int, u_int32_t, int, int));
536 +int ppp_recv_config __P((int, int, u_int32_t, int, int));
537 +void remove_pidfiles __P((void));
538 +void lock_db __P((void));
539 +void unlock_db __P((void));
540 +
541 +/* Procedures exported from tty.c. */
542 +void tty_init __P((void));
543 +
544 +/* Procedures exported from utils.c. */
545 +void log_packet __P((u_char *, int, char *, int));
546 + /* Format a packet and log it with syslog */
547 +void print_string __P((char *, int, void (*) (void *, char *, ...),
548 + void *)); /* Format a string for output */
549 +int slprintf __P((char *, int, char *, ...)); /* sprintf++ */
550 +int vslprintf __P((char *, int, char *, va_list)); /* vsprintf++ */
551 +size_t strlcpy __P((char *, const char *, size_t)); /* safe strcpy */
552 +size_t strlcat __P((char *, const char *, size_t)); /* safe strncpy */
553 +void dbglog __P((char *, ...)); /* log a debug message */
554 +void info __P((char *, ...)); /* log an informational message */
555 +void notice __P((char *, ...)); /* log a notice-level message */
556 +void warn __P((char *, ...)); /* log a warning message */
557 +void error __P((char *, ...)); /* log an error message */
558 +void fatal __P((char *, ...)); /* log an error message and die(1) */
559 +void init_pr_log __P((char *, int)); /* initialize for using pr_log */
560 +void pr_log __P((void *, char *, ...)); /* printer fn, output to syslog */
561 +void end_pr_log __P((void)); /* finish up after using pr_log */
562 +void dump_packet __P((const char *, u_char *, int));
563 + /* dump packet to debug log if interesting */
564 +ssize_t complete_read __P((int, void *, size_t));
565 + /* read a complete buffer */
566 +
567 +/* Procedures exported from auth.c */
568 +void link_required __P((int)); /* we are starting to use the link */
569 +void link_terminated __P((int)); /* we are finished with the link */
570 +void link_down __P((int)); /* the LCP layer has left the Opened state */
571 +void upper_layers_down __P((int));/* take all NCPs down */
572 +void link_established __P((int)); /* the link is up; authenticate now */
573 +void start_networks __P((int)); /* start all the network control protos */
574 +void continue_networks __P((int)); /* start network [ip, etc] control protos */
575 +void np_up __P((int, int)); /* a network protocol has come up */
576 +void np_down __P((int, int)); /* a network protocol has gone down */
577 +void np_finished __P((int, int)); /* a network protocol no longer needs link */
578 +void auth_peer_fail __P((int, int));
579 + /* peer failed to authenticate itself */
580 +void auth_peer_success __P((int, int, int, char *, int));
581 + /* peer successfully authenticated itself */
582 +void auth_withpeer_fail __P((int, int));
583 + /* we failed to authenticate ourselves */
584 +void auth_withpeer_success __P((int, int, int));
585 + /* we successfully authenticated ourselves */
586 +void auth_check_options __P((void));
587 + /* check authentication options supplied */
588 +void auth_reset __P((int)); /* check what secrets we have */
589 +int check_passwd __P((int, char *, int, char *, int, char **));
590 + /* Check peer-supplied username/password */
591 +int get_secret __P((int, char *, char *, char *, int *, int));
592 + /* get "secret" for chap */
593 +int get_srp_secret __P((int unit, char *client, char *server, char *secret,
594 + int am_server));
595 +int auth_ip_addr __P((int, u_int32_t));
596 + /* check if IP address is authorized */
597 +int auth_number __P((void)); /* check if remote number is authorized */
598 +int bad_ip_adrs __P((u_int32_t));
599 + /* check if IP address is unreasonable */
600 +
601 +/* Procedures exported from demand.c */
602 +void demand_conf __P((void)); /* config interface(s) for demand-dial */
603 +void demand_block __P((void)); /* set all NPs to queue up packets */
604 +void demand_unblock __P((void)); /* set all NPs to pass packets */
605 +void demand_discard __P((void)); /* set all NPs to discard packets */
606 +void demand_rexmit __P((int)); /* retransmit saved frames for an NP */
607 +int loop_chars __P((unsigned char *, int)); /* process chars from loopback */
608 +int loop_frame __P((unsigned char *, int)); /* should we bring link up? */
609 +
610 +/* Procedures exported from multilink.c */
611 +#ifdef HAVE_MULTILINK
612 +void mp_check_options __P((void)); /* Check multilink-related options */
613 +int mp_join_bundle __P((void)); /* join our link to an appropriate bundle */
614 +void mp_exit_bundle __P((void)); /* have disconnected our link from bundle */
615 +void mp_bundle_terminated __P((void));
616 +char *epdisc_to_str __P((struct epdisc *)); /* string from endpoint discrim. */
617 +int str_to_epdisc __P((struct epdisc *, char *)); /* endpt disc. from str */
618 +#else
619 +#define mp_bundle_terminated() /* nothing */
620 +#define mp_exit_bundle() /* nothing */
621 +#define doing_multilink 0
622 +#define multilink_master 0
623 +#endif
624 +
625 +/* Procedures exported from sys-*.c */
626 +void sys_init __P((void)); /* Do system-dependent initialization */
627 +void sys_cleanup __P((void)); /* Restore system state before exiting */
628 +int sys_check_options __P((void)); /* Check options specified */
629 +void sys_close __P((void)); /* Clean up in a child before execing */
630 +int ppp_available __P((void)); /* Test whether ppp kernel support exists */
631 +int get_pty __P((int *, int *, char *, int)); /* Get pty master/slave */
632 +int open_ppp_loopback __P((void)); /* Open loopback for demand-dialling */
633 +int tty_establish_ppp __P((int)); /* Turn serial port into a ppp interface */
634 +void tty_disestablish_ppp __P((int)); /* Restore port to normal operation */
635 +void generic_disestablish_ppp __P((int dev_fd)); /* Restore device setting */
636 +int generic_establish_ppp __P((int dev_fd)); /* Make a ppp interface */
637 +void make_new_bundle __P((int, int, int, int)); /* Create new bundle */
638 +int bundle_attach __P((int)); /* Attach link to existing bundle */
639 +void cfg_bundle __P((int, int, int, int)); /* Configure existing bundle */
640 +void destroy_bundle __P((void)); /* Tell driver to destroy bundle */
641 +void clean_check __P((void)); /* Check if line was 8-bit clean */
642 +void set_up_tty __P((int, int)); /* Set up port's speed, parameters, etc. */
643 +void restore_tty __P((int)); /* Restore port's original parameters */
644 +void setdtr __P((int, int)); /* Raise or lower port's DTR line */
645 +void output __P((int, u_char *, int)); /* Output a PPP packet */
646 +void wait_input __P((struct timeval *));
647 + /* Wait for input, with timeout */
648 +void add_fd __P((int)); /* Add fd to set to wait for */
649 +void remove_fd __P((int)); /* Remove fd from set to wait for */
650 +int read_packet __P((u_char *)); /* Read PPP packet */
651 +int get_loop_output __P((void)); /* Read pkts from loopback */
652 +void tty_send_config __P((int, u_int32_t, int, int));
653 + /* Configure i/f transmit parameters */
654 +void tty_set_xaccm __P((ext_accm));
655 + /* Set extended transmit ACCM */
656 +void tty_recv_config __P((int, u_int32_t, int, int));
657 + /* Configure i/f receive parameters */
658 +int ccp_test __P((int, u_char *, int, int));
659 + /* Test support for compression scheme */
660 +void ccp_flags_set __P((int, int, int));
661 + /* Set kernel CCP state */
662 +int ccp_fatal_error __P((int)); /* Test for fatal decomp error in kernel */
663 +int get_idle_time __P((int, struct ppp_idle *));
664 + /* Find out how long link has been idle */
665 +int get_ppp_stats __P((int, struct pppd_stats *));
666 + /* Return link statistics */
667 +void netif_set_mtu __P((int, int)); /* Set PPP interface MTU */
668 +int netif_get_mtu __P((int)); /* Get PPP interface MTU */
669 +int sifvjcomp __P((int, int, int, int));
670 + /* Configure VJ TCP header compression */
671 +int sifup __P((int)); /* Configure i/f up for one protocol */
672 +int sifnpmode __P((int u, int proto, enum NPmode mode));
673 + /* Set mode for handling packets for proto */
674 +int sifdown __P((int)); /* Configure i/f down for one protocol */
675 +int sifaddr __P((int, u_int32_t, u_int32_t, u_int32_t));
676 + /* Configure IPv4 addresses for i/f */
677 +int cifaddr __P((int, u_int32_t, u_int32_t));
678 + /* Reset i/f IP addresses */
679 +#ifdef INET6
680 +int sif6addr __P((int, eui64_t, eui64_t));
681 + /* Configure IPv6 addresses for i/f */
682 +int cif6addr __P((int, eui64_t, eui64_t));
683 + /* Remove an IPv6 address from i/f */
684 +#endif
685 +int sifdefaultroute __P((int, u_int32_t, u_int32_t));
686 + /* Create default route through i/f */
687 +int cifdefaultroute __P((int, u_int32_t, u_int32_t));
688 + /* Delete default route through i/f */
689 +int sifproxyarp __P((int, u_int32_t));
690 + /* Add proxy ARP entry for peer */
691 +int cifproxyarp __P((int, u_int32_t));
692 + /* Delete proxy ARP entry for peer */
693 +u_int32_t GetMask __P((u_int32_t)); /* Get appropriate netmask for address */
694 +int lock __P((char *)); /* Create lock file for device */
695 +int relock __P((int)); /* Rewrite lock file with new pid */
696 +void unlock __P((void)); /* Delete previously-created lock file */
697 +void logwtmp __P((const char *, const char *, const char *));
698 + /* Write entry to wtmp file */
699 +int get_host_seed __P((void)); /* Get host-dependent random number seed */
700 +int have_route_to __P((u_int32_t)); /* Check if route to addr exists */
701 +#ifdef PPP_FILTER
702 +int set_filters __P((struct bpf_program *pass, struct bpf_program *active));
703 + /* Set filter programs in kernel */
704 +#endif
705 +#ifdef IPX_CHANGE
706 +int sipxfaddr __P((int, unsigned long, unsigned char *));
707 +int cipxfaddr __P((int));
708 +#endif
709 +int get_if_hwaddr __P((u_char *addr, char *name));
710 +char *get_first_ethernet __P((void));
711 +
712 +/* Procedures exported from options.c */
713 +int setipaddr __P((char *, char **, int)); /* Set local/remote ip addresses */
714 +int parse_args __P((int argc, char **argv));
715 + /* Parse options from arguments given */
716 +int options_from_file __P((char *filename, int must_exist, int check_prot,
717 + int privileged));
718 + /* Parse options from an options file */
719 +int options_from_user __P((void)); /* Parse options from user's .ppprc */
720 +int options_for_tty __P((void)); /* Parse options from /etc/ppp/options.tty */
721 +int options_from_list __P((struct wordlist *, int privileged));
722 + /* Parse options from a wordlist */
723 +int getword __P((FILE *f, char *word, int *newlinep, char *filename));
724 + /* Read a word from a file */
725 +void option_error __P((char *fmt, ...));
726 + /* Print an error message about an option */
727 +int int_option __P((char *, int *));
728 + /* Simplified number_option for decimal ints */
729 +void add_options __P((option_t *)); /* Add extra options */
730 +void check_options __P((void)); /* check values after all options parsed */
731 +int override_value __P((const char *, int, const char *));
732 + /* override value if permitted by priority */
733 +void print_options __P((void (*) __P((void *, char *, ...)), void *));
734 + /* print out values of all options */
735 +
736 +int parse_dotted_ip __P((char *, u_int32_t *));
737 +
738 +/*
739 + * Hooks to enable plugins to change various things.
740 + */
741 +extern int (*new_phase_hook) __P((int));
742 +extern int (*idle_time_hook) __P((struct ppp_idle *));
743 +extern int (*holdoff_hook) __P((void));
744 +extern int (*pap_check_hook) __P((void));
745 +extern int (*pap_auth_hook) __P((char *user, char *passwd, char **msgp,
746 + struct wordlist **paddrs,
747 + struct wordlist **popts));
748 +extern void (*pap_logout_hook) __P((void));
749 +extern int (*pap_passwd_hook) __P((char *user, char *passwd));
750 +extern int (*allowed_address_hook) __P((u_int32_t addr));
751 +extern void (*ip_up_hook) __P((void));
752 +extern void (*ip_down_hook) __P((void));
753 +extern void (*ip_choose_hook) __P((u_int32_t *));
754 +
755 +extern int (*chap_check_hook) __P((void));
756 +extern int (*chap_passwd_hook) __P((char *user, char *passwd));
757 +
758 +/* Let a plugin snoop sent and received packets. Useful for L2TP */
759 +extern void (*snoop_recv_hook) __P((unsigned char *p, int len));
760 +extern void (*snoop_send_hook) __P((unsigned char *p, int len));
761 +
762 +/*
763 + * Inline versions of get/put char/short/long.
764 + * Pointer is advanced; we assume that both arguments
765 + * are lvalues and will already be in registers.
766 + * cp MUST be u_char *.
767 + */
768 +#define GETCHAR(c, cp) { \
769 + (c) = *(cp)++; \
770 +}
771 +#define PUTCHAR(c, cp) { \
772 + *(cp)++ = (u_char) (c); \
773 +}
774 +
775 +
776 +#define GETSHORT(s, cp) { \
777 + (s) = *(cp)++ << 8; \
778 + (s) |= *(cp)++; \
779 +}
780 +#define PUTSHORT(s, cp) { \
781 + *(cp)++ = (u_char) ((s) >> 8); \
782 + *(cp)++ = (u_char) (s); \
783 +}
784 +
785 +#define GETLONG(l, cp) { \
786 + (l) = *(cp)++ << 8; \
787 + (l) |= *(cp)++; (l) <<= 8; \
788 + (l) |= *(cp)++; (l) <<= 8; \
789 + (l) |= *(cp)++; \
790 +}
791 +#define PUTLONG(l, cp) { \
792 + *(cp)++ = (u_char) ((l) >> 24); \
793 + *(cp)++ = (u_char) ((l) >> 16); \
794 + *(cp)++ = (u_char) ((l) >> 8); \
795 + *(cp)++ = (u_char) (l); \
796 +}
797 +
798 +#define INCPTR(n, cp) ((cp) += (n))
799 +#define DECPTR(n, cp) ((cp) -= (n))
800 +
801 +/*
802 + * System dependent definitions for user-level 4.3BSD UNIX implementation.
803 + */
804 +
805 +#define TIMEOUT(r, f, t) timeout((r), (f), (t), 0)
806 +#define UNTIMEOUT(r, f) untimeout((r), (f))
807 +
808 +#define BCOPY(s, d, l) memcpy(d, s, l)
809 +#define BZERO(s, n) memset(s, 0, n)
810 +#define BCMP(s1, s2, l) memcmp(s1, s2, l)
811 +
812 +#define PRINTMSG(m, l) { info("Remote message: %0.*v", l, m); }
813 +
814 +/*
815 + * MAKEHEADER - Add Header fields to a packet.
816 + */
817 +#define MAKEHEADER(p, t) { \
818 + PUTCHAR(PPP_ALLSTATIONS, p); \
819 + PUTCHAR(PPP_UI, p); \
820 + PUTSHORT(t, p); }
821 +
822 +/*
823 + * Exit status values.
824 + */
825 +#define EXIT_OK 0
826 +#define EXIT_FATAL_ERROR 1
827 +#define EXIT_OPTION_ERROR 2
828 +#define EXIT_NOT_ROOT 3
829 +#define EXIT_NO_KERNEL_SUPPORT 4
830 +#define EXIT_USER_REQUEST 5
831 +#define EXIT_LOCK_FAILED 6
832 +#define EXIT_OPEN_FAILED 7
833 +#define EXIT_CONNECT_FAILED 8
834 +#define EXIT_PTYCMD_FAILED 9
835 +#define EXIT_NEGOTIATION_FAILED 10
836 +#define EXIT_PEER_AUTH_FAILED 11
837 +#define EXIT_IDLE_TIMEOUT 12
838 +#define EXIT_CONNECT_TIME 13
839 +#define EXIT_CALLBACK 14
840 +#define EXIT_PEER_DEAD 15
841 +#define EXIT_HANGUP 16
842 +#define EXIT_LOOPBACK 17
843 +#define EXIT_INIT_FAILED 18
844 +#define EXIT_AUTH_TOPEER_FAILED 19
845 +#ifdef MAXOCTETS
846 +#define EXIT_TRAFFIC_LIMIT 20
847 +#endif
848 +#define EXIT_CNID_AUTH_FAILED 21
849 +
850 +/*
851 + * Debug macros. Slightly useful for finding bugs in pppd, not particularly
852 + * useful for finding out why your connection isn't being established.
853 + */
854 +#ifdef DEBUGALL
855 +#define DEBUGMAIN 1
856 +#define DEBUGFSM 1
857 +#define DEBUGLCP 1
858 +#define DEBUGIPCP 1
859 +#define DEBUGIPV6CP 1
860 +#define DEBUGUPAP 1
861 +#define DEBUGCHAP 1
862 +#endif
863 +
864 +#ifndef LOG_PPP /* we use LOG_LOCAL2 for syslog by default */
865 +#if defined(DEBUGMAIN) || defined(DEBUGFSM) || defined(DEBUGSYS) \
866 + || defined(DEBUGLCP) || defined(DEBUGIPCP) || defined(DEBUGUPAP) \
867 + || defined(DEBUGCHAP) || defined(DEBUG) || defined(DEBUGIPV6CP)
868 +#define LOG_PPP LOG_LOCAL2
869 +#else
870 +#define LOG_PPP LOG_DAEMON
871 +#endif
872 +#endif /* LOG_PPP */
873 +
874 +#ifdef DEBUGMAIN
875 +#define MAINDEBUG(x) if (debug) dbglog x
876 +#else
877 +#define MAINDEBUG(x)
878 +#endif
879 +
880 +#ifdef DEBUGSYS
881 +#define SYSDEBUG(x) if (debug) dbglog x
882 +#else
883 +#define SYSDEBUG(x)
884 +#endif
885 +
886 +#ifdef DEBUGFSM
887 +#define FSMDEBUG(x) if (debug) dbglog x
888 +#else
889 +#define FSMDEBUG(x)
890 +#endif
891 +
892 +#ifdef DEBUGLCP
893 +#define LCPDEBUG(x) if (debug) dbglog x
894 +#else
895 +#define LCPDEBUG(x)
896 +#endif
897 +
898 +#ifdef DEBUGIPCP
899 +#define IPCPDEBUG(x) if (debug) dbglog x
900 +#else
901 +#define IPCPDEBUG(x)
902 +#endif
903 +
904 +#ifdef DEBUGIPV6CP
905 +#define IPV6CPDEBUG(x) if (debug) dbglog x
906 +#else
907 +#define IPV6CPDEBUG(x)
908 +#endif
909 +
910 +#ifdef DEBUGUPAP
911 +#define UPAPDEBUG(x) if (debug) dbglog x
912 +#else
913 +#define UPAPDEBUG(x)
914 +#endif
915 +
916 +#ifdef DEBUGCHAP
917 +#define CHAPDEBUG(x) if (debug) dbglog x
918 +#else
919 +#define CHAPDEBUG(x)
920 +#endif
921 +
922 +#ifdef DEBUGIPXCP
923 +#define IPXCPDEBUG(x) if (debug) dbglog x
924 +#else
925 +#define IPXCPDEBUG(x)
926 +#endif
927 +
928 +#ifndef SIGTYPE
929 +#if defined(sun) || defined(SYSV) || defined(POSIX_SOURCE)
930 +#define SIGTYPE void
931 +#else
932 +#define SIGTYPE int
933 +#endif /* defined(sun) || defined(SYSV) || defined(POSIX_SOURCE) */
934 +#endif /* SIGTYPE */
935 +
936 +#ifndef MIN
937 +#define MIN(a, b) ((a) < (b)? (a): (b))
938 +#endif
939 +#ifndef MAX
940 +#define MAX(a, b) ((a) > (b)? (a): (b))
941 +#endif
942 +
943 +#ifndef offsetof
944 +#define offsetof(type, member) ((size_t) &((type *)0)->member)
945 +#endif
946 +
947 +#endif /* __PPP_H__ */