From 75870d7b55e36af526a0786fff94912989c73fd1 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Tue, 29 Dec 2020 16:08:24 +1100 Subject: [PATCH] Convert to ANSI C This gets rid of the __P and __V macros that were used so that the code was in theory compilable by a K&R C compiler, and converts the function definitions to ANSI C style. In fact there were already quite a few function definitions in the ANSI C style, so it would not have been compilable by a K&R C compiler in fact. The Solaris and BSD kernel code modules have had __P removed but the function definitions have not been converted. There are some other minor changes here to remove warnings. Signed-off-by: Paul Mackerras --- chat/chat.c | 205 +++++--------- include/linux/ppp_defs.h | 8 - include/net/if_ppp.h | 4 +- include/net/ppp-comp.h | 34 +-- include/net/ppp_defs.h | 8 - include/net/slcompress.h | 14 +- include/net/vjcompress.h | 16 +- modules/bsd-comp.c | 26 +- modules/deflate.c | 38 +-- modules/if_ppp.c | 20 +- modules/ppp.c | 68 ++--- modules/ppp_ahdlc.c | 12 +- modules/ppp_comp.c | 16 +- modules/ppp_mod.h | 8 +- pppd/auth.c | 305 ++++++++------------- pppd/cbcp.c | 76 ++--- pppd/ccp.c | 143 ++++------ pppd/chap-new.c | 4 +- pppd/chap_ms.c | 22 +- pppd/chap_ms.h | 10 +- pppd/demand.c | 25 +- pppd/eap.c | 177 ++++-------- pppd/eap.h | 4 +- pppd/ecp.c | 35 +-- pppd/eui64.c | 6 +- pppd/eui64.h | 5 +- pppd/fsm.c | 91 ++---- pppd/fsm.h | 52 ++-- pppd/ipcp.c | 198 +++++-------- pppd/ipcp.h | 4 +- pppd/ipv6cp.c | 168 ++++-------- pppd/ipv6cp.h | 2 - pppd/ipxcp.c | 163 ++++------- pppd/ipxcp.h | 2 - pppd/lcp.c | 193 +++++-------- pppd/lcp.h | 12 +- pppd/magic.c | 2 - pppd/magic.h | 2 - pppd/main.c | 246 ++++++----------- pppd/md4.c | 19 +- pppd/md4.h | 17 +- pppd/md5.c | 16 +- pppd/multilink.c | 41 ++- pppd/options.c | 195 +++++-------- pppd/pathnames.h | 2 - pppd/plugins/radius/radiusclient.h | 90 +++--- pppd/pppcrypt.c | 40 +-- pppd/pppcrypt.h | 6 +- pppd/pppd.h | 427 ++++++++++++++--------------- pppd/session.c | 12 +- pppd/sys-linux.c | 25 +- pppd/sys-solaris.c | 243 ++++++---------- pppd/tty.c | 116 +++----- pppd/upap.c | 93 ++----- pppd/upap.h | 6 +- pppd/utils.c | 148 ++-------- pppdump/bsd-comp.c | 64 ++--- pppdump/deflate.c | 61 ++--- pppdump/ppp-comp.h | 18 +- pppstats/pppstats.c | 39 +-- solaris/ppp.c | 68 ++--- solaris/ppp_ahdlc.c | 10 +- solaris/ppp_comp.c | 14 +- solaris/ppp_mod.c | 14 +- solaris/ppp_mod.h | 8 +- 65 files changed, 1522 insertions(+), 2694 deletions(-) diff --git a/chat/chat.c b/chat/chat.c index bf10733..1639b3e 100644 --- a/chat/chat.c +++ b/chat/chat.c @@ -82,14 +82,6 @@ * */ -#ifndef __STDC__ -#define const -#endif - -#ifndef lint -static const char rcsid[] = "$Id: chat.c,v 1.30 2004/01/17 05:47:55 carlsonj Exp $"; -#endif - #include #include #include @@ -102,6 +94,7 @@ static const char rcsid[] = "$Id: chat.c,v 1.30 2004/01/17 05:47:55 carlsonj Exp #include #include #include +#include #ifndef TERMIO #undef TERMIOS @@ -121,20 +114,6 @@ static const char rcsid[] = "$Id: chat.c,v 1.30 2004/01/17 05:47:55 carlsonj Exp #define SIGTYPE void #endif -#undef __P -#undef __V - -#ifdef __STDC__ -#include -#define __V(x) x -#define __P(x) x -#else -#include -#define __V(x) (va_alist) va_dcl -#define __P(x) () -#define const -#endif - #ifndef O_NONBLOCK #define O_NONBLOCK O_NDELAY #endif @@ -209,43 +188,41 @@ int clear_report_next = 0; int say_next = 0, hup_next = 0; -void *dup_mem __P((void *b, size_t c)); -void *copy_of __P((char *s)); -char *grow __P((char *s, char **p, size_t len)); -void usage __P((void)); -void msgf __P((const char *fmt, ...)); -void fatal __P((int code, const char *fmt, ...)); -SIGTYPE sigalrm __P((int signo)); -SIGTYPE sigint __P((int signo)); -SIGTYPE sigterm __P((int signo)); -SIGTYPE sighup __P((int signo)); -void unalarm __P((void)); -void init __P((void)); -void set_tty_parameters __P((void)); -void echo_stderr __P((int)); -void break_sequence __P((void)); -void terminate __P((int status)); -void do_file __P((char *chat_file)); -int get_string __P((register char *string)); -int put_string __P((register char *s)); -int write_char __P((int c)); -int put_char __P((int c)); -int get_char __P((void)); -void chat_send __P((register char *s)); -char *character __P((int c)); -void chat_expect __P((register char *s)); -char *clean __P((register char *s, int sending)); -void break_sequence __P((void)); -void terminate __P((int status)); -void pack_array __P((char **array, int end)); -char *expect_strtok __P((char *, char *)); -int vfmtmsg __P((char *, int, const char *, va_list)); /* vsprintf++ */ - -int main __P((int, char *[])); - -void *dup_mem(b, c) -void *b; -size_t c; +void *dup_mem (void *b, size_t c); +void *copy_of (char *s); +char *grow (char *s, char **p, size_t len); +void usage (void); +void msgf (const char *fmt, ...); +void fatal (int code, const char *fmt, ...); +SIGTYPE sigalrm (int signo); +SIGTYPE sigint (int signo); +SIGTYPE sigterm (int signo); +SIGTYPE sighup (int signo); +void unalarm (void); +void init (void); +void set_tty_parameters (void); +void echo_stderr (int); +void break_sequence (void); +void terminate (int status); +void do_file (char *chat_file); +int get_string (register char *string); +int put_string (register char *s); +int write_char (int c); +int put_char (int c); +int get_char (void); +void chat_send (register char *s); +char *character (int c); +void chat_expect (register char *s); +char *clean (register char *s, int sending); +void break_sequence (void); +void terminate (int status); +void pack_array (char **array, int end); +char *expect_strtok (char *, char *); +int vfmtmsg (char *, int, const char *, va_list); /* vsprintf++ */ + +int main (int, char *[]); + +void *dup_mem(void *b, size_t c) { void *ans = malloc (c); if (!ans) @@ -255,17 +232,13 @@ size_t c; return ans; } -void *copy_of (s) -char *s; +void *copy_of (char *s) { return dup_mem (s, strlen (s) + 1); } /* grow a char buffer and keep a pointer offset */ -char *grow(s, p, len) -char *s; -char **p; -size_t len; +char *grow(char *s, char **p, size_t len) { size_t l = *p - s; /* save p as distance into s */ @@ -284,9 +257,7 @@ size_t len; * Perform a UUCP-dialer-like chat script on stdin and stdout. */ int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { int option; char *arg; @@ -413,8 +384,7 @@ main(argc, argv) * Process a chat script when read from a file. */ -void do_file (chat_file) -char *chat_file; +void do_file (char *chat_file) { int linect, sendflg; char *sp, *arg, quote; @@ -482,7 +452,7 @@ char *chat_file; /* * We got an error parsing the command line. */ -void usage() +void usage(void) { fprintf(stderr, "\ Usage: %s [-e] [-E] [-v] [-V] [-t timeout] [-r report-file]\n\ @@ -495,17 +465,11 @@ char line[1024]; /* * Send a message to syslog and/or stderr. */ -void msgf __V((const char *fmt, ...)) +void msgf(const char *fmt, ...) { va_list args; -#ifdef __STDC__ va_start(args, fmt); -#else - char *fmt; - va_start(args); - fmt = va_arg(args, char *); -#endif vfmtmsg(line, sizeof(line), fmt, args); if (to_log) @@ -519,19 +483,11 @@ void msgf __V((const char *fmt, ...)) * Print an error message and terminate. */ -void fatal __V((int code, const char *fmt, ...)) +void fatal(int code, const char *fmt, ...) { va_list args; -#ifdef __STDC__ va_start(args, fmt); -#else - int code; - char *fmt; - va_start(args); - code = va_arg(args, int); - fmt = va_arg(args, char *); -#endif vfmtmsg(line, sizeof(line), fmt, args); if (to_log) @@ -544,8 +500,7 @@ void fatal __V((int code, const char *fmt, ...)) int alarmed = 0; -SIGTYPE sigalrm(signo) -int signo; +SIGTYPE sigalrm(int signo) { int flags; @@ -563,7 +518,7 @@ int signo; msgf("alarm"); } -void unalarm() +void unalarm(void) { int flags; @@ -574,25 +529,22 @@ void unalarm() fatal(2, "Can't set file mode flags on stdin: %m"); } -SIGTYPE sigint(signo) -int signo; +SIGTYPE sigint(int signo) { fatal(2, "SIGINT"); } -SIGTYPE sigterm(signo) -int signo; +SIGTYPE sigterm(int signo) { fatal(2, "SIGTERM"); } -SIGTYPE sighup(signo) -int signo; +SIGTYPE sighup(int signo) { fatal(2, "SIGHUP"); } -void init() +void init(void) { signal(SIGINT, sigint); signal(SIGTERM, sigterm); @@ -604,7 +556,7 @@ void init() alarmed = 0; } -void set_tty_parameters() +void set_tty_parameters(void) { #if defined(get_term_param) term_parms t; @@ -628,15 +580,14 @@ void set_tty_parameters() #endif } -void break_sequence() +void break_sequence(void) { #ifdef TERMIOS tcsendbreak (0, 0); #endif } -void terminate(status) -int status; +void terminate(int status) { static int terminating = 0; @@ -683,9 +634,8 @@ int status; /* * 'Clean up' this string. */ -char *clean(s, sending) -register char *s; -int sending; /* set to 1 when sending (putting) this string. */ +char *clean(register char *s, + int sending) /* set to 1 when sending (putting) this string. */ { char cur_chr; char *s1, *p, *phchar; @@ -870,8 +820,7 @@ int sending; /* set to 1 when sending (putting) this string. */ * A modified version of 'strtok'. This version skips \ sequences. */ -char *expect_strtok (s, term) - char *s, *term; +char *expect_strtok (char *s, char *term) { static char *str = ""; int escape_flag = 0; @@ -925,8 +874,7 @@ char *expect_strtok (s, term) * Process the expect string */ -void chat_expect (s) -char *s; +void chat_expect (char *s) { char *expect; char *reply; @@ -1014,8 +962,7 @@ char *s; * the data. */ -char *character(c) -int c; +char *character(int c) { static char string[10]; char *meta; @@ -1036,8 +983,7 @@ int c; /* * process the reply string */ -void chat_send (s) -register char *s; +void chat_send (register char *s) { char file_data[STR_LEN]; @@ -1227,7 +1173,7 @@ register char *s; fatal(1, "Failed"); } -int get_char() +int get_char(void) { int status; char c; @@ -1252,8 +1198,7 @@ int get_char() } } -int put_char(c) -int c; +int put_char(int c) { int status; char ch = c; @@ -1280,8 +1225,7 @@ int c; } } -int write_char (c) -int c; +int write_char(int c) { if (alarmed || put_char(c) < 0) { alarm(0); @@ -1298,8 +1242,7 @@ int c; return (1); } -int put_string (s) -register char *s; +int put_string(register char *s) { quiet = 0; s = clean(s, 1); @@ -1353,8 +1296,7 @@ register char *s; * When called with -1, a '\n' character is generated when * the cursor is not at the beginning of a line. */ -void echo_stderr(n) -int n; +void echo_stderr(int n) { static int need_lf; char *s; @@ -1381,8 +1323,7 @@ int n; /* * 'Wait for' this string to appear on this file descriptor. */ -int get_string(string) -register char *string; +int get_string(register char *string) { char temp[STR_LEN]; int c, printed = 0, len, minlen; @@ -1550,9 +1491,8 @@ register char *string; extern int select(); -int -usleep( usec ) /* returns 0 if ok, else -1 */ - long usec; /* delay in microseconds */ +/* returns 0 if ok, else -1 */ +int usleep(long usec) /* delay in microseconds */ { static struct { /* `timeval' */ long tv_sec; /* seconds */ @@ -1566,10 +1506,9 @@ usleep( usec ) /* returns 0 if ok, else -1 */ } #endif -void -pack_array (array, end) - char **array; /* The address of the array of string pointers */ - int end; /* The index of the next free entry before CLR_ */ +void pack_array ( + char **array, /* The address of the array of string pointers */ + int end) /* The index of the next free entry before CLR_ */ { int i, j; @@ -1595,11 +1534,7 @@ pack_array (array, end) #define OUTCHAR(c) (buflen > 0? (--buflen, *buf++ = (c)): 0) int -vfmtmsg(buf, buflen, fmt, args) - char *buf; - int buflen; - const char *fmt; - va_list args; +vfmtmsg(char *buf, int buflen, const char *fmt, va_list args) { int c, i, n; int width, prec, fillch; diff --git a/include/linux/ppp_defs.h b/include/linux/ppp_defs.h index 314339e..ef4232b 100644 --- a/include/linux/ppp_defs.h +++ b/include/linux/ppp_defs.h @@ -184,12 +184,4 @@ struct ppp_idle { time_t recv_idle; /* time since last NP packet received */ }; -#ifndef __P -#ifdef __STDC__ -#define __P(x) x -#else -#define __P(x) () -#endif -#endif - #endif /* _PPP_DEFS_H_ */ diff --git a/include/net/if_ppp.h b/include/net/if_ppp.h index bfec606..d08605e 100644 --- a/include/net/if_ppp.h +++ b/include/net/if_ppp.h @@ -150,7 +150,7 @@ struct ifpppcstatsreq { #endif #if (defined(_KERNEL) || defined(KERNEL)) && !defined(NeXT) -void pppattach __P((void)); -void pppintr __P((void)); +void pppattach(void); +void pppintr(void); #endif #endif /* _IF_PPP_H_ */ diff --git a/include/net/ppp-comp.h b/include/net/ppp-comp.h index 088c73e..b09ef71 100644 --- a/include/net/ppp-comp.h +++ b/include/net/ppp-comp.h @@ -59,36 +59,36 @@ struct compressor { int compress_proto; /* CCP compression protocol number */ /* Allocate space for a compressor (transmit side) */ - void *(*comp_alloc) __P((u_char *options, int opt_len)); + void *(*comp_alloc)(u_char *options, int opt_len); /* Free space used by a compressor */ - void (*comp_free) __P((void *state)); + void (*comp_free)(void *state); /* Initialize a compressor */ - int (*comp_init) __P((void *state, u_char *options, int opt_len, - int unit, int hdrlen, int debug)); + int (*comp_init)(void *state, u_char *options, int opt_len, + int unit, int hdrlen, int debug); /* Reset a compressor */ - void (*comp_reset) __P((void *state)); + void (*comp_reset)(void *state); /* Compress a packet */ - int (*compress) __P((void *state, PACKETPTR *mret, - PACKETPTR mp, int orig_len, int max_len)); + int (*compress)(void *state, PACKETPTR *mret, + PACKETPTR mp, int orig_len, int max_len); /* Return compression statistics */ - void (*comp_stat) __P((void *state, struct compstat *stats)); + void (*comp_stat)(void *state, struct compstat *stats); /* Allocate space for a decompressor (receive side) */ - void *(*decomp_alloc) __P((u_char *options, int opt_len)); + void *(*decomp_alloc)(u_char *options, int opt_len); /* Free space used by a decompressor */ - void (*decomp_free) __P((void *state)); + void (*decomp_free)(void *state); /* Initialize a decompressor */ - int (*decomp_init) __P((void *state, u_char *options, int opt_len, - int unit, int hdrlen, int mru, int debug)); + int (*decomp_init)(void *state, u_char *options, int opt_len, + int unit, int hdrlen, int mru, int debug); /* Reset a decompressor */ - void (*decomp_reset) __P((void *state)); + void (*decomp_reset)(void *state); /* Decompress a packet. */ - int (*decompress) __P((void *state, PACKETPTR mp, - PACKETPTR *dmpp)); + int (*decompress)(void *state, PACKETPTR mp, + PACKETPTR *dmpp); /* Update state for an incompressible packet received */ - void (*incomp) __P((void *state, PACKETPTR mp)); + void (*incomp)(void *state, PACKETPTR mp); /* Return decompression statistics */ - void (*decomp_stat) __P((void *state, struct compstat *stats)); + void (*decomp_stat)(void *state, struct compstat *stats); }; #endif /* PACKETPTR */ diff --git a/include/net/ppp_defs.h b/include/net/ppp_defs.h index b06eda5..a5112b3 100644 --- a/include/net/ppp_defs.h +++ b/include/net/ppp_defs.h @@ -183,12 +183,4 @@ struct ppp_idle { time_t recv_idle; /* time since last NP packet received */ }; -#ifndef __P -#ifdef __STDC__ -#define __P(x) x -#else -#define __P(x) () -#endif -#endif - #endif /* _PPP_DEFS_H_ */ diff --git a/include/net/slcompress.h b/include/net/slcompress.h index d887dfc..3712a1a 100644 --- a/include/net/slcompress.h +++ b/include/net/slcompress.h @@ -137,12 +137,12 @@ struct slcompress { /* flag values */ #define SLF_TOSS 1 /* tossing rcvd frames because of input err */ -void sl_compress_init __P((struct slcompress *)); -void sl_compress_setup __P((struct slcompress *, int)); -u_int sl_compress_tcp __P((struct mbuf *, - struct ip *, struct slcompress *, int)); -int sl_uncompress_tcp __P((u_char **, int, u_int, struct slcompress *)); -int sl_uncompress_tcp_core __P((u_char *, int, int, u_int, - struct slcompress *, u_char **, u_int *)); +void sl_compress_init(struct slcompress *); +void sl_compress_setup(struct slcompress *, int); +u_int sl_compress_tcp(struct mbuf *, + struct ip *, struct slcompress *, int); +int sl_uncompress_tcp(u_char **, int, u_int, struct slcompress *); +int sl_uncompress_tcp_core(u_char *, int, int, u_int, + struct slcompress *, u_char **, u_int *); #endif /* _SLCOMPRESS_H_ */ diff --git a/include/net/vjcompress.h b/include/net/vjcompress.h index 03a33bf..ba1ee1f 100644 --- a/include/net/vjcompress.h +++ b/include/net/vjcompress.h @@ -130,15 +130,15 @@ struct vjcompress { /* flag values */ #define VJF_TOSS 1 /* tossing rcvd frames because of input err */ -extern void vj_compress_init __P((struct vjcompress *comp, int max_state)); -extern u_int vj_compress_tcp __P((struct ip *ip, u_int mlen, +extern void vj_compress_init(struct vjcompress *comp, int max_state); +extern u_int vj_compress_tcp(struct ip *ip, u_int mlen, struct vjcompress *comp, int compress_cid_flag, - u_char **vjhdrp)); -extern void vj_uncompress_err __P((struct vjcompress *comp)); -extern int vj_uncompress_uncomp __P((u_char *buf, int buflen, - struct vjcompress *comp)); -extern int vj_uncompress_tcp __P((u_char *buf, int buflen, int total_len, + u_char **vjhdrp); +extern void vj_uncompress_err(struct vjcompress *comp); +extern int vj_uncompress_uncomp(u_char *buf, int buflen, + struct vjcompress *comp); +extern int vj_uncompress_tcp(u_char *buf, int buflen, int total_len, struct vjcompress *comp, u_char **hdrp, - u_int *hlenp)); + u_int *hlenp); #endif /* _VJCOMPRESS_H_ */ diff --git a/modules/bsd-comp.c b/modules/bsd-comp.c index 9d2b12e..fb52aa2 100644 --- a/modules/bsd-comp.c +++ b/modules/bsd-comp.c @@ -148,19 +148,19 @@ struct bsd_db { #define BSD_OVHD 2 /* BSD compress overhead/packet */ #define BSD_INIT_BITS BSD_MIN_BITS -static void *bsd_comp_alloc __P((u_char *options, int opt_len)); -static void *bsd_decomp_alloc __P((u_char *options, int opt_len)); -static void bsd_free __P((void *state)); -static int bsd_comp_init __P((void *state, u_char *options, int opt_len, - int unit, int hdrlen, int debug)); -static int bsd_decomp_init __P((void *state, u_char *options, int opt_len, - int unit, int hdrlen, int mru, int debug)); -static int bsd_compress __P((void *state, mblk_t **mret, - mblk_t *mp, int slen, int maxolen)); -static void bsd_incomp __P((void *state, mblk_t *dmsg)); -static int bsd_decompress __P((void *state, mblk_t *cmp, mblk_t **dmpp)); -static void bsd_reset __P((void *state)); -static void bsd_comp_stats __P((void *state, struct compstat *stats)); +static void *bsd_comp_alloc(u_char *options, int opt_len); +static void *bsd_decomp_alloc(u_char *options, int opt_len); +static void bsd_free(void *state); +static int bsd_comp_init(void *state, u_char *options, int opt_len, + int unit, int hdrlen, int debug); +static int bsd_decomp_init(void *state, u_char *options, int opt_len, + int unit, int hdrlen, int mru, int debug); +static int bsd_compress(void *state, mblk_t **mret, + mblk_t *mp, int slen, int maxolen); +static void bsd_incomp(void *state, mblk_t *dmsg); +static int bsd_decompress(void *state, mblk_t *cmp, mblk_t **dmpp); +static void bsd_reset(void *state); +static void bsd_comp_stats(void *state, struct compstat *stats); /* * Procedures exported to ppp_comp.c. diff --git a/modules/deflate.c b/modules/deflate.c index c896846..2702326 100644 --- a/modules/deflate.c +++ b/modules/deflate.c @@ -80,25 +80,25 @@ struct deflate_state { #define DEFLATE_OVHD 2 /* Deflate overhead/packet */ -static void *z_alloc __P((void *, u_int items, u_int size)); -static void *z_alloc_init __P((void *, u_int items, u_int size)); -static void z_free __P((void *, void *ptr)); -static void *z_comp_alloc __P((u_char *options, int opt_len)); -static void *z_decomp_alloc __P((u_char *options, int opt_len)); -static void z_comp_free __P((void *state)); -static void z_decomp_free __P((void *state)); -static int z_comp_init __P((void *state, u_char *options, int opt_len, - int unit, int hdrlen, int debug)); -static int z_decomp_init __P((void *state, u_char *options, int opt_len, - int unit, int hdrlen, int mru, int debug)); -static int z_compress __P((void *state, mblk_t **mret, - mblk_t *mp, int slen, int maxolen)); -static void z_incomp __P((void *state, mblk_t *dmsg)); -static int z_decompress __P((void *state, mblk_t *cmp, - mblk_t **dmpp)); -static void z_comp_reset __P((void *state)); -static void z_decomp_reset __P((void *state)); -static void z_comp_stats __P((void *state, struct compstat *stats)); +static void *z_alloc(void *, u_int items, u_int size); +static void *z_alloc_init(void *, u_int items, u_int size); +static void z_free(void *, void *ptr); +static void *z_comp_alloc(u_char *options, int opt_len); +static void *z_decomp_alloc(u_char *options, int opt_len); +static void z_comp_free(void *state); +static void z_decomp_free(void *state); +static int z_comp_init(void *state, u_char *options, int opt_len, + int unit, int hdrlen, int debug); +static int z_decomp_init(void *state, u_char *options, int opt_len, + int unit, int hdrlen, int mru, int debug); +static int z_compress(void *state, mblk_t **mret, + mblk_t *mp, int slen, int maxolen); +static void z_incomp(void *state, mblk_t *dmsg); +static int z_decompress(void *state, mblk_t *cmp, + mblk_t **dmpp); +static void z_comp_reset(void *state); +static void z_decomp_reset(void *state); +static void z_comp_stats(void *state, struct compstat *stats); /* * Procedures exported to ppp_comp.c. diff --git a/modules/if_ppp.c b/modules/if_ppp.c index 85962d6..e150923 100644 --- a/modules/if_ppp.c +++ b/modules/if_ppp.c @@ -80,10 +80,10 @@ #define ifr_mtu ifr_metric -static int if_ppp_open __P((queue_t *, int, int, int)); -static int if_ppp_close __P((queue_t *, int)); -static int if_ppp_wput __P((queue_t *, mblk_t *)); -static int if_ppp_rput __P((queue_t *, mblk_t *)); +static int if_ppp_open(queue_t *, int, int, int); +static int if_ppp_close(queue_t *, int); +static int if_ppp_wput(queue_t *, mblk_t *); +static int if_ppp_rput(queue_t *, mblk_t *); #define PPP_IF_ID 0x8021 static struct module_info minfo = { @@ -117,11 +117,11 @@ static int ppp_nalloc; /* Number of elements of ifs and states */ static struct ifnet **ifs; /* Array of pointers to interface structs */ static if_ppp_t **states; /* Array of pointers to state structs */ -static int if_ppp_output __P((struct ifnet *, struct mbuf *, - struct sockaddr *)); -static int if_ppp_ioctl __P((struct ifnet *, u_int, caddr_t)); -static struct mbuf *make_mbufs __P((mblk_t *, int)); -static mblk_t *make_message __P((struct mbuf *, int)); +static int if_ppp_output(struct ifnet *, struct mbuf *, + struct sockaddr *); +static int if_ppp_ioctl(struct ifnet *, u_int, caddr_t); +static struct mbuf *make_mbufs(mblk_t *, int); +static mblk_t *make_message(struct mbuf *, int); #ifdef SNIT_SUPPORT /* Fake ether header for SNIT */ @@ -129,7 +129,7 @@ static struct ether_header snit_ehdr = {{0}, {0}, ETHERTYPE_IP}; #endif #ifndef __osf__ -static void ppp_if_detach __P((struct ifnet *)); +static void ppp_if_detach(struct ifnet *); /* * Detach all the interfaces before unloading. diff --git a/modules/ppp.c b/modules/ppp.c index ad345db..f5fb71f 100644 --- a/modules/ppp.c +++ b/modules/ppp.c @@ -31,8 +31,6 @@ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * $Id: ppp.c,v 1.26 2002/12/06 09:49:15 paulus Exp $ */ /* @@ -85,12 +83,6 @@ #include /* leave this outside of PRIOQ for htons */ -#ifdef __STDC__ -#define __P(x) x -#else -#define __P(x) () -#endif - /* * The IP module may use this SAP value for IP packets. */ @@ -254,43 +246,43 @@ static upperstr_t *minor_devs = NULL; static upperstr_t *ppas = NULL; #ifdef SVR4 -static int pppopen __P((queue_t *, dev_t *, int, int, cred_t *)); -static int pppclose __P((queue_t *, int, cred_t *)); +static int pppopen(queue_t *, dev_t *, int, int, cred_t *); +static int pppclose(queue_t *, int, cred_t *); #else -static int pppopen __P((queue_t *, int, int, int)); -static int pppclose __P((queue_t *, int)); +static int pppopen(queue_t *, int, int, int); +static int pppclose(queue_t *, int); #endif /* SVR4 */ -static int pppurput __P((queue_t *, mblk_t *)); -static int pppuwput __P((queue_t *, mblk_t *)); -static int pppursrv __P((queue_t *)); -static int pppuwsrv __P((queue_t *)); -static int ppplrput __P((queue_t *, mblk_t *)); -static int ppplwput __P((queue_t *, mblk_t *)); -static int ppplrsrv __P((queue_t *)); -static int ppplwsrv __P((queue_t *)); +static int pppurput(queue_t *, mblk_t *); +static int pppuwput(queue_t *, mblk_t *); +static int pppursrv(queue_t *); +static int pppuwsrv(queue_t *); +static int ppplrput(queue_t *, mblk_t *); +static int ppplwput(queue_t *, mblk_t *); +static int ppplrsrv(queue_t *); +static int ppplwsrv(queue_t *); #ifndef NO_DLPI -static void dlpi_request __P((queue_t *, mblk_t *, upperstr_t *)); -static void dlpi_error __P((queue_t *, upperstr_t *, int, int, int)); -static void dlpi_ok __P((queue_t *, int)); +static void dlpi_request(queue_t *, mblk_t *, upperstr_t *); +static void dlpi_error(queue_t *, upperstr_t *, int, int, int); +static void dlpi_ok(queue_t *, int); #endif -static int send_data __P((mblk_t *, upperstr_t *)); -static void new_ppa __P((queue_t *, mblk_t *)); -static void attach_ppa __P((queue_t *, mblk_t *)); -static void detach_ppa __P((queue_t *, mblk_t *)); -static void detach_lower __P((queue_t *, mblk_t *)); -static void debug_dump __P((queue_t *, mblk_t *)); -static upperstr_t *find_dest __P((upperstr_t *, int)); +static int send_data(mblk_t *, upperstr_t *); +static void new_ppa(queue_t *, mblk_t *); +static void attach_ppa(queue_t *, mblk_t *); +static void detach_ppa(queue_t *, mblk_t *); +static void detach_lower(queue_t *, mblk_t *); +static void debug_dump(queue_t *, mblk_t *); +static upperstr_t *find_dest(upperstr_t *, int); #if defined(SOL2) -static upperstr_t *find_promisc __P((upperstr_t *, int)); -static mblk_t *prepend_ether __P((upperstr_t *, mblk_t *, int)); -static mblk_t *prepend_udind __P((upperstr_t *, mblk_t *, int)); -static void promisc_sendup __P((upperstr_t *, mblk_t *, int, int)); +static upperstr_t *find_promisc(upperstr_t *, int); +static mblk_t *prepend_ether(upperstr_t *, mblk_t *, int); +static mblk_t *prepend_udind(upperstr_t *, mblk_t *, int); +static void promisc_sendup(upperstr_t *, mblk_t *, int, int); #endif /* defined(SOL2) */ -static int putctl2 __P((queue_t *, int, int, int)); -static int putctl4 __P((queue_t *, int, int, int)); -static int pass_packet __P((upperstr_t *ppa, mblk_t *mp, int outbound)); +static int putctl2(queue_t *, int, int, int); +static int putctl4(queue_t *, int, int, int); +static int pass_packet(upperstr_t *ppa, mblk_t *mp, int outbound); #ifdef FILTER_PACKETS -static int ip_hard_filter __P((upperstr_t *ppa, mblk_t *mp, int outbound)); +static int ip_hard_filter(upperstr_t *ppa, mblk_t *mp, int outbound); #endif /* FILTER_PACKETS */ #define PPP_ID 0xb1a6 diff --git a/modules/ppp_ahdlc.c b/modules/ppp_ahdlc.c index 184b535..68e0907 100644 --- a/modules/ppp_ahdlc.c +++ b/modules/ppp_ahdlc.c @@ -55,8 +55,6 @@ * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, * OR MODIFICATIONS. - * - * $Id: ppp_ahdlc.c,v 1.18 2002/12/06 09:49:15 paulus Exp $ */ /* @@ -107,11 +105,11 @@ typedef unsigned int uintpointer_t; MOD_OPEN_DECL(ahdlc_open); MOD_CLOSE_DECL(ahdlc_close); -static int ahdlc_wput __P((queue_t *, mblk_t *)); -static int ahdlc_rput __P((queue_t *, mblk_t *)); -static void ahdlc_encode __P((queue_t *, mblk_t *)); -static void ahdlc_decode __P((queue_t *, mblk_t *)); -static int msg_byte __P((mblk_t *, unsigned int)); +static int ahdlc_wput(queue_t *, mblk_t *); +static int ahdlc_rput(queue_t *, mblk_t *); +static void ahdlc_encode(queue_t *, mblk_t *); +static void ahdlc_decode(queue_t *, mblk_t *); +static int msg_byte(mblk_t *, unsigned int); #if defined(SOL2) /* diff --git a/modules/ppp_comp.c b/modules/ppp_comp.c index 97d13eb..9e204d9 100644 --- a/modules/ppp_comp.c +++ b/modules/ppp_comp.c @@ -31,8 +31,6 @@ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * $Id: ppp_comp.c,v 1.14 2002/12/06 09:49:15 paulus Exp $ */ /* @@ -74,12 +72,12 @@ MOD_OPEN_DECL(ppp_comp_open); MOD_CLOSE_DECL(ppp_comp_close); -static int ppp_comp_rput __P((queue_t *, mblk_t *)); -static int ppp_comp_rsrv __P((queue_t *)); -static int ppp_comp_wput __P((queue_t *, mblk_t *)); -static int ppp_comp_wsrv __P((queue_t *)); -static void ppp_comp_ccp __P((queue_t *, mblk_t *, int)); -static int msg_byte __P((mblk_t *, unsigned int)); +static int ppp_comp_rput(queue_t *, mblk_t *); +static int ppp_comp_rsrv(queue_t *); +static int ppp_comp_wput(queue_t *, mblk_t *); +static int ppp_comp_wsrv(queue_t *); +static void ppp_comp_ccp(queue_t *, mblk_t *, int); +static int msg_byte(mblk_t *, unsigned int); /* Extract byte i of message mp. */ #define MSG_BYTE(mp, i) ((i) < (mp)->b_wptr - (mp)->b_rptr? (mp)->b_rptr[i]: \ @@ -118,7 +116,7 @@ int ppp_comp_count; /* number of module instances in use */ #ifdef __osf__ -static void ppp_comp_alloc __P((comp_state_t *)); +static void ppp_comp_alloc(comp_state_t *); typedef struct memreq { unsigned char comp_opts[20]; int cmd; diff --git a/modules/ppp_mod.h b/modules/ppp_mod.h index f0af008..792c4d4 100644 --- a/modules/ppp_mod.h +++ b/modules/ppp_mod.h @@ -143,10 +143,10 @@ typedef int minor_t; */ #ifdef SVR4 #define MOD_OPEN_DECL(name) \ -static int name __P((queue_t *, dev_t *, int, int, cred_t *)) +static int name(queue_t *, dev_t *, int, int, cred_t *) #define MOD_CLOSE_DECL(name) \ -static int name __P((queue_t *, int, cred_t *)) +static int name(queue_t *, int, cred_t *) #define MOD_OPEN(name) \ static int name(q, devp, flag, sflag, credp) \ @@ -168,10 +168,10 @@ static int name(q, flag, credp) \ #else /* not SVR4 */ #define MOD_OPEN_DECL(name) \ -static int name __P((queue_t *, int, int, int)) +static int name(queue_t *, int, int, int) #define MOD_CLOSE_DECL(name) \ -static int name __P((queue_t *, int)) +static int name(queue_t *, int) #define MOD_OPEN(name) \ static int name(q, dev, flag, sflag) \ diff --git a/pppd/auth.c b/pppd/auth.c index 601241f..ffa0e14 100644 --- a/pppd/auth.c +++ b/pppd/auth.c @@ -168,43 +168,43 @@ static int passwd_from_file; static bool default_auth; /* Hook to enable a plugin to control the idle time limit */ -int (*idle_time_hook) __P((struct ppp_idle *)) = NULL; +int (*idle_time_hook)(struct ppp_idle *) = NULL; /* Hook for a plugin to say whether we can possibly authenticate any peer */ -int (*pap_check_hook) __P((void)) = NULL; +int (*pap_check_hook)(void) = NULL; /* Hook for a plugin to check the PAP user and password */ -int (*pap_auth_hook) __P((char *user, char *passwd, char **msgp, - struct wordlist **paddrs, - struct wordlist **popts)) = NULL; +int (*pap_auth_hook)(char *user, char *passwd, char **msgp, + struct wordlist **paddrs, + struct wordlist **popts) = NULL; /* Hook for a plugin to know about the PAP user logout */ -void (*pap_logout_hook) __P((void)) = NULL; +void (*pap_logout_hook)(void) = NULL; /* Hook for a plugin to get the PAP password for authenticating us */ -int (*pap_passwd_hook) __P((char *user, char *passwd)) = NULL; +int (*pap_passwd_hook)(char *user, char *passwd) = NULL; /* Hook for a plugin to say if we can possibly authenticate a peer using CHAP */ -int (*chap_check_hook) __P((void)) = NULL; +int (*chap_check_hook)(void) = NULL; /* Hook for a plugin to get the CHAP password for authenticating us */ -int (*chap_passwd_hook) __P((char *user, char *passwd)) = NULL; +int (*chap_passwd_hook)(char *user, char *passwd) = NULL; #ifdef USE_EAPTLS /* Hook for a plugin to get the EAP-TLS password for authenticating us */ -int (*eaptls_passwd_hook) __P((char *user, char *passwd)) = NULL; +int (*eaptls_passwd_hook)(char *user, char *passwd) = NULL; #endif /* Hook for a plugin to say whether it is OK if the peer refuses to authenticate. */ -int (*null_auth_hook) __P((struct wordlist **paddrs, - struct wordlist **popts)) = NULL; +int (*null_auth_hook)(struct wordlist **paddrs, + struct wordlist **popts) = NULL; -int (*allowed_address_hook) __P((u_int32_t addr)) = NULL; +int (*allowed_address_hook)(u_int32_t addr) = NULL; #ifdef HAVE_MULTILINK /* Hook for plugin to hear when an interface joins a multilink bundle */ -void (*multilink_join_hook) __P((void)) = NULL; +void (*multilink_join_hook)(void) = NULL; #endif /* A notifier for when the peer has authenticated itself, @@ -263,50 +263,50 @@ bool need_peer_eap = 0; /* Require peer to authenticate us */ static char *uafname; /* name of most recent +ua file */ -extern char *crypt __P((const char *, const char *)); +extern char *crypt (const char *, const char *); /* Prototypes for procedures local to this file. */ -static void network_phase __P((int)); -static void check_idle __P((void *)); -static void connect_time_expired __P((void *)); -static int null_login __P((int)); -static int get_pap_passwd __P((char *)); -static int have_pap_secret __P((int *)); -static int have_chap_secret __P((char *, char *, int, int *)); -static int have_srp_secret __P((char *client, char *server, int need_ip, - int *lacks_ipp)); +static void network_phase (int); +static void check_idle (void *); +static void connect_time_expired (void *); +static int null_login (int); +static int get_pap_passwd (char *); +static int have_pap_secret (int *); +static int have_chap_secret (char *, char *, int, int *); +static int have_srp_secret(char *client, char *server, int need_ip, + int *lacks_ipp); #ifdef USE_EAPTLS static int have_eaptls_secret_server -__P((char *client, char *server, int need_ip, int *lacks_ipp)); -static int have_eaptls_secret_client __P((char *client, char *server)); -static int scan_authfile_eaptls __P((FILE * f, char *client, char *server, +(char *client, char *server, int need_ip, int *lacks_ipp); +static int have_eaptls_secret_client (char *client, char *server); +static int scan_authfile_eaptls(FILE * f, char *client, char *server, char *cli_cert, char *serv_cert, char *ca_cert, char *pk, struct wordlist ** addrs, struct wordlist ** opts, - char *filename, int flags)); + char *filename, int flags); #endif -static int ip_addr_check __P((u_int32_t, struct permitted_ip *)); -static int scan_authfile __P((FILE *, char *, char *, char *, - struct wordlist **, struct wordlist **, - char *, int)); -static void free_wordlist __P((struct wordlist *)); -static void auth_script __P((char *)); -static void auth_script_done __P((void *)); -static void set_allowed_addrs __P((int, struct wordlist *, struct wordlist *)); -static int some_ip_ok __P((struct wordlist *)); -static int setupapfile __P((char **)); -static int privgroup __P((char **)); -static int set_noauth_addr __P((char **)); -static int set_permitted_number __P((char **)); -static void check_access __P((FILE *, char *)); -static int wordlist_count __P((struct wordlist *)); +static int ip_addr_check (u_int32_t, struct permitted_ip *); +static int scan_authfile(FILE *, char *, char *, char *, + struct wordlist **, struct wordlist **, + char *, int); +static void free_wordlist (struct wordlist *); +static void auth_script (char *); +static void auth_script_done (void *); +static void set_allowed_addrs (int, struct wordlist *, struct wordlist *); +static int some_ip_ok (struct wordlist *); +static int setupapfile (char **); +static int privgroup (char **); +static int set_noauth_addr (char **); +static int set_permitted_number (char **); +static void check_access (FILE *, char *); +static int wordlist_count (struct wordlist *); #ifdef MAXOCTETS -static void check_maxoctets __P((void *)); +static void check_maxoctets (void *); #endif /* @@ -455,8 +455,7 @@ option_t auth_options[] = { * setupapfile - specifies UPAP info for authenticating with peer. */ static int -setupapfile(argv) - char **argv; +setupapfile(char **argv) { FILE *ufile; int l; @@ -523,8 +522,7 @@ setupapfile(argv) * privgroup - allow members of the group to have privileged access. */ static int -privgroup(argv) - char **argv; +privgroup(char **argv) { struct group *g; int i; @@ -549,8 +547,7 @@ privgroup(argv) * Equivalent to specifying an entry like `"" * "" addr' in pap-secrets. */ static int -set_noauth_addr(argv) - char **argv; +set_noauth_addr(char **argv) { char *addr = *argv; int l = strlen(addr) + 1; @@ -571,8 +568,7 @@ set_noauth_addr(argv) * set_permitted_number - set remote telephone number(s) that may connect. */ static int -set_permitted_number(argv) - char **argv; +set_permitted_number(char **argv) { char *number = *argv; int l = strlen(number) + 1; @@ -593,16 +589,14 @@ set_permitted_number(argv) * An Open on LCP has requested a change from Dead to Establish phase. */ void -link_required(unit) - int unit; +link_required(int unit) { } /* * Bring the link up to the point of being able to do ppp. */ -void start_link(unit) - int unit; +void start_link(int unit) { status = EXIT_CONNECT_FAILED; new_phase(PHASE_SERIALCONN); @@ -661,8 +655,7 @@ void start_link(unit) * physical layer down. */ void -link_terminated(unit) - int unit; +link_terminated(int unit) { if (phase == PHASE_DEAD || phase == PHASE_MASTER) return; @@ -731,8 +724,7 @@ link_terminated(unit) * LCP has gone down; it will either die or try to re-establish. */ void -link_down(unit) - int unit; +link_down(int unit) { if (auth_state != s_down) { notify(link_down_notifier, 0); @@ -774,8 +766,7 @@ void upper_layers_down(int unit) * Proceed to the Dead, Authenticate or Network phase as appropriate. */ void -link_established(unit) - int unit; +link_established(int unit) { int auth; lcp_options *wo = &lcp_wantoptions[unit]; @@ -874,8 +865,7 @@ link_established(unit) * Proceed to the network phase. */ static void -network_phase(unit) - int unit; +network_phase(int unit) { lcp_options *go = &lcp_gotoptions[unit]; @@ -918,8 +908,7 @@ network_phase(unit) } void -start_networks(unit) - int unit; +start_networks(int unit) { int i; struct protent *protp; @@ -959,8 +948,7 @@ start_networks(unit) } void -continue_networks(unit) - int unit; +continue_networks(int unit) { int i; struct protent *protp; @@ -985,8 +973,7 @@ continue_networks(unit) * The peer has failed to authenticate himself using `protocol'. */ void -auth_peer_fail(unit, protocol) - int unit, protocol; +auth_peer_fail(int unit, int protocol) { /* * Authentication failure: take the link down @@ -999,10 +986,8 @@ auth_peer_fail(unit, protocol) * The peer has been successfully authenticated using `protocol'. */ void -auth_peer_success(unit, protocol, prot_flavor, name, namelen) - int unit, protocol, prot_flavor; - char *name; - int namelen; +auth_peer_success(int unit, int protocol, int prot_flavor, + char *name, int namelen) { int bit; @@ -1058,8 +1043,7 @@ auth_peer_success(unit, protocol, prot_flavor, name, namelen) * We have failed to authenticate ourselves to the peer using `protocol'. */ void -auth_withpeer_fail(unit, protocol) - int unit, protocol; +auth_withpeer_fail(int unit, int protocol) { if (passwd_from_file) BZERO(passwd, MAXSECRETLEN); @@ -1077,8 +1061,7 @@ auth_withpeer_fail(unit, protocol) * We have successfully authenticated ourselves with the peer using `protocol'. */ void -auth_withpeer_success(unit, protocol, prot_flavor) - int unit, protocol, prot_flavor; +auth_withpeer_success(int unit, int protocol, int prot_flavor) { int bit; const char *prot = ""; @@ -1134,8 +1117,7 @@ auth_withpeer_success(unit, protocol, prot_flavor) * np_up - a network protocol has come up. */ void -np_up(unit, proto) - int unit, proto; +np_up(int unit, int proto) { int tlim; @@ -1186,8 +1168,7 @@ np_up(unit, proto) * np_down - a network protocol has gone down. */ void -np_down(unit, proto) - int unit, proto; +np_down(int unit, int proto) { if (--num_np_up == 0) { UNTIMEOUT(check_idle, NULL); @@ -1203,8 +1184,7 @@ np_down(unit, proto) * np_finished - a network protocol has finished using the link. */ void -np_finished(unit, proto) - int unit, proto; +np_finished(int unit, int proto) { if (--num_np_open <= 0) { /* no further use for the link: shut up shop. */ @@ -1214,8 +1194,7 @@ np_finished(unit, proto) #ifdef MAXOCTETS static void -check_maxoctets(arg) - void *arg; +check_maxoctets(void *arg) { unsigned int used; @@ -1253,8 +1232,7 @@ check_maxoctets(arg) * enough that we can shut it down. */ static void -check_idle(arg) - void *arg; +check_idle(void *arg) { struct ppp_idle idle; time_t itime; @@ -1283,8 +1261,7 @@ check_idle(arg) * connect_time_expired - log a message and close the connection. */ static void -connect_time_expired(arg) - void *arg; +connect_time_expired(void *arg) { info("Connect time expired"); status = EXIT_CONNECT_TIME; @@ -1295,7 +1272,7 @@ connect_time_expired(arg) * auth_check_options - called to check authentication options. */ void -auth_check_options() +auth_check_options(void) { lcp_options *wo = &lcp_wantoptions[0]; int can_auth; @@ -1400,8 +1377,7 @@ auth_check_options() * to use for authenticating ourselves and/or the peer. */ void -auth_reset(unit) - int unit; +auth_reset(int unit) { lcp_options *go = &lcp_gotoptions[unit]; lcp_options *ao = &lcp_allowoptions[unit]; @@ -1457,13 +1433,9 @@ auth_reset(unit) * In either case, msg points to an appropriate message. */ int -check_passwd(unit, auser, userlen, apasswd, passwdlen, msg) - int unit; - char *auser; - int userlen; - char *apasswd; - int passwdlen; - char **msg; +check_passwd(int unit, + char *auser, int userlen, + char *apasswd, int passwdlen, char **msg) { int ret; char *filename; @@ -1585,8 +1557,7 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg) * and return 1. */ static int -null_login(unit) - int unit; +null_login(int unit) { char *filename; FILE *f; @@ -1636,8 +1607,7 @@ null_login(unit) * Assumes passwd points to MAXSECRETLEN bytes of space (if non-null). */ static int -get_pap_passwd(passwd) - char *passwd; +get_pap_passwd(char *passwd) { char *filename; FILE *f; @@ -1676,8 +1646,7 @@ get_pap_passwd(passwd) * secrets that we could possibly use for authenticating the peer. */ static int -have_pap_secret(lacks_ipp) - int *lacks_ipp; +have_pap_secret(int *lacks_ipp) { FILE *f; int ret; @@ -1718,11 +1687,8 @@ have_pap_secret(lacks_ipp) * know the identity yet. */ static int -have_chap_secret(client, server, need_ip, lacks_ipp) - char *client; - char *server; - int need_ip; - int *lacks_ipp; +have_chap_secret(char *client, char *server, + int need_ip, int *lacks_ipp) { FILE *f; int ret; @@ -1767,11 +1733,7 @@ have_chap_secret(client, server, need_ip, lacks_ipp) * know the identity yet. */ static int -have_srp_secret(client, server, need_ip, lacks_ipp) - char *client; - char *server; - int need_ip; - int *lacks_ipp; +have_srp_secret(char *client, char *server, int need_ip, int *lacks_ipp) { FILE *f; int ret; @@ -1808,13 +1770,8 @@ have_srp_secret(client, server, need_ip, lacks_ipp) * (We could be either client or server). */ int -get_secret(unit, client, server, secret, secret_len, am_server) - int unit; - char *client; - char *server; - char *secret; - int *secret_len; - int am_server; +get_secret(int unit, char *client, char *server, + char *secret, int *secret_len, int am_server) { FILE *f; int ret, len; @@ -1874,12 +1831,8 @@ get_secret(unit, client, server, secret, secret_len, am_server) * (We could be either client or server). */ int -get_srp_secret(unit, client, server, secret, am_server) - int unit; - char *client; - char *server; - char *secret; - int am_server; +get_srp_secret(int unit, char *client, char *server, + char *secret, int am_server) { FILE *fp; int ret; @@ -1923,10 +1876,8 @@ get_srp_secret(unit, client, server, secret, am_server) * and leaves the following words in extra_options. */ static void -set_allowed_addrs(unit, addrs, opts) - int unit; - struct wordlist *addrs; - struct wordlist *opts; +set_allowed_addrs(int unit, struct wordlist *addrs, + struct wordlist *opts) { int n; struct wordlist *ap, **plink; @@ -2079,9 +2030,7 @@ set_allowed_addrs(unit, addrs, opts) * a given IP address. Returns 1 if authorized, 0 otherwise. */ int -auth_ip_addr(unit, addr) - int unit; - u_int32_t addr; +auth_ip_addr(int unit, u_int32_t addr) { int ok; @@ -2106,9 +2055,7 @@ auth_ip_addr(unit, addr) } static int -ip_addr_check(addr, addrs) - u_int32_t addr; - struct permitted_ip *addrs; +ip_addr_check(u_int32_t addr, struct permitted_ip *addrs) { for (; ; ++addrs) if ((addr & addrs->mask) == addrs->base) @@ -2121,8 +2068,7 @@ ip_addr_check(addr, addrs) * addr is in network byte order. */ int -bad_ip_adrs(addr) - u_int32_t addr; +bad_ip_adrs(u_int32_t addr) { addr = ntohl(addr); return (addr >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET @@ -2134,8 +2080,7 @@ bad_ip_adrs(addr) * IP address(es). */ static int -some_ip_ok(addrs) - struct wordlist *addrs; +some_ip_ok(struct wordlist *addrs) { for (; addrs != 0; addrs = addrs->next) { if (addrs->word[0] == '-') @@ -2151,7 +2096,7 @@ some_ip_ok(addrs) * Returns 1 if authorized, 0 otherwise. */ int -auth_number() +auth_number(void) { struct wordlist *wp = permitted_numbers; int l; @@ -2178,9 +2123,7 @@ auth_number() * check_access - complain if a secret file has too-liberal permissions. */ static void -check_access(f, filename) - FILE *f; - char *filename; +check_access(FILE *f, char *filename) { struct stat sbuf; @@ -2208,15 +2151,10 @@ check_access(f, filename) * match. */ static int -scan_authfile(f, client, server, secret, addrs, opts, filename, flags) - FILE *f; - char *client; - char *server; - char *secret; - struct wordlist **addrs; - struct wordlist **opts; - char *filename; - int flags; +scan_authfile(FILE *f, char *client, char *server, + char *secret, struct wordlist **addrs, + struct wordlist **opts, char *filename, + int flags) { int newline, xxx; int got_flag, best_flag; @@ -2371,8 +2309,7 @@ scan_authfile(f, client, server, secret, addrs, opts, filename, flags) * wordlist_count - return the number of items in a wordlist */ static int -wordlist_count(wp) - struct wordlist *wp; +wordlist_count(struct wordlist *wp) { int n; @@ -2385,8 +2322,7 @@ wordlist_count(wp) * free_wordlist - release memory allocated for a wordlist. */ static void -free_wordlist(wp) - struct wordlist *wp; +free_wordlist(struct wordlist *wp) { struct wordlist *next; @@ -2402,8 +2338,7 @@ free_wordlist(wp) * has finished. */ static void -auth_script_done(arg) - void *arg; +auth_script_done(void *arg) { auth_script_pid = 0; switch (auth_script_state) { @@ -2427,8 +2362,7 @@ auth_script_done(arg) * interface-name peer-name real-user tty speed */ static void -auth_script(script) - char *script; +auth_script(char *script) { char strspeed[32]; struct passwd *pw; @@ -2458,11 +2392,8 @@ auth_script(script) #ifdef USE_EAPTLS static int -have_eaptls_secret_server(client, server, need_ip, lacks_ipp) - char *client; - char *server; - int need_ip; - int *lacks_ipp; +have_eaptls_secret_server(char *client, char *server, + int need_ip, int *lacks_ipp) { FILE *f; int ret; @@ -2509,9 +2440,7 @@ have_eaptls_secret_server(client, server, need_ip, lacks_ipp) static int -have_eaptls_secret_client(client, server) - char *client; - char *server; +have_eaptls_secret_client(char *client, char *server) { FILE *f; int ret; @@ -2555,19 +2484,11 @@ have_eaptls_secret_client(client, server) static int -scan_authfile_eaptls(f, client, server, cli_cert, serv_cert, ca_cert, pk, - addrs, opts, filename, flags) - FILE *f; - char *client; - char *server; - char *cli_cert; - char *serv_cert; - char *ca_cert; - char *pk; - struct wordlist **addrs; - struct wordlist **opts; - char *filename; - int flags; +scan_authfile_eaptls(FILE *f, char *client, char *server, + char *cli_cert, char *serv_cert, char *ca_cert, + char *pk, struct wordlist **addrs, + struct wordlist **opts, + char *filename, int flags) { int newline; int got_flag, best_flag; @@ -2718,17 +2639,9 @@ scan_authfile_eaptls(f, client, server, cli_cert, serv_cert, ca_cert, pk, int -get_eaptls_secret(unit, client, server, clicertfile, servcertfile, - cacertfile, capath, pkfile, am_server) - int unit; - char *client; - char *server; - char *clicertfile; - char *servcertfile; - char *cacertfile; - char *capath; - char *pkfile; - int am_server; +get_eaptls_secret(int unit, char *client, char *server, + char *clicertfile, char *servcertfile, char *cacertfile, + char *capath, char *pkfile, int am_server) { FILE *fp; int ret; diff --git a/pppd/cbcp.c b/pppd/cbcp.c index f735ab9..e356633 100644 --- a/pppd/cbcp.c +++ b/pppd/cbcp.c @@ -33,8 +33,6 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: cbcp.c,v 1.17 2006/05/22 00:04:07 paulus Exp $" - #include #include #include @@ -49,7 +47,7 @@ /* * Options. */ -static int setcbcp __P((char **)); +static int setcbcp (char **); static option_t cbcp_option_list[] = { { "callback", o_special, (void *)setcbcp, @@ -60,14 +58,14 @@ static option_t cbcp_option_list[] = { /* * Protocol entry points. */ -static void cbcp_init __P((int unit)); -static void cbcp_open __P((int unit)); -static void cbcp_lowerup __P((int unit)); -static void cbcp_input __P((int unit, u_char *pkt, int len)); -static void cbcp_protrej __P((int unit)); -static int cbcp_printpkt __P((u_char *pkt, int len, - void (*printer) __P((void *, char *, ...)), - void *arg)); +static void cbcp_init (int unit); +static void cbcp_open (int unit); +static void cbcp_lowerup (int unit); +static void cbcp_input (int unit, u_char *pkt, int len); +static void cbcp_protrej (int unit); +static int cbcp_printpkt (u_char *pkt, int len, + void (*printer)(void *, char *, ...), + void *arg); struct protent cbcp_protent = { PPP_CBCP, @@ -93,16 +91,15 @@ cbcp_state cbcp[NUM_PPP]; /* internal prototypes */ -static void cbcp_recvreq __P((cbcp_state *us, u_char *pckt, int len)); -static void cbcp_resp __P((cbcp_state *us)); -static void cbcp_up __P((cbcp_state *us)); -static void cbcp_recvack __P((cbcp_state *us, u_char *pckt, int len)); -static void cbcp_send __P((cbcp_state *us, int code, u_char *buf, int len)); +static void cbcp_recvreq (cbcp_state *us, u_char *pckt, int len); +static void cbcp_resp (cbcp_state *us); +static void cbcp_up (cbcp_state *us); +static void cbcp_recvack (cbcp_state *us, u_char *pckt, int len); +static void cbcp_send (cbcp_state *us, int code, u_char *buf, int len); /* option processing */ static int -setcbcp(argv) - char **argv; +setcbcp(char **argv) { lcp_wantoptions[0].neg_cbcp = 1; cbcp_protent.enabled_flag = 1; @@ -116,8 +113,7 @@ setcbcp(argv) /* init state */ static void -cbcp_init(iface) - int iface; +cbcp_init(int iface) { cbcp_state *us; @@ -129,8 +125,7 @@ cbcp_init(iface) /* lower layer is up */ static void -cbcp_lowerup(iface) - int iface; +cbcp_lowerup(int iface) { cbcp_state *us = &cbcp[iface]; @@ -142,18 +137,14 @@ cbcp_lowerup(iface) } static void -cbcp_open(unit) - int unit; +cbcp_open(int unit) { dbglog("cbcp_open"); } /* process an incomming packet */ static void -cbcp_input(unit, inpacket, pktlen) - int unit; - u_char *inpacket; - int pktlen; +cbcp_input(int unit, u_char *inpacket, int pktlen) { u_char *inp; u_char code, id; @@ -223,11 +214,8 @@ char *cbcp_optionnames[] = { /* pretty print a packet */ static int -cbcp_printpkt(p, plen, printer, arg) - u_char *p; - int plen; - void (*printer) __P((void *, char *, ...)); - void *arg; +cbcp_printpkt(u_char *p, int plen, + void (*printer) (void *, char *, ...), void *arg) { int code, opt, id, len, olen, delay; u_char *pstart; @@ -301,10 +289,7 @@ cbcp_printpkt(p, plen, printer, arg) /* received CBCP request */ static void -cbcp_recvreq(us, pckt, pcktlen) - cbcp_state *us; - u_char *pckt; - int pcktlen; +cbcp_recvreq(cbcp_state *us, u_char *pckt, int pcktlen) { u_char type, opt_len, delay, addr_type; char address[256]; @@ -360,8 +345,7 @@ cbcp_recvreq(us, pckt, pcktlen) } static void -cbcp_resp(us) - cbcp_state *us; +cbcp_resp(cbcp_state *us) { u_char cb_type; u_char buf[256]; @@ -416,11 +400,7 @@ cbcp_resp(us) } static void -cbcp_send(us, code, buf, len) - cbcp_state *us; - int code; - u_char *buf; - int len; +cbcp_send(cbcp_state *us, int code, u_char *buf, int len) { u_char *outp; int outlen; @@ -442,10 +422,7 @@ cbcp_send(us, code, buf, len) } static void -cbcp_recvack(us, pckt, len) - cbcp_state *us; - u_char *pckt; - int len; +cbcp_recvack(cbcp_state *us, u_char *pckt, int len) { u_char type, delay, addr_type; int opt_len; @@ -478,8 +455,7 @@ cbcp_recvack(us, pckt, len) /* ok peer will do callback */ static void -cbcp_up(us) - cbcp_state *us; +cbcp_up(cbcp_state *us) { persist = 0; status = EXIT_CALLBACK; diff --git a/pppd/ccp.c b/pppd/ccp.c index dbc567e..052c4c6 100644 --- a/pppd/ccp.c +++ b/pppd/ccp.c @@ -56,8 +56,8 @@ /* * Command-line options. */ -static int setbsdcomp __P((char **)); -static int setdeflate __P((char **)); +static int setbsdcomp (char **); +static int setdeflate (char **); static char bsd_value[8]; static char deflate_value[8]; @@ -163,17 +163,17 @@ static option_t ccp_option_list[] = { /* * Protocol entry points from main code. */ -static void ccp_init __P((int unit)); -static void ccp_open __P((int unit)); -static void ccp_close __P((int unit, char *)); -static void ccp_lowerup __P((int unit)); -static void ccp_lowerdown __P((int)); -static void ccp_input __P((int unit, u_char *pkt, int len)); -static void ccp_protrej __P((int unit)); -static int ccp_printpkt __P((u_char *pkt, int len, - void (*printer) __P((void *, char *, ...)), - void *arg)); -static void ccp_datainput __P((int unit, u_char *pkt, int len)); +static void ccp_init (int unit); +static void ccp_open (int unit); +static void ccp_close (int unit, char *); +static void ccp_lowerup (int unit); +static void ccp_lowerdown (int); +static void ccp_input (int unit, u_char *pkt, int len); +static void ccp_protrej (int unit); +static int ccp_printpkt (u_char *pkt, int len, + void (*printer)(void *, char *, ...), + void *arg); +static void ccp_datainput (int unit, u_char *pkt, int len); struct protent ccp_protent = { PPP_CCP, @@ -204,18 +204,18 @@ ccp_options ccp_hisoptions[NUM_PPP]; /* what we agreed to do */ /* * Callbacks for fsm code. */ -static void ccp_resetci __P((fsm *)); -static int ccp_cilen __P((fsm *)); -static void ccp_addci __P((fsm *, u_char *, int *)); -static int ccp_ackci __P((fsm *, u_char *, int)); -static int ccp_nakci __P((fsm *, u_char *, int, int)); -static int ccp_rejci __P((fsm *, u_char *, int)); -static int ccp_reqci __P((fsm *, u_char *, int *, int)); -static void ccp_up __P((fsm *)); -static void ccp_down __P((fsm *)); -static int ccp_extcode __P((fsm *, int, int, u_char *, int)); -static void ccp_rack_timeout __P((void *)); -static char *method_name __P((ccp_options *, ccp_options *)); +static void ccp_resetci (fsm *); +static int ccp_cilen (fsm *); +static void ccp_addci (fsm *, u_char *, int *); +static int ccp_ackci (fsm *, u_char *, int); +static int ccp_nakci (fsm *, u_char *, int, int); +static int ccp_rejci (fsm *, u_char *, int); +static int ccp_reqci (fsm *, u_char *, int *, int); +static void ccp_up (fsm *); +static void ccp_down (fsm *); +static int ccp_extcode (fsm *, int, int, u_char *, int); +static void ccp_rack_timeout (void *); +static char *method_name (ccp_options *, ccp_options *); static fsm_callbacks ccp_callbacks = { ccp_resetci, @@ -257,8 +257,7 @@ static int all_rejected[NUM_PPP]; /* we rejected all peer's options */ * Option parsing. */ static int -setbsdcomp(argv) - char **argv; +setbsdcomp(char **argv) { int rbits, abits; char *str, *endp; @@ -296,8 +295,7 @@ setbsdcomp(argv) } static int -setdeflate(argv) - char **argv; +setdeflate(char **argv) { int rbits, abits; char *str, *endp; @@ -347,8 +345,7 @@ setdeflate(argv) * ccp_init - initialize CCP. */ static void -ccp_init(unit) - int unit; +ccp_init(int unit) { fsm *f = &ccp_fsm[unit]; @@ -383,8 +380,7 @@ ccp_init(unit) * ccp_open - CCP is allowed to come up. */ static void -ccp_open(unit) - int unit; +ccp_open(int unit) { fsm *f = &ccp_fsm[unit]; @@ -406,9 +402,7 @@ ccp_open(unit) * ccp_close - Terminate CCP. */ static void -ccp_close(unit, reason) - int unit; - char *reason; +ccp_close(int unit, char *reason) { ccp_flags_set(unit, 0, 0); fsm_close(&ccp_fsm[unit], reason); @@ -418,8 +412,7 @@ ccp_close(unit, reason) * ccp_lowerup - we may now transmit CCP packets. */ static void -ccp_lowerup(unit) - int unit; +ccp_lowerup(int unit) { fsm_lowerup(&ccp_fsm[unit]); } @@ -428,8 +421,7 @@ ccp_lowerup(unit) * ccp_lowerdown - we may not transmit CCP packets. */ static void -ccp_lowerdown(unit) - int unit; +ccp_lowerdown(int unit) { fsm_lowerdown(&ccp_fsm[unit]); } @@ -438,10 +430,7 @@ ccp_lowerdown(unit) * ccp_input - process a received CCP packet. */ static void -ccp_input(unit, p, len) - int unit; - u_char *p; - int len; +ccp_input(int unit, u_char *p, int len) { fsm *f = &ccp_fsm[unit]; int oldstate; @@ -474,11 +463,7 @@ ccp_input(unit, p, len) * Handle a CCP-specific code. */ static int -ccp_extcode(f, code, id, p, len) - fsm *f; - int code, id; - u_char *p; - int len; +ccp_extcode(fsm *f, int code, int id, u_char *p, int len) { switch (code) { case CCP_RESETREQ: @@ -507,8 +492,7 @@ ccp_extcode(f, code, id, p, len) * ccp_protrej - peer doesn't talk CCP. */ static void -ccp_protrej(unit) - int unit; +ccp_protrej(int unit) { ccp_flags_set(unit, 0, 0); fsm_lowerdown(&ccp_fsm[unit]); @@ -526,8 +510,7 @@ ccp_protrej(unit) * ccp_resetci - initialize at start of negotiation. */ static void -ccp_resetci(f) - fsm *f; +ccp_resetci(fsm *f) { ccp_options *go = &ccp_gotoptions[f->unit]; u_char opt_buf[CCP_MAX_OPTION_LENGTH]; @@ -687,8 +670,7 @@ ccp_resetci(f) * ccp_cilen - Return total length of our configuration info. */ static int -ccp_cilen(f) - fsm *f; + ccp_cilen(fsm *f) { ccp_options *go = &ccp_gotoptions[f->unit]; @@ -704,10 +686,7 @@ ccp_cilen(f) * ccp_addci - put our requests in a packet. */ static void -ccp_addci(f, p, lenp) - fsm *f; - u_char *p; - int *lenp; + ccp_addci(fsm *f, u_char *p, int *lenp) { int res; ccp_options *go = &ccp_gotoptions[f->unit]; @@ -823,10 +802,7 @@ ccp_addci(f, p, lenp) * 1 iff the packet was OK. */ static int -ccp_ackci(f, p, len) - fsm *f; - u_char *p; - int len; + ccp_ackci(fsm *f, u_char *p, int len) { ccp_options *go = &ccp_gotoptions[f->unit]; u_char *p0 = p; @@ -912,11 +888,7 @@ ccp_ackci(f, p, len) * Returns 1 iff the nak was OK. */ static int -ccp_nakci(f, p, len, treat_as_reject) - fsm *f; - u_char *p; - int len; - int treat_as_reject; + ccp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) { ccp_options *go = &ccp_gotoptions[f->unit]; ccp_options no; /* options we've seen already */ @@ -1002,10 +974,7 @@ ccp_nakci(f, p, len, treat_as_reject) * ccp_rejci - reject some of our suggested compression methods. */ static int -ccp_rejci(f, p, len) - fsm *f; - u_char *p; - int len; +ccp_rejci(fsm *f, u_char *p, int len) { ccp_options *go = &ccp_gotoptions[f->unit]; ccp_options try; /* options to request next time */ @@ -1084,11 +1053,7 @@ ccp_rejci(f, p, len) * appropriately. */ static int -ccp_reqci(f, p, lenp, dont_nak) - fsm *f; - u_char *p; - int *lenp; - int dont_nak; +ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak) { int ret, newret, res; u_char *p0, *retp; @@ -1375,8 +1340,7 @@ ccp_reqci(f, p, lenp, dont_nak) * Make a string name for a compression method (or 2). */ static char * -method_name(opt, opt2) - ccp_options *opt, *opt2; +method_name(ccp_options *opt, ccp_options *opt2) { static char result[64]; @@ -1440,8 +1404,7 @@ method_name(opt, opt2) * CCP has come up - inform the kernel driver and log a message. */ static void -ccp_up(f) - fsm *f; +ccp_up(fsm *f) { ccp_options *go = &ccp_gotoptions[f->unit]; ccp_options *ho = &ccp_hisoptions[f->unit]; @@ -1474,8 +1437,7 @@ ccp_up(f) * CCP has gone down - inform the kernel driver. */ static void -ccp_down(f) - fsm *f; +ccp_down(fsm *f) { if (ccp_localstate[f->unit] & RACK_PENDING) UNTIMEOUT(ccp_rack_timeout, f); @@ -1504,11 +1466,8 @@ static char *ccp_codenames[] = { }; static int -ccp_printpkt(p, plen, printer, arg) - u_char *p; - int plen; - void (*printer) __P((void *, char *, ...)); - void *arg; +ccp_printpkt(u_char *p, int plen, + void (*printer) (void *, char *, ...), void *arg) { u_char *p0, *optend; int code, id, len; @@ -1637,10 +1596,7 @@ ccp_printpkt(p, plen, printer, arg) * compression :-(, otherwise we issue the reset-request. */ static void -ccp_datainput(unit, pkt, len) - int unit; - u_char *pkt; - int len; +ccp_datainput(int unit, u_char *pkt, int len) { fsm *f; @@ -1681,8 +1637,7 @@ ccp_datainput(unit, pkt, len) * Timeout waiting for reset-ack. */ static void -ccp_rack_timeout(arg) - void *arg; +ccp_rack_timeout(void *arg) { fsm *f = arg; diff --git a/pppd/chap-new.c b/pppd/chap-new.c index 2714bff..ba906ea 100644 --- a/pppd/chap-new.c +++ b/pppd/chap-new.c @@ -129,7 +129,7 @@ static void chap_handle_status(struct chap_client_state *cs, int code, int id, static void chap_protrej(int unit); static void chap_input(int unit, unsigned char *pkt, int pktlen); static int chap_print_pkt(unsigned char *p, int plen, - void (*printer) __P((void *, char *, ...)), void *arg); + void (*printer)(void *, char *, ...), void *arg); /* List of digest types that we know about */ static struct chap_digest_type *chap_digests; @@ -584,7 +584,7 @@ static char *chap_code_names[] = { static int chap_print_pkt(unsigned char *p, int plen, - void (*printer) __P((void *, char *, ...)), void *arg) + void (*printer)(void *, char *, ...), void *arg) { int code, id, len; int clen, nlen; diff --git a/pppd/chap_ms.c b/pppd/chap_ms.c index ffb6bd1..e6b84f2 100644 --- a/pppd/chap_ms.c +++ b/pppd/chap_ms.c @@ -96,22 +96,22 @@ -static void ascii2unicode __P((char[], int, u_char[])); -static void NTPasswordHash __P((u_char *, int, u_char[MD4_SIGNATURE_SIZE])); -static void ChallengeResponse __P((u_char *, u_char *, u_char[24])); -static void ChapMS_NT __P((u_char *, char *, int, u_char[24])); -static void ChapMS2_NT __P((u_char *, u_char[16], char *, char *, int, - u_char[24])); +static void ascii2unicode (char[], int, u_char[]); +static void NTPasswordHash (u_char *, int, u_char[MD4_SIGNATURE_SIZE]); +static void ChallengeResponse (u_char *, u_char *, u_char[24]); +static void ChapMS_NT (u_char *, char *, int, u_char[24]); +static void ChapMS2_NT (u_char *, u_char[16], char *, char *, int, + u_char[24]); static void GenerateAuthenticatorResponsePlain - __P((char*, int, u_char[24], u_char[16], u_char *, - char *, u_char[41])); + (char*, int, u_char[24], u_char[16], u_char *, + char *, u_char[41]); #ifdef MSLANMAN -static void ChapMS_LANMan __P((u_char *, char *, int, u_char *)); +static void ChapMS_LANMan (u_char *, char *, int, u_char *); #endif #ifdef MPPE -static void Set_Start_Key __P((u_char *, char *, int)); -static void SetMasterKeys __P((char *, int, u_char[24], int)); +static void Set_Start_Key (u_char *, char *, int); +static void SetMasterKeys (char *, int, u_char[24], int); #endif #ifdef MSLANMAN diff --git a/pppd/chap_ms.h b/pppd/chap_ms.h index 040d80a..005eb63 100644 --- a/pppd/chap_ms.h +++ b/pppd/chap_ms.h @@ -87,16 +87,16 @@ extern void set_mppe_enc_types(int, int); #define MS_CHAP2_AUTHENTICATEE 0 #define MS_CHAP2_AUTHENTICATOR 1 -void ChapMS __P((u_char *, char *, int, u_char *)); -void ChapMS2 __P((u_char *, u_char *, char *, char *, int, - u_char *, u_char[MS_AUTH_RESPONSE_LENGTH+1], int)); +void ChapMS (u_char *, char *, int, u_char *); +void ChapMS2 (u_char *, u_char *, char *, char *, int, + u_char *, u_char[MS_AUTH_RESPONSE_LENGTH+1], int); #ifdef MPPE -void mppe_set_keys __P((u_char *, u_char[MD4_SIGNATURE_SIZE])); +void mppe_set_keys (u_char *, u_char[MD4_SIGNATURE_SIZE]); void mppe_set_keys2(u_char PasswordHashHash[MD4_SIGNATURE_SIZE], u_char NTResponse[24], int IsServer); #endif -void ChallengeHash __P((u_char[16], u_char *, char *, u_char[8])); +void ChallengeHash (u_char[16], u_char *, char *, u_char[8]); void GenerateAuthenticatorResponse(u_char PasswordHashHash[MD4_SIGNATURE_SIZE], u_char NTResponse[24], u_char PeerChallenge[16], diff --git a/pppd/demand.c b/pppd/demand.c index 72e379c..289c9f8 100644 --- a/pppd/demand.c +++ b/pppd/demand.c @@ -69,13 +69,13 @@ struct packet { struct packet *pend_q; struct packet *pend_qtail; -static int active_packet __P((unsigned char *, int)); +static int active_packet(unsigned char *, int); /* * demand_conf - configure the interface for doing dial-on-demand. */ void -demand_conf() +demand_conf(void) { int i; struct protent *protp; @@ -116,7 +116,7 @@ demand_conf() * demand_block - set each network protocol to block further packets. */ void -demand_block() +demand_block(void) { int i; struct protent *protp; @@ -132,7 +132,7 @@ demand_block() * with an error. */ void -demand_discard() +demand_discard(void) { struct packet *pkt, *nextpkt; int i; @@ -159,7 +159,7 @@ demand_discard() * demand_unblock - set each enabled network protocol to pass packets. */ void -demand_unblock() +demand_unblock(void) { int i; struct protent *protp; @@ -213,9 +213,7 @@ static u_short fcstab[256] = { * Return value is 1 if we need to bring up the link, 0 otherwise. */ int -loop_chars(p, n) - unsigned char *p; - int n; +loop_chars(unsigned char *p, int n) { int c, rv; @@ -265,9 +263,7 @@ loop_chars(p, n) * bring up the link. */ int -loop_frame(frame, len) - unsigned char *frame; - int len; +loop_frame(unsigned char *frame, int len) { struct packet *pkt; @@ -298,8 +294,7 @@ loop_frame(frame, len) * loopback, now that the real serial link is up. */ void -demand_rexmit(proto) - int proto; +demand_rexmit(int proto) { struct packet *pkt, *prev, *nextpkt; @@ -329,9 +324,7 @@ demand_rexmit(proto) * that is, whether it is worth bringing up the link for. */ static int -active_packet(p, len) - unsigned char *p; - int len; +active_packet(unsigned char *p, int len) { int proto, i; struct protent *protp; diff --git a/pppd/eap.c b/pppd/eap.c index aa14208..92d29ec 100644 --- a/pppd/eap.c +++ b/pppd/eap.c @@ -48,8 +48,6 @@ * Implemented EAP-TLS authentication */ -#define RCSID "$Id: eap.c,v 1.4 2004/11/09 22:39:25 paulus Exp $" - /* * TODO: */ @@ -118,13 +116,13 @@ static option_t eap_option_list[] = { /* * Protocol entry points. */ -static void eap_init __P((int unit)); -static void eap_input __P((int unit, u_char *inp, int inlen)); -static void eap_protrej __P((int unit)); -static void eap_lowerup __P((int unit)); -static void eap_lowerdown __P((int unit)); -static int eap_printpkt __P((u_char *inp, int inlen, - void (*)(void *arg, char *fmt, ...), void *arg)); +static void eap_init (int unit); +static void eap_input (int unit, u_char *inp, int inlen); +static void eap_protrej (int unit); +static void eap_lowerup (int unit); +static void eap_lowerdown (int unit); +static int eap_printpkt (u_char *inp, int inlen, + void (*)(void *arg, char *fmt, ...), void *arg); struct protent eap_protent = { PPP_EAP, /* protocol number */ @@ -146,6 +144,7 @@ struct protent eap_protent = { NULL /* say whether to bring up link for this pkt */ }; +#ifdef USE_SRP /* * A well-known 2048 bit modulus. */ @@ -183,16 +182,16 @@ static const u_char wkmodulus[] = { 0x9B, 0x65, 0xE3, 0x72, 0xFC, 0xD6, 0x8E, 0xF2, 0x0F, 0xA7, 0x11, 0x1F, 0x9E, 0x4A, 0xFF, 0x73 }; +#endif /* USE_SRP */ /* Local forward declarations. */ -static void eap_server_timeout __P((void *arg)); +static void eap_server_timeout (void *arg); /* * Convert EAP state code to printable string for debug. */ static const char * -eap_state_name(esc) -enum eap_state_code esc; +eap_state_name(enum eap_state_code esc) { static const char *state_names[] = { EAP_STATES }; @@ -204,8 +203,7 @@ enum eap_state_code esc; * called once by main() during start-up. */ static void -eap_init(unit) -int unit; +eap_init(int unit) { eap_state *esp = &eap_states[unit]; @@ -226,8 +224,7 @@ int unit; * Request messages. */ static void -eap_client_timeout(arg) -void *arg; +eap_client_timeout(void *arg) { eap_state *esp = (eap_state *) arg; @@ -246,9 +243,7 @@ void *arg; * after eap_lowerup. */ void -eap_authwithpeer(unit, localname) -int unit; -char *localname; +eap_authwithpeer(int unit, char *localname) { eap_state *esp = &eap_states[unit]; @@ -272,8 +267,7 @@ char *localname; * (Server operation) */ static void -eap_send_failure(esp) -eap_state *esp; +eap_send_failure(eap_state *esp) { u_char *outp; @@ -297,8 +291,7 @@ eap_state *esp; * (Server operation) */ static void -eap_send_success(esp) -eap_state *esp; +eap_send_success(eap_state *esp) { u_char *outp; @@ -352,11 +345,7 @@ struct b64state { }; static int -b64enc(bs, inp, inlen, outp) -struct b64state *bs; -u_char *inp; -int inlen; -u_char *outp; +b64enc(struct b64state *bs, u_char *inp, int inlen, u_char *outp) { int outlen = 0; @@ -378,9 +367,7 @@ u_char *outp; } static int -b64flush(bs, outp) -struct b64state *bs; -u_char *outp; +b64flush(struct b64state *bs, u_char *outp) { int outlen = 0; @@ -400,11 +387,7 @@ u_char *outp; } static int -b64dec(bs, inp, inlen, outp) -struct b64state *bs; -u_char *inp; -int inlen; -u_char *outp; +b64dec(struct b64state *bs, u_char *inp, int inlen, u_char *outp) { int outlen = 0; char *cp; @@ -432,9 +415,7 @@ u_char *outp; * 0 for success and non-zero for failure. */ static void -eap_figure_next_state(esp, status) -eap_state *esp; -int status; +eap_figure_next_state(eap_state *esp, int status) { #ifdef USE_SRP unsigned char secbuf[MAXWORDLEN], clear[8], *sp, *dp; @@ -731,8 +712,7 @@ int status; * type depends on current state. (Server operation) */ static void -eap_send_request(esp) -eap_state *esp; +eap_send_request(eap_state *esp) { u_char *outp; u_char *lenloc; @@ -989,9 +969,7 @@ eap_state *esp; * after eap_lowerup. */ void -eap_authpeer(unit, localname) -int unit; -char *localname; +eap_authpeer(int unit, char *localname) { eap_state *esp = &eap_states[unit]; @@ -1019,8 +997,7 @@ char *localname; * expired. */ static void -eap_server_timeout(arg) -void *arg; +eap_server_timeout(void *arg) { #ifdef USE_EAPTLS u_char *outp; @@ -1083,8 +1060,7 @@ void *arg; * will restart the timer. If it fails, then the link is dropped. */ static void -eap_rechallenge(arg) -void *arg; +eap_rechallenge(void *arg) { eap_state *esp = (eap_state *)arg; @@ -1100,8 +1076,7 @@ void *arg; } static void -srp_lwrechallenge(arg) -void *arg; +srp_lwrechallenge(void *arg) { eap_state *esp = (eap_state *)arg; @@ -1124,8 +1099,7 @@ void *arg; * thing. */ static void -eap_lowerup(unit) -int unit; +eap_lowerup(int unit) { eap_state *esp = &eap_states[unit]; @@ -1148,8 +1122,7 @@ int unit; * Cancel all timeouts and return to initial state. */ static void -eap_lowerdown(unit) -int unit; +eap_lowerdown(int unit) { eap_state *esp = &eap_states[unit]; @@ -1183,8 +1156,7 @@ int unit; * failure. */ static void -eap_protrej(unit) -int unit; +eap_protrej(int unit) { eap_state *esp = &eap_states[unit]; @@ -1203,12 +1175,8 @@ int unit; * Format and send a regular EAP Response message. */ static void -eap_send_response(esp, id, typenum, str, lenstr) -eap_state *esp; -u_char id; -u_char typenum; -u_char *str; -int lenstr; +eap_send_response(eap_state *esp, u_char id, u_char typenum, + u_char *str, int lenstr) { u_char *outp; int msglen; @@ -1234,12 +1202,8 @@ int lenstr; * Format and send an MD5-Challenge EAP Response message. */ static void -eap_chap_response(esp, id, hash, name, namelen) -eap_state *esp; -u_char id; -u_char *hash; -char *name; -int namelen; +eap_chap_response(eap_state *esp, u_char id, u_char *hash, + char *name, int namelen) { u_char *outp; int msglen; @@ -1270,12 +1234,8 @@ int namelen; * Format and send a SRP EAP Response message. */ static void -eap_srp_response(esp, id, subtypenum, str, lenstr) -eap_state *esp; -u_char id; -u_char subtypenum; -u_char *str; -int lenstr; +eap_srp_response(eap_state *esp, u_char id, u_char subtypenum, + u_char *str, int lenstr) { u_char *outp; int msglen; @@ -1302,11 +1262,7 @@ int lenstr; * Format and send a SRP EAP Client Validator Response message. */ static void -eap_srpval_response(esp, id, flags, str) -eap_state *esp; -u_char id; -u_int32_t flags; -u_char *str; +eap_srpval_response(eap_state *esp, u_char id, u_int32_t flags, u_char *str) { u_char *outp; int msglen; @@ -1335,9 +1291,7 @@ u_char *str; * Send an EAP-TLS response message with tls data */ static void -eap_tls_response(esp, id) -eap_state *esp; -u_char id; +eap_tls_response(eap_state *esp, u_char id) { u_char *outp; int outlen; @@ -1374,9 +1328,7 @@ u_char id; * Send an EAP-TLS ack */ static void -eap_tls_sendack(esp, id) -eap_state *esp; -u_char id; +eap_tls_sendack(eap_state *esp, u_char id) { u_char *outp; int outlen; @@ -1404,10 +1356,7 @@ u_char id; #endif /* USE_EAPTLS */ static void -eap_send_nak(esp, id, type) -eap_state *esp; -u_char id; -u_char type; +eap_send_nak(eap_state *esp, u_char id, u_char type) { u_char *outp; int msglen; @@ -1429,7 +1378,7 @@ u_char type; #ifdef USE_SRP static char * -name_of_pn_file() +name_of_pn_file(void) { char *user, *path, *file; struct passwd *pw; @@ -1455,8 +1404,7 @@ name_of_pn_file() } static int -open_pn_file(modebits) -mode_t modebits; +open_pn_file(mode_t modebits) { char *path; int fd, err; @@ -1471,7 +1419,7 @@ mode_t modebits; } static void -remove_pn_file() +remove_pn_file(void) { char *path; @@ -1482,10 +1430,7 @@ remove_pn_file() } static void -write_pseudonym(esp, inp, len, id) -eap_state *esp; -u_char *inp; -int len, id; +write_pseudonym(eap_state *esp, u_char *inp, int len, int id) { u_char val; u_char *datp, *digp; @@ -1544,11 +1489,7 @@ int len, id; * eap_request - Receive EAP Request message (client mode). */ static void -eap_request(esp, inp, id, len) -eap_state *esp; -u_char *inp; -int id; -int len; +eap_request(eap_state *esp, u_char *inp, int id, int len) { u_char typenum; u_char vallen; @@ -1633,7 +1574,7 @@ int len; esp->es_usedpseudo = 2; } #endif /* USE_SRP */ - eap_send_response(esp, id, typenum, esp->es_client.ea_name, + eap_send_response(esp, id, typenum, (u_char *)esp->es_client.ea_name, esp->es_client.ea_namelen); break; @@ -2055,11 +1996,7 @@ client_failure: * eap_response - Receive EAP Response message (server mode). */ static void -eap_response(esp, inp, id, len) -eap_state *esp; -u_char *inp; -int id; -int len; +eap_response(eap_state *esp, u_char *inp, int id, int len) { u_char typenum; u_char vallen; @@ -2428,11 +2365,7 @@ int len; * eap_success - Receive EAP Success message (client mode). */ static void -eap_success(esp, inp, id, len) -eap_state *esp; -u_char *inp; -int id; -int len; +eap_success(eap_state *esp, u_char *inp, int id, int len) { if (esp->es_client.ea_state != eapOpen && !eap_client_active(esp) #ifdef USE_EAPTLS @@ -2472,11 +2405,7 @@ int len; * eap_failure - Receive EAP Failure message (client mode). */ static void -eap_failure(esp, inp, id, len) -eap_state *esp; -u_char *inp; -int id; -int len; +eap_failure(eap_state *esp, u_char *inp, int id, int len) { /* * Ignore failure messages if we're not open @@ -2509,10 +2438,7 @@ int len; * eap_input - Handle received EAP message. */ static void -eap_input(unit, inp, inlen) -int unit; -u_char *inp; -int inlen; +eap_input(int unit, u_char *inp, int inlen) { eap_state *esp = &eap_states[unit]; u_char code, id; @@ -2577,11 +2503,8 @@ static char *eap_typenames[] = { }; static int -eap_printpkt(inp, inlen, printer, arg) -u_char *inp; -int inlen; -void (*printer) __P((void *, char *, ...)); -void *arg; +eap_printpkt(u_char *inp, int inlen, + void (*printer) (void *, char *, ...), void *arg) { int code, id, len, rtype, vallen; u_char *pstart; diff --git a/pppd/eap.h b/pppd/eap.h index 087baad..56bef13 100644 --- a/pppd/eap.h +++ b/pppd/eap.h @@ -175,8 +175,8 @@ typedef struct eap_state { extern eap_state eap_states[]; -void eap_authwithpeer __P((int unit, char *localname)); -void eap_authpeer __P((int unit, char *localname)); +void eap_authwithpeer (int unit, char *localname); +void eap_authpeer (int unit, char *localname); extern struct protent eap_protent; diff --git a/pppd/ecp.c b/pppd/ecp.c index dada8e6..1ecd7be 100644 --- a/pppd/ecp.c +++ b/pppd/ecp.c @@ -57,9 +57,6 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: ecp.c,v 1.4 2004/11/04 10:02:26 paulus Exp $" - - #include #include "pppd.h" @@ -78,20 +75,20 @@ static option_t ecp_option_list[] = { /* * Protocol entry points from main code. */ -static void ecp_init __P((int unit)); +static void ecp_init (int unit); /* -static void ecp_open __P((int unit)); -static void ecp_close __P((int unit, char *)); -static void ecp_lowerup __P((int unit)); -static void ecp_lowerdown __P((int)); -static void ecp_input __P((int unit, u_char *pkt, int len)); -static void ecp_protrej __P((int unit)); +static void ecp_open (int unit); +static void ecp_close (int unit, char *); +static void ecp_lowerup (int unit); +static void ecp_lowerdown (int); +static void ecp_input (int unit, u_char *pkt, int len); +static void ecp_protrej (int unit); */ -static int ecp_printpkt __P((u_char *pkt, int len, - void (*printer) __P((void *, char *, ...)), - void *arg)); +static int ecp_printpkt (u_char *pkt, int len, + void (*printer)(void *, char *, ...), + void *arg); /* -static void ecp_datainput __P((int unit, u_char *pkt, int len)); +static void ecp_datainput (int unit, u_char *pkt, int len); */ struct protent ecp_protent = { @@ -142,8 +139,7 @@ static fsm_callbacks ecp_callbacks = { * ecp_init - initialize ECP. */ static void -ecp_init(unit) - int unit; +ecp_init(int unit) { fsm *f = &ecp_fsm[unit]; @@ -161,11 +157,8 @@ ecp_init(unit) static int -ecp_printpkt(p, plen, printer, arg) - u_char *p; - int plen; - void (*printer) __P((void *, char *, ...)); - void *arg; +ecp_printpkt(u_char *p, int plen, + void (*printer)(void *, char *, ...), void *arg) { return 0; } diff --git a/pppd/eui64.c b/pppd/eui64.c index e7be0e1..98caf94 100644 --- a/pppd/eui64.c +++ b/pppd/eui64.c @@ -32,11 +32,8 @@ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: eui64.c,v 1.6 2002/12/04 23:03:32 paulus Exp $ */ -#define RCSID "$Id: eui64.c,v 1.6 2002/12/04 23:03:32 paulus Exp $" - #include "pppd.h" @@ -44,8 +41,7 @@ * eui64_ntoa - Make an ascii representation of an interface identifier */ char * -eui64_ntoa(e) - eui64_t e; +eui64_ntoa(eui64_t e) { static char buf[32]; diff --git a/pppd/eui64.h b/pppd/eui64.h index 0f6b6fd..c48d689 100644 --- a/pppd/eui64.h +++ b/pppd/eui64.h @@ -32,8 +32,7 @@ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: eui64.h,v 1.6 2002/12/04 23:03:32 paulus Exp $ -*/ + */ #ifndef __EUI64_H__ #define __EUI64_H__ @@ -108,7 +107,7 @@ typedef union } while (0) #define eui64_setlo32(e, l) eui64_set32(e, l) -char *eui64_ntoa __P((eui64_t)); /* Returns ascii representation of id */ +char *eui64_ntoa(eui64_t); /* Returns ascii representation of id */ #endif /* __EUI64_H__ */ diff --git a/pppd/fsm.c b/pppd/fsm.c index d78ef79..96d20e8 100644 --- a/pppd/fsm.c +++ b/pppd/fsm.c @@ -40,8 +40,6 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: fsm.c,v 1.23 2004/11/13 02:28:15 paulus Exp $" - /* * TODO: * Randomize fsm id on link/init. @@ -56,14 +54,14 @@ #include "fsm.h" -static void fsm_timeout __P((void *)); -static void fsm_rconfreq __P((fsm *, int, u_char *, int)); -static void fsm_rconfack __P((fsm *, int, u_char *, int)); -static void fsm_rconfnakrej __P((fsm *, int, int, u_char *, int)); -static void fsm_rtermreq __P((fsm *, int, u_char *, int)); -static void fsm_rtermack __P((fsm *)); -static void fsm_rcoderej __P((fsm *, u_char *, int)); -static void fsm_sconfreq __P((fsm *, int)); +static void fsm_timeout (void *); +static void fsm_rconfreq (fsm *, int, u_char *, int); +static void fsm_rconfack (fsm *, int, u_char *, int); +static void fsm_rconfnakrej (fsm *, int, int, u_char *, int); +static void fsm_rtermreq (fsm *, int, u_char *, int); +static void fsm_rtermack (fsm *); +static void fsm_rcoderej (fsm *, u_char *, int); +static void fsm_sconfreq (fsm *, int); #define PROTO_NAME(f) ((f)->callbacks->proto_name) @@ -76,8 +74,7 @@ int peer_mru[NUM_PPP]; * Initialize fsm state. */ void -fsm_init(f) - fsm *f; +fsm_init(fsm *f) { f->state = INITIAL; f->flags = 0; @@ -94,8 +91,7 @@ fsm_init(f) * fsm_lowerup - The lower layer is up. */ void -fsm_lowerup(f) - fsm *f; +fsm_lowerup(fsm *f) { switch( f->state ){ case INITIAL: @@ -124,8 +120,7 @@ fsm_lowerup(f) * Cancel all timeouts and inform upper layers. */ void -fsm_lowerdown(f) - fsm *f; +fsm_lowerdown(fsm *f) { switch( f->state ){ case CLOSED: @@ -167,8 +162,7 @@ fsm_lowerdown(f) * fsm_open - Link is allowed to come up. */ void -fsm_open(f) - fsm *f; +fsm_open(fsm *f) { switch( f->state ){ case INITIAL: @@ -207,9 +201,7 @@ fsm_open(f) * send a terminate-request message as configured. */ static void -terminate_layer(f, nextstate) - fsm *f; - int nextstate; +terminate_layer(fsm *f, int nextstate) { if( f->state != OPENED ) UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */ @@ -246,9 +238,7 @@ terminate_layer(f, nextstate) * the CLOSED state. */ void -fsm_close(f, reason) - fsm *f; - char *reason; +fsm_close(fsm *f, char *reason) { f->term_reason = reason; f->term_reason_len = (reason == NULL? 0: strlen(reason)); @@ -277,8 +267,7 @@ fsm_close(f, reason) * fsm_timeout - Timeout expired. */ static void -fsm_timeout(arg) - void *arg; +fsm_timeout(void *arg) { fsm *f = (fsm *) arg; @@ -330,10 +319,7 @@ fsm_timeout(arg) * fsm_input - Input packet. */ void -fsm_input(f, inpacket, l) - fsm *f; - u_char *inpacket; - int l; +fsm_input(fsm *f, u_char *inpacket, int l) { u_char *inp; u_char code, id; @@ -409,11 +395,7 @@ fsm_input(f, inpacket, l) * fsm_rconfreq - Receive Configure-Request. */ static void -fsm_rconfreq(f, id, inp, len) - fsm *f; - u_char id; - u_char *inp; - int len; +fsm_rconfreq(fsm *f, int id, u_char *inp, int len) { int code, reject_if_disagree; @@ -480,11 +462,7 @@ fsm_rconfreq(f, id, inp, len) * fsm_rconfack - Receive Configure-Ack. */ static void -fsm_rconfack(f, id, inp, len) - fsm *f; - int id; - u_char *inp; - int len; +fsm_rconfack(fsm *f, int id, u_char *inp, int len) { if (id != f->reqid || f->seen_ack) /* Expected id? */ return; /* Nope, toss... */ @@ -538,11 +516,7 @@ fsm_rconfack(f, id, inp, len) * fsm_rconfnakrej - Receive Configure-Nak or Configure-Reject. */ static void -fsm_rconfnakrej(f, code, id, inp, len) - fsm *f; - int code, id; - u_char *inp; - int len; +fsm_rconfnakrej(fsm *f, int code, int id, u_char *inp, int len) { int ret; int treat_as_reject; @@ -607,11 +581,7 @@ fsm_rconfnakrej(f, code, id, inp, len) * fsm_rtermreq - Receive Terminate-Req. */ static void -fsm_rtermreq(f, id, p, len) - fsm *f; - int id; - u_char *p; - int len; +fsm_rtermreq(fsm *f, int id, u_char *p, int len) { switch (f->state) { case ACKRCVD: @@ -640,8 +610,7 @@ fsm_rtermreq(f, id, p, len) * fsm_rtermack - Receive Terminate-Ack. */ static void -fsm_rtermack(f) - fsm *f; +fsm_rtermack(fsm *f) { switch (f->state) { case CLOSING: @@ -675,10 +644,7 @@ fsm_rtermack(f) * fsm_rcoderej - Receive an Code-Reject. */ static void -fsm_rcoderej(f, inp, len) - fsm *f; - u_char *inp; - int len; +fsm_rcoderej(fsm *f, u_char *inp, int len) { u_char code, id; @@ -701,8 +667,7 @@ fsm_rcoderej(f, inp, len) * Treat this as a catastrophic error (RXJ-). */ void -fsm_protreject(f) - fsm *f; +fsm_protreject(fsm *f) { switch( f->state ){ case CLOSING: @@ -741,9 +706,7 @@ fsm_protreject(f) * fsm_sconfreq - Send a Configure-Request. */ static void -fsm_sconfreq(f, retransmit) - fsm *f; - int retransmit; +fsm_sconfreq(fsm *f, int retransmit) { u_char *outp; int cilen; @@ -792,11 +755,7 @@ fsm_sconfreq(f, retransmit) * Used for all packets sent to our peer by this module. */ void -fsm_sdata(f, code, id, data, datalen) - fsm *f; - u_char code, id; - u_char *data; - int datalen; +fsm_sdata(fsm *f, int code, int id, u_char *data, int datalen) { u_char *outp; int outlen; diff --git a/pppd/fsm.h b/pppd/fsm.h index 87a78d3..75a36d5 100644 --- a/pppd/fsm.h +++ b/pppd/fsm.h @@ -85,34 +85,26 @@ typedef struct fsm { typedef struct fsm_callbacks { - void (*resetci) /* Reset our Configuration Information */ - __P((fsm *)); - int (*cilen) /* Length of our Configuration Information */ - __P((fsm *)); + void (*resetci)(fsm *); /* Reset our Configuration Information */ + int (*cilen)(fsm *); /* Length of our Configuration Information */ void (*addci) /* Add our Configuration Information */ - __P((fsm *, u_char *, int *)); + (fsm *, u_char *, int *); int (*ackci) /* ACK our Configuration Information */ - __P((fsm *, u_char *, int)); + (fsm *, u_char *, int); int (*nakci) /* NAK our Configuration Information */ - __P((fsm *, u_char *, int, int)); + (fsm *, u_char *, int, int); int (*rejci) /* Reject our Configuration Information */ - __P((fsm *, u_char *, int)); + (fsm *, u_char *, int); int (*reqci) /* Request peer's Configuration Information */ - __P((fsm *, u_char *, int *, int)); - void (*up) /* Called when fsm reaches OPENED state */ - __P((fsm *)); - void (*down) /* Called when fsm leaves OPENED state */ - __P((fsm *)); - void (*starting) /* Called when we want the lower layer */ - __P((fsm *)); - void (*finished) /* Called when we don't want the lower layer */ - __P((fsm *)); - void (*protreject) /* Called when Protocol-Reject received */ - __P((int)); - void (*retransmit) /* Retransmission is necessary */ - __P((fsm *)); + (fsm *, u_char *, int *, int); + void (*up)(fsm *); /* Called when fsm reaches OPENED state */ + void (*down)(fsm *); /* Called when fsm leaves OPENED state */ + void (*starting)(fsm *); /* Called when we want the lower layer */ + void (*finished)(fsm *); /* Called when we don't want the lower layer */ + void (*protreject)(int); /* Called when Protocol-Reject received */ + void (*retransmit)(fsm *); /* Retransmission is necessary */ int (*extcode) /* Called when unknown code received */ - __P((fsm *, int, int, u_char *, int)); + (fsm *, int, int, u_char *, int); char *proto_name; /* String name for protocol (for messages) */ } fsm_callbacks; @@ -152,14 +144,14 @@ typedef struct fsm_callbacks { /* * Prototypes */ -void fsm_init __P((fsm *)); -void fsm_lowerup __P((fsm *)); -void fsm_lowerdown __P((fsm *)); -void fsm_open __P((fsm *)); -void fsm_close __P((fsm *, char *)); -void fsm_input __P((fsm *, u_char *, int)); -void fsm_protreject __P((fsm *)); -void fsm_sdata __P((fsm *, int, int, u_char *, int)); +void fsm_init (fsm *); +void fsm_lowerup (fsm *); +void fsm_lowerdown (fsm *); +void fsm_open (fsm *); +void fsm_close (fsm *, char *); +void fsm_input (fsm *, u_char *, int); +void fsm_protreject (fsm *); +void fsm_sdata (fsm *, int, int, u_char *, int); /* diff --git a/pppd/ipcp.c b/pppd/ipcp.c index ed6cd4b..80a18f8 100644 --- a/pppd/ipcp.c +++ b/pppd/ipcp.c @@ -40,8 +40,6 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: ipcp.c,v 1.73 2008/05/26 08:33:22 paulus Exp $" - /* * TODO: */ @@ -74,13 +72,13 @@ bool disable_defaultip = 0; /* Don't use hostname for default IP adrs */ bool noremoteip = 0; /* Let him have no IP address */ /* Hook for a plugin to know when IP protocol has come up */ -void (*ip_up_hook) __P((void)) = NULL; +void (*ip_up_hook)(void) = NULL; /* Hook for a plugin to know when IP protocol has come down */ -void (*ip_down_hook) __P((void)) = NULL; +void (*ip_down_hook)(void) = NULL; /* Hook for a plugin to choose the remote IP address */ -void (*ip_choose_hook) __P((u_int32_t *)) = NULL; +void (*ip_choose_hook)(u_int32_t *) = NULL; /* Notifiers for when IPCP goes up and down */ struct notifier *ip_up_notifier = NULL; @@ -99,16 +97,16 @@ static char netmask_str[20]; /* string form of netmask value */ /* * Callbacks for fsm code. (CI = Configuration Information) */ -static void ipcp_resetci __P((fsm *)); /* Reset our CI */ -static int ipcp_cilen __P((fsm *)); /* Return length of our CI */ -static void ipcp_addci __P((fsm *, u_char *, int *)); /* Add our CI */ -static int ipcp_ackci __P((fsm *, u_char *, int)); /* Peer ack'd our CI */ -static int ipcp_nakci __P((fsm *, u_char *, int, int));/* Peer nak'd our CI */ -static int ipcp_rejci __P((fsm *, u_char *, int)); /* Peer rej'd our CI */ -static int ipcp_reqci __P((fsm *, u_char *, int *, int)); /* Rcv CI */ -static void ipcp_up __P((fsm *)); /* We're UP */ -static void ipcp_down __P((fsm *)); /* We're DOWN */ -static void ipcp_finished __P((fsm *)); /* Don't need lower layer */ +static void ipcp_resetci (fsm *); /* Reset our CI */ +static int ipcp_cilen (fsm *); /* Return length of our CI */ +static void ipcp_addci (fsm *, u_char *, int *); /* Add our CI */ +static int ipcp_ackci (fsm *, u_char *, int); /* Peer ack'd our CI */ +static int ipcp_nakci (fsm *, u_char *, int, int);/* Peer nak'd our CI */ +static int ipcp_rejci (fsm *, u_char *, int); /* Peer rej'd our CI */ +static int ipcp_reqci (fsm *, u_char *, int *, int); /* Rcv CI */ +static void ipcp_up (fsm *); /* We're UP */ +static void ipcp_down (fsm *); /* We're DOWN */ +static void ipcp_finished (fsm *); /* Don't need lower layer */ fsm ipcp_fsm[NUM_PPP]; /* IPCP fsm structure */ @@ -133,12 +131,12 @@ static fsm_callbacks ipcp_callbacks = { /* IPCP callback routines */ /* * Command-line options. */ -static int setvjslots __P((char **)); -static int setdnsaddr __P((char **)); -static int setwinsaddr __P((char **)); -static int setnetmask __P((char **)); -int setipaddr __P((char *, char **, int)); -static void printipaddr __P((option_t *, void (*)(void *, char *,...),void *)); +static int setvjslots (char **); +static int setdnsaddr (char **); +static int setwinsaddr (char **); +static int setnetmask (char **); +int setipaddr (char *, char **, int); +static void printipaddr (option_t *, void (*)(void *, char *,...),void *); static option_t ipcp_option_list[] = { { "noip", o_bool, &ipcp_protent.enabled_flag, @@ -236,19 +234,19 @@ static option_t ipcp_option_list[] = { /* * Protocol entry points from main code. */ -static void ipcp_init __P((int)); -static void ipcp_open __P((int)); -static void ipcp_close __P((int, char *)); -static void ipcp_lowerup __P((int)); -static void ipcp_lowerdown __P((int)); -static void ipcp_input __P((int, u_char *, int)); -static void ipcp_protrej __P((int)); -static int ipcp_printpkt __P((u_char *, int, - void (*) __P((void *, char *, ...)), void *)); -static void ip_check_options __P((void)); -static int ip_demand_conf __P((int)); -static int ip_active_pkt __P((u_char *, int)); -static void create_resolv __P((u_int32_t, u_int32_t)); +static void ipcp_init (int); +static void ipcp_open (int); +static void ipcp_close (int, char *); +static void ipcp_lowerup (int); +static void ipcp_lowerdown (int); +static void ipcp_input (int, u_char *, int); +static void ipcp_protrej (int); +static int ipcp_printpkt (u_char *, int, + void (*) (void *, char *, ...), void *); +static void ip_check_options (void); +static int ip_demand_conf (int); +static int ip_active_pkt (u_char *, int); +static void create_resolv (u_int32_t, u_int32_t); struct protent ipcp_protent = { PPP_IPCP, @@ -270,9 +268,9 @@ struct protent ipcp_protent = { ip_active_pkt }; -static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t)); -static void ipcp_script __P((char *, int)); /* Run an up/down script */ -static void ipcp_script_done __P((void *)); +static void ipcp_clear_addrs (int, u_int32_t, u_int32_t); +static void ipcp_script (char *, int); /* Run an up/down script */ +static void ipcp_script_done (void *); /* * Lengths of configuration options. @@ -301,8 +299,7 @@ static pid_t ipcp_script_pid; * Make a string representation of a network IP address. */ char * -ip_ntoa(ipaddr) -u_int32_t ipaddr; +ip_ntoa(u_int32_t ipaddr) { static char b[64]; @@ -318,8 +315,7 @@ u_int32_t ipaddr; * setvjslots - set maximum number of connection slots for VJ compression */ static int -setvjslots(argv) - char **argv; +setvjslots(char **argv) { int value; @@ -339,8 +335,7 @@ setvjslots(argv) * setdnsaddr - set the dns address(es) */ static int -setdnsaddr(argv) - char **argv; +setdnsaddr(char **argv) { u_int32_t dns; struct hostent *hp; @@ -375,8 +370,7 @@ setdnsaddr(argv) * the caller to the existing WINS server on a Windows NT platform. */ static int -setwinsaddr(argv) - char **argv; +setwinsaddr(char **argv) { u_int32_t wins; struct hostent *hp; @@ -412,10 +406,7 @@ setwinsaddr(argv) * Not static so that plugins can call it to set the addresses */ int -setipaddr(arg, argv, doit) - char *arg; - char **argv; - int doit; +setipaddr(char *arg, char **argv, int doit) { struct hostent *hp; char *colon; @@ -479,10 +470,7 @@ setipaddr(arg, argv, doit) } static void -printipaddr(opt, printer, arg) - option_t *opt; - void (*printer) __P((void *, char *, ...)); - void *arg; +printipaddr(option_t *opt, void (*printer) (void *, char *, ...), void *arg) { ipcp_options *wo = &ipcp_wantoptions[0]; @@ -497,8 +485,7 @@ printipaddr(opt, printer, arg) * setnetmask - set the netmask to be used on the interface. */ static int -setnetmask(argv) - char **argv; +setnetmask(char **argv) { u_int32_t mask; int n; @@ -525,9 +512,7 @@ setnetmask(argv) } int -parse_dotted_ip(p, vp) - char *p; - u_int32_t *vp; +parse_dotted_ip(char *p, u_int32_t *vp) { int n; u_int32_t v, b; @@ -562,8 +547,7 @@ parse_dotted_ip(p, vp) * ipcp_init - Initialize IPCP. */ static void -ipcp_init(unit) - int unit; +ipcp_init(int unit) { fsm *f = &ipcp_fsm[unit]; ipcp_options *wo = &ipcp_wantoptions[unit]; @@ -614,8 +598,7 @@ ipcp_init(unit) * ipcp_open - IPCP is allowed to come up. */ static void -ipcp_open(unit) - int unit; +ipcp_open(int unit) { fsm_open(&ipcp_fsm[unit]); ipcp_is_open = 1; @@ -626,9 +609,7 @@ ipcp_open(unit) * ipcp_close - Take IPCP down. */ static void -ipcp_close(unit, reason) - int unit; - char *reason; +ipcp_close(int unit, char *reason) { fsm_close(&ipcp_fsm[unit], reason); } @@ -638,8 +619,7 @@ ipcp_close(unit, reason) * ipcp_lowerup - The lower layer is up. */ static void -ipcp_lowerup(unit) - int unit; +ipcp_lowerup(int unit) { fsm_lowerup(&ipcp_fsm[unit]); } @@ -649,8 +629,7 @@ ipcp_lowerup(unit) * ipcp_lowerdown - The lower layer is down. */ static void -ipcp_lowerdown(unit) - int unit; +ipcp_lowerdown(int unit) { fsm_lowerdown(&ipcp_fsm[unit]); } @@ -660,10 +639,7 @@ ipcp_lowerdown(unit) * ipcp_input - Input IPCP packet. */ static void -ipcp_input(unit, p, len) - int unit; - u_char *p; - int len; +ipcp_input(int unit, u_char *p, int len) { fsm_input(&ipcp_fsm[unit], p, len); } @@ -675,8 +651,7 @@ ipcp_input(unit, p, len) * Pretend the lower layer went down, so we shut up. */ static void -ipcp_protrej(unit) - int unit; +ipcp_protrej(int unit) { fsm_lowerdown(&ipcp_fsm[unit]); } @@ -687,8 +662,7 @@ ipcp_protrej(unit) * Called by fsm_sconfreq, Send Configure Request. */ static void -ipcp_resetci(f) - fsm *f; +ipcp_resetci(fsm *f) { ipcp_options *wo = &ipcp_wantoptions[f->unit]; ipcp_options *go = &ipcp_gotoptions[f->unit]; @@ -720,8 +694,7 @@ ipcp_resetci(f) * Called by fsm_sconfreq, Send Configure Request. */ static int -ipcp_cilen(f) - fsm *f; +ipcp_cilen(fsm *f) { ipcp_options *go = &ipcp_gotoptions[f->unit]; ipcp_options *wo = &ipcp_wantoptions[f->unit]; @@ -764,10 +737,7 @@ ipcp_cilen(f) * Called by fsm_sconfreq, Send Configure Request. */ static void -ipcp_addci(f, ucp, lenp) - fsm *f; - u_char *ucp; - int *lenp; +ipcp_addci(fsm *f, u_char *ucp, int *lenp) { ipcp_options *go = &ipcp_gotoptions[f->unit]; int len = *lenp; @@ -871,10 +841,7 @@ ipcp_addci(f, ucp, lenp) * 1 - Ack was good. */ static int -ipcp_ackci(f, p, len) - fsm *f; - u_char *p; - int len; +ipcp_ackci(fsm *f, u_char *p, int len) { ipcp_options *go = &ipcp_gotoptions[f->unit]; u_short cilen, citype, cishort; @@ -1015,11 +982,7 @@ bad: * 1 - Nak was good. */ static int -ipcp_nakci(f, p, len, treat_as_reject) - fsm *f; - u_char *p; - int len; - int treat_as_reject; +ipcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) { ipcp_options *go = &ipcp_gotoptions[f->unit]; u_char cimaxslotindex, cicflag; @@ -1264,10 +1227,7 @@ bad: * Callback from fsm_rconfnakrej. */ static int -ipcp_rejci(f, p, len) - fsm *f; - u_char *p; - int len; +ipcp_rejci(fsm *f, u_char *p, int len) { ipcp_options *go = &ipcp_gotoptions[f->unit]; u_char cimaxslotindex, ciflag, cilen; @@ -1415,11 +1375,7 @@ bad: * CONFNAK; returns CONFREJ if it can't return CONFACK. */ static int -ipcp_reqci(f, inp, len, reject_if_disagree) - fsm *f; - u_char *inp; /* Requested CIs */ - int *len; /* Length of requested CIs */ - int reject_if_disagree; +ipcp_reqci(fsm *f, u_char *inp, int *len, int reject_if_disagree) { ipcp_options *wo = &ipcp_wantoptions[f->unit]; ipcp_options *ho = &ipcp_hisoptions[f->unit]; @@ -1704,7 +1660,7 @@ endswitch: * and assign appropriate defaults. */ static void -ip_check_options() +ip_check_options(void) { struct hostent *hp; u_int32_t local; @@ -1736,8 +1692,7 @@ ip_check_options() * IPCP were up, for use with dial-on-demand. */ static int -ip_demand_conf(u) - int u; +ip_demand_conf(int u) { ipcp_options *wo = &ipcp_wantoptions[u]; @@ -1780,8 +1735,7 @@ ip_demand_conf(u) * Configure the IP network interface appropriately and bring it up. */ static void -ipcp_up(f) - fsm *f; +ipcp_up(fsm *f) { u_int32_t mask; ipcp_options *ho = &ipcp_hisoptions[f->unit]; @@ -1969,8 +1923,7 @@ ipcp_up(f) * and delete routes through it. */ static void -ipcp_down(f) - fsm *f; +ipcp_down(fsm *f) { IPCPDEBUG(("ipcp: down")); /* XXX a bit IPv4-centric here, we only need to get the stats @@ -2017,10 +1970,7 @@ ipcp_down(f) * proxy arp entries, etc. */ static void -ipcp_clear_addrs(unit, ouraddr, hisaddr) - int unit; - u_int32_t ouraddr; /* local address */ - u_int32_t hisaddr; /* remote address */ +ipcp_clear_addrs(int unit, u_int32_t ouraddr, u_int32_t hisaddr) { if (proxy_arp_set[unit]) { cifproxyarp(unit, hisaddr); @@ -2038,8 +1988,7 @@ ipcp_clear_addrs(unit, ouraddr, hisaddr) * ipcp_finished - possibly shut down the lower layers. */ static void -ipcp_finished(f) - fsm *f; +ipcp_finished(fsm *f) { if (ipcp_is_open) { ipcp_is_open = 0; @@ -2053,8 +2002,7 @@ ipcp_finished(f) * has finished. */ static void -ipcp_script_done(arg) - void *arg; +ipcp_script_done(void *arg) { ipcp_script_pid = 0; switch (ipcp_script_state) { @@ -2079,9 +2027,7 @@ ipcp_script_done(arg) * interface-name tty-name speed local-IP remote-IP. */ static void -ipcp_script(script, wait) - char *script; - int wait; +ipcp_script(char *script, int wait) { char strspeed[32], strlocal[32], strremote[32]; char *argv[8]; @@ -2109,8 +2055,7 @@ ipcp_script(script, wait) * create_resolv - create the replacement resolv.conf file */ static void -create_resolv(peerdns1, peerdns2) - u_int32_t peerdns1, peerdns2; +create_resolv(u_int32_t peerdns1, u_int32_t peerdns2) { FILE *f; @@ -2141,11 +2086,8 @@ static char *ipcp_codenames[] = { }; static int -ipcp_printpkt(p, plen, printer, arg) - u_char *p; - int plen; - void (*printer) __P((void *, char *, ...)); - void *arg; +ipcp_printpkt(u_char *p, int plen, + void (*printer) (void *, char *, ...), void *arg) { int code, id, len, olen; u_char *pstart, *optend; @@ -2285,9 +2227,7 @@ ipcp_printpkt(p, plen, printer, arg) #define get_tcpflags(x) (((unsigned char *)(x))[13]) static int -ip_active_pkt(pkt, len) - u_char *pkt; - int len; +ip_active_pkt(u_char *pkt, int len) { u_char *tcp; int hlen; diff --git a/pppd/ipcp.h b/pppd/ipcp.h index 6cf14c9..dc6665c 100644 --- a/pppd/ipcp.h +++ b/pppd/ipcp.h @@ -38,8 +38,6 @@ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * $Id: ipcp.h,v 1.14 2002/12/04 23:03:32 paulus Exp $ */ /* @@ -91,6 +89,6 @@ extern ipcp_options ipcp_gotoptions[]; extern ipcp_options ipcp_allowoptions[]; extern ipcp_options ipcp_hisoptions[]; -char *ip_ntoa __P((u_int32_t)); +char *ip_ntoa(u_int32_t); extern struct protent ipcp_protent; diff --git a/pppd/ipv6cp.c b/pppd/ipv6cp.c index c01b846..dec6cfe 100644 --- a/pppd/ipv6cp.c +++ b/pppd/ipv6cp.c @@ -134,12 +134,8 @@ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * $Id: ipv6cp.c,v 1.21 2005/08/25 23:59:34 paulus Exp $ */ -#define RCSID "$Id: ipv6cp.c,v 1.21 2005/08/25 23:59:34 paulus Exp $" - /* * TODO: * @@ -181,10 +177,10 @@ static int default_route_set[NUM_PPP]; /* Have set up a default route */ static int ipv6cp_is_up; /* Hook for a plugin to know when IPv6 protocol has come up */ -void (*ipv6_up_hook) __P((void)) = NULL; +void (*ipv6_up_hook)(void) = NULL; /* Hook for a plugin to know when IPv6 protocol has come down */ -void (*ipv6_down_hook) __P((void)) = NULL; +void (*ipv6_down_hook)(void) = NULL; /* Notifiers for when IPCPv6 goes up and down */ struct notifier *ipv6_up_notifier = NULL; @@ -193,16 +189,16 @@ struct notifier *ipv6_down_notifier = NULL; /* * Callbacks for fsm code. (CI = Configuration Information) */ -static void ipv6cp_resetci __P((fsm *)); /* Reset our CI */ -static int ipv6cp_cilen __P((fsm *)); /* Return length of our CI */ -static void ipv6cp_addci __P((fsm *, u_char *, int *)); /* Add our CI */ -static int ipv6cp_ackci __P((fsm *, u_char *, int)); /* Peer ack'd our CI */ -static int ipv6cp_nakci __P((fsm *, u_char *, int, int));/* Peer nak'd our CI */ -static int ipv6cp_rejci __P((fsm *, u_char *, int)); /* Peer rej'd our CI */ -static int ipv6cp_reqci __P((fsm *, u_char *, int *, int)); /* Rcv CI */ -static void ipv6cp_up __P((fsm *)); /* We're UP */ -static void ipv6cp_down __P((fsm *)); /* We're DOWN */ -static void ipv6cp_finished __P((fsm *)); /* Don't need lower layer */ +static void ipv6cp_resetci (fsm *); /* Reset our CI */ +static int ipv6cp_cilen (fsm *); /* Return length of our CI */ +static void ipv6cp_addci (fsm *, u_char *, int *); /* Add our CI */ +static int ipv6cp_ackci (fsm *, u_char *, int); /* Peer ack'd our CI */ +static int ipv6cp_nakci (fsm *, u_char *, int, int);/* Peer nak'd our CI */ +static int ipv6cp_rejci (fsm *, u_char *, int); /* Peer rej'd our CI */ +static int ipv6cp_reqci (fsm *, u_char *, int *, int); /* Rcv CI */ +static void ipv6cp_up (fsm *); /* We're UP */ +static void ipv6cp_down (fsm *); /* We're DOWN */ +static void ipv6cp_finished (fsm *); /* Don't need lower layer */ fsm ipv6cp_fsm[NUM_PPP]; /* IPV6CP fsm structure */ @@ -227,9 +223,9 @@ static fsm_callbacks ipv6cp_callbacks = { /* IPV6CP callback routines */ /* * Command-line options. */ -static int setifaceid __P((char **arg)); -static void printifaceid __P((option_t *, - void (*)(void *, char *, ...), void *)); +static int setifaceid (char **arg); +static void printifaceid (option_t *, + void (*)(void *, char *, ...), void *); static option_t ipv6cp_option_list[] = { { "ipv6", o_special, (void *)setifaceid, @@ -279,18 +275,18 @@ static option_t ipv6cp_option_list[] = { /* * Protocol entry points from main code. */ -static void ipv6cp_init __P((int)); -static void ipv6cp_open __P((int)); -static void ipv6cp_close __P((int, char *)); -static void ipv6cp_lowerup __P((int)); -static void ipv6cp_lowerdown __P((int)); -static void ipv6cp_input __P((int, u_char *, int)); -static void ipv6cp_protrej __P((int)); -static int ipv6cp_printpkt __P((u_char *, int, - void (*) __P((void *, char *, ...)), void *)); -static void ipv6_check_options __P((void)); -static int ipv6_demand_conf __P((int)); -static int ipv6_active_pkt __P((u_char *, int)); +static void ipv6cp_init (int); +static void ipv6cp_open (int); +static void ipv6cp_close (int, char *); +static void ipv6cp_lowerup (int); +static void ipv6cp_lowerdown (int); +static void ipv6cp_input (int, u_char *, int); +static void ipv6cp_protrej (int); +static int ipv6cp_printpkt (u_char *, int, + void (*) (void *, char *, ...), void *); +static void ipv6_check_options (void); +static int ipv6_demand_conf (int); +static int ipv6_active_pkt (u_char *, int); struct protent ipv6cp_protent = { PPP_IPV6CP, @@ -312,9 +308,9 @@ struct protent ipv6cp_protent = { ipv6_active_pkt }; -static void ipv6cp_clear_addrs __P((int, eui64_t, eui64_t)); -static void ipv6cp_script __P((char *)); -static void ipv6cp_script_done __P((void *)); +static void ipv6cp_clear_addrs (int, eui64_t, eui64_t); +static void ipv6cp_script (char *); +static void ipv6cp_script_done (void *); /* * Lengths of configuration options. @@ -340,8 +336,7 @@ static pid_t ipv6cp_script_pid; * setifaceid - set the interface identifiers manually */ static int -setifaceid(argv) - char **argv; +setifaceid(char **argv) { char *comma, *arg, c; ipv6cp_options *wo = &ipv6cp_wantoptions[0]; @@ -398,10 +393,7 @@ setifaceid(argv) char *llv6_ntoa(eui64_t ifaceid); static void -printifaceid(opt, printer, arg) - option_t *opt; - void (*printer) __P((void *, char *, ...)); - void *arg; +printifaceid(option_t *opt, void (*printer) (void *, char *, ...), void *arg) { ipv6cp_options *wo = &ipv6cp_wantoptions[0]; @@ -416,8 +408,7 @@ printifaceid(opt, printer, arg) * Make a string representation of a network address. */ char * -llv6_ntoa(ifaceid) - eui64_t ifaceid; +llv6_ntoa(eui64_t ifaceid) { static char b[64]; @@ -430,8 +421,7 @@ llv6_ntoa(ifaceid) * ipv6cp_init - Initialize IPV6CP. */ static void -ipv6cp_init(unit) - int unit; +ipv6cp_init(int unit) { fsm *f = &ipv6cp_fsm[unit]; ipv6cp_options *wo = &ipv6cp_wantoptions[unit]; @@ -467,8 +457,7 @@ ipv6cp_init(unit) * ipv6cp_open - IPV6CP is allowed to come up. */ static void -ipv6cp_open(unit) - int unit; +ipv6cp_open(int unit) { fsm_open(&ipv6cp_fsm[unit]); } @@ -478,9 +467,7 @@ ipv6cp_open(unit) * ipv6cp_close - Take IPV6CP down. */ static void -ipv6cp_close(unit, reason) - int unit; - char *reason; +ipv6cp_close(int unit, char *reason) { fsm_close(&ipv6cp_fsm[unit], reason); } @@ -490,8 +477,7 @@ ipv6cp_close(unit, reason) * ipv6cp_lowerup - The lower layer is up. */ static void -ipv6cp_lowerup(unit) - int unit; +ipv6cp_lowerup(int unit) { fsm_lowerup(&ipv6cp_fsm[unit]); } @@ -501,8 +487,7 @@ ipv6cp_lowerup(unit) * ipv6cp_lowerdown - The lower layer is down. */ static void -ipv6cp_lowerdown(unit) - int unit; +ipv6cp_lowerdown(int unit) { fsm_lowerdown(&ipv6cp_fsm[unit]); } @@ -512,10 +497,7 @@ ipv6cp_lowerdown(unit) * ipv6cp_input - Input IPV6CP packet. */ static void -ipv6cp_input(unit, p, len) - int unit; - u_char *p; - int len; +ipv6cp_input(int unit, u_char *p, int len) { fsm_input(&ipv6cp_fsm[unit], p, len); } @@ -527,8 +509,7 @@ ipv6cp_input(unit, p, len) * Pretend the lower layer went down, so we shut up. */ static void -ipv6cp_protrej(unit) - int unit; +ipv6cp_protrej(int unit) { fsm_lowerdown(&ipv6cp_fsm[unit]); } @@ -538,8 +519,7 @@ ipv6cp_protrej(unit) * ipv6cp_resetci - Reset our CI. */ static void -ipv6cp_resetci(f) - fsm *f; +ipv6cp_resetci(fsm *f) { ipv6cp_options *wo = &ipv6cp_wantoptions[f->unit]; ipv6cp_options *go = &ipv6cp_gotoptions[f->unit]; @@ -562,8 +542,7 @@ ipv6cp_resetci(f) * ipv6cp_cilen - Return length of our CI. */ static int -ipv6cp_cilen(f) - fsm *f; +ipv6cp_cilen(fsm *f) { ipv6cp_options *go = &ipv6cp_gotoptions[f->unit]; @@ -579,10 +558,7 @@ ipv6cp_cilen(f) * ipv6cp_addci - Add our desired CIs to a packet. */ static void -ipv6cp_addci(f, ucp, lenp) - fsm *f; - u_char *ucp; - int *lenp; +ipv6cp_addci(fsm *f, u_char *ucp, int *lenp) { ipv6cp_options *go = &ipv6cp_gotoptions[f->unit]; int len = *lenp; @@ -627,10 +603,7 @@ ipv6cp_addci(f, ucp, lenp) * 1 - Ack was good. */ static int -ipv6cp_ackci(f, p, len) - fsm *f; - u_char *p; - int len; +ipv6cp_ackci(fsm *f, u_char *p, int len) { ipv6cp_options *go = &ipv6cp_gotoptions[f->unit]; u_short cilen, citype, cishort; @@ -698,11 +671,7 @@ bad: * 1 - Nak was good. */ static int -ipv6cp_nakci(f, p, len, treat_as_reject) - fsm *f; - u_char *p; - int len; - int treat_as_reject; +ipv6cp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) { ipv6cp_options *go = &ipv6cp_gotoptions[f->unit]; u_char citype, cilen, *next; @@ -836,10 +805,7 @@ bad: * ipv6cp_rejci - Reject some of our CIs. */ static int -ipv6cp_rejci(f, p, len) - fsm *f; - u_char *p; - int len; +ipv6cp_rejci(fsm *f, u_char *p, int len) { ipv6cp_options *go = &ipv6cp_gotoptions[f->unit]; u_char cilen; @@ -911,11 +877,7 @@ bad: * CONFNAK; returns CONFREJ if it can't return CONFACK. */ static int -ipv6cp_reqci(f, inp, len, reject_if_disagree) - fsm *f; - u_char *inp; /* Requested CIs */ - int *len; /* Length of requested CIs */ - int reject_if_disagree; +ipv6cp_reqci(fsm *f, u_char *inp, int *len, int reject_if_disagree) { ipv6cp_options *wo = &ipv6cp_wantoptions[f->unit]; ipv6cp_options *ho = &ipv6cp_hisoptions[f->unit]; @@ -1098,7 +1060,7 @@ endswitch: * and assign appropriate defaults. */ static void -ipv6_check_options() +ipv6_check_options(void) { ipv6cp_options *wo = &ipv6cp_wantoptions[0]; @@ -1156,8 +1118,7 @@ ipv6_check_options() * IPV6CP were up, for use with dial-on-demand. */ static int -ipv6_demand_conf(u) - int u; +ipv6_demand_conf(int u) { ipv6cp_options *wo = &ipv6cp_wantoptions[u]; @@ -1189,8 +1150,7 @@ ipv6_demand_conf(u) * Configure the IPv6 network interface appropriately and bring it up. */ static void -ipv6cp_up(f) - fsm *f; +ipv6cp_up(fsm *f) { ipv6cp_options *ho = &ipv6cp_hisoptions[f->unit]; ipv6cp_options *go = &ipv6cp_gotoptions[f->unit]; @@ -1312,8 +1272,7 @@ ipv6cp_up(f) * and delete routes through it. */ static void -ipv6cp_down(f) - fsm *f; +ipv6cp_down(fsm *f) { IPV6CPDEBUG(("ipv6cp: down")); update_link_stats(f->unit); @@ -1362,10 +1321,7 @@ ipv6cp_down(f) * proxy neighbour discovery entries, etc. */ static void -ipv6cp_clear_addrs(unit, ourid, hisid) - int unit; - eui64_t ourid; - eui64_t hisid; +ipv6cp_clear_addrs(int unit, eui64_t ourid, eui64_t hisid) { cif6addr(unit, ourid, hisid); } @@ -1375,8 +1331,7 @@ ipv6cp_clear_addrs(unit, ourid, hisid) * ipv6cp_finished - possibly shut down the lower layers. */ static void -ipv6cp_finished(f) - fsm *f; +ipv6cp_finished(fsm *f) { np_finished(f->unit, PPP_IPV6); } @@ -1387,8 +1342,7 @@ ipv6cp_finished(f) * has finished. */ static void -ipv6cp_script_done(arg) - void *arg; +ipv6cp_script_done(void *arg) { ipv6cp_script_pid = 0; switch (ipv6cp_script_state) { @@ -1413,8 +1367,7 @@ ipv6cp_script_done(arg) * interface-name tty-name speed local-LL remote-LL. */ static void -ipv6cp_script(script) - char *script; +ipv6cp_script(char *script) { char strspeed[32], strlocal[32], strremote[32]; char *argv[8]; @@ -1445,11 +1398,8 @@ static char *ipv6cp_codenames[] = { }; static int -ipv6cp_printpkt(p, plen, printer, arg) - u_char *p; - int plen; - void (*printer) __P((void *, char *, ...)); - void *arg; +ipv6cp_printpkt(u_char *p, int plen, + void (*printer) (void *, char *, ...), void *arg) { int code, id, len, olen; u_char *pstart, *optend; @@ -1552,9 +1502,7 @@ ipv6cp_printpkt(p, plen, printer, arg) #define get_tcpflags(x) (((unsigned char *)(x))[13]) static int -ipv6_active_pkt(pkt, len) - u_char *pkt; - int len; +ipv6_active_pkt(u_char *pkt, int len) { u_char *tcp; diff --git a/pppd/ipv6cp.h b/pppd/ipv6cp.h index 3eb7b2a..19bc013 100644 --- a/pppd/ipv6cp.h +++ b/pppd/ipv6cp.h @@ -134,8 +134,6 @@ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * $Id: ipv6cp.h,v 1.7 2002/12/04 23:03:32 paulus Exp $ */ /* diff --git a/pppd/ipxcp.c b/pppd/ipxcp.c index 04605b1..d39b14c 100644 --- a/pppd/ipxcp.c +++ b/pppd/ipxcp.c @@ -42,8 +42,6 @@ #ifdef IPX_CHANGE -#define RCSID "$Id: ipxcp.c,v 1.24 2005/08/25 23:59:34 paulus Exp $" - /* * TODO: */ @@ -77,17 +75,17 @@ ipxcp_options ipxcp_hisoptions[NUM_PPP]; /* Options that we ack'd */ /* * Callbacks for fsm code. (CI = Configuration Information) */ -static void ipxcp_resetci __P((fsm *)); /* Reset our CI */ -static int ipxcp_cilen __P((fsm *)); /* Return length of our CI */ -static void ipxcp_addci __P((fsm *, u_char *, int *)); /* Add our CI */ -static int ipxcp_ackci __P((fsm *, u_char *, int)); /* Peer ack'd our CI */ -static int ipxcp_nakci __P((fsm *, u_char *, int, int));/* Peer nak'd our CI */ -static int ipxcp_rejci __P((fsm *, u_char *, int)); /* Peer rej'd our CI */ -static int ipxcp_reqci __P((fsm *, u_char *, int *, int)); /* Rcv CI */ -static void ipxcp_up __P((fsm *)); /* We're UP */ -static void ipxcp_down __P((fsm *)); /* We're DOWN */ -static void ipxcp_finished __P((fsm *)); /* Don't need lower layer */ -static void ipxcp_script __P((fsm *, char *)); /* Run an up/down script */ +static void ipxcp_resetci (fsm *); /* Reset our CI */ +static int ipxcp_cilen (fsm *); /* Return length of our CI */ +static void ipxcp_addci (fsm *, u_char *, int *); /* Add our CI */ +static int ipxcp_ackci (fsm *, u_char *, int); /* Peer ack'd our CI */ +static int ipxcp_nakci (fsm *, u_char *, int, int);/* Peer nak'd our CI */ +static int ipxcp_rejci (fsm *, u_char *, int); /* Peer rej'd our CI */ +static int ipxcp_reqci (fsm *, u_char *, int *, int); /* Rcv CI */ +static void ipxcp_up (fsm *); /* We're UP */ +static void ipxcp_down (fsm *); /* We're DOWN */ +static void ipxcp_finished (fsm *); /* Don't need lower layer */ +static void ipxcp_script (fsm *, char *); /* Run an up/down script */ fsm ipxcp_fsm[NUM_PPP]; /* IPXCP fsm structure */ @@ -112,10 +110,10 @@ static fsm_callbacks ipxcp_callbacks = { /* IPXCP callback routines */ /* * Command-line options. */ -static int setipxnode __P((char **)); -static void printipxnode __P((option_t *, - void (*)(void *, char *, ...), void *)); -static int setipxname __P((char **)); +static int setipxnode (char **); +static void printipxnode (option_t *, + void (*)(void *, char *, ...), void *); +static int setipxname (char **); static option_t ipxcp_option_list[] = { { "ipx", o_bool, &ipxcp_protent.enabled_flag, @@ -169,15 +167,15 @@ static option_t ipxcp_option_list[] = { * Protocol entry points. */ -static void ipxcp_init __P((int)); -static void ipxcp_open __P((int)); -static void ipxcp_close __P((int, char *)); -static void ipxcp_lowerup __P((int)); -static void ipxcp_lowerdown __P((int)); -static void ipxcp_input __P((int, u_char *, int)); -static void ipxcp_protrej __P((int)); -static int ipxcp_printpkt __P((u_char *, int, - void (*) __P((void *, char *, ...)), void *)); +static void ipxcp_init (int); +static void ipxcp_open (int); +static void ipxcp_close (int, char *); +static void ipxcp_lowerup (int); +static void ipxcp_lowerdown (int); +static void ipxcp_input (int, u_char *, int); +static void ipxcp_protrej (int); +static int ipxcp_printpkt (u_char *, int, + void (*) (void *, char *, ...), void *); struct protent ipxcp_protent = { PPP_IPXCP, @@ -216,7 +214,7 @@ struct protent ipxcp_protent = { static int ipxcp_is_up; -static char *ipx_ntoa __P((u_int32_t)); +static char *ipx_ntoa (u_int32_t); /* Used in printing the node number */ #define NODE(base) base[0], base[1], base[2], base[3], base[4], base[5] @@ -229,8 +227,7 @@ static char *ipx_ntoa __P((u_int32_t)); */ static short int -to_external(internal) -short int internal; +to_external(short int internal) { short int external; @@ -247,8 +244,7 @@ short int internal; */ static char * -ipx_ntoa(ipxaddr) -u_int32_t ipxaddr; +ipx_ntoa(u_int32_t ipxaddr) { static char b[64]; slprintf(b, sizeof(b), "%x", ipxaddr); @@ -257,8 +253,7 @@ u_int32_t ipxaddr; static u_char * -setipxnodevalue(src,dst) -u_char *src, *dst; +setipxnodevalue(u_char *src, u_char *dst) { int indx; int item; @@ -285,8 +280,7 @@ u_char *src, *dst; static int ipx_prio_our, ipx_prio_his; static int -setipxnode(argv) - char **argv; +setipxnode(char **argv) { u_char *end; int have_his = 0; @@ -296,7 +290,7 @@ setipxnode(argv) memset (our_node, 0, 6); memset (his_node, 0, 6); - end = setipxnodevalue (*argv, our_node); + end = setipxnodevalue ((u_char *)*argv, our_node); if (*end == ':') { have_his = 1; end = setipxnodevalue (++end, his_node); @@ -320,10 +314,7 @@ setipxnode(argv) } static void -printipxnode(opt, printer, arg) - option_t *opt; - void (*printer) __P((void *, char *, ...)); - void *arg; +printipxnode(option_t *opt, void (*printer) (void *, char *, ...), void *arg) { unsigned char *p; @@ -339,8 +330,7 @@ printipxnode(opt, printer, arg) } static int -setipxname (argv) - char **argv; +setipxname (char **argv) { u_char *dest = ipxcp_wantoptions[0].name; char *src = *argv; @@ -376,8 +366,7 @@ setipxname (argv) * ipxcp_init - Initialize IPXCP. */ static void -ipxcp_init(unit) - int unit; +ipxcp_init(int unit) { fsm *f = &ipxcp_fsm[unit]; @@ -413,8 +402,7 @@ ipxcp_init(unit) */ static void -copy_node (src, dst) -u_char *src, *dst; +copy_node (u_char *src, u_char *dst) { memcpy (dst, src, sizeof (ipxcp_wantoptions[0].our_node)); } @@ -424,8 +412,7 @@ u_char *src, *dst; */ static int -compare_node (src, dst) -u_char *src, *dst; +compare_node (u_char *src, u_char *dst) { return memcmp (dst, src, sizeof (ipxcp_wantoptions[0].our_node)) == 0; } @@ -435,8 +422,7 @@ u_char *src, *dst; */ static int -zero_node (node) -u_char *node; +zero_node (u_char *node) { int indx; for (indx = 0; indx < sizeof (ipxcp_wantoptions[0].our_node); ++indx) @@ -450,8 +436,7 @@ u_char *node; */ static void -inc_node (node) -u_char *node; +inc_node (u_char *node) { u_char *outp; u_int32_t magic_num; @@ -467,8 +452,7 @@ u_char *node; * ipxcp_open - IPXCP is allowed to come up. */ static void -ipxcp_open(unit) - int unit; +ipxcp_open(int unit) { fsm_open(&ipxcp_fsm[unit]); } @@ -477,9 +461,7 @@ ipxcp_open(unit) * ipxcp_close - Take IPXCP down. */ static void -ipxcp_close(unit, reason) - int unit; - char *reason; +ipxcp_close(int unit, char *reason) { fsm_close(&ipxcp_fsm[unit], reason); } @@ -489,8 +471,7 @@ ipxcp_close(unit, reason) * ipxcp_lowerup - The lower layer is up. */ static void -ipxcp_lowerup(unit) - int unit; +ipxcp_lowerup(int unit) { fsm_lowerup(&ipxcp_fsm[unit]); } @@ -500,8 +481,7 @@ ipxcp_lowerup(unit) * ipxcp_lowerdown - The lower layer is down. */ static void -ipxcp_lowerdown(unit) - int unit; +ipxcp_lowerdown(int unit) { fsm_lowerdown(&ipxcp_fsm[unit]); } @@ -511,10 +491,7 @@ ipxcp_lowerdown(unit) * ipxcp_input - Input IPXCP packet. */ static void -ipxcp_input(unit, p, len) - int unit; - u_char *p; - int len; +ipxcp_input(int unit, u_char *p, int len) { fsm_input(&ipxcp_fsm[unit], p, len); } @@ -526,8 +503,7 @@ ipxcp_input(unit, p, len) * Pretend the lower layer went down, so we shut up. */ static void -ipxcp_protrej(unit) - int unit; +ipxcp_protrej(int unit) { fsm_lowerdown(&ipxcp_fsm[unit]); } @@ -537,8 +513,7 @@ ipxcp_protrej(unit) * ipxcp_resetci - Reset our CI. */ static void -ipxcp_resetci(f) - fsm *f; +ipxcp_resetci(fsm *f) { wo->req_node = wo->neg_node && ao->neg_node; wo->req_nn = wo->neg_nn && ao->neg_nn; @@ -585,8 +560,7 @@ ipxcp_resetci(f) */ static int -ipxcp_cilen(f) - fsm *f; +ipxcp_cilen(fsm *f) { int len; @@ -606,10 +580,7 @@ ipxcp_cilen(f) * ipxcp_addci - Add our desired CIs to a packet. */ static void -ipxcp_addci(f, ucp, lenp) - fsm *f; - u_char *ucp; - int *lenp; +ipxcp_addci(fsm *f, u_char *ucp, int *lenp) { /* * Add the options to the record. @@ -655,10 +626,7 @@ ipxcp_addci(f, ucp, lenp) * 1 - Ack was good. */ static int -ipxcp_ackci(f, p, len) - fsm *f; - u_char *p; - int len; +ipxcp_ackci(fsm *f, u_char *p, int len) { u_short cilen, citype, cishort; u_char cichar; @@ -762,11 +730,7 @@ ipxcp_ackci(f, p, len) */ static int -ipxcp_nakci(f, p, len, treat_as_reject) - fsm *f; - u_char *p; - int len; - int treat_as_reject; +ipxcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) { u_char citype, cilen, *next; u_short s; @@ -875,10 +839,7 @@ bad: * ipxcp_rejci - Reject some of our CIs. */ static int -ipxcp_rejci(f, p, len) - fsm *f; - u_char *p; - int len; +ipxcp_rejci(fsm *f, u_char *p, int len) { u_short cilen, citype, cishort; u_char cichar; @@ -986,11 +947,7 @@ ipxcp_rejci(f, p, len) * CONFNAK; returns CONFREJ if it can't return CONFACK. */ static int -ipxcp_reqci(f, inp, len, reject_if_disagree) - fsm *f; - u_char *inp; /* Requested CIs */ - int *len; /* Length of requested CIs */ - int reject_if_disagree; +ipxcp_reqci(fsm *f, u_char *inp, int *len, int reject_if_disagree) { u_char *cip, *next; /* Pointer to current and next CIs */ u_short cilen, citype; /* Parsed len, type */ @@ -1289,8 +1246,7 @@ endswitch: */ static void -ipxcp_up(f) - fsm *f; +ipxcp_up(fsm *f) { int unit = f->unit; @@ -1368,8 +1324,7 @@ ipxcp_up(f) */ static void -ipxcp_down(f) - fsm *f; +ipxcp_down(fsm *f) { IPXCPDEBUG(("ipxcp: down")); @@ -1388,8 +1343,7 @@ ipxcp_down(f) * ipxcp_finished - possibly shut down the lower layers. */ static void -ipxcp_finished(f) - fsm *f; +ipxcp_finished(fsm *f) { np_finished(f->unit, PPP_IPX); } @@ -1400,9 +1354,7 @@ ipxcp_finished(f) * interface-name tty-name speed local-IPX remote-IPX networks. */ static void -ipxcp_script(f, script) - fsm *f; - char *script; +ipxcp_script(fsm *f, char *script) { char strspeed[32], strlocal[32], strremote[32]; char strnetwork[32], strpid[32]; @@ -1469,11 +1421,8 @@ static char *ipxcp_codenames[] = { }; static int -ipxcp_printpkt(p, plen, printer, arg) - u_char *p; - int plen; - void (*printer) __P((void *, char *, ...)); - void *arg; +ipxcp_printpkt(u_char *p, int plen, + void (*printer) (void *, char *, ...), void *arg) { int code, id, len, olen; u_char *pstart, *optend; diff --git a/pppd/ipxcp.h b/pppd/ipxcp.h index 396b6bb..8a69232 100644 --- a/pppd/ipxcp.h +++ b/pppd/ipxcp.h @@ -38,8 +38,6 @@ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * $Id: ipxcp.h,v 1.5 2002/12/04 23:03:32 paulus Exp $ */ /* diff --git a/pppd/lcp.c b/pppd/lcp.c index d7ea471..ac5d5ce 100644 --- a/pppd/lcp.c +++ b/pppd/lcp.c @@ -40,12 +40,6 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: lcp.c,v 1.76 2006/05/22 00:04:07 paulus Exp $" - -/* - * TODO: - */ - #include #include #include @@ -65,7 +59,7 @@ /* steal a bit in fsm flags word */ #define DELAYED_UP 0x100 -static void lcp_delayed_up __P((void *)); +static void lcp_delayed_up(void *); /* * LCP-related command-line options. @@ -76,12 +70,11 @@ bool lcp_echo_adaptive = 0; /* request echo only if the link was idle */ bool lax_recv = 0; /* accept control chars in asyncmap */ bool noendpoint = 0; /* don't send/accept endpoint discriminator */ -static int noopt __P((char **)); +static int noopt(char **); #ifdef HAVE_MULTILINK -static int setendpoint __P((char **)); -static void printendpoint __P((option_t *, void (*)(void *, char *, ...), - void *)); +static int setendpoint(char **); +static void printendpoint(option_t *, void (*)(void *, char *, ...), void *); #endif /* HAVE_MULTILINK */ static option_t lcp_option_list[] = { @@ -204,31 +197,31 @@ static u_char nak_buffer[PPP_MRU]; /* where we construct a nak packet */ /* * Callbacks for fsm code. (CI = Configuration Information) */ -static void lcp_resetci __P((fsm *)); /* Reset our CI */ -static int lcp_cilen __P((fsm *)); /* Return length of our CI */ -static void lcp_addci __P((fsm *, u_char *, int *)); /* Add our CI to pkt */ -static int lcp_ackci __P((fsm *, u_char *, int)); /* Peer ack'd our CI */ -static int lcp_nakci __P((fsm *, u_char *, int, int)); /* Peer nak'd our CI */ -static int lcp_rejci __P((fsm *, u_char *, int)); /* Peer rej'd our CI */ -static int lcp_reqci __P((fsm *, u_char *, int *, int)); /* Rcv peer CI */ -static void lcp_up __P((fsm *)); /* We're UP */ -static void lcp_down __P((fsm *)); /* We're DOWN */ -static void lcp_starting __P((fsm *)); /* We need lower layer up */ -static void lcp_finished __P((fsm *)); /* We need lower layer down */ -static int lcp_extcode __P((fsm *, int, int, u_char *, int)); -static void lcp_rprotrej __P((fsm *, u_char *, int)); +static void lcp_resetci(fsm *); /* Reset our CI */ +static int lcp_cilen(fsm *); /* Return length of our CI */ +static void lcp_addci(fsm *, u_char *, int *); /* Add our CI to pkt */ +static int lcp_ackci(fsm *, u_char *, int); /* Peer ack'd our CI */ +static int lcp_nakci(fsm *, u_char *, int, int); /* Peer nak'd our CI */ +static int lcp_rejci(fsm *, u_char *, int); /* Peer rej'd our CI */ +static int lcp_reqci(fsm *, u_char *, int *, int); /* Rcv peer CI */ +static void lcp_up(fsm *); /* We're UP */ +static void lcp_down(fsm *); /* We're DOWN */ +static void lcp_starting(fsm *); /* We need lower layer up */ +static void lcp_finished(fsm *); /* We need lower layer down */ +static int lcp_extcode(fsm *, int, int, u_char *, int); +static void lcp_rprotrej(fsm *, u_char *, int); /* * routines to send LCP echos to peer */ -static void lcp_echo_lowerup __P((int)); -static void lcp_echo_lowerdown __P((int)); -static void LcpEchoTimeout __P((void *)); -static void lcp_received_echo_reply __P((fsm *, int, u_char *, int)); -static void LcpSendEchoRequest __P((fsm *)); -static void LcpLinkFailure __P((fsm *)); -static void LcpEchoCheck __P((fsm *)); +static void lcp_echo_lowerup(int); +static void lcp_echo_lowerdown(int); +static void LcpEchoTimeout(void *); +static void lcp_received_echo_reply(fsm *, int, u_char *, int); +static void LcpSendEchoRequest(fsm *); +static void LcpLinkFailure(fsm *); +static void LcpEchoCheck(fsm *); static fsm_callbacks lcp_callbacks = { /* LCP callback routines */ lcp_resetci, /* Reset our Configuration Information */ @@ -253,11 +246,10 @@ static fsm_callbacks lcp_callbacks = { /* LCP callback routines */ * Some of these are called directly. */ -static void lcp_init __P((int)); -static void lcp_input __P((int, u_char *, int)); -static void lcp_protrej __P((int)); -static int lcp_printpkt __P((u_char *, int, - void (*) __P((void *, char *, ...)), void *)); +static void lcp_init(int); +static void lcp_input(int, u_char *, int); +static void lcp_protrej(int); +static int lcp_printpkt(u_char *, int, void (*)(void *, char *, ...), void *); struct protent lcp_protent = { PPP_LCP, @@ -299,8 +291,7 @@ int lcp_loopbackfail = DEFLOOPBACKFAIL; * noopt - Disable all options (why?). */ static int -noopt(argv) - char **argv; +noopt(char **argv) { BZERO((char *) &lcp_wantoptions[0], sizeof (struct lcp_options)); BZERO((char *) &lcp_allowoptions[0], sizeof (struct lcp_options)); @@ -310,8 +301,7 @@ noopt(argv) #ifdef HAVE_MULTILINK static int -setendpoint(argv) - char **argv; +setendpoint(char **argv) { if (str_to_epdisc(&lcp_wantoptions[0].endpoint, *argv)) { lcp_wantoptions[0].neg_endpoint = 1; @@ -322,10 +312,7 @@ setendpoint(argv) } static void -printendpoint(opt, printer, arg) - option_t *opt; - void (*printer) __P((void *, char *, ...)); - void *arg; +printendpoint(option_t *opt, void (*printer)(void *, char *, ...), void *arg) { printer(arg, "%s", epdisc_to_str(&lcp_wantoptions[0].endpoint)); } @@ -335,8 +322,7 @@ printendpoint(opt, printer, arg) * lcp_init - Initialize LCP. */ static void -lcp_init(unit) - int unit; +lcp_init(int unit) { fsm *f = &lcp_fsm[unit]; lcp_options *wo = &lcp_wantoptions[unit]; @@ -375,8 +361,7 @@ lcp_init(unit) * lcp_open - LCP is allowed to come up. */ void -lcp_open(unit) - int unit; +lcp_open(int unit) { fsm *f = &lcp_fsm[unit]; lcp_options *wo = &lcp_wantoptions[unit]; @@ -394,9 +379,7 @@ lcp_open(unit) * lcp_close - Take LCP down. */ void -lcp_close(unit, reason) - int unit; - char *reason; +lcp_close(int unit, char *reason) { fsm *f = &lcp_fsm[unit]; int oldstate; @@ -429,8 +412,7 @@ lcp_close(unit, reason) * lcp_lowerup - The lower layer is up. */ void -lcp_lowerup(unit) - int unit; +lcp_lowerup(int unit) { lcp_options *wo = &lcp_wantoptions[unit]; fsm *f = &lcp_fsm[unit]; @@ -458,8 +440,7 @@ lcp_lowerup(unit) * lcp_lowerdown - The lower layer is down. */ void -lcp_lowerdown(unit) - int unit; +lcp_lowerdown(int unit) { fsm *f = &lcp_fsm[unit]; @@ -475,8 +456,7 @@ lcp_lowerdown(unit) * lcp_delayed_up - Bring the lower layer up now. */ static void -lcp_delayed_up(arg) - void *arg; +lcp_delayed_up(void *arg) { fsm *f = arg; @@ -491,10 +471,7 @@ lcp_delayed_up(arg) * lcp_input - Input LCP packet. */ static void -lcp_input(unit, p, len) - int unit; - u_char *p; - int len; +lcp_input(int unit, u_char *p, int len) { fsm *f = &lcp_fsm[unit]; @@ -510,11 +487,7 @@ lcp_input(unit, p, len) * lcp_extcode - Handle a LCP-specific code. */ static int -lcp_extcode(f, code, id, inp, len) - fsm *f; - int code, id; - u_char *inp; - int len; +lcp_extcode(fsm *f, int code, int id, u_char *inp, int len) { u_char *magp; @@ -553,10 +526,7 @@ lcp_extcode(f, code, id, inp, len) * Figure out which protocol is rejected and inform it. */ static void -lcp_rprotrej(f, inp, len) - fsm *f; - u_char *inp; - int len; +lcp_rprotrej(fsm *f, u_char *inp, int len) { int i; struct protent *protp; @@ -608,8 +578,7 @@ lcp_rprotrej(f, inp, len) */ /*ARGSUSED*/ static void -lcp_protrej(unit) - int unit; +lcp_protrej(int unit) { /* * Can't reject LCP! @@ -623,10 +592,7 @@ lcp_protrej(unit) * lcp_sprotrej - Send a Protocol-Reject for some protocol. */ void -lcp_sprotrej(unit, p, len) - int unit; - u_char *p; - int len; +lcp_sprotrej(int unit, u_char *p, int len) { /* * Send back the protocol and the information field of the @@ -644,8 +610,7 @@ lcp_sprotrej(unit, p, len) * lcp_resetci - Reset our CI. */ static void -lcp_resetci(f) - fsm *f; +lcp_resetci(fsm *f) { lcp_options *wo = &lcp_wantoptions[f->unit]; lcp_options *go = &lcp_gotoptions[f->unit]; @@ -670,8 +635,7 @@ lcp_resetci(f) * lcp_cilen - Return length of our CI. */ static int -lcp_cilen(f) - fsm *f; +lcp_cilen(fsm *f) { lcp_options *go = &lcp_gotoptions[f->unit]; @@ -706,10 +670,7 @@ lcp_cilen(f) * lcp_addci - Add our desired CIs to a packet. */ static void -lcp_addci(f, ucp, lenp) - fsm *f; - u_char *ucp; - int *lenp; +lcp_addci(fsm *f, u_char *ucp, int *lenp) { lcp_options *go = &lcp_gotoptions[f->unit]; u_char *start_ucp = ucp; @@ -794,10 +755,7 @@ lcp_addci(f, ucp, lenp) * 1 - Ack was good. */ static int -lcp_ackci(f, p, len) - fsm *f; - u_char *p; - int len; +lcp_ackci(fsm *f, u_char *p, int len) { lcp_options *go = &lcp_gotoptions[f->unit]; u_char cilen, citype, cichar; @@ -949,11 +907,7 @@ bad: * 1 - Nak was good. */ static int -lcp_nakci(f, p, len, treat_as_reject) - fsm *f; - u_char *p; - int len; - int treat_as_reject; +lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) { lcp_options *go = &lcp_gotoptions[f->unit]; lcp_options *wo = &lcp_wantoptions[f->unit]; @@ -1343,10 +1297,7 @@ bad: * 1 - Reject was good. */ static int -lcp_rejci(f, p, len) - fsm *f; - u_char *p; - int len; +lcp_rejci(fsm *f, u_char *p, int len) { lcp_options *go = &lcp_gotoptions[f->unit]; u_char cichar; @@ -1502,11 +1453,7 @@ bad: * CONFNAK; returns CONFREJ if it can't return CONFACK. */ static int -lcp_reqci(f, inp, lenp, reject_if_disagree) - fsm *f; - u_char *inp; /* Requested CIs */ - int *lenp; /* Length of requested CIs */ - int reject_if_disagree; +lcp_reqci(fsm *f, u_char *inp, int *lenp, int reject_if_disagree) { lcp_options *go = &lcp_gotoptions[f->unit]; lcp_options *ho = &lcp_hisoptions[f->unit]; @@ -1893,8 +1840,7 @@ endswitch: * lcp_up - LCP has come UP. */ static void -lcp_up(f) - fsm *f; +lcp_up(fsm *f) { lcp_options *wo = &lcp_wantoptions[f->unit]; lcp_options *ho = &lcp_hisoptions[f->unit]; @@ -1944,8 +1890,7 @@ lcp_up(f) * Alert other protocols. */ static void -lcp_down(f) - fsm *f; +lcp_down(fsm *f) { lcp_options *go = &lcp_gotoptions[f->unit]; @@ -1965,8 +1910,7 @@ lcp_down(f) * lcp_starting - LCP needs the lower layer up. */ static void -lcp_starting(f) - fsm *f; +lcp_starting(fsm *f) { link_required(f->unit); } @@ -1976,8 +1920,7 @@ lcp_starting(f) * lcp_finished - LCP has finished with the lower layer. */ static void -lcp_finished(f) - fsm *f; +lcp_finished(fsm *f) { link_terminated(f->unit); } @@ -1994,11 +1937,7 @@ static char *lcp_codenames[] = { }; static int -lcp_printpkt(p, plen, printer, arg) - u_char *p; - int plen; - void (*printer) __P((void *, char *, ...)); - void *arg; +lcp_printpkt(u_char *p, int plen, void (*printer)(void *, char *, ...), void *arg) { int code, id, len, olen, i; u_char *pstart, *optend; @@ -2237,8 +2176,7 @@ lcp_printpkt(p, plen, printer, arg) */ static -void LcpLinkFailure (f) - fsm *f; +void LcpLinkFailure (fsm *f) { if (f->state == OPENED) { info("No response to %d echo-requests", lcp_echos_pending); @@ -2253,8 +2191,7 @@ void LcpLinkFailure (f) */ static void -LcpEchoCheck (f) - fsm *f; +LcpEchoCheck (fsm *f) { LcpSendEchoRequest (f); if (f->state != OPENED) @@ -2274,8 +2211,7 @@ LcpEchoCheck (f) */ static void -LcpEchoTimeout (arg) - void *arg; +LcpEchoTimeout (void *arg) { if (lcp_echo_timer_running != 0) { lcp_echo_timer_running = 0; @@ -2288,11 +2224,7 @@ LcpEchoTimeout (arg) */ static void -lcp_received_echo_reply (f, id, inp, len) - fsm *f; - int id; - u_char *inp; - int len; +lcp_received_echo_reply (fsm *f, int id, u_char *inp, int len) { u_int32_t magic; @@ -2317,8 +2249,7 @@ lcp_received_echo_reply (f, id, inp, len) */ static void -LcpSendEchoRequest (f) - fsm *f; +LcpSendEchoRequest (fsm *f) { u_int32_t lcp_magic; u_char pkt[4], *pktp; @@ -2364,8 +2295,7 @@ LcpSendEchoRequest (f) */ static void -lcp_echo_lowerup (unit) - int unit; +lcp_echo_lowerup (int unit) { fsm *f = &lcp_fsm[unit]; @@ -2384,8 +2314,7 @@ lcp_echo_lowerup (unit) */ static void -lcp_echo_lowerdown (unit) - int unit; +lcp_echo_lowerdown (int unit) { fsm *f = &lcp_fsm[unit]; diff --git a/pppd/lcp.h b/pppd/lcp.h index d5f8aee..984f868 100644 --- a/pppd/lcp.h +++ b/pppd/lcp.h @@ -38,8 +38,6 @@ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * $Id: lcp.h,v 1.20 2004/11/14 22:53:42 carlsonj Exp $ */ /* @@ -122,11 +120,11 @@ extern lcp_options lcp_hisoptions[]; #define MINMRU 128 /* No MRUs below this */ #define MAXMRU 16384 /* Normally limit MRU to this */ -void lcp_open __P((int)); -void lcp_close __P((int, char *)); -void lcp_lowerup __P((int)); -void lcp_lowerdown __P((int)); -void lcp_sprotrej __P((int, u_char *, int)); /* send protocol reject */ +void lcp_open(int); +void lcp_close(int, char *); +void lcp_lowerup(int); +void lcp_lowerdown(int); +void lcp_sprotrej(int, u_char *, int); /* send protocol reject */ extern struct protent lcp_protent; diff --git a/pppd/magic.c b/pppd/magic.c index e8bb71f..8e08e47 100644 --- a/pppd/magic.c +++ b/pppd/magic.c @@ -40,8 +40,6 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: magic.c,v 1.11 2003/06/11 23:56:26 paulus Exp $" - #include #include #include diff --git a/pppd/magic.h b/pppd/magic.h index 9d399e3..d6094db 100644 --- a/pppd/magic.h +++ b/pppd/magic.h @@ -38,8 +38,6 @@ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * $Id: magic.h,v 1.5 2003/06/11 23:56:26 paulus Exp $ */ void magic_init (void); /* Initialize the magic number generator */ diff --git a/pppd/main.c b/pppd/main.c index c18ea51..099c050 100644 --- a/pppd/main.c +++ b/pppd/main.c @@ -39,7 +39,7 @@ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * Copyright (c) 1999-2004 Paul Mackerras. All rights reserved. + * Copyright (c) 1999-2020 Paul Mackerras. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -66,8 +66,6 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: main.c,v 1.156 2008/06/23 11:47:18 paulus Exp $" - #include #include #include @@ -157,10 +155,10 @@ TDB_CONTEXT *pppdb; /* database for storing status etc. */ char db_key[32]; -int (*holdoff_hook) __P((void)) = NULL; -int (*new_phase_hook) __P((int)) = NULL; -void (*snoop_recv_hook) __P((unsigned char *p, int len)) = NULL; -void (*snoop_send_hook) __P((unsigned char *p, int len)) = NULL; +int (*holdoff_hook)(void) = NULL; +int (*new_phase_hook)(int) = NULL; +void (*snoop_recv_hook)(unsigned char *p, int len) = NULL; +void (*snoop_send_hook)(unsigned char *p, int len) = NULL; static int conn_running; /* we have a [dis]connector running */ static int fd_loop; /* fd for getting demand-dial packets */ @@ -216,7 +214,7 @@ bool bundle_terminating; struct subprocess { pid_t pid; char *prog; - void (*done) __P((void *)); + void (*done)(void *); void *arg; int killable; struct subprocess *next; @@ -226,46 +224,37 @@ static struct subprocess *children; /* Prototypes for procedures local to this file. */ -static void setup_signals __P((void)); -static void create_pidfile __P((int pid)); -static void create_linkpidfile __P((int pid)); -static void cleanup __P((void)); -static void get_input __P((void)); -static void calltimeout __P((void)); -static struct timeval *timeleft __P((struct timeval *)); -static void kill_my_pg __P((int)); -static void hup __P((int)); -static void term __P((int)); -static void chld __P((int)); -static void toggle_debug __P((int)); -static void open_ccp __P((int)); -static void bad_signal __P((int)); -static void holdoff_end __P((void *)); -static void forget_child __P((int pid, int status)); -static int reap_kids __P((void)); -static void childwait_end __P((void *)); +static void setup_signals(void); +static void create_pidfile(int pid); +static void create_linkpidfile(int pid); +static void cleanup(void); +static void get_input(void); +static void calltimeout(void); +static struct timeval *timeleft(struct timeval *); +static void kill_my_pg(int); +static void hup(int); +static void term(int); +static void chld(int); +static void toggle_debug(int); +static void open_ccp(int); +static void bad_signal(int); +static void holdoff_end(void *); +static void forget_child(int pid, int status); +static int reap_kids(void); +static void childwait_end(void *); #ifdef USE_TDB -static void update_db_entry __P((void)); -static void add_db_key __P((const char *)); -static void delete_db_key __P((const char *)); -static void cleanup_db __P((void)); +static void update_db_entry(void); +static void add_db_key(const char *); +static void delete_db_key(const char *); +static void cleanup_db(void); #endif -static void handle_events __P((void)); -void print_link_stats __P((void)); - -extern char *getlogin __P((void)); -int main __P((int, char *[])); +static void handle_events(void); +void print_link_stats(void); -#ifdef ultrix -#undef O_NONBLOCK -#define O_NONBLOCK O_NDELAY -#endif - -#ifdef ULTRIX -#define setlogmask(x) -#endif +extern char *getlogin(void); +int main(int, char *[]); /* * PPP Data Link Layer "protocol" table. @@ -296,9 +285,7 @@ struct protent *protocols[] = { }; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int i, t; char *p; @@ -594,7 +581,7 @@ main(argc, argv) * handle_events - wait for something to happen and respond to it. */ static void -handle_events() +handle_events(void) { struct timeval timo; unsigned char buf[16]; @@ -642,7 +629,7 @@ handle_events() * setup_signals - initialize signal handling. */ static void -setup_signals() +setup_signals(void) { struct sigaction sa; @@ -734,8 +721,7 @@ setup_signals() * unit we are using. */ void -set_ifunit(iskey) - int iskey; +set_ifunit(int iskey) { char ifkey[32]; @@ -757,7 +743,7 @@ set_ifunit(iskey) * detach - detach us from the controlling terminal. */ void -detach() +detach(void) { int pid; char numbuf[16]; @@ -802,7 +788,7 @@ detach() * reopen_log - (re)open our connection to syslog. */ void -reopen_log() +reopen_log(void) { openlog("pppd", LOG_PID | LOG_NDELAY, LOG_PPP); setlogmask(LOG_UPTO(LOG_INFO)); @@ -812,8 +798,7 @@ reopen_log() * Create a file containing our process ID. */ static void -create_pidfile(pid) - int pid; +create_pidfile(int pid) { FILE *pidfile; @@ -829,8 +814,7 @@ create_pidfile(pid) } void -create_linkpidfile(pid) - int pid; +create_linkpidfile(int pid) { FILE *pidfile; @@ -853,7 +837,7 @@ create_linkpidfile(pid) /* * remove_pidfile - remove our pid files */ -void remove_pidfiles() +void remove_pidfiles(void) { if (pidfilename[0] != 0 && unlink(pidfilename) < 0 && errno != ENOENT) warn("unable to delete pid file %s: %m", pidfilename); @@ -867,8 +851,7 @@ void remove_pidfiles() * holdoff_end - called via a timeout when the holdoff period ends. */ static void -holdoff_end(arg) - void *arg; +holdoff_end(void *arg) { new_phase(PHASE_DORMANT); } @@ -1012,8 +995,7 @@ struct protocol_list { * protocol_name - find a name for a PPP protocol. */ const char * -protocol_name(proto) - int proto; +protocol_name(int proto) { struct protocol_list *lp; @@ -1027,7 +1009,7 @@ protocol_name(proto) * get_input - called when incoming data is available. */ static void -get_input() +get_input(void) { int len, i; u_char *p; @@ -1119,10 +1101,7 @@ get_input() * itself), otherwise 0. */ int -ppp_send_config(unit, mtu, accm, pcomp, accomp) - int unit, mtu; - u_int32_t accm; - int pcomp, accomp; +ppp_send_config(int unit, int mtu, u_int32_t accm, int pcomp, int accomp) { int errs; @@ -1140,10 +1119,7 @@ ppp_send_config(unit, mtu, accm, pcomp, accomp) * itself), otherwise 0. */ int -ppp_recv_config(unit, mru, accm, pcomp, accomp) - int unit, mru; - u_int32_t accm; - int pcomp, accomp; +ppp_recv_config(int unit, int mru, u_int32_t accm, int pcomp, int accomp) { int errs; @@ -1158,8 +1134,7 @@ ppp_recv_config(unit, mru, accm, pcomp, accomp) * new_phase - signal the start of a new phase of pppd's operation. */ void -new_phase(p) - int p; +new_phase(int p) { phase = p; if (new_phase_hook) @@ -1171,8 +1146,7 @@ new_phase(p) * die - clean up state and exit with the specified status. */ void -die(status) - int status; +die(int status) { if (!doing_multilink || multilink_master) print_link_stats(); @@ -1187,7 +1161,7 @@ die(status) */ /* ARGSUSED */ static void -cleanup() +cleanup(void) { sys_cleanup(); @@ -1205,7 +1179,7 @@ cleanup() } void -print_link_stats() +print_link_stats(void) { /* * Print connect time and statistics. @@ -1223,8 +1197,7 @@ print_link_stats() * reset_link_stats - "reset" stats when link goes up. */ void -reset_link_stats(u) - int u; +reset_link_stats(int u) { if (!get_ppp_stats(u, &old_link_stats)) return; @@ -1235,8 +1208,7 @@ reset_link_stats(u) * update_link_stats - get stats at link termination. */ void -update_link_stats(u) - int u; +update_link_stats(int u) { struct timeval now; char numbuf[32]; @@ -1264,7 +1236,7 @@ update_link_stats(u) struct callout { struct timeval c_time; /* time at which to call routine */ void *c_arg; /* argument to routine */ - void (*c_func) __P((void *)); /* routine */ + void (*c_func)(void *); /* routine */ struct callout *c_next; }; @@ -1275,10 +1247,7 @@ static struct timeval timenow; /* Current time */ * timeout - Schedule a timeout. */ void -timeout(func, arg, secs, usecs) - void (*func) __P((void *)); - void *arg; - int secs, usecs; +timeout(void (*func)(void *), void *arg, int secs, int usecs) { struct callout *newp, *p, **pp; @@ -1314,9 +1283,7 @@ timeout(func, arg, secs, usecs) * untimeout - Unschedule a timeout. */ void -untimeout(func, arg) - void (*func) __P((void *)); - void *arg; +untimeout(void (*func)(void *), void *arg) { struct callout **copp, *freep; @@ -1336,7 +1303,7 @@ untimeout(func, arg) * calltimeout - Call any timeout routines which are now due. */ static void -calltimeout() +calltimeout(void) { struct callout *p; @@ -1362,8 +1329,7 @@ calltimeout() * timeleft - return the length of time until the next timeout is due. */ static struct timeval * -timeleft(tvp) - struct timeval *tvp; +timeleft(struct timeval *tvp) { if (callout == NULL) return NULL; @@ -1387,8 +1353,7 @@ timeleft(tvp) * We assume that sig is currently blocked. */ static void -kill_my_pg(sig) - int sig; +kill_my_pg(int sig) { struct sigaction act, oldact; struct subprocess *chp; @@ -1434,8 +1399,7 @@ kill_my_pg(sig) * signal, we just take the link down. */ static void -hup(sig) - int sig; +hup(int sig) { /* can't log a message here, it can deadlock */ got_sighup = 1; @@ -1455,8 +1419,7 @@ hup(sig) */ /*ARGSUSED*/ static void -term(sig) - int sig; +term(int sig) { /* can't log a message here, it can deadlock */ got_sigterm = sig; @@ -1474,8 +1437,7 @@ term(sig) * Sets a flag so we will call reap_kids in the mainline. */ static void -chld(sig) - int sig; +chld(int sig) { got_sigchld = 1; if (waiting) @@ -1490,8 +1452,7 @@ chld(sig) */ /*ARGSUSED*/ static void -toggle_debug(sig) - int sig; +toggle_debug(int sig) { debug = !debug; if (debug) { @@ -1509,8 +1470,7 @@ toggle_debug(sig) */ /*ARGSUSED*/ static void -open_ccp(sig) - int sig; +open_ccp(int sig) { got_sigusr2 = 1; if (waiting) @@ -1522,8 +1482,7 @@ open_ccp(sig) * bad_signal - We've caught a fatal signal. Clean up state and exit. */ static void -bad_signal(sig) - int sig; +bad_signal(int sig) { static int crashed = 0; @@ -1624,9 +1583,7 @@ safe_fork(int infd, int outfd, int errfd) } static bool -add_script_env(pos, newstring) - int pos; - char *newstring; +add_script_env(int pos, char *newstring) { if (pos + 1 >= s_env_nalloc) { int new_n = pos + 17; @@ -1644,8 +1601,7 @@ add_script_env(pos, newstring) } static void -remove_script_env(pos) - int pos; +remove_script_env(int pos) { free(script_env[pos] - 1); while ((script_env[pos] = script_env[pos + 1]) != NULL) @@ -1657,7 +1613,7 @@ remove_script_env(pos) * and update the system environment. */ static void -update_system_environment() +update_system_environment(void) { struct userenv *uep; @@ -1675,10 +1631,7 @@ update_system_environment() * stderr gets connected to the log fd or to the _PATH_CONNERRS file. */ int -device_script(program, in, out, dont_wait) - char *program; - int in, out; - int dont_wait; +device_script(char *program, int in, int out, int dont_wait) { int pid; int status = -1; @@ -1740,7 +1693,7 @@ device_script(program, in, out, dont_wait) * script_unsetenv() safely after this routine is run. */ static void -update_script_environment() +update_script_environment(void) { struct userenv *uep; @@ -1781,13 +1734,7 @@ update_script_environment() * reap_kids) iff the return value is > 0. */ pid_t -run_program(prog, args, must_exist, done, arg, wait) - char *prog; - char **args; - int must_exist; - void (*done) __P((void *)); - void *arg; - int wait; +run_program(char *prog, char **args, int must_exist, void (*done)(void *), void *arg, int wait) { int pid, status; struct stat sbuf; @@ -1858,12 +1805,7 @@ run_program(prog, args, must_exist, done, arg, wait) * to use. */ void -record_child(pid, prog, done, arg, killable) - int pid; - char *prog; - void (*done) __P((void *)); - void *arg; - int killable; +record_child(int pid, char *prog, void (*done)(void *), void *arg, int killable) { struct subprocess *chp; @@ -1888,8 +1830,7 @@ record_child(pid, prog, done, arg, killable) * exit, send them all a SIGTERM. */ static void -childwait_end(arg) - void *arg; +childwait_end(void *arg) { struct subprocess *chp; @@ -1905,8 +1846,7 @@ childwait_end(arg) * forget_child - clean up after a dead child */ static void -forget_child(pid, status) - int pid, status; +forget_child(int pid, int status) { struct subprocess *chp, **prevp; @@ -1935,7 +1875,7 @@ forget_child(pid, status) * and log a message for abnormal terminations. */ static int -reap_kids() +reap_kids(void) { int pid, status; @@ -1957,10 +1897,7 @@ reap_kids() * add_notifier - add a new function to be called when something happens. */ void -add_notifier(notif, func, arg) - struct notifier **notif; - notify_func func; - void *arg; +add_notifier(struct notifier **notif, notify_func func, void *arg) { struct notifier *np; @@ -1978,10 +1915,7 @@ add_notifier(notif, func, arg) * be called when something happens. */ void -remove_notifier(notif, func, arg) - struct notifier **notif; - notify_func func; - void *arg; +remove_notifier(struct notifier **notif, notify_func func, void *arg) { struct notifier *np; @@ -1998,9 +1932,7 @@ remove_notifier(notif, func, arg) * notify - call a set of functions registered with add_notifier. */ void -notify(notif, val) - struct notifier *notif; - int val; +notify(struct notifier *notif, int val) { struct notifier *np; @@ -2014,8 +1946,7 @@ notify(notif, val) * novm - log an error message saying we ran out of memory, and die. */ void -novm(msg) - char *msg; +novm(char *msg) { fatal("Virtual memory exhausted allocating %s\n", msg); } @@ -2025,9 +1956,7 @@ novm(msg) * for scripts that we run (e.g. ip-up, auth-up, etc.) */ void -script_setenv(var, value, iskey) - char *var, *value; - int iskey; +script_setenv(char *var, char *value, int iskey) { size_t varl = strlen(var); size_t vl = varl + strlen(value) + 2; @@ -2088,8 +2017,7 @@ script_setenv(var, value, iskey) * for scripts. */ void -script_unsetenv(var) - char *var; +script_unsetenv(char *var) { int vl = strlen(var); int i; @@ -2123,7 +2051,7 @@ script_unsetenv(var) * lock_db - get an exclusive lock on the TDB database. * Used to ensure atomicity of various lookup/modify operations. */ -void lock_db() +void lock_db(void) { #ifdef USE_TDB TDB_DATA key; @@ -2137,7 +2065,7 @@ void lock_db() /* * unlock_db - remove the exclusive lock obtained by lock_db. */ -void unlock_db() +void unlock_db(void) { #ifdef USE_TDB TDB_DATA key; @@ -2153,7 +2081,7 @@ void unlock_db() * update_db_entry - update our entry in the database. */ static void -update_db_entry() +update_db_entry(void) { TDB_DATA key, dbuf; int vlen, i; @@ -2187,8 +2115,7 @@ update_db_entry() * add_db_key - add a key that we can use to look up our database entry. */ static void -add_db_key(str) - const char *str; +add_db_key(const char *str) { TDB_DATA key, dbuf; @@ -2204,8 +2131,7 @@ add_db_key(str) * delete_db_key - delete a key for looking up our database entry. */ static void -delete_db_key(str) - const char *str; +delete_db_key(const char *str) { TDB_DATA key; @@ -2218,7 +2144,7 @@ delete_db_key(str) * cleanup_db - delete all the entries we put in the database. */ static void -cleanup_db() +cleanup_db(void) { TDB_DATA key; int i; diff --git a/pppd/md4.c b/pppd/md4.c index d943e88..42a9b2e 100644 --- a/pppd/md4.c +++ b/pppd/md4.c @@ -87,8 +87,7 @@ ** This is a user-callable routine. */ void -MD4Print(MDp) -MD4_CTX *MDp; +MD4Print(MD4_CTX *MDp) { int i,j; for (i=0;i<4;i++) @@ -101,8 +100,7 @@ MD4_CTX *MDp; ** This is a user-callable routine. */ void -MD4Init(MDp) -MD4_CTX *MDp; +MD4Init(MD4_CTX *MDp) { int i; MDp->buffer[0] = I0; @@ -120,9 +118,7 @@ MD4_CTX *MDp; ** This routine is not user-callable. */ static void -MDblock(MDp,Xb) -MD4_CTX *MDp; -unsigned char *Xb; +MDblock(MD4_CTX *MDp, unsigned char *Xb) { register unsigned int tmp, A, B, C, D; unsigned int X[16]; @@ -206,10 +202,7 @@ unsigned char *Xb; ** if desired. */ void -MD4Update(MDp,X,count) -MD4_CTX *MDp; -unsigned char *X; -unsigned int count; +MD4Update(MD4_CTX *MDp, unsigned char *X, unsigned int count) { unsigned int i, tmp, bit, byte, mask; unsigned char XX[64]; @@ -277,9 +270,7 @@ unsigned int count; ** Finish up MD4 computation and return message digest. */ void -MD4Final(buf, MD) -unsigned char *buf; -MD4_CTX *MD; +MD4Final(unsigned char *buf, MD4_CTX *MD) { int i, j; unsigned int w; diff --git a/pppd/md4.h b/pppd/md4.h index 80e8f9a..b6fc3f5 100644 --- a/pppd/md4.h +++ b/pppd/md4.h @@ -8,15 +8,6 @@ ** ******************************************************************** */ -#ifndef __P -# if defined(__STDC__) || defined(__GNUC__) -# define __P(x) x -# else -# define __P(x) () -# endif -#endif - - /* MDstruct is the data structure for a message digest computation. */ typedef struct { @@ -29,7 +20,7 @@ typedef struct { ** Initialize the MD4_CTX prepatory to doing a message digest ** computation. */ -extern void MD4Init __P((MD4_CTX *MD)); +extern void MD4Init(MD4_CTX *MD); /* MD4Update(MD,X,count) ** Input: X -- a pointer to an array of unsigned characters. @@ -43,7 +34,7 @@ extern void MD4Init __P((MD4_CTX *MD)); ** every MD computation should end with one call to MD4Update with a ** count less than 512. Zero is OK for a count. */ -extern void MD4Update __P((MD4_CTX *MD, unsigned char *X, unsigned int count)); +extern void MD4Update(MD4_CTX *MD, unsigned char *X, unsigned int count); /* MD4Print(MD) ** Prints message digest buffer MD as 32 hexadecimal digits. @@ -51,13 +42,13 @@ extern void MD4Update __P((MD4_CTX *MD, unsigned char *X, unsigned int count)); ** of buffer[3]. ** Each byte is printed with high-order hexadecimal digit first. */ -extern void MD4Print __P((MD4_CTX *)); +extern void MD4Print(MD4_CTX *); /* MD4Final(buf, MD) ** Returns message digest from MD and terminates the message ** digest computation. */ -extern void MD4Final __P((unsigned char *, MD4_CTX *)); +extern void MD4Final(unsigned char *, MD4_CTX *); /* ** End of md4.h diff --git a/pppd/md5.c b/pppd/md5.c index f1291ce..f7988e6 100644 --- a/pppd/md5.c +++ b/pppd/md5.c @@ -102,8 +102,7 @@ static unsigned char PADDING[64] = { /* The routine MD5_Init initializes the message-digest context mdContext. All fields are set to zero. */ -void MD5_Init (mdContext) -MD5_CTX *mdContext; +void MD5_Init (MD5_CTX *mdContext) { mdContext->i[0] = mdContext->i[1] = (UINT4)0; @@ -119,10 +118,7 @@ MD5_CTX *mdContext; account for the presence of each of the characters inBuf[0..inLen-1] in the message whose digest is being computed. */ -void MD5_Update (mdContext, inBuf, inLen) -MD5_CTX *mdContext; -unsigned char *inBuf; -unsigned int inLen; +void MD5_Update (MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen) { UINT4 in[16]; int mdi; @@ -157,9 +153,7 @@ unsigned int inLen; /* The routine MD5Final terminates the message-digest computation and ends with the desired message digest in mdContext->digest[0...15]. */ -void MD5_Final (hash, mdContext) -unsigned char hash[]; -MD5_CTX *mdContext; +void MD5_Final (unsigned char hash[], MD5_CTX *mdContext) { UINT4 in[16]; int mdi; @@ -200,9 +194,7 @@ MD5_CTX *mdContext; /* Basic MD5 step. Transforms buf based on in. */ -static void Transform (buf, in) -UINT4 *buf; -UINT4 *in; +static void Transform (UINT4 *buf, UINT4 *in) { UINT4 a = buf[0], b = buf[1], c = buf[2], d = buf[3]; diff --git a/pppd/multilink.c b/pppd/multilink.c index 3aee0bc..07bd6d0 100644 --- a/pppd/multilink.c +++ b/pppd/multilink.c @@ -50,13 +50,13 @@ bool multilink_master; /* we own the multilink bundle */ extern TDB_CONTEXT *pppdb; extern char db_key[]; -static void make_bundle_links __P((int append)); -static void remove_bundle_link __P((void)); -static void iterate_bundle_links __P((void (*func) __P((char *)))); +static void make_bundle_links(int append); +static void remove_bundle_link(void); +static void iterate_bundle_links(void (*func)(char *)); -static int get_default_epdisc __P((struct epdisc *)); -static int parse_num __P((char *str, const char *key, int *valp)); -static int owns_unit __P((TDB_DATA pid, int unit)); +static int get_default_epdisc(struct epdisc *); +static int parse_num(char *str, const char *key, int *valp); +static int owns_unit(TDB_DATA pid, int unit); #define set_ip_epdisc(ep, addr) do { \ ep->length = 4; \ @@ -74,7 +74,7 @@ static int owns_unit __P((TDB_DATA pid, int unit)); #define process_exists(n) (kill((n), 0) == 0 || errno != ESRCH) void -mp_check_options() +mp_check_options(void) { lcp_options *wo = &lcp_wantoptions[0]; lcp_options *ao = &lcp_allowoptions[0]; @@ -102,7 +102,7 @@ mp_check_options() * if we are doing multilink. */ int -mp_join_bundle() +mp_join_bundle(void) { lcp_options *go = &lcp_gotoptions[0]; lcp_options *ho = &lcp_hisoptions[0]; @@ -240,7 +240,7 @@ mp_join_bundle() return 0; } -void mp_exit_bundle() +void mp_exit_bundle(void) { lock_db(); remove_bundle_link(); @@ -258,7 +258,7 @@ static void sendhup(char *str) } } -void mp_bundle_terminated() +void mp_bundle_terminated(void) { TDB_DATA key; @@ -325,7 +325,7 @@ static void make_bundle_links(int append) free(p); } -static void remove_bundle_link() +static void remove_bundle_link(void) { TDB_DATA key, rec; char entry[32]; @@ -388,10 +388,7 @@ static void iterate_bundle_links(void (*func)(char *)) } static int -parse_num(str, key, valp) - char *str; - const char *key; - int *valp; +parse_num(char *str, const char *key, int *valp) { char *p, *endp; int i; @@ -412,9 +409,7 @@ parse_num(str, key, valp) * Check whether the pppd identified by `key' still owns ppp unit `unit'. */ static int -owns_unit(key, unit) - TDB_DATA key; - int unit; +owns_unit(TDB_DATA key, int unit) { char ifkey[32]; TDB_DATA kd, vd; @@ -433,8 +428,7 @@ owns_unit(key, unit) } static int -get_default_epdisc(ep) - struct epdisc *ep; +get_default_epdisc(struct epdisc *ep) { char *p; struct hostent *hp; @@ -474,8 +468,7 @@ static char *endp_class_names[] = { }; char * -epdisc_to_str(ep) - struct epdisc *ep; +epdisc_to_str(struct epdisc *ep) { static char str[MAX_ENDP_LEN*3+8]; u_char *p = ep->value; @@ -525,9 +518,7 @@ static int hexc_val(int c) } int -str_to_epdisc(ep, str) - struct epdisc *ep; - char *str; +str_to_epdisc(struct epdisc *ep, char *str) { int i, l; char *p, *endp; diff --git a/pppd/options.c b/pppd/options.c index e08c108..c45f7cc 100644 --- a/pppd/options.c +++ b/pppd/options.c @@ -40,9 +40,8 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: options.c,v 1.102 2008/06/15 06:53:06 paulus Exp $" - #include +#include #include #include #include @@ -76,7 +75,7 @@ #include "pathnames.h" #if defined(ultrix) || defined(NeXT) -char *strdup __P((char *)); +char *strdup(char *); #endif @@ -154,35 +153,35 @@ static char logfile_name[MAXPATHLEN]; /* name of log file */ /* * Prototypes */ -static int setdomain __P((char **)); -static int readfile __P((char **)); -static int callfile __P((char **)); -static int showversion __P((char **)); -static int showhelp __P((char **)); -static void usage __P((void)); -static int setlogfile __P((char **)); +static int setdomain(char **); +static int readfile(char **); +static int callfile(char **); +static int showversion(char **); +static int showhelp(char **); +static void usage(void); +static int setlogfile(char **); #ifdef PLUGIN -static int loadplugin __P((char **)); +static int loadplugin(char **); #endif #ifdef PPP_FILTER -static int setpassfilter __P((char **)); -static int setactivefilter __P((char **)); +static int setpassfilter(char **); +static int setactivefilter(char **); #endif #ifdef MAXOCTETS -static int setmodir __P((char **)); +static int setmodir(char **); #endif -static int user_setenv __P((char **)); -static void user_setprint __P((option_t *, printer_func, void *)); -static int user_unsetenv __P((char **)); -static void user_unsetprint __P((option_t *, printer_func, void *)); +static int user_setenv(char **); +static void user_setprint(option_t *, printer_func, void *); +static int user_unsetenv(char **); +static void user_unsetprint(option_t *, printer_func, void *); -static option_t *find_option __P((const char *name)); -static int process_option __P((option_t *, char *, char **)); -static int n_arguments __P((option_t *)); -static int number_option __P((char *, u_int32_t *, int)); +static option_t *find_option(char *name); +static int process_option(option_t *, char *, char **); +static int n_arguments(option_t *); +static int number_option(char *, u_int32_t *, int); /* * Structure to store extra lists of options. @@ -385,9 +384,7 @@ See pppd(8) for more options.\n\ * parse_args - parse a string of arguments from the command line. */ int -parse_args(argc, argv) - int argc; - char **argv; +parse_args(int argc, char **argv) { char *arg; option_t *opt; @@ -423,11 +420,7 @@ parse_args(argc, argv) * and interpret them. */ int -options_from_file(filename, must_exist, check_prot, priv) - char *filename; - int must_exist; - int check_prot; - int priv; +options_from_file(char *filename, int must_exist, int check_prot, int priv) { FILE *f; int i, newline, ret, err; @@ -500,7 +493,7 @@ err: * and if so, interpret options from it. */ int -options_from_user() +options_from_user(void) { char *user, *path, *file; int ret; @@ -531,7 +524,7 @@ options_from_user() * files a lower priority than the command line. */ int -options_for_tty() +options_for_tty(void) { char *dev, *path, *p; int ret; @@ -561,9 +554,7 @@ options_for_tty() * options_from_list - process a string of options in a wordlist. */ int -options_from_list(w, priv) - struct wordlist *w; - int priv; +options_from_list(struct wordlist *w, int priv) { char *argv[MAXARGS]; option_t *opt; @@ -607,18 +598,15 @@ err: * match_option - see if this option matches an option_t structure. */ static int -match_option(name, opt, dowild) - char *name; - option_t *opt; - int dowild; +match_option(char *name, option_t *opt, int dowild) { - int (*match) __P((char *, char **, int)); + int (*match)(char *, char **, int); if (dowild != (opt->type == o_wild)) return 0; if (!dowild) return strcmp(name, opt->name) == 0; - match = (int (*) __P((char *, char **, int))) opt->addr; + match = (int (*)(char *, char **, int)) opt->addr; return (*match)(name, NULL, 0); } @@ -628,8 +616,7 @@ match_option(name, opt, dowild) * This could be optimized by using a hash table. */ static option_t * -find_option(name) - const char *name; +find_option(char *name) { option_t *opt; struct option_list *list; @@ -662,16 +649,13 @@ find_option(name) * process_option - process one new-style option. */ static int -process_option(opt, cmd, argv) - option_t *opt; - char *cmd; - char **argv; +process_option(option_t *opt, char *cmd, char **argv) { u_int32_t v; int iv, a; char *sv; - int (*parser) __P((char **)); - int (*wildp) __P((char *, char **, int)); + int (*parser)(char **); + int (*wildp)(char *, char **, int); char *optopt = (opt->type == o_wild)? "": " option"; int prio = option_priority; option_t *mainopt = opt; @@ -810,7 +794,7 @@ process_option(opt, cmd, argv) case o_special_noarg: case o_special: - parser = (int (*) __P((char **))) opt->addr; + parser = (int (*)(char **)) opt->addr; curopt = opt; if (!(*parser)(argv)) return 0; @@ -834,7 +818,7 @@ process_option(opt, cmd, argv) break; case o_wild: - wildp = (int (*) __P((char *, char **, int))) opt->addr; + wildp = (int (*)(char *, char **, int)) opt->addr; if (!(*wildp)(cmd, argv, 1)) return 0; break; @@ -861,10 +845,7 @@ process_option(opt, cmd, argv) * and source of the option value. Otherwise returns 0. */ int -override_value(option, priority, source) - const char *option; - int priority; - const char *source; +override_value(char *option, int priority, const char *source) { option_t *opt; @@ -885,8 +866,7 @@ override_value(option, priority, source) * n_arguments - tell how many arguments an option takes */ static int -n_arguments(opt) - option_t *opt; +n_arguments(option_t *opt) { return (opt->type == o_bool || opt->type == o_special_noarg || (opt->flags & OPT_NOARG))? 0: 1; @@ -896,8 +876,7 @@ n_arguments(opt) * add_options - add a list of options to the set we grok. */ void -add_options(opt) - option_t *opt; +add_options(option_t *opt) { struct option_list *list; @@ -913,7 +892,7 @@ add_options(opt) * check_options - check that options are valid and consistent. */ void -check_options() +check_options(void) { if (logfile_fd >= 0 && logfile_fd != log_to_fd) close(logfile_fd); @@ -923,10 +902,7 @@ check_options() * print_option - print out an option and its value */ static void -print_option(opt, mainopt, printer, arg) - option_t *opt, *mainopt; - printer_func printer; - void *arg; +print_option(option_t *opt, option_t *mainopt, printer_func printer, void *arg) { int i, v; char *p; @@ -988,9 +964,9 @@ print_option(opt, mainopt, printer, arg) printer(arg, " "); } if (opt->flags & OPT_A2PRINTER) { - void (*oprt) __P((option_t *, printer_func, void *)); - oprt = (void (*) __P((option_t *, printer_func, - void *)))opt->addr2; + void (*oprt)(option_t *, printer_func, void *); + oprt = (void (*)(option_t *, printer_func, void *)) + opt->addr2; (*oprt)(opt, printer, arg); } else if (opt->flags & OPT_A2STRVAL) { p = (char *) opt->addr2; @@ -1025,10 +1001,7 @@ print_option(opt, mainopt, printer, arg) * array of options. */ static void -print_option_list(opt, printer, arg) - option_t *opt; - printer_func printer; - void *arg; +print_option_list(option_t *opt, printer_func printer, void *arg) { while (opt->name != NULL) { if (opt->priority != OPRIO_DEFAULT @@ -1044,9 +1017,7 @@ print_option_list(opt, printer, arg) * print_options - print out what options are in effect. */ void -print_options(printer, arg) - printer_func printer; - void *arg; +print_options(printer_func printer, void *arg) { struct option_list *list; int i; @@ -1065,7 +1036,7 @@ print_options(printer, arg) * usage - print out a message telling how to use the program. */ static void -usage() +usage(void) { if (phase == PHASE_INITIALIZE) fprintf(stderr, usage_string, VERSION, progname); @@ -1075,8 +1046,7 @@ usage() * showhelp - print out usage message and exit. */ static int -showhelp(argv) - char **argv; +showhelp(char **argv) { if (phase == PHASE_INITIALIZE) { usage(); @@ -1089,8 +1059,7 @@ showhelp(argv) * showversion - print out the version number and exit. */ static int -showversion(argv) - char **argv; +showversion(char **argv) { if (phase == PHASE_INITIALIZE) { fprintf(stdout, "pppd version %s\n", VERSION); @@ -1105,18 +1074,12 @@ showversion(argv) * stderr if phase == PHASE_INITIALIZE. */ void -option_error __V((char *fmt, ...)) +option_error(char *fmt, ...) { va_list args; char buf[1024]; -#if defined(__STDC__) va_start(args, fmt); -#else - char *fmt; - va_start(args); - fmt = va_arg(args, char *); -#endif vslprintf(buf, sizeof(buf), fmt, args); va_end(args); if (phase == PHASE_INITIALIZE) @@ -1129,8 +1092,7 @@ option_error __V((char *fmt, ...)) * readable - check if a file is readable by the real user. */ int -readable(fd) - int fd; +readable(int fd) { uid_t uid; int i; @@ -1159,11 +1121,7 @@ readable(fd) * \ is ignored. */ int -getword(f, word, newlinep, filename) - FILE *f; - char *word; - int *newlinep; - char *filename; +getword(FILE *f, char *word, int *newlinep, char *filename) { int c, len, escape; int quoted, comment; @@ -1405,10 +1363,7 @@ getword(f, word, newlinep, filename) * number_option - parse an unsigned numeric parameter for an option. */ static int -number_option(str, valp, base) - char *str; - u_int32_t *valp; - int base; +number_option(char *str, u_int32_t *valp, int base) { char *ptr; @@ -1428,9 +1383,7 @@ number_option(str, valp, base) * if there is an error. */ int -int_option(str, valp) - char *str; - int *valp; +int_option(char *str, int *valp) { u_int32_t v; @@ -1449,8 +1402,7 @@ int_option(str, valp) * readfile - take commands from a file. */ static int -readfile(argv) - char **argv; +readfile(char **argv) { return options_from_file(*argv, 1, 1, privileged_option); } @@ -1460,8 +1412,7 @@ readfile(argv) * Name may not contain /../, start with / or ../, or end in /.. */ static int -callfile(argv) - char **argv; +callfile(char **argv) { char *fname, *arg, *p; int l, ok; @@ -1503,8 +1454,7 @@ callfile(argv) * setpassfilter - Set the pass filter for packets */ static int -setpassfilter(argv) - char **argv; +setpassfilter(char **argv) { pcap_t *pc; int ret = 1; @@ -1524,8 +1474,7 @@ setpassfilter(argv) * setactivefilter - Set the active filter for packets */ static int -setactivefilter(argv) - char **argv; +setactivefilter(char **argv) { pcap_t *pc; int ret = 1; @@ -1546,8 +1495,7 @@ setactivefilter(argv) * setdomain - Set domain name to append to hostname */ static int -setdomain(argv) - char **argv; +setdomain(char **argv) { gethostname(hostname, MAXNAMELEN); if (**argv != 0) { @@ -1561,8 +1509,7 @@ setdomain(argv) } static int -setlogfile(argv) - char **argv; +setlogfile(char **argv) { int fd, err; uid_t euid; @@ -1594,8 +1541,7 @@ setlogfile(argv) #ifdef MAXOCTETS static int -setmodir(argv) - char **argv; +setmodir(char **argv) { if(*argv == NULL) return 0; @@ -1614,13 +1560,12 @@ setmodir(argv) #ifdef PLUGIN static int -loadplugin(argv) - char **argv; +loadplugin(char **argv) { char *arg = *argv; void *handle; const char *err; - void (*init) __P((void)); + void (*init)(void); char *path = arg; const char *vers; @@ -1672,8 +1617,7 @@ loadplugin(argv) * Set an environment variable specified by the user. */ static int -user_setenv(argv) - char **argv; +user_setenv(char **argv) { char *arg = argv[0]; char *eqp; @@ -1725,10 +1669,7 @@ user_setenv(argv) } static void -user_setprint(opt, printer, arg) - option_t *opt; - printer_func printer; - void *arg; +user_setprint(option_t *opt, printer_func printer, void *arg) { struct userenv *uep, *uepnext; @@ -1748,8 +1689,7 @@ user_setprint(opt, printer, arg) } static int -user_unsetenv(argv) - char **argv; +user_unsetenv(char **argv) { struct userenv *uep, **insp; char *arg = argv[0]; @@ -1797,10 +1737,7 @@ user_unsetenv(argv) } static void -user_unsetprint(opt, printer, arg) - option_t *opt; - printer_func printer; - void *arg; +user_unsetprint(option_t *opt, printer_func printer, void *arg) { struct userenv *uep, *uepnext; diff --git a/pppd/pathnames.h b/pppd/pathnames.h index 5c8cfe8..524d608 100644 --- a/pppd/pathnames.h +++ b/pppd/pathnames.h @@ -1,7 +1,5 @@ /* * define path names - * - * $Id: pathnames.h,v 1.18 2005/08/25 23:59:34 paulus Exp $ */ #ifdef HAVE_PATHS_H diff --git a/pppd/plugins/radius/radiusclient.h b/pppd/plugins/radius/radiusclient.h index cff0c26..c3a8e7a 100644 --- a/pppd/plugins/radius/radiusclient.h +++ b/pppd/plugins/radius/radiusclient.h @@ -386,75 +386,75 @@ typedef struct env /* avpair.c */ -VALUE_PAIR *rc_avpair_add __P((VALUE_PAIR **, int, void *, int, int)); -int rc_avpair_assign __P((VALUE_PAIR *, void *, int)); -VALUE_PAIR *rc_avpair_new __P((int, void *, int, int)); -VALUE_PAIR *rc_avpair_gen __P((AUTH_HDR *)); -VALUE_PAIR *rc_avpair_get __P((VALUE_PAIR *, UINT4)); -VALUE_PAIR *rc_avpair_copy __P((VALUE_PAIR *)); -void rc_avpair_insert __P((VALUE_PAIR **, VALUE_PAIR *, VALUE_PAIR *)); -void rc_avpair_free __P((VALUE_PAIR *)); -int rc_avpair_parse __P((char *, VALUE_PAIR **)); -int rc_avpair_tostr __P((VALUE_PAIR *, char *, int, char *, int)); -VALUE_PAIR *rc_avpair_readin __P((FILE *)); +VALUE_PAIR *rc_avpair_add(VALUE_PAIR **, int, void *, int, int); +int rc_avpair_assign(VALUE_PAIR *, void *, int); +VALUE_PAIR *rc_avpair_new(int, void *, int, int); +VALUE_PAIR *rc_avpair_gen(AUTH_HDR *); +VALUE_PAIR *rc_avpair_get(VALUE_PAIR *, UINT4); +VALUE_PAIR *rc_avpair_copy(VALUE_PAIR *); +void rc_avpair_insert(VALUE_PAIR **, VALUE_PAIR *, VALUE_PAIR *); +void rc_avpair_free(VALUE_PAIR *); +int rc_avpair_parse(char *, VALUE_PAIR **); +int rc_avpair_tostr(VALUE_PAIR *, char *, int, char *, int); +VALUE_PAIR *rc_avpair_readin(FILE *); /* buildreq.c */ -void rc_buildreq __P((SEND_DATA *, int, char *, unsigned short, int, int)); -unsigned char rc_get_seqnbr __P((void)); -int rc_auth __P((UINT4, VALUE_PAIR *, VALUE_PAIR **, char *, REQUEST_INFO *)); -int rc_auth_using_server __P((SERVER *, UINT4, VALUE_PAIR *, VALUE_PAIR **, - char *, REQUEST_INFO *)); -int rc_auth_proxy __P((VALUE_PAIR *, VALUE_PAIR **, char *)); -int rc_acct __P((UINT4, VALUE_PAIR *)); -int rc_acct_using_server __P((SERVER *, UINT4, VALUE_PAIR *)); -int rc_acct_proxy __P((VALUE_PAIR *)); -int rc_check __P((char *, unsigned short, char *)); +void rc_buildreq(SEND_DATA *, int, char *, unsigned short, int, int); +unsigned char rc_get_seqnbr(void); +int rc_auth(UINT4, VALUE_PAIR *, VALUE_PAIR **, char *, REQUEST_INFO *); +int rc_auth_using_server(SERVER *, UINT4, VALUE_PAIR *, VALUE_PAIR **, + char *, REQUEST_INFO *); +int rc_auth_proxy(VALUE_PAIR *, VALUE_PAIR **, char *); +int rc_acct(UINT4, VALUE_PAIR *); +int rc_acct_using_server(SERVER *, UINT4, VALUE_PAIR *); +int rc_acct_proxy(VALUE_PAIR *); +int rc_check(char *, unsigned short, char *); /* clientid.c */ -int rc_read_mapfile __P((char *)); -UINT4 rc_map2id __P((char *)); +int rc_read_mapfile(char *); +UINT4 rc_map2id(char *); /* config.c */ -int rc_read_config __P((char *)); -char *rc_conf_str __P((char *)); -int rc_conf_int __P((char *)); -SERVER *rc_conf_srv __P((char *)); -int rc_find_server __P((char *, UINT4 *, char *)); +int rc_read_config(char *); +char *rc_conf_str(char *); +int rc_conf_int(char *); +SERVER *rc_conf_srv(char *); +int rc_find_server(char *, UINT4 *, char *); /* dict.c */ -int rc_read_dictionary __P((char *)); -DICT_ATTR *rc_dict_getattr __P((int, int)); -DICT_ATTR *rc_dict_findattr __P((char *)); -DICT_VALUE *rc_dict_findval __P((char *)); -DICT_VALUE * rc_dict_getval __P((UINT4, char *)); -VENDOR_DICT * rc_dict_findvendor __P((char *)); -VENDOR_DICT * rc_dict_getvendor __P((int)); +int rc_read_dictionary(char *); +DICT_ATTR *rc_dict_getattr(int, int); +DICT_ATTR *rc_dict_findattr(char *); +DICT_VALUE *rc_dict_findval(char *); +DICT_VALUE * rc_dict_getval(UINT4, char *); +VENDOR_DICT * rc_dict_findvendor(char *); +VENDOR_DICT * rc_dict_getvendor(int); /* ip_util.c */ -UINT4 rc_get_ipaddr __P((char *)); -int rc_good_ipaddr __P((char *)); -const char *rc_ip_hostname __P((UINT4)); -UINT4 rc_own_ipaddress __P((void)); -UINT4 rc_own_bind_ipaddress __P((void)); +UINT4 rc_get_ipaddr(char *); +int rc_good_ipaddr(char *); +const char *rc_ip_hostname(UINT4); +UINT4 rc_own_ipaddress(void); +UINT4 rc_own_bind_ipaddress(void); /* sendserver.c */ -int rc_send_server __P((SEND_DATA *, char *, REQUEST_INFO *)); +int rc_send_server(SEND_DATA *, char *, REQUEST_INFO *); /* util.c */ -void rc_str2tm __P((char *, struct tm *)); -char *rc_mksid __P((void)); -void rc_mdelay __P((int)); +void rc_str2tm(char *, struct tm *); +char *rc_mksid(void); +void rc_mdelay(int); /* md5.c */ -void rc_md5_calc __P((unsigned char *, unsigned char *, unsigned int)); +void rc_md5_calc(unsigned char *, unsigned char *, unsigned int); #endif /* RADIUSCLIENT_H */ diff --git a/pppd/pppcrypt.c b/pppd/pppcrypt.c index 6b35375..193f8fd 100644 --- a/pppd/pppcrypt.c +++ b/pppd/pppcrypt.c @@ -35,9 +35,7 @@ #include "pppcrypt.h" static u_char -Get7Bits(input, startBit) -u_char *input; -int startBit; +Get7Bits(u_char *input, int startBit) { unsigned int word; @@ -50,10 +48,10 @@ int startBit; } static void -MakeKey(key, des_key) -u_char *key; /* IN 56 bit DES key missing parity bits */ -u_char *des_key; /* OUT 64 bit DES key with parity bits added */ +MakeKey(u_char *key, u_char *des_key) { + /* key IN 56 bit DES key missing parity bits */ + /* des_key OUT 64 bit DES key with parity bits added */ des_key[0] = Get7Bits(key, 0); des_key[1] = Get7Bits(key, 7); des_key[2] = Get7Bits(key, 14); @@ -75,9 +73,7 @@ u_char *des_key; /* OUT 64 bit DES key with parity bits added */ * Note that the low-order "bit" is always ignored by by setkey() */ static void -Expand(in, out) -u_char *in; -u_char *out; +Expand(u_char *in, u_char *out) { int j, c; int i; @@ -93,9 +89,7 @@ u_char *out; /* The inverse of Expand */ static void -Collapse(in, out) -u_char *in; -u_char *out; +Collapse(u_char *in, u_char *out) { int j; int i; @@ -110,8 +104,7 @@ u_char *out; } bool -DesSetkey(key) -u_char *key; +DesSetkey(u_char *key) { u_char des_key[8]; u_char crypt_key[66]; @@ -126,9 +119,7 @@ u_char *key; } bool -DesEncrypt(clear, cipher) -u_char *clear; /* IN 8 octets */ -u_char *cipher; /* OUT 8 octets */ +DesEncrypt(u_char *clear, u_char *cipher) { u_char des_input[66]; @@ -142,9 +133,7 @@ u_char *cipher; /* OUT 8 octets */ } bool -DesDecrypt(cipher, clear) -u_char *cipher; /* IN 8 octets */ -u_char *clear; /* OUT 8 octets */ +DesDecrypt(u_char *cipher, u_char *clear) { u_char des_input[66]; @@ -161,8 +150,7 @@ u_char *clear; /* OUT 8 octets */ static DES_key_schedule key_schedule; bool -DesSetkey(key) -u_char *key; +DesSetkey(u_char *key) { DES_cblock des_key; MakeKey(key, des_key); @@ -171,9 +159,7 @@ u_char *key; } bool -DesEncrypt(clear, cipher) -u_char *clear; /* IN 8 octets */ -u_char *cipher; /* OUT 8 octets */ +DesEncrypt(u_char *clear, u_char *cipher) { DES_ecb_encrypt((DES_cblock *)clear, (DES_cblock *)cipher, &key_schedule, 1); @@ -181,9 +167,7 @@ u_char *cipher; /* OUT 8 octets */ } bool -DesDecrypt(cipher, clear) -u_char *cipher; /* IN 8 octets */ -u_char *clear; /* OUT 8 octets */ +DesDecrypt(u_char *cipher, u_char *clear) { DES_ecb_encrypt((DES_cblock *)cipher, (DES_cblock *)clear, &key_schedule, 0); diff --git a/pppd/pppcrypt.h b/pppd/pppcrypt.h index adcdcbc..364940e 100644 --- a/pppd/pppcrypt.h +++ b/pppd/pppcrypt.h @@ -41,8 +41,8 @@ #include #endif -extern bool DesSetkey __P((u_char *)); -extern bool DesEncrypt __P((u_char *, u_char *)); -extern bool DesDecrypt __P((u_char *, u_char *)); +extern bool DesSetkey(u_char *); +extern bool DesEncrypt(u_char *, u_char *); +extern bool DesDecrypt(u_char *, u_char *); #endif /* PPPCRYPT_H */ diff --git a/pppd/pppd.h b/pppd/pppd.h index a35deaa..6cdffe8 100644 --- a/pppd/pppd.h +++ b/pppd/pppd.h @@ -59,16 +59,6 @@ #include #include "patchlevel.h" -#if defined(__STDC__) -#include -#define __V(x) x -#else -#include -#define __V(x) (va_alist) va_dcl -#define const -#define volatile -#endif - #ifdef INET6 #include "eui64.h" #endif @@ -210,8 +200,8 @@ struct epdisc { #define EPD_MAGIC 4 #define EPD_PHONENUM 5 -typedef void (*notify_func) __P((void *, int)); -typedef void (*printer_func) __P((void *, char *, ...)); +typedef void (*notify_func)(void *, int); +typedef void (*printer_func)(void *, char *, ...); struct notifier { struct notifier *next; @@ -420,34 +410,33 @@ extern int option_priority; /* priority of current options */ struct protent { u_short protocol; /* PPP protocol number */ /* Initialization procedure */ - void (*init) __P((int unit)); + void (*init)(int unit); /* Process a received packet */ - void (*input) __P((int unit, u_char *pkt, int len)); + void (*input)(int unit, u_char *pkt, int len); /* Process a received protocol-reject */ - void (*protrej) __P((int unit)); + void (*protrej)(int unit); /* Lower layer has come up */ - void (*lowerup) __P((int unit)); + void (*lowerup)(int unit); /* Lower layer has gone down */ - void (*lowerdown) __P((int unit)); + void (*lowerdown)(int unit); /* Open the protocol */ - void (*open) __P((int unit)); + void (*open)(int unit); /* Close the protocol */ - void (*close) __P((int unit, char *reason)); + void (*close)(int unit, char *reason); /* Print a packet in readable form */ - int (*printpkt) __P((u_char *pkt, int len, printer_func printer, - void *arg)); + int (*printpkt)(u_char *pkt, int len, printer_func printer, void *arg); /* Process a received data packet */ - void (*datainput) __P((int unit, u_char *pkt, int len)); + void (*datainput)(int unit, u_char *pkt, int len); bool enabled_flag; /* 0 iff protocol is disabled */ char *name; /* Text name of protocol */ char *data_name; /* Text name of corresponding data protocol */ option_t *options; /* List of command-line options */ /* Check requested options, assign defaults */ - void (*check_options) __P((void)); + void (*check_options)(void); /* Configure interface for demand-dial */ - int (*demand_conf) __P((int unit)); + int (*demand_conf)(int unit); /* Say whether to bring up link for this pkt */ - int (*active_pkt) __P((u_char *pkt, int len)); + int (*active_pkt)(u_char *pkt, int len); }; /* Table of pointers to supported protocols */ @@ -464,25 +453,25 @@ struct channel { /* set of options for this channel */ option_t *options; /* find and process a per-channel options file */ - void (*process_extra_options) __P((void)); + void (*process_extra_options)(void); /* check all the options that have been given */ - void (*check_options) __P((void)); + void (*check_options)(void); /* get the channel ready to do PPP, return a file descriptor */ - int (*connect) __P((void)); + int (*connect)(void); /* we're finished with the channel */ - void (*disconnect) __P((void)); + void (*disconnect)(void); /* put the channel into PPP `mode' */ - int (*establish_ppp) __P((int)); + int (*establish_ppp)(int); /* take the channel out of PPP `mode', restore loopback if demand */ - void (*disestablish_ppp) __P((int)); + void (*disestablish_ppp)(int); /* set the transmit-side PPP parameters of the channel */ - void (*send_config) __P((int, u_int32_t, int, int)); + void (*send_config)(int, u_int32_t, int, int); /* set the receive-side PPP parameters of the channel */ - void (*recv_config) __P((int, u_int32_t, int, int)); + void (*recv_config)(int, u_int32_t, int, int); /* cleanup on error or normal exit */ - void (*cleanup) __P((void)); + void (*cleanup)(void); /* close the device, called in children after fork */ - void (*close) __P((void)); + void (*close)(void); }; extern struct channel *the_channel; @@ -507,117 +496,117 @@ extern struct userenv *userenv_list; */ /* Procedures exported from main.c. */ -void set_ifunit __P((int)); /* set stuff that depends on ifunit */ -void detach __P((void)); /* Detach from controlling tty */ -void die __P((int)); /* Cleanup and exit */ -void quit __P((void)); /* like die(1) */ -void novm __P((char *)); /* Say we ran out of memory, and die */ -void timeout __P((void (*func)(void *), void *arg, int s, int us)); +void set_ifunit(int); /* set stuff that depends on ifunit */ +void detach(void); /* Detach from controlling tty */ +void die(int); /* Cleanup and exit */ +void quit(void); /* like die(1) */ +void novm(char *); /* Say we ran out of memory, and die */ +void timeout(void (*func)(void *), void *arg, int s, int us); /* Call func(arg) after s.us seconds */ -void untimeout __P((void (*func)(void *), void *arg)); +void untimeout(void (*func)(void *), void *arg); /* Cancel call to func(arg) */ -void record_child __P((int, char *, void (*) (void *), void *, int)); -pid_t safe_fork __P((int, int, int)); /* Fork & close stuff in child */ -int device_script __P((char *cmd, int in, int out, int dont_wait)); +void record_child(int, char *, void (*) (void *), void *, int); +pid_t safe_fork(int, int, int); /* Fork & close stuff in child */ +int device_script(char *cmd, int in, int out, int dont_wait); /* Run `cmd' with given stdin and stdout */ -pid_t run_program __P((char *prog, char **args, int must_exist, - void (*done)(void *), void *arg, int wait)); +pid_t run_program(char *prog, char **args, int must_exist, + void (*done)(void *), void *arg, int wait); /* Run program prog with args in child */ -void reopen_log __P((void)); /* (re)open the connection to syslog */ -void print_link_stats __P((void)); /* Print stats, if available */ -void reset_link_stats __P((int)); /* Reset (init) stats when link goes up */ -void update_link_stats __P((int)); /* Get stats at link termination */ -void script_setenv __P((char *, char *, int)); /* set script env var */ -void script_unsetenv __P((char *)); /* unset script env var */ -void new_phase __P((int)); /* signal start of new phase */ -void add_notifier __P((struct notifier **, notify_func, void *)); -void remove_notifier __P((struct notifier **, notify_func, void *)); -void notify __P((struct notifier *, int)); -int ppp_send_config __P((int, int, u_int32_t, int, int)); -int ppp_recv_config __P((int, int, u_int32_t, int, int)); -const char *protocol_name __P((int)); -void remove_pidfiles __P((void)); -void lock_db __P((void)); -void unlock_db __P((void)); +void reopen_log(void); /* (re)open the connection to syslog */ +void print_link_stats(void); /* Print stats, if available */ +void reset_link_stats(int); /* Reset (init) stats when link goes up */ +void update_link_stats(int); /* Get stats at link termination */ +void script_setenv(char *, char *, int); /* set script env var */ +void script_unsetenv(char *); /* unset script env var */ +void new_phase(int); /* signal start of new phase */ +void add_notifier(struct notifier **, notify_func, void *); +void remove_notifier(struct notifier **, notify_func, void *); +void notify(struct notifier *, int); +int ppp_send_config(int, int, u_int32_t, int, int); +int ppp_recv_config(int, int, u_int32_t, int, int); +const char *protocol_name(int); +void remove_pidfiles(void); +void lock_db(void); +void unlock_db(void); /* Procedures exported from tty.c. */ -void tty_init __P((void)); +void tty_init(void); /* Procedures exported from utils.c. */ -void log_packet __P((u_char *, int, char *, int)); +void log_packet(u_char *, int, char *, int); /* Format a packet and log it with syslog */ -void print_string __P((char *, int, printer_func, void *)); +void print_string(char *, int, printer_func, void *); /* Format a string for output */ -int slprintf __P((char *, int, char *, ...)); /* sprintf++ */ -int vslprintf __P((char *, int, char *, va_list)); /* vsprintf++ */ -size_t strlcpy __P((char *, const char *, size_t)); /* safe strcpy */ -size_t strlcat __P((char *, const char *, size_t)); /* safe strncpy */ -void dbglog __P((char *, ...)); /* log a debug message */ -void info __P((char *, ...)); /* log an informational message */ -void notice __P((char *, ...)); /* log a notice-level message */ -void warn __P((char *, ...)); /* log a warning message */ -void error __P((char *, ...)); /* log an error message */ -void fatal __P((char *, ...)); /* log an error message and die(1) */ -void init_pr_log __P((const char *, int)); /* initialize for using pr_log */ -void pr_log __P((void *, char *, ...)); /* printer fn, output to syslog */ -void end_pr_log __P((void)); /* finish up after using pr_log */ -void dump_packet __P((const char *, u_char *, int)); +int slprintf(char *, int, char *, ...); /* sprintf++ */ +int vslprintf(char *, int, char *, va_list); /* vsprintf++ */ +size_t strlcpy(char *, const char *, size_t); /* safe strcpy */ +size_t strlcat(char *, const char *, size_t); /* safe strncpy */ +void dbglog(char *, ...); /* log a debug message */ +void info(char *, ...); /* log an informational message */ +void notice(char *, ...); /* log a notice-level message */ +void warn(char *, ...); /* log a warning message */ +void error(char *, ...); /* log an error message */ +void fatal(char *, ...); /* log an error message and die(1) */ +void init_pr_log(const char *, int); /* initialize for using pr_log */ +void pr_log(void *, char *, ...); /* printer fn, output to syslog */ +void end_pr_log(void); /* finish up after using pr_log */ +void dump_packet(const char *, u_char *, int); /* dump packet to debug log if interesting */ -ssize_t complete_read __P((int, void *, size_t)); +ssize_t complete_read(int, void *, size_t); /* read a complete buffer */ /* Procedures exported from auth.c */ -void link_required __P((int)); /* we are starting to use the link */ -void start_link __P((int)); /* bring the link up now */ -void link_terminated __P((int)); /* we are finished with the link */ -void link_down __P((int)); /* the LCP layer has left the Opened state */ -void upper_layers_down __P((int));/* take all NCPs down */ -void link_established __P((int)); /* the link is up; authenticate now */ -void start_networks __P((int)); /* start all the network control protos */ -void continue_networks __P((int)); /* start network [ip, etc] control protos */ -void np_up __P((int, int)); /* a network protocol has come up */ -void np_down __P((int, int)); /* a network protocol has gone down */ -void np_finished __P((int, int)); /* a network protocol no longer needs link */ -void auth_peer_fail __P((int, int)); +void link_required(int); /* we are starting to use the link */ +void start_link(int); /* bring the link up now */ +void link_terminated(int); /* we are finished with the link */ +void link_down(int); /* the LCP layer has left the Opened state */ +void upper_layers_down(int);/* take all NCPs down */ +void link_established(int); /* the link is up; authenticate now */ +void start_networks(int); /* start all the network control protos */ +void continue_networks(int); /* start network [ip, etc] control protos */ +void np_up(int, int); /* a network protocol has come up */ +void np_down(int, int); /* a network protocol has gone down */ +void np_finished(int, int); /* a network protocol no longer needs link */ +void auth_peer_fail(int, int); /* peer failed to authenticate itself */ -void auth_peer_success __P((int, int, int, char *, int)); +void auth_peer_success(int, int, int, char *, int); /* peer successfully authenticated itself */ -void auth_withpeer_fail __P((int, int)); +void auth_withpeer_fail(int, int); /* we failed to authenticate ourselves */ -void auth_withpeer_success __P((int, int, int)); +void auth_withpeer_success(int, int, int); /* we successfully authenticated ourselves */ -void auth_check_options __P((void)); +void auth_check_options(void); /* check authentication options supplied */ -void auth_reset __P((int)); /* check what secrets we have */ -int check_passwd __P((int, char *, int, char *, int, char **)); +void auth_reset(int); /* check what secrets we have */ +int check_passwd(int, char *, int, char *, int, char **); /* Check peer-supplied username/password */ -int get_secret __P((int, char *, char *, char *, int *, int)); +int get_secret(int, char *, char *, char *, int *, int); /* get "secret" for chap */ -int get_srp_secret __P((int unit, char *client, char *server, char *secret, - int am_server)); -int auth_ip_addr __P((int, u_int32_t)); +int get_srp_secret(int unit, char *client, char *server, char *secret, + int am_server); +int auth_ip_addr(int, u_int32_t); /* check if IP address is authorized */ -int auth_number __P((void)); /* check if remote number is authorized */ -int bad_ip_adrs __P((u_int32_t)); +int auth_number(void); /* check if remote number is authorized */ +int bad_ip_adrs(u_int32_t); /* check if IP address is unreasonable */ /* Procedures exported from demand.c */ -void demand_conf __P((void)); /* config interface(s) for demand-dial */ -void demand_block __P((void)); /* set all NPs to queue up packets */ -void demand_unblock __P((void)); /* set all NPs to pass packets */ -void demand_discard __P((void)); /* set all NPs to discard packets */ -void demand_rexmit __P((int)); /* retransmit saved frames for an NP */ -int loop_chars __P((unsigned char *, int)); /* process chars from loopback */ -int loop_frame __P((unsigned char *, int)); /* should we bring link up? */ +void demand_conf(void); /* config interface(s) for demand-dial */ +void demand_block(void); /* set all NPs to queue up packets */ +void demand_unblock(void); /* set all NPs to pass packets */ +void demand_discard(void); /* set all NPs to discard packets */ +void demand_rexmit(int); /* retransmit saved frames for an NP */ +int loop_chars(unsigned char *, int); /* process chars from loopback */ +int loop_frame(unsigned char *, int); /* should we bring link up? */ /* Procedures exported from multilink.c */ #ifdef HAVE_MULTILINK -void mp_check_options __P((void)); /* Check multilink-related options */ -int mp_join_bundle __P((void)); /* join our link to an appropriate bundle */ -void mp_exit_bundle __P((void)); /* have disconnected our link from bundle */ -void mp_bundle_terminated __P((void)); -char *epdisc_to_str __P((struct epdisc *)); /* string from endpoint discrim. */ -int str_to_epdisc __P((struct epdisc *, char *)); /* endpt disc. from str */ +void mp_check_options(void); /* Check multilink-related options */ +int mp_join_bundle(void); /* join our link to an appropriate bundle */ +void mp_exit_bundle(void); /* have disconnected our link from bundle */ +void mp_bundle_terminated(void); +char *epdisc_to_str(struct epdisc *); /* string from endpoint discrim. */ +int str_to_epdisc(struct epdisc *, char *); /* endpt disc. from str */ #else #define mp_bundle_terminated() /* nothing */ #define mp_exit_bundle() /* nothing */ @@ -626,159 +615,159 @@ int str_to_epdisc __P((struct epdisc *, char *)); /* endpt disc. from str */ #endif /* Procedures exported from sys-*.c */ -void sys_init __P((void)); /* Do system-dependent initialization */ -void sys_cleanup __P((void)); /* Restore system state before exiting */ -int sys_check_options __P((void)); /* Check options specified */ -void sys_close __P((void)); /* Clean up in a child before execing */ -int ppp_available __P((void)); /* Test whether ppp kernel support exists */ -int get_pty __P((int *, int *, char *, int)); /* Get pty master/slave */ -int open_ppp_loopback __P((void)); /* Open loopback for demand-dialling */ -int tty_establish_ppp __P((int)); /* Turn serial port into a ppp interface */ -void tty_disestablish_ppp __P((int)); /* Restore port to normal operation */ -void generic_disestablish_ppp __P((int dev_fd)); /* Restore device setting */ -int generic_establish_ppp __P((int dev_fd)); /* Make a ppp interface */ -void make_new_bundle __P((int, int, int, int)); /* Create new bundle */ -int bundle_attach __P((int)); /* Attach link to existing bundle */ -void cfg_bundle __P((int, int, int, int)); /* Configure existing bundle */ -void destroy_bundle __P((void)); /* Tell driver to destroy bundle */ -void clean_check __P((void)); /* Check if line was 8-bit clean */ -void set_up_tty __P((int, int)); /* Set up port's speed, parameters, etc. */ -void restore_tty __P((int)); /* Restore port's original parameters */ -void setdtr __P((int, int)); /* Raise or lower port's DTR line */ -void output __P((int, u_char *, int)); /* Output a PPP packet */ -void wait_input __P((struct timeval *)); +void sys_init(void); /* Do system-dependent initialization */ +void sys_cleanup(void); /* Restore system state before exiting */ +int sys_check_options(void); /* Check options specified */ +void sys_close(void); /* Clean up in a child before execing */ +int ppp_available(void); /* Test whether ppp kernel support exists */ +int get_pty(int *, int *, char *, int); /* Get pty master/slave */ +int open_ppp_loopback(void); /* Open loopback for demand-dialling */ +int tty_establish_ppp(int); /* Turn serial port into a ppp interface */ +void tty_disestablish_ppp(int); /* Restore port to normal operation */ +void generic_disestablish_ppp(int dev_fd); /* Restore device setting */ +int generic_establish_ppp(int dev_fd); /* Make a ppp interface */ +void make_new_bundle(int, int, int, int); /* Create new bundle */ +int bundle_attach(int); /* Attach link to existing bundle */ +void cfg_bundle(int, int, int, int); /* Configure existing bundle */ +void destroy_bundle(void); /* Tell driver to destroy bundle */ +void clean_check(void); /* Check if line was 8-bit clean */ +void set_up_tty(int, int); /* Set up port's speed, parameters, etc. */ +void restore_tty(int); /* Restore port's original parameters */ +void setdtr(int, int); /* Raise or lower port's DTR line */ +void output(int, u_char *, int); /* Output a PPP packet */ +void wait_input(struct timeval *); /* Wait for input, with timeout */ -void add_fd __P((int)); /* Add fd to set to wait for */ -void remove_fd __P((int)); /* Remove fd from set to wait for */ -int read_packet __P((u_char *)); /* Read PPP packet */ -int get_loop_output __P((void)); /* Read pkts from loopback */ -void tty_send_config __P((int, u_int32_t, int, int)); +void add_fd(int); /* Add fd to set to wait for */ +void remove_fd(int); /* Remove fd from set to wait for */ +int read_packet(u_char *); /* Read PPP packet */ +int get_loop_output(void); /* Read pkts from loopback */ +void tty_send_config(int, u_int32_t, int, int); /* Configure i/f transmit parameters */ -void tty_set_xaccm __P((ext_accm)); +void tty_set_xaccm(ext_accm); /* Set extended transmit ACCM */ -void tty_recv_config __P((int, u_int32_t, int, int)); +void tty_recv_config(int, u_int32_t, int, int); /* Configure i/f receive parameters */ -int ccp_test __P((int, u_char *, int, int)); +int ccp_test(int, u_char *, int, int); /* Test support for compression scheme */ -void ccp_flags_set __P((int, int, int)); +void ccp_flags_set(int, int, int); /* Set kernel CCP state */ -int ccp_fatal_error __P((int)); /* Test for fatal decomp error in kernel */ -int get_idle_time __P((int, struct ppp_idle *)); +int ccp_fatal_error(int); /* Test for fatal decomp error in kernel */ +int get_idle_time(int, struct ppp_idle *); /* Find out how long link has been idle */ -int get_ppp_stats __P((int, struct pppd_stats *)); +int get_ppp_stats(int, struct pppd_stats *); /* Return link statistics */ -void netif_set_mtu __P((int, int)); /* Set PPP interface MTU */ -int netif_get_mtu __P((int)); /* Get PPP interface MTU */ -int sifvjcomp __P((int, int, int, int)); +void netif_set_mtu(int, int); /* Set PPP interface MTU */ +int netif_get_mtu(int); /* Get PPP interface MTU */ +int sifvjcomp(int, int, int, int); /* Configure VJ TCP header compression */ -int sifup __P((int)); /* Configure i/f up for one protocol */ -int sifnpmode __P((int u, int proto, enum NPmode mode)); +int sifup(int); /* Configure i/f up for one protocol */ +int sifnpmode(int u, int proto, enum NPmode mode); /* Set mode for handling packets for proto */ -int sifdown __P((int)); /* Configure i/f down for one protocol */ -int sifaddr __P((int, u_int32_t, u_int32_t, u_int32_t)); +int sifdown(int); /* Configure i/f down for one protocol */ +int sifaddr(int, u_int32_t, u_int32_t, u_int32_t); /* Configure IPv4 addresses for i/f */ -int cifaddr __P((int, u_int32_t, u_int32_t)); +int cifaddr(int, u_int32_t, u_int32_t); /* Reset i/f IP addresses */ #ifdef INET6 int ether_to_eui64(eui64_t *p_eui64); /* convert eth0 hw address to EUI64 */ -int sif6up __P((int)); /* Configure i/f up for IPv6 */ -int sif6down __P((int)); /* Configure i/f down for IPv6 */ -int sif6addr __P((int, eui64_t, eui64_t)); +int sif6up(int); /* Configure i/f up for IPv6 */ +int sif6down(int); /* Configure i/f down for IPv6 */ +int sif6addr(int, eui64_t, eui64_t); /* Configure IPv6 addresses for i/f */ -int cif6addr __P((int, eui64_t, eui64_t)); +int cif6addr(int, eui64_t, eui64_t); /* Remove an IPv6 address from i/f */ #endif -int sifdefaultroute __P((int, u_int32_t, u_int32_t)); +int sifdefaultroute(int, u_int32_t, u_int32_t); /* Create default route through i/f */ -int cifdefaultroute __P((int, u_int32_t, u_int32_t)); +int cifdefaultroute(int, u_int32_t, u_int32_t); /* Delete default route through i/f */ #ifdef INET6 -int sif6defaultroute __P((int, eui64_t, eui64_t)); +int sif6defaultroute(int, eui64_t, eui64_t); /* Create default IPv6 route through i/f */ -int cif6defaultroute __P((int, eui64_t, eui64_t)); +int cif6defaultroute(int, eui64_t, eui64_t); /* Delete default IPv6 route through i/f */ #endif -int sifproxyarp __P((int, u_int32_t)); +int sifproxyarp(int, u_int32_t); /* Add proxy ARP entry for peer */ -int cifproxyarp __P((int, u_int32_t)); +int cifproxyarp(int, u_int32_t); /* Delete proxy ARP entry for peer */ -u_int32_t GetMask __P((u_int32_t)); /* Get appropriate netmask for address */ -int lock __P((char *)); /* Create lock file for device */ -int relock __P((int)); /* Rewrite lock file with new pid */ -void unlock __P((void)); /* Delete previously-created lock file */ -void logwtmp __P((const char *, const char *, const char *)); +u_int32_t GetMask(u_int32_t); /* Get appropriate netmask for address */ +int lock(char *); /* Create lock file for device */ +int relock(int); /* Rewrite lock file with new pid */ +void unlock(void); /* Delete previously-created lock file */ +void logwtmp(const char *, const char *, const char *); /* Write entry to wtmp file */ -int get_host_seed __P((void)); /* Get host-dependent random number seed */ -int have_route_to __P((u_int32_t)); /* Check if route to addr exists */ +int get_host_seed(void); /* Get host-dependent random number seed */ +int have_route_to(u_int32_t); /* Check if route to addr exists */ #ifdef PPP_FILTER -int set_filters __P((struct bpf_program *pass, struct bpf_program *active)); +int set_filters(struct bpf_program *pass, struct bpf_program *active); /* Set filter programs in kernel */ #endif #ifdef IPX_CHANGE -int sipxfaddr __P((int, unsigned long, unsigned char *)); -int cipxfaddr __P((int)); +int sipxfaddr(int, unsigned long, unsigned char *); +int cipxfaddr(int); #endif -int get_if_hwaddr __P((u_char *addr, char *name)); -char *get_first_ethernet __P((void)); -int get_time __P((struct timeval *)); +int get_if_hwaddr(u_char *addr, char *name); +char *get_first_ethernet(void); +int get_time(struct timeval *); /* Get current time, monotonic if possible. */ /* Procedures exported from options.c */ -int setipaddr __P((char *, char **, int)); /* Set local/remote ip addresses */ -int parse_args __P((int argc, char **argv)); +int setipaddr(char *, char **, int); /* Set local/remote ip addresses */ +int parse_args(int argc, char **argv); /* Parse options from arguments given */ -int options_from_file __P((char *filename, int must_exist, int check_prot, - int privileged)); +int options_from_file(char *filename, int must_exist, int check_prot, + int privileged); /* Parse options from an options file */ -int options_from_user __P((void)); /* Parse options from user's .ppprc */ -int options_for_tty __P((void)); /* Parse options from /etc/ppp/options.tty */ -int options_from_list __P((struct wordlist *, int privileged)); +int options_from_user(void); /* Parse options from user's .ppprc */ +int options_for_tty(void); /* Parse options from /etc/ppp/options.tty */ +int options_from_list(struct wordlist *, int privileged); /* Parse options from a wordlist */ -int getword __P((FILE *f, char *word, int *newlinep, char *filename)); +int getword(FILE *f, char *word, int *newlinep, char *filename); /* Read a word from a file */ -void option_error __P((char *fmt, ...)); +void option_error(char *fmt, ...); /* Print an error message about an option */ -int int_option __P((char *, int *)); +int int_option(char *, int *); /* Simplified number_option for decimal ints */ -void add_options __P((option_t *)); /* Add extra options */ -void check_options __P((void)); /* check values after all options parsed */ -int override_value __P((const char *, int, const char *)); +void add_options(option_t *); /* Add extra options */ +void check_options(void); /* check values after all options parsed */ +int override_value(char *, int, const char *); /* override value if permitted by priority */ -void print_options __P((printer_func, void *)); +void print_options(printer_func, void *); /* print out values of all options */ -int parse_dotted_ip __P((char *, u_int32_t *)); +int parse_dotted_ip(char *, u_int32_t *); /* * Hooks to enable plugins to change various things. */ -extern int (*new_phase_hook) __P((int)); -extern int (*idle_time_hook) __P((struct ppp_idle *)); -extern int (*holdoff_hook) __P((void)); -extern int (*pap_check_hook) __P((void)); -extern int (*pap_auth_hook) __P((char *user, char *passwd, char **msgp, - struct wordlist **paddrs, - struct wordlist **popts)); -extern void (*pap_logout_hook) __P((void)); -extern int (*pap_passwd_hook) __P((char *user, char *passwd)); -extern int (*allowed_address_hook) __P((u_int32_t addr)); -extern void (*ip_up_hook) __P((void)); -extern void (*ip_down_hook) __P((void)); -extern void (*ip_choose_hook) __P((u_int32_t *)); -extern void (*ipv6_up_hook) __P((void)); -extern void (*ipv6_down_hook) __P((void)); - -extern int (*chap_check_hook) __P((void)); -extern int (*chap_passwd_hook) __P((char *user, char *passwd)); -extern void (*multilink_join_hook) __P((void)); +extern int (*new_phase_hook)(int); +extern int (*idle_time_hook)(struct ppp_idle *); +extern int (*holdoff_hook)(void); +extern int (*pap_check_hook)(void); +extern int (*pap_auth_hook)(char *user, char *passwd, char **msgp, + struct wordlist **paddrs, + struct wordlist **popts); +extern void (*pap_logout_hook)(void); +extern int (*pap_passwd_hook)(char *user, char *passwd); +extern int (*allowed_address_hook)(u_int32_t addr); +extern void (*ip_up_hook)(void); +extern void (*ip_down_hook)(void); +extern void (*ip_choose_hook)(u_int32_t *); +extern void (*ipv6_up_hook)(void); +extern void (*ipv6_down_hook)(void); + +extern int (*chap_check_hook)(void); +extern int (*chap_passwd_hook)(char *user, char *passwd); +extern void (*multilink_join_hook)(void); #ifdef USE_EAPTLS -extern int (*eaptls_passwd_hook) __P((char *user, char *passwd)); +extern int (*eaptls_passwd_hook)(char *user, char *passwd); #endif /* Let a plugin snoop sent and received packets. Useful for L2TP */ -extern void (*snoop_recv_hook) __P((unsigned char *p, int len)); -extern void (*snoop_send_hook) __P((unsigned char *p, int len)); +extern void (*snoop_recv_hook)(unsigned char *p, int len); +extern void (*snoop_send_hook)(unsigned char *p, int len); /* * Inline versions of get/put char/short/long. diff --git a/pppd/session.c b/pppd/session.c index 473e51e..2f1c83e 100644 --- a/pppd/session.c +++ b/pppd/session.c @@ -116,10 +116,7 @@ static pam_handle_t *pamh = NULL; */ static int conversation (int num_msg, -#ifndef SOL2 - const -#endif - struct pam_message **msg, + const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) { int replies = 0; @@ -164,12 +161,7 @@ static struct pam_conv pam_conv_data = { #endif /* #ifdef USE_PAM */ int -session_start(flags, user, passwd, ttyName, msg) - const int flags; - const char *user; - const char *passwd; - const char *ttyName; - char **msg; +session_start(const int flags, const char *user, const char *passwd, const char *ttyName, char **msg) { #ifdef USE_PAM bool ok = 1; diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index f38210a..6e14238 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -625,7 +625,7 @@ void generic_disestablish_ppp(int dev_fd) * make_ppp_unit - make a new ppp unit for ppp_dev_fd. * Assumes new_style_driver. */ -static int make_ppp_unit() +static int make_ppp_unit(void) { int x, flags; @@ -1377,9 +1377,7 @@ int set_filters(struct bpf_program *pass, struct bpf_program *active) * get_idle_time - return how long the link has been idle. */ int -get_idle_time(u, ip) - int u; - struct ppp_idle *ip; +get_idle_time(int u, struct ppp_idle *ip) { return ioctl(ppp_dev_fd, PPPIOCGIDLE, ip) >= 0; } @@ -1389,9 +1387,7 @@ get_idle_time(u, ip) * get_ppp_stats - return statistics for the link. */ int -get_ppp_stats(u, stats) - int u; - struct pppd_stats *stats; +get_ppp_stats(int u, struct pppd_stats *stats) { struct ifpppstatsreq req; @@ -2106,7 +2102,7 @@ get_if_hwaddr(u_char *addr, char *name) * interface on this system. */ char * -get_first_ethernet() +get_first_ethernet(void) { return "eth0"; } @@ -2826,11 +2822,7 @@ int cif6addr (int unit, eui64_t our_eui64, eui64_t his_eui64) * to the uid given. Assumes slave_name points to >= 16 bytes of space. */ int -get_pty(master_fdp, slave_fdp, slave_name, uid) - int *master_fdp; - int *slave_fdp; - char *slave_name; - int uid; +get_pty(int *master_fdp, int *slave_fdp, char *slave_name, int uid) { int i, mfd, sfd = -1; char pty_name[16]; @@ -2956,10 +2948,7 @@ open_ppp_loopback(void) */ int -sifnpmode(u, proto, mode) - int u; - int proto; - enum NPmode mode; +sifnpmode(int u, int proto, enum NPmode mode) { struct npioctl npi; @@ -3070,7 +3059,7 @@ int cipxfaddr (int unit) * Use the hostname as part of the random number seed. */ int -get_host_seed() +get_host_seed(void) { int h; char *p = hostname; diff --git a/pppd/sys-solaris.c b/pppd/sys-solaris.c index 113eb7b..d96d23c 100644 --- a/pppd/sys-solaris.c +++ b/pppd/sys-solaris.c @@ -85,8 +85,6 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: sys-solaris.c,v 1.16 2008/01/30 14:26:53 carlsonj Exp $" - #include #include #include @@ -256,15 +254,15 @@ static eui64_t default_route_gateway6; /* Gateway for default IPv6 route added * static u_int32_t proxy_arp_addr; /* Addr for proxy arp entry added */ /* Prototypes for procedures local to this file. */ -static int translate_speed __P((int)); -static int baud_rate_of __P((int)); -static int get_ether_addr __P((u_int32_t, struct sockaddr *)); -static int get_hw_addr __P((char *, u_int32_t, struct sockaddr *)); -static int get_hw_addr_dlpi __P((char *, struct sockaddr *)); -static int dlpi_attach __P((int, int)); -static int dlpi_info_req __P((int)); -static int dlpi_get_reply __P((int, union DL_primitives *, int, int)); -static int strioctl __P((int, int, void *, int, int)); +static int translate_speed(int); +static int baud_rate_of(int); +static int get_ether_addr(u_int32_t, struct sockaddr *); +static int get_hw_addr(char *, u_int32_t, struct sockaddr *); +static int get_hw_addr_dlpi(char *, struct sockaddr *); +static int dlpi_attach(int, int); +static int dlpi_info_req(int); +static int dlpi_get_reply(int, union DL_primitives *, int, int); +static int strioctl(int, int, void *, int, int); #ifdef SOL2 /* @@ -302,7 +300,7 @@ sifppa(fd, ppa) * NOTE: This is the lifreq version (Solaris 8 and above) */ char * -get_first_ethernet() +get_first_ethernet(void) { struct lifnum lifn; struct lifconf lifc; @@ -396,7 +394,7 @@ get_first_ethernet() * NOTE: This is the ifreq version (before Solaris 8). */ char * -get_first_ethernet() +get_first_ethernet(void) { struct ifconf ifc; struct ifreq *pifreq; @@ -511,9 +509,7 @@ get_if_hwaddr(u_char *addr, char *if_name) * be set in order to declare this as an IPv6 interface */ static int -slifname(fd, ppa) - int fd; - int ppa; +slifname(int fd, int ppa) { struct lifreq lifr; int ret; @@ -585,7 +581,7 @@ ether_to_eui64(eui64_t *p_eui64) * sys_init - System-dependent initialization. */ void -sys_init() +sys_init(void) { int ifd, x; struct ifreq ifr; @@ -785,7 +781,7 @@ sys_init() * This should call die() because it's called from die(). */ void -sys_cleanup() +sys_cleanup(void) { #if defined(SOL2) struct ifreq ifr; @@ -859,7 +855,7 @@ sys_cleanup() * sys_close - Clean up in a child process before execing. */ void -sys_close() +sys_close(void) { close(ipfd); #if defined(INET6) && defined(SOL2) @@ -873,7 +869,7 @@ sys_close() * sys_check_options - check the options that the user specified */ int -sys_check_options() +sys_check_options(void) { return 1; } @@ -883,8 +879,7 @@ sys_check_options() * daemon - Detach us from controlling terminal session. */ int -daemon(nochdir, noclose) - int nochdir, noclose; +daemon(int nochdir, int noclose) { int pid; @@ -908,7 +903,7 @@ daemon(nochdir, noclose) * ppp_available - check whether the system has any ppp interfaces */ int -ppp_available() +ppp_available(void) { struct stat buf; @@ -925,7 +920,7 @@ ppp_available() * no point of having the comp module be pushed on the stream. */ static int -any_compressions() +any_compressions(void) { if ((!lcp_wantoptions[0].neg_accompression) && (!lcp_wantoptions[0].neg_pcompression) && @@ -940,8 +935,7 @@ any_compressions() * tty_establish_ppp - Turn the serial port into a ppp interface. */ int -tty_establish_ppp(fd) - int fd; +tty_establish_ppp(int fd) { int i; @@ -1000,8 +994,7 @@ tty_establish_ppp(fd) * modules. This shouldn't call die() because it's called from die(). */ void -tty_disestablish_ppp(fd) - int fd; +tty_disestablish_ppp(int fd) { int i; @@ -1037,7 +1030,7 @@ tty_disestablish_ppp(fd) * Check whether the link seems not to be 8-bit clean. */ void -clean_check() +clean_check(void) { int x; char *s; @@ -1159,8 +1152,7 @@ struct speed { * Translate from bits/second to a speed_t. */ static int -translate_speed(bps) - int bps; +translate_speed(int bps) { struct speed *speedp; @@ -1177,8 +1169,7 @@ translate_speed(bps) * Translate from a speed_t to bits/second. */ static int -baud_rate_of(speed) - int speed; +baud_rate_of(int speed) { struct speed *speedp; @@ -1196,8 +1187,7 @@ baud_rate_of(speed) * regardless of whether the modem option was specified. */ void -set_up_tty(fd, local) - int fd, local; +set_up_tty(int fd, int local) { int speed; struct termios tios; @@ -1292,8 +1282,7 @@ set_up_tty(fd, local) * restore_tty - restore the terminal to the saved settings. */ void -restore_tty(fd) - int fd; +restore_tty(int fd) { if (restore_term) { if (!default_device) { @@ -1325,8 +1314,7 @@ restore_tty(fd) * This is called from die(), so it shouldn't call die(). */ void -setdtr(fd, on) -int fd, on; +setdtr(int fd, int on) { int modembits = TIOCM_DTR; @@ -1339,7 +1327,7 @@ int fd, on; * to the ppp driver. */ int -open_ppp_loopback() +open_ppp_loopback(void) { return pppfd; } @@ -1348,10 +1336,7 @@ open_ppp_loopback() * output - Output PPP packet. */ void -output(unit, p, len) - int unit; - u_char *p; - int len; +output(int unit, u_char *p, int len) { struct strbuf data; int retries; @@ -1382,8 +1367,7 @@ output(unit, p, len) * if timo is NULL). */ void -wait_input(timo) - struct timeval *timo; +wait_input(struct timeval *timo) { int t; @@ -1395,8 +1379,7 @@ wait_input(timo) /* * add_fd - add an fd to the set that wait_input waits for. */ -void add_fd(fd) - int fd; +void add_fd(int fd) { int n; @@ -1414,8 +1397,7 @@ void add_fd(fd) /* * remove_fd - remove an fd from the set that wait_input waits for. */ -void remove_fd(fd) - int fd; +void remove_fd(int fd) { int n; @@ -1436,8 +1418,7 @@ void remove_fd(fd) * if timo is NULL). */ void -wait_loop_output(timo) - struct timeval *timo; +wait_loop_output(struct timeval *timo) { wait_input(timo); } @@ -1447,8 +1428,7 @@ wait_loop_output(timo) * signal is received. */ void -wait_time(timo) - struct timeval *timo; +wait_time(struct timeval *timo) { int n; @@ -1463,8 +1443,7 @@ wait_time(timo) * read_packet - get a PPP packet from the serial device. */ int -read_packet(buf) - u_char *buf; +read_packet(u_char *buf) { struct strbuf ctrl, data; int flags, len; @@ -1503,7 +1482,7 @@ read_packet(buf) * Return value is 1 if we need to bring up the link, 0 otherwise. */ int -get_loop_output() +get_loop_output(void) { int len; int rv = 0; @@ -1519,8 +1498,7 @@ get_loop_output() * netif_set_mtu - set the MTU on the PPP network interface. */ void -netif_set_mtu(unit, mtu) - int unit, mtu; +netif_set_mtu(int unit, int mtu) { struct ifreq ifr; #if defined(INET6) && defined(SOL2) @@ -1576,10 +1554,7 @@ netif_get_mtu(int unit) * the ppp interface. */ void -tty_send_config(mtu, asyncmap, pcomp, accomp) - int mtu; - u_int32_t asyncmap; - int pcomp, accomp; +tty_send_config(int mtu, u_int32_t asyncmap, int pcomp, int accomp) { int cf[2]; @@ -1608,8 +1583,7 @@ tty_send_config(mtu, asyncmap, pcomp, accomp) * tty_set_xaccm - set the extended transmit ACCM for the interface. */ void -tty_set_xaccm(accm) - ext_accm accm; +tty_set_xaccm(ext_accm accm) { if (sync_serial) return; @@ -1626,10 +1600,7 @@ tty_set_xaccm(accm) * the ppp interface. */ void -tty_recv_config(mru, asyncmap, pcomp, accomp) - int mru; - u_int32_t asyncmap; - int pcomp, accomp; +tty_recv_config(int mru, u_int32_t asyncmap, int pcomp, int accomp) { int cf[2]; @@ -1659,9 +1630,7 @@ tty_recv_config(mru, asyncmap, pcomp, accomp) * is acceptable for use. */ int -ccp_test(unit, opt_ptr, opt_len, for_transmit) - int unit, opt_len, for_transmit; - u_char *opt_ptr; +ccp_test(int unit, u_char *opt_ptr, int opt_len, int for_transmit) { if (strioctl(pppfd, (for_transmit? PPPIO_XCOMP: PPPIO_RCOMP), opt_ptr, opt_len, 0) >= 0) @@ -1673,8 +1642,7 @@ ccp_test(unit, opt_ptr, opt_len, for_transmit) * ccp_flags_set - inform kernel about the current state of CCP. */ void -ccp_flags_set(unit, isopen, isup) - int unit, isopen, isup; +ccp_flags_set(int unit, int isopen, int isup) { int cf[2]; @@ -1690,9 +1658,7 @@ ccp_flags_set(unit, isopen, isup) * get_idle_time - return how long the link has been idle. */ int -get_idle_time(u, ip) - int u; - struct ppp_idle *ip; +get_idle_time(int u, struct ppp_idle *ip) { return strioctl(pppfd, PPPIO_GIDLE, ip, 0, sizeof(struct ppp_idle)) >= 0; } @@ -1701,9 +1667,7 @@ get_idle_time(u, ip) * get_ppp_stats - return statistics for the link. */ int -get_ppp_stats(u, stats) - int u; - struct pppd_stats *stats; +get_ppp_stats(int u, struct pppd_stats *stats) { struct ppp_stats s; @@ -1724,8 +1688,7 @@ get_ppp_stats(u, stats) * set_filters - transfer the pass and active filters to the kernel. */ int -set_filters(pass, active) - struct bpf_program *pass, *active; +set_filters(struct bpf_program *pass, struct bpf_program *active) { int ret = 1; @@ -1753,8 +1716,7 @@ set_filters(pass, active) * 0 otherwise. This is necessary because of patent nonsense. */ int -ccp_fatal_error(unit) - int unit; +ccp_fatal_error(int unit) { int cf[2]; @@ -1771,8 +1733,7 @@ ccp_fatal_error(unit) * sifvjcomp - config tcp header compression */ int -sifvjcomp(u, vjcomp, xcidcomp, xmaxcid) - int u, vjcomp, xcidcomp, xmaxcid; +sifvjcomp(int u, int vjcomp, int xcidcomp, int xmaxcid) { int cf[2]; char maxcid[2]; @@ -1800,8 +1761,7 @@ sifvjcomp(u, vjcomp, xcidcomp, xmaxcid) * sifup - Config the interface up and enable IP packets to pass. */ int -sifup(u) - int u; +sifup(int u) { struct ifreq ifr; @@ -1823,8 +1783,7 @@ sifup(u) * sifdown - Config the interface down and disable IP. */ int -sifdown(u) - int u; +sifdown(int u) { struct ifreq ifr; @@ -1848,10 +1807,7 @@ sifdown(u) * sifnpmode - Set the mode for handling packets for a given NP. */ int -sifnpmode(u, proto, mode) - int u; - int proto; - enum NPmode mode; +sifnpmode(int u, int proto, enum NPmode mode) { int npi[2]; @@ -1869,8 +1825,7 @@ sifnpmode(u, proto, mode) * sif6up - Config the IPv6 interface up and enable IPv6 packets to pass. */ int -sif6up(u) - int u; +sif6up(int u) { struct lifreq lifr; int fd; @@ -1903,8 +1858,7 @@ sif6up(u) * sifdown - Config the IPv6 interface down and disable IPv6. */ int -sif6down(u) - int u; +sif6down(int u) { struct lifreq lifr; int fd; @@ -1936,9 +1890,7 @@ sif6down(u) * sif6addr - Config the interface with an IPv6 link-local address */ int -sif6addr(u, o, h) - int u; - eui64_t o, h; +sif6addr(int u, eui64_t o, eui64_t h) { struct lifreq lifr; struct sockaddr_storage laddr; @@ -1987,9 +1939,7 @@ sif6addr(u, o, h) * cif6addr - Remove the IPv6 address from interface */ int -cif6addr(u, o, h) - int u; - eui64_t o, h; +cif6addr(int u, eui64_t o, eui64_t h) { return 1; } @@ -1998,9 +1948,7 @@ cif6addr(u, o, h) * sif6defaultroute - assign a default route through the address given. */ int -sif6defaultroute(u, l, g) - int u; - eui64_t l, g; +sif6defaultroute(int u, eui64_t l, eui64_t g) { struct { struct rt_msghdr rtm; @@ -2048,9 +1996,7 @@ sif6defaultroute(u, l, g) * cif6defaultroute - delete a default route through the address given. */ int -cif6defaultroute(u, l, g) - int u; - eui64_t l, g; +cif6defaultroute(int u, eui64_t l, eui64_t g) { /* No need to do this on Solaris; the kernel deletes the route when the interface goes down. */ @@ -2067,9 +2013,7 @@ cif6defaultroute(u, l, g) * sifaddr - Config the interface IP addresses and netmask. */ int -sifaddr(u, o, h, m) - int u; - u_int32_t o, h, m; +sifaddr(int u, u_int32_t o, u_int32_t h, u_int32_t m) { struct ifreq ifr; int ret = 1; @@ -2117,9 +2061,7 @@ sifaddr(u, o, h, m) * through the interface if possible. */ int -cifaddr(u, o, h) - int u; - u_int32_t o, h; +cifaddr(int u, u_int32_t o, u_int32_t h) { #if defined(__USLC__) /* was: #if 0 */ cifroute(unit, ouraddr, hisaddr); @@ -2140,9 +2082,7 @@ cifaddr(u, o, h) * sifdefaultroute - assign a default route through the address given. */ int -sifdefaultroute(u, l, g) - int u; - u_int32_t l, g; +sifdefaultroute(int u, u_int32_t l, u_int32_t g) { struct rtentry rt; @@ -2169,9 +2109,7 @@ sifdefaultroute(u, l, g) * cifdefaultroute - delete a default route through the address given. */ int -cifdefaultroute(u, l, g) - int u; - u_int32_t l, g; +cifdefaultroute(int u, u_int32_t l, u_int32_t g) { struct rtentry rt; @@ -2198,9 +2136,7 @@ cifdefaultroute(u, l, g) * sifproxyarp - Make a proxy ARP entry for the peer. */ int -sifproxyarp(unit, hisaddr) - int unit; - u_int32_t hisaddr; +sifproxyarp(int unit, u_int32_t hisaddr) { struct arpreq arpreq; @@ -2224,9 +2160,7 @@ sifproxyarp(unit, hisaddr) * cifproxyarp - Delete the proxy ARP entry for the peer. */ int -cifproxyarp(unit, hisaddr) - int unit; - u_int32_t hisaddr; +cifproxyarp(int unit, u_int32_t hisaddr) { struct arpreq arpreq; @@ -2249,9 +2183,7 @@ cifproxyarp(unit, hisaddr) #define MAX_IFS 32 static int -get_ether_addr(ipaddr, hwaddr) - u_int32_t ipaddr; - struct sockaddr *hwaddr; +get_ether_addr(u_int32_t ipaddr, struct sockaddr *hwaddr) { struct ifreq *ifr, *ifend, ifreq; int nif; @@ -2320,9 +2252,7 @@ get_ether_addr(ipaddr, hwaddr) * get_hw_addr_dlpi - obtain the hardware address using DLPI */ static int -get_hw_addr_dlpi(name, hwaddr) - char *name; - struct sockaddr *hwaddr; +get_hw_addr_dlpi(char *name, struct sockaddr *hwaddr) { char *q; int unit, iffd, adrlen; @@ -2379,10 +2309,7 @@ get_hw_addr_dlpi(name, hwaddr) * get_hw_addr - obtain the hardware address for a named interface. */ static int -get_hw_addr(name, ina, hwaddr) - char *name; - u_int32_t ina; - struct sockaddr *hwaddr; +get_hw_addr(char *name, u_int32_t ina, struct sockaddr *hwaddr) { /* New way - get the address by doing an arp request. */ int s; @@ -2405,8 +2332,7 @@ get_hw_addr(name, ina, hwaddr) } static int -dlpi_attach(fd, ppa) - int fd, ppa; +dlpi_attach(int fd, int ppa) { dl_attach_req_t req; struct strbuf buf; @@ -2419,8 +2345,7 @@ dlpi_attach(fd, ppa) } static int -dlpi_info_req(fd) - int fd; +dlpi_info_req(int fd) { dl_info_req_t req; struct strbuf buf; @@ -2432,9 +2357,7 @@ dlpi_info_req(fd) } static int -dlpi_get_reply(fd, reply, expected_prim, maxlen) - union DL_primitives *reply; - int fd, expected_prim, maxlen; +dlpi_get_reply(int fd, union DL_primitives *reply, int expected_prim, maxlen) { struct strbuf buf; int flags, n; @@ -2492,8 +2415,7 @@ dlpi_get_reply(fd, reply, expected_prim, maxlen) * user-specified netmask. */ u_int32_t -GetMask(addr) - u_int32_t addr; +GetMask(u_int32_t addr) { u_int32_t mask, nmask, ina; struct ifreq *ifr, *ifend, ifreq; @@ -2561,8 +2483,7 @@ GetMask(addr) * logwtmp - write an accounting record to the /var/adm/wtmp file. */ void -logwtmp(line, name, host) - const char *line, *name, *host; +logwtmp(const char *line, const char *name, const char *host) { static struct utmpx utmpx; @@ -2589,7 +2510,7 @@ logwtmp(line, name, host) * get_host_seed - return the serial number of this machine. */ int -get_host_seed() +get_host_seed(void) { char buf[32]; @@ -2601,9 +2522,7 @@ get_host_seed() } static int -strioctl(fd, cmd, ptr, ilen, olen) - int fd, cmd, ilen, olen; - void *ptr; +strioctl(int fd, int cmd, void *ptr, int ilen, int olen) { struct strioctl str; @@ -2628,8 +2547,7 @@ strioctl(fd, cmd, ptr, ilen, olen) static char lock_file[40]; /* name of lock file created */ int -lock(dev) - char *dev; +lock(char *dev) { int n, fd, pid; struct stat sbuf; @@ -2690,7 +2608,7 @@ lock(dev) * unlock - remove our lockfile */ void -unlock() +unlock(void) { if (lock_file[0]) { unlink(lock_file); @@ -2703,9 +2621,7 @@ unlock() * cifroute - delete a route through the addresses given. */ int -cifroute(u, our, his) - int u; - u_int32_t our, his; +cifroute(int u, u_int32_t our, u_int32_t his) { struct rtentry rt; @@ -2736,8 +2652,7 @@ cifroute(u, our, his) #endif int -have_route_to(addr) - u_int32_t addr; +have_route_to(u_int32_t addr) { #ifdef SOL2 int fd, r, flags, i; @@ -2840,11 +2755,7 @@ have_route_to(addr) * the uid given. Assumes slave_name points to MAXPATHLEN bytes of space. */ int -get_pty(master_fdp, slave_fdp, slave_name, uid) - int *master_fdp; - int *slave_fdp; - char *slave_name; - int uid; +get_pty(int *master_fdp, int *slave_fdp, char *slave_name, int uid) { int mfd, sfd; char *pty_name; diff --git a/pppd/tty.c b/pppd/tty.c index 4d5b2db..852cee7 100644 --- a/pppd/tty.c +++ b/pppd/tty.c @@ -68,8 +68,6 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: tty.c,v 1.27 2008/07/01 12:27:56 paulus Exp $" - #include #include #include @@ -97,28 +95,28 @@ #include "fsm.h" #include "lcp.h" -void tty_process_extra_options __P((void)); -void tty_check_options __P((void)); -int connect_tty __P((void)); -void disconnect_tty __P((void)); -void tty_close_fds __P((void)); -void cleanup_tty __P((void)); -void tty_do_send_config __P((int, u_int32_t, int, int)); - -static int setdevname __P((char *, char **, int)); -static int setspeed __P((char *, char **, int)); -static int setxonxoff __P((char **)); -static int setescape __P((char **)); -static void printescape __P((option_t *, void (*)(void *, char *,...),void *)); -static void finish_tty __P((void)); -static int start_charshunt __P((int, int)); -static void stop_charshunt __P((void *, int)); -static void charshunt_done __P((void *)); -static void charshunt __P((int, int, char *)); -static int record_write __P((FILE *, int code, u_char *buf, int nb, - struct timeval *)); -static int open_socket __P((char *)); -static void maybe_relock __P((void *, int)); +void tty_process_extra_options(void); +void tty_check_options(void); +int connect_tty(void); +void disconnect_tty(void); +void tty_close_fds(void); +void cleanup_tty(void); +void tty_do_send_config(int, u_int32_t, int, int); + +static int setdevname(char *, char **, int); +static int setspeed(char *, char **, int); +static int setxonxoff(char **); +static int setescape(char **); +static void printescape(option_t *, void (*)(void *, char *,...),void *); +static void finish_tty(void); +static int start_charshunt(int, int); +static void stop_charshunt(void *, int); +static void charshunt_done(void *); +static void charshunt(int, int, char *); +static int record_write(FILE *, int code, u_char *buf, int nb, + struct timeval *); +static int open_socket(char *); +static void maybe_relock(void *, int); static int pty_master; /* fd for master side of pty */ static int pty_slave; /* fd for slave side of pty */ @@ -265,10 +263,7 @@ struct channel tty_channel = { * potentially a speed value. */ static int -setspeed(arg, argv, doit) - char *arg; - char **argv; - int doit; +setspeed(char *arg, char **argv, int doit) { char *ptr; int spd; @@ -290,10 +285,7 @@ setspeed(arg, argv, doit) * potentially a device name. */ static int -setdevname(cp, argv, doit) - char *cp; - char **argv; - int doit; +setdevname(char *cp, char **argv, int doit) { struct stat statbuf; char dev[MAXPATHLEN]; @@ -332,8 +324,7 @@ setdevname(cp, argv, doit) } static int -setxonxoff(argv) - char **argv; +setxonxoff(char **argv) { lcp_wantoptions[0].asyncmap |= 0x000A0000; /* escape ^S and ^Q */ lcp_wantoptions[0].neg_asyncmap = 1; @@ -346,8 +337,7 @@ setxonxoff(argv) * setescape - add chars to the set we escape on transmission. */ static int -setescape(argv) - char **argv; +setescape(char **argv) { int n, ret; char *p, *endp; @@ -375,10 +365,7 @@ setescape(argv) } static void -printescape(opt, printer, arg) - option_t *opt; - void (*printer) __P((void *, char *, ...)); - void *arg; +printescape(option_t *opt, void (*printer)(void *, char *, ...), void *arg) { int n; int first = 1; @@ -401,7 +388,7 @@ printescape(opt, printer, arg) /* * tty_init - do various tty-related initializations. */ -void tty_init() +void tty_init(void) { add_notifier(&pidchange, maybe_relock, 0); the_channel = &tty_channel; @@ -412,7 +399,7 @@ void tty_init() * tty_process_extra_options - work out which tty device we are using * and read its options file. */ -void tty_process_extra_options() +void tty_process_extra_options(void) { using_pty = notty || ptycommand != NULL || pty_socket != NULL; if (using_pty) @@ -444,7 +431,7 @@ void tty_process_extra_options() * tty_check_options - do consistency checks on the options we were given. */ void -tty_check_options() +tty_check_options(void) { struct stat statbuf; int fdflags; @@ -514,7 +501,7 @@ tty_check_options() * That is, open the serial port, set its speed and mode, and run * the connector and/or welcomer. */ -int connect_tty() +int connect_tty(void) { char *connector; int fdflags; @@ -772,7 +759,7 @@ int connect_tty() } -void disconnect_tty() +void disconnect_tty(void) { if (disconnect_script == NULL || hungup) return; @@ -786,7 +773,7 @@ void disconnect_tty() stop_charshunt(NULL, 0); } -void tty_close_fds() +void tty_close_fds(void) { if (pty_slave >= 0) close(pty_slave); @@ -797,7 +784,7 @@ void tty_close_fds() /* N.B. ttyfd will == either pty_slave or real_ttyfd */ } -void cleanup_tty() +void cleanup_tty(void) { if (real_ttyfd >= 0) finish_tty(); @@ -813,10 +800,7 @@ void cleanup_tty() * We set the extended transmit ACCM here as well. */ void -tty_do_send_config(mtu, accm, pcomp, accomp) - int mtu; - u_int32_t accm; - int pcomp, accomp; +tty_do_send_config(int mtu, u_int32_t accm, int pcomp, int accomp) { tty_set_xaccm(xmit_accm); tty_send_config(mtu, accm, pcomp, accomp); @@ -826,7 +810,7 @@ tty_do_send_config(mtu, accm, pcomp, accomp) * finish_tty - restore the terminal device to its original settings */ static void -finish_tty() +finish_tty(void) { /* drop dtr to hang up */ if (!default_device && modem) { @@ -855,9 +839,7 @@ finish_tty() * maybe_relock - our PID has changed, maybe update the lock file. */ static void -maybe_relock(arg, pid) - void *arg; - int pid; +maybe_relock(void *arg, int pid) { if (locked) relock(pid); @@ -868,8 +850,7 @@ maybe_relock(arg, pid) * host and port. */ static int -open_socket(dest) - char *dest; +open_socket(char *dest) { char *sep, *endp = NULL; int sock, port = -1; @@ -922,8 +903,7 @@ open_socket(dest) * start_charshunt - create a child process to run the character shunt. */ static int -start_charshunt(ifd, ofd) - int ifd, ofd; +start_charshunt(int ifd, int ofd) { int cpid; @@ -952,16 +932,13 @@ start_charshunt(ifd, ofd) } static void -charshunt_done(arg) - void *arg; +charshunt_done(void *arg) { charshunt_pid = 0; } static void -stop_charshunt(arg, sig) - void *arg; - int sig; +stop_charshunt(void *arg, int sig) { if (charshunt_pid) kill(charshunt_pid, (sig == SIGINT? sig: SIGTERM)); @@ -974,9 +951,7 @@ stop_charshunt(arg, sig) * (We assume ofd >= ifd which is true the way this gets called. :-). */ static void -charshunt(ifd, ofd, record_file) - int ifd, ofd; - char *record_file; +charshunt(int ifd, int ofd, char *record_file) { int n, nfds; fd_set ready, writey; @@ -1224,12 +1199,7 @@ charshunt(ifd, ofd, record_file) } static int -record_write(f, code, buf, nb, tp) - FILE *f; - int code; - u_char *buf; - int nb; - struct timeval *tp; +record_write(FILE *f, int code, u_char *buf, int nb, struct timeval *tp) { struct timeval now; int diff; diff --git a/pppd/upap.c b/pppd/upap.c index 8733533..0ae0288 100644 --- a/pppd/upap.c +++ b/pppd/upap.c @@ -40,8 +40,6 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: upap.c,v 1.30 2005/07/13 10:41:58 paulus Exp $" - /* * TODO: */ @@ -77,13 +75,13 @@ static option_t pap_option_list[] = { /* * Protocol entry points. */ -static void upap_init __P((int)); -static void upap_lowerup __P((int)); -static void upap_lowerdown __P((int)); -static void upap_input __P((int, u_char *, int)); -static void upap_protrej __P((int)); -static int upap_printpkt __P((u_char *, int, - void (*) __P((void *, char *, ...)), void *)); +static void upap_init(int); +static void upap_lowerup(int); +static void upap_lowerdown(int); +static void upap_input(int, u_char *, int); +static void upap_protrej(int); +static int upap_printpkt(u_char *, int, + void (*)(void *, char *, ...), void *); struct protent pap_protent = { PPP_PAP, @@ -107,21 +105,20 @@ struct protent pap_protent = { upap_state upap[NUM_PPP]; /* UPAP state; one for each unit */ -static void upap_timeout __P((void *)); -static void upap_reqtimeout __P((void *)); -static void upap_rauthreq __P((upap_state *, u_char *, int, int)); -static void upap_rauthack __P((upap_state *, u_char *, int, int)); -static void upap_rauthnak __P((upap_state *, u_char *, int, int)); -static void upap_sauthreq __P((upap_state *)); -static void upap_sresp __P((upap_state *, int, int, char *, int)); +static void upap_timeout(void *); +static void upap_reqtimeout(void *); +static void upap_rauthreq(upap_state *, u_char *, int, int); +static void upap_rauthack(upap_state *, u_char *, int, int); +static void upap_rauthnak(upap_state *, u_char *, int, int); +static void upap_sauthreq(upap_state *); +static void upap_sresp(upap_state *, int, int, char *, int); /* * upap_init - Initialize a UPAP unit. */ static void -upap_init(unit) - int unit; +upap_init(int unit) { upap_state *u = &upap[unit]; @@ -145,9 +142,7 @@ upap_init(unit) * Set new state and send authenticate's. */ void -upap_authwithpeer(unit, user, password) - int unit; - char *user, *password; +upap_authwithpeer(int unit, char *user, char *password) { upap_state *u = &upap[unit]; @@ -175,8 +170,7 @@ upap_authwithpeer(unit, user, password) * Set new state. */ void -upap_authpeer(unit) - int unit; +upap_authpeer(int unit) { upap_state *u = &upap[unit]; @@ -197,8 +191,7 @@ upap_authpeer(unit) * upap_timeout - Retransmission timer for sending auth-reqs expired. */ static void -upap_timeout(arg) - void *arg; +upap_timeout(void *arg) { upap_state *u = (upap_state *) arg; @@ -221,8 +214,7 @@ upap_timeout(arg) * upap_reqtimeout - Give up waiting for the peer to send an auth-req. */ static void -upap_reqtimeout(arg) - void *arg; +upap_reqtimeout(void *arg) { upap_state *u = (upap_state *) arg; @@ -240,8 +232,7 @@ upap_reqtimeout(arg) * Start authenticating if pending. */ static void -upap_lowerup(unit) - int unit; +upap_lowerup(int unit) { upap_state *u = &upap[unit]; @@ -267,8 +258,7 @@ upap_lowerup(unit) * Cancel all timeouts. */ static void -upap_lowerdown(unit) - int unit; +upap_lowerdown(int unit) { upap_state *u = &upap[unit]; @@ -288,8 +278,7 @@ upap_lowerdown(unit) * This shouldn't happen. In any case, pretend lower layer went down. */ static void -upap_protrej(unit) - int unit; +upap_protrej(int unit) { upap_state *u = &upap[unit]; @@ -309,10 +298,7 @@ upap_protrej(unit) * upap_input - Input UPAP packet. */ static void -upap_input(unit, inpacket, l) - int unit; - u_char *inpacket; - int l; +upap_input(int unit, u_char *inpacket, int l) { upap_state *u = &upap[unit]; u_char *inp; @@ -367,11 +353,7 @@ upap_input(unit, inpacket, l) * upap_rauth - Receive Authenticate. */ static void -upap_rauthreq(u, inp, id, len) - upap_state *u; - u_char *inp; - int id; - int len; +upap_rauthreq(upap_state *u, u_char *inp, int id, int len) { u_char ruserlen, rpasswdlen; char *ruser, *rpasswd; @@ -465,11 +447,7 @@ upap_rauthreq(u, inp, id, len) * upap_rauthack - Receive Authenticate-Ack. */ static void -upap_rauthack(u, inp, id, len) - upap_state *u; - u_char *inp; - int id; - int len; +upap_rauthack(upap_state *u, u_char *inp, int id, int len) { u_char msglen; char *msg; @@ -505,11 +483,7 @@ upap_rauthack(u, inp, id, len) * upap_rauthnak - Receive Authenticate-Nak. */ static void -upap_rauthnak(u, inp, id, len) - upap_state *u; - u_char *inp; - int id; - int len; +upap_rauthnak(upap_state *u, u_char *inp, int id, int len) { u_char msglen; char *msg; @@ -546,8 +520,7 @@ upap_rauthnak(u, inp, id, len) * upap_sauthreq - Send an Authenticate-Request. */ static void -upap_sauthreq(u) - upap_state *u; +upap_sauthreq(upap_state *u) { u_char *outp; int outlen; @@ -579,11 +552,7 @@ upap_sauthreq(u) * upap_sresp - Send a response (ack or nak). */ static void -upap_sresp(u, code, id, msg, msglen) - upap_state *u; - u_char code, id; - char *msg; - int msglen; +upap_sresp(upap_state *u, int code, int id, char *msg, int msglen) { u_char *outp; int outlen; @@ -608,11 +577,7 @@ static char *upap_codenames[] = { }; static int -upap_printpkt(p, plen, printer, arg) - u_char *p; - int plen; - void (*printer) __P((void *, char *, ...)); - void *arg; +upap_printpkt(u_char *p, int plen, void (*printer)(void *, char *, ...), void *arg) { int code, id, len; int mlen, ulen, wlen; diff --git a/pppd/upap.h b/pppd/upap.h index 5cb59e9..99b007f 100644 --- a/pppd/upap.h +++ b/pppd/upap.h @@ -38,8 +38,6 @@ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * $Id: upap.h,v 1.8 2002/12/04 23:03:33 paulus Exp $ */ /* @@ -104,7 +102,7 @@ typedef struct upap_state { extern upap_state upap[]; -void upap_authwithpeer __P((int, char *, char *)); -void upap_authpeer __P((int)); +void upap_authwithpeer(int, char *, char *); +void upap_authpeer(int); extern struct protent pap_protent; diff --git a/pppd/utils.c b/pppd/utils.c index 23189d0..7228279 100644 --- a/pppd/utils.c +++ b/pppd/utils.c @@ -28,8 +28,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: utils.c,v 1.25 2008/06/03 12:06:37 paulus Exp $" - +#include #include #include #include @@ -64,10 +63,10 @@ extern char *strerror(); #endif -static void logit __P((int, char *, va_list)); -static void log_write __P((int, char *)); -static void vslp_printer __P((void *, char *, ...)); -static void format_packet __P((u_char *, int, printer_func, void *)); +static void logit(int, char *, va_list); +static void log_write(int, char *); +static void vslp_printer(void *, char *, ...); +static void format_packet(u_char *, int, printer_func, void *); struct buffer_info { char *ptr; @@ -79,10 +78,7 @@ struct buffer_info { * always leaves destination null-terminated (for len > 0). */ size_t -strlcpy(dest, src, len) - char *dest; - const char *src; - size_t len; +strlcpy(char *dest, const char *src, size_t len) { size_t ret = strlen(src); @@ -102,10 +98,7 @@ strlcpy(dest, src, len) * always leaves destination null-terminated (for len > 0). */ size_t -strlcat(dest, src, len) - char *dest; - const char *src; - size_t len; +strlcat(char *dest, const char *src, size_t len) { size_t dlen = strlen(dest); @@ -122,22 +115,12 @@ strlcat(dest, src, len) * Returns the number of chars put into buf. */ int -slprintf __V((char *buf, int buflen, char *fmt, ...)) +slprintf(char *buf, int buflen, char *fmt, ...) { va_list args; int n; -#if defined(__STDC__) va_start(args, fmt); -#else - char *buf; - int buflen; - char *fmt; - va_start(args); - buf = va_arg(args, char *); - buflen = va_arg(args, int); - fmt = va_arg(args, char *); -#endif n = vslprintf(buf, buflen, fmt, args); va_end(args); return n; @@ -149,11 +132,7 @@ slprintf __V((char *buf, int buflen, char *fmt, ...)) #define OUTCHAR(c) (buflen > 0? (--buflen, *buf++ = (c)): 0) int -vslprintf(buf, buflen, fmt, args) - char *buf; - int buflen; - char *fmt; - va_list args; +vslprintf(char *buf, int buflen, char *fmt, va_list args) { int c, i, n; int width, prec, fillch; @@ -417,21 +396,13 @@ vslprintf(buf, buflen, fmt, args) * vslp_printer - used in processing a %P format */ static void -vslp_printer __V((void *arg, char *fmt, ...)) +vslp_printer(void *arg, char *fmt, ...) { int n; va_list pvar; struct buffer_info *bi; -#if defined(__STDC__) va_start(pvar, fmt); -#else - void *arg; - char *fmt; - va_start(pvar); - arg = va_arg(pvar, void *); - fmt = va_arg(pvar, char *); -#endif bi = (struct buffer_info *) arg; n = vslprintf(bi->ptr, bi->len, fmt, pvar); @@ -447,11 +418,7 @@ vslp_printer __V((void *arg, char *fmt, ...)) */ void -log_packet(p, len, prefix, level) - u_char *p; - int len; - char *prefix; - int level; +log_packet(u_char *p, int len, char *prefix, int level) { init_pr_log(prefix, level); format_packet(p, len, pr_log, &level); @@ -464,11 +431,7 @@ log_packet(p, len, prefix, level) * calling `printer(arg, format, ...)' to output it. */ static void -format_packet(p, len, printer, arg) - u_char *p; - int len; - printer_func printer; - void *arg; +format_packet(u_char *p, int len, printer_func printer, void *arg) { int i, n; u_short proto; @@ -518,9 +481,7 @@ static char *linep; /* current pointer within line */ static int llevel; /* level for logging */ void -init_pr_log(prefix, level) - const char *prefix; - int level; +init_pr_log(const char *prefix, int level) { linep = line; if (prefix != NULL) { @@ -531,7 +492,7 @@ init_pr_log(prefix, level) } void -end_pr_log() +end_pr_log(void) { if (linep != line) { *linep = 0; @@ -543,22 +504,14 @@ end_pr_log() * pr_log - printer routine for outputting to syslog */ void -pr_log __V((void *arg, char *fmt, ...)) +pr_log(void *arg, char *fmt, ...) { int l, n; va_list pvar; char *p, *eol; char buf[256]; -#if defined(__STDC__) va_start(pvar, fmt); -#else - void *arg; - char *fmt; - va_start(pvar); - arg = va_arg(pvar, void *); - fmt = va_arg(pvar, char *); -#endif n = vslprintf(buf, sizeof(buf), fmt, pvar); va_end(pvar); @@ -602,11 +555,7 @@ pr_log __V((void *arg, char *fmt, ...)) * printer. */ void -print_string(p, len, printer, arg) - char *p; - int len; - printer_func printer; - void *arg; +print_string(char *p, int len, printer_func printer, void *arg) { int c; @@ -640,10 +589,7 @@ print_string(p, len, printer, arg) * logit - does the hard work for fatal et al. */ static void -logit(level, fmt, args) - int level; - char *fmt; - va_list args; +logit(int level, char *fmt, va_list args) { char buf[1024]; @@ -652,9 +598,7 @@ logit(level, fmt, args) } static void -log_write(level, buf) - int level; - char *buf; +log_write(int level, char *buf) { syslog(level, "%s", buf); if (log_to_fd >= 0 && (level != LOG_DEBUG || debug)) { @@ -672,17 +616,11 @@ log_write(level, buf) * fatal - log an error message and die horribly. */ void -fatal __V((char *fmt, ...)) +fatal(char *fmt, ...) { va_list pvar; -#if defined(__STDC__) va_start(pvar, fmt); -#else - char *fmt; - va_start(pvar); - fmt = va_arg(pvar, char *); -#endif logit(LOG_ERR, fmt, pvar); va_end(pvar); @@ -694,17 +632,11 @@ fatal __V((char *fmt, ...)) * error - log an error message. */ void -error __V((char *fmt, ...)) +error(char *fmt, ...) { va_list pvar; -#if defined(__STDC__) va_start(pvar, fmt); -#else - char *fmt; - va_start(pvar); - fmt = va_arg(pvar, char *); -#endif logit(LOG_ERR, fmt, pvar); va_end(pvar); @@ -715,17 +647,11 @@ error __V((char *fmt, ...)) * warn - log a warning message. */ void -warn __V((char *fmt, ...)) +warn(char *fmt, ...) { va_list pvar; -#if defined(__STDC__) va_start(pvar, fmt); -#else - char *fmt; - va_start(pvar); - fmt = va_arg(pvar, char *); -#endif logit(LOG_WARNING, fmt, pvar); va_end(pvar); @@ -735,17 +661,11 @@ warn __V((char *fmt, ...)) * notice - log a notice-level message. */ void -notice __V((char *fmt, ...)) +notice(char *fmt, ...) { va_list pvar; -#if defined(__STDC__) va_start(pvar, fmt); -#else - char *fmt; - va_start(pvar); - fmt = va_arg(pvar, char *); -#endif logit(LOG_NOTICE, fmt, pvar); va_end(pvar); @@ -755,17 +675,11 @@ notice __V((char *fmt, ...)) * info - log an informational message. */ void -info __V((char *fmt, ...)) +info(char *fmt, ...) { va_list pvar; -#if defined(__STDC__) va_start(pvar, fmt); -#else - char *fmt; - va_start(pvar); - fmt = va_arg(pvar, char *); -#endif logit(LOG_INFO, fmt, pvar); va_end(pvar); @@ -775,17 +689,11 @@ info __V((char *fmt, ...)) * dbglog - log a debug message. */ void -dbglog __V((char *fmt, ...)) +dbglog(char *fmt, ...) { va_list pvar; -#if defined(__STDC__) va_start(pvar, fmt); -#else - char *fmt; - va_start(pvar); - fmt = va_arg(pvar, char *); -#endif logit(LOG_DEBUG, fmt, pvar); va_end(pvar); @@ -866,8 +774,7 @@ static char lock_file[MAXPATHLEN]; * lock - create a lock file for the named device */ int -lock(dev) - char *dev; +lock(char *dev) { #ifdef LOCKLIB int result; @@ -995,8 +902,7 @@ lock(dev) * between when the parent died and the child rewrote the lockfile). */ int -relock(pid) - int pid; +relock(int pid) { #ifdef LOCKLIB /* XXX is there a way to do this? */ @@ -1031,7 +937,7 @@ relock(pid) * unlock - remove our lockfile */ void -unlock() +unlock(void) { if (lock_file[0]) { #ifdef LOCKLIB diff --git a/pppdump/bsd-comp.c b/pppdump/bsd-comp.c index 966e958..9d45f0b 100644 --- a/pppdump/bsd-comp.c +++ b/pppdump/bsd-comp.c @@ -124,15 +124,15 @@ struct bsd_db { #define BSD_OVHD 2 /* BSD compress overhead/packet */ #define BSD_INIT_BITS BSD_MIN_BITS -static void *bsd_decomp_alloc __P((u_char *options, int opt_len)); -static void bsd_free __P((void *state)); -static int bsd_decomp_init __P((void *state, u_char *options, int opt_len, - int unit, int hdrlen, int mru, int debug)); -static void bsd_incomp __P((void *state, u_char *dmsg, int len)); -static int bsd_decompress __P((void *state, u_char *cmp, int inlen, - u_char *dmp, int *outlen)); -static void bsd_reset __P((void *state)); -static void bsd_comp_stats __P((void *state, struct compstat *stats)); +static void *bsd_decomp_alloc(u_char *options, int opt_len); +static void bsd_free(void *state); +static int bsd_decomp_init(void *state, u_char *options, int opt_len, + int unit, int hdrlen, int mru, int debug); +static void bsd_incomp(void *state, u_char *dmsg, int len); +static int bsd_decompress(void *state, u_char *cmp, int inlen, + u_char *dmp, int *outlen); +static void bsd_reset(void *state); +static void bsd_comp_stats(void *state, struct compstat *stats); /* * Exported procedures. @@ -174,8 +174,7 @@ struct compressor ppp_bsd_compress = { * clear the dictionary */ static void -bsd_clear(db) - struct bsd_db *db; +bsd_clear(struct bsd_db *db) { db->clear_count++; db->max_ent = FIRST-1; @@ -200,8 +199,7 @@ bsd_clear(db) * must compute the same ratio. */ static int /* 1=output CLEAR */ -bsd_check(db) - struct bsd_db *db; +bsd_check(struct bsd_db *db) { u_int new_ratio; @@ -241,9 +239,7 @@ bsd_check(db) * Return statistics. */ static void -bsd_comp_stats(state, stats) - void *state; - struct compstat *stats; +bsd_comp_stats(void *state, struct compstat *stats) { struct bsd_db *db = (struct bsd_db *) state; u_int out; @@ -268,8 +264,7 @@ bsd_comp_stats(state, stats) * Reset state, as on a CCP ResetReq. */ static void -bsd_reset(state) - void *state; +bsd_reset(void *state) { struct bsd_db *db = (struct bsd_db *) state; @@ -282,9 +277,7 @@ bsd_reset(state) * Allocate space for a (de) compressor. */ static void * -bsd_alloc(options, opt_len, decomp) - u_char *options; - int opt_len, decomp; +bsd_alloc(u_char *options, int opt_len, int decomp) { int bits; u_int newlen, hsize, hshift, maxmaxcode; @@ -350,8 +343,7 @@ bsd_alloc(options, opt_len, decomp) } static void -bsd_free(state) - void *state; +bsd_free(void *state) { struct bsd_db *db = (struct bsd_db *) state; @@ -361,9 +353,7 @@ bsd_free(state) } static void * -bsd_decomp_alloc(options, opt_len) - u_char *options; - int opt_len; +bsd_decomp_alloc(u_char *options, int opt_len) { return bsd_alloc(options, opt_len, 1); } @@ -372,10 +362,8 @@ bsd_decomp_alloc(options, opt_len) * Initialize the database. */ static int -bsd_init(db, options, opt_len, unit, hdrlen, mru, debug, decomp) - struct bsd_db *db; - u_char *options; - int opt_len, unit, hdrlen, mru, debug, decomp; +bsd_init(struct bsd_db *db, u_char *options, int opt_len, int unit, + int hdrlen, int mru, int debug, int decomp) { int i; @@ -409,10 +397,8 @@ bsd_init(db, options, opt_len, unit, hdrlen, mru, debug, decomp) } static int -bsd_decomp_init(state, options, opt_len, unit, hdrlen, mru, debug) - void *state; - u_char *options; - int opt_len, unit, hdrlen, mru, debug; +bsd_decomp_init(void *state, u_char *options, int opt_len, + int unit, int hdrlen, int mru, int debug) { return bsd_init((struct bsd_db *) state, options, opt_len, unit, hdrlen, mru, debug, 1); @@ -424,10 +410,7 @@ bsd_decomp_init(state, options, opt_len, unit, hdrlen, mru, debug) * incompressible data by pretending to compress the incoming data. */ static void -bsd_incomp(state, dmsg, mlen) - void *state; - u_char *dmsg; - int mlen; +bsd_incomp(void *state, u_char *dmsg, int mlen) { struct bsd_db *db = (struct bsd_db *) state; u_int hshift = db->hshift; @@ -544,10 +527,7 @@ bsd_incomp(state, dmsg, mlen) * compression, even though they are detected by inspecting the input. */ static int -bsd_decompress(state, cmsg, inlen, dmp, outlenp) - void *state; - u_char *cmsg, *dmp; - int inlen, *outlenp; +bsd_decompress(void *state, u_char *cmsg, int inlen, u_char *dmp, int *outlenp) { struct bsd_db *db = (struct bsd_db *) state; u_int max_ent = db->max_ent; diff --git a/pppdump/deflate.c b/pppdump/deflate.c index 43c9c51..5668a4d 100644 --- a/pppdump/deflate.c +++ b/pppdump/deflate.c @@ -65,17 +65,17 @@ struct deflate_state { #define DEFLATE_OVHD 2 /* Deflate overhead/packet */ -static void *z_alloc __P((void *, u_int items, u_int size)); -static void z_free __P((void *, void *ptr, u_int nb)); -static void *z_decomp_alloc __P((u_char *options, int opt_len)); -static void z_decomp_free __P((void *state)); -static int z_decomp_init __P((void *state, u_char *options, int opt_len, - int unit, int hdrlen, int mru, int debug)); -static void z_incomp __P((void *state, u_char *dmsg, int len)); -static int z_decompress __P((void *state, u_char *cmp, int inlen, - u_char *dmp, int *outlenp)); -static void z_decomp_reset __P((void *state)); -static void z_comp_stats __P((void *state, struct compstat *stats)); +static void *z_alloc(void *, u_int items, u_int size); +static void z_free(void *, void *ptr, u_int nb); +static void *z_decomp_alloc(u_char *options, int opt_len); +static void z_decomp_free(void *state); +static int z_decomp_init(void *state, u_char *options, int opt_len, + int unit, int hdrlen, int mru, int debug); +static void z_incomp(void *state, u_char *dmsg, int len); +static int z_decompress(void *state, u_char *cmp, int inlen, + u_char *dmp, int *outlenp); +static void z_decomp_reset(void *state); +static void z_comp_stats(void *state, struct compstat *stats); /* * Procedures exported to if_ppp.c. @@ -95,26 +95,19 @@ struct compressor ppp_deflate = { * Space allocation and freeing routines for use by zlib routines. */ static void * -z_alloc(notused, items, size) - void *notused; - u_int items, size; +z_alloc(void *notused, u_int items, u_int size) { return malloc(items * size); } static void -z_free(notused, ptr, nbytes) - void *notused; - void *ptr; - u_int nbytes; +z_free(void *notused, void *ptr, u_int nbytes) { free(ptr); } static void -z_comp_stats(arg, stats) - void *arg; - struct compstat *stats; +z_comp_stats(void *arg, struct compstat *stats) { struct deflate_state *state = (struct deflate_state *) arg; u_int out; @@ -134,9 +127,7 @@ z_comp_stats(arg, stats) * Allocate space for a decompressor. */ static void * -z_decomp_alloc(options, opt_len) - u_char *options; - int opt_len; +z_decomp_alloc(u_char *options, int opt_len) { struct deflate_state *state; int w_size; @@ -168,8 +159,7 @@ z_decomp_alloc(options, opt_len) } static void -z_decomp_free(arg) - void *arg; +z_decomp_free(void *arg) { struct deflate_state *state = (struct deflate_state *) arg; @@ -178,10 +168,8 @@ z_decomp_free(arg) } static int -z_decomp_init(arg, options, opt_len, unit, hdrlen, mru, debug) - void *arg; - u_char *options; - int opt_len, unit, hdrlen, mru, debug; +z_decomp_init(void *arg, u_char *options, int opt_len, + int unit, int hdrlen, int mru, int debug) { struct deflate_state *state = (struct deflate_state *) arg; @@ -204,8 +192,7 @@ z_decomp_init(arg, options, opt_len, unit, hdrlen, mru, debug) } static void -z_decomp_reset(arg) - void *arg; +z_decomp_reset(void *arg) { struct deflate_state *state = (struct deflate_state *) arg; @@ -230,10 +217,7 @@ z_decomp_reset(arg) * compression, even though they are detected by inspecting the input. */ static int -z_decompress(arg, mi, inlen, mo, outlenp) - void *arg; - u_char *mi, *mo; - int inlen, *outlenp; +z_decompress(void *arg, u_char *mi, int inlen, u_char *mo, int *outlenp) { struct deflate_state *state = (struct deflate_state *) arg; u_char *rptr, *wptr; @@ -302,10 +286,7 @@ z_decompress(arg, mi, inlen, mo, outlenp) * Incompressible data has arrived - add it to the history. */ static void -z_incomp(arg, mi, mlen) - void *arg; - u_char *mi; - int mlen; +z_incomp(void *arg, u_char *mi, int mlen) { struct deflate_state *state = (struct deflate_state *) arg; u_char *rptr; diff --git a/pppdump/ppp-comp.h b/pppdump/ppp-comp.h index 4be51d0..4046a1f 100644 --- a/pppdump/ppp-comp.h +++ b/pppdump/ppp-comp.h @@ -58,21 +58,21 @@ struct compressor { int compress_proto; /* CCP compression protocol number */ /* Allocate space for a decompressor (receive side) */ - void *(*decomp_alloc) __P((u_char *options, int opt_len)); + void *(*decomp_alloc)(u_char *options, int opt_len); /* Free space used by a decompressor */ - void (*decomp_free) __P((void *state)); + void (*decomp_free)(void *state); /* Initialize a decompressor */ - int (*decomp_init) __P((void *state, u_char *options, int opt_len, - int unit, int hdrlen, int mru, int debug)); + int (*decomp_init)(void *state, u_char *options, int opt_len, + int unit, int hdrlen, int mru, int debug); /* Reset a decompressor */ - void (*decomp_reset) __P((void *state)); + void (*decomp_reset)(void *state); /* Decompress a packet. */ - int (*decompress) __P((void *state, u_char *mp, int inlen, - u_char *dmp, int *outlen)); + int (*decompress)(void *state, u_char *mp, int inlen, + u_char *dmp, int *outlen); /* Update state for an incompressible packet received */ - void (*incomp) __P((void *state, u_char *mp, int len)); + void (*incomp)(void *state, u_char *mp, int len); /* Return decompression statistics */ - void (*decomp_stat) __P((void *state, struct compstat *stats)); + void (*decomp_stat)(void *state, struct compstat *stats); }; /* diff --git a/pppstats/pppstats.c b/pppstats/pppstats.c index 843f7ea..92ebc2a 100644 --- a/pppstats/pppstats.c +++ b/pppstats/pppstats.c @@ -106,16 +106,16 @@ extern char *optarg; #define PPP_DRV_NAME "ppp" #endif /* !defined(PPP_DRV_NAME) */ -static void usage __P((void)); -static void catchalarm __P((int)); -static void get_ppp_stats __P((struct ppp_stats *)); -static void get_ppp_cstats __P((struct ppp_comp_stats *)); -static void intpr __P((void)); +static void usage(void); +static void catchalarm(int); +static void get_ppp_stats(struct ppp_stats *); +static void get_ppp_cstats(struct ppp_comp_stats *); +static void intpr(void); -int main __P((int, char *argv[])); +int main(int, char *argv[]); static void -usage() +usage(void) { fprintf(stderr, "Usage: %s [-a|-d] [-v|-r|-z] [-c count] [-w wait] [interface]\n", progname); @@ -127,8 +127,7 @@ usage() * Sets a flag to not wait for the alarm. */ static void -catchalarm(arg) - int arg; +catchalarm(int arg) { signalled = 1; } @@ -136,8 +135,7 @@ catchalarm(arg) #ifndef STREAMS static void -get_ppp_stats(curp) - struct ppp_stats *curp; +get_ppp_stats(struct ppp_stats *curp) { struct ifpppstatsreq req; @@ -163,8 +161,7 @@ get_ppp_stats(curp) } static void -get_ppp_cstats(csp) - struct ppp_comp_stats *csp; +get_ppp_cstats(struct ppp_comp_stats *csp) { struct ifpppcstatsreq creq; @@ -219,9 +216,7 @@ get_ppp_cstats(csp) #else /* STREAMS */ int -strioctl(fd, cmd, ptr, ilen, olen) - int fd, cmd, ilen, olen; - char *ptr; +strioctl(int fd, int cmd, char *ptr, int ilen, int olen) { struct strioctl str; @@ -238,8 +233,7 @@ strioctl(fd, cmd, ptr, ilen, olen) } static void -get_ppp_stats(curp) - struct ppp_stats *curp; +get_ppp_stats(struct ppp_stats *curp) { if (strioctl(s, PPPIO_GETSTAT, curp, 0, sizeof(*curp)) < 0) { fprintf(stderr, "%s: ", progname); @@ -252,8 +246,7 @@ get_ppp_stats(curp) } static void -get_ppp_cstats(csp) - struct ppp_comp_stats *csp; +get_ppp_cstats(struct ppp_comp_stats *csp) { if (strioctl(s, PPPIO_GETCSTAT, csp, 0, sizeof(*csp)) < 0) { fprintf(stderr, "%s: ", progname); @@ -287,7 +280,7 @@ get_ppp_cstats(csp) * First line printed is cumulative. */ static void -intpr() +intpr(void) { register int line = 0; sigset_t oldmask, mask; @@ -444,9 +437,7 @@ intpr() } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int c; #ifdef STREAMS diff --git a/solaris/ppp.c b/solaris/ppp.c index 676bc26..98f4f91 100644 --- a/solaris/ppp.c +++ b/solaris/ppp.c @@ -31,8 +31,6 @@ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * $Id: ppp.c,v 1.4 2005/06/27 00:59:57 carlsonj Exp $ */ /* @@ -85,12 +83,6 @@ #include /* leave this outside of PRIOQ for htons */ -#ifdef __STDC__ -#define __P(x) x -#else -#define __P(x) () -#endif - /* * The IP module may use this SAP value for IP packets. */ @@ -254,45 +246,45 @@ static upperstr_t *minor_devs = NULL; static upperstr_t *ppas = NULL; #ifdef SVR4 -static int pppopen __P((queue_t *, dev_t *, int, int, cred_t *)); -static int pppclose __P((queue_t *, int, cred_t *)); +static int pppopen(queue_t *, dev_t *, int, int, cred_t *); +static int pppclose(queue_t *, int, cred_t *); #else -static int pppopen __P((queue_t *, int, int, int)); -static int pppclose __P((queue_t *, int)); +static int pppopen(queue_t *, int, int, int); +static int pppclose(queue_t *, int); #endif /* SVR4 */ -static int pppurput __P((queue_t *, mblk_t *)); -static int pppuwput __P((queue_t *, mblk_t *)); -static int pppursrv __P((queue_t *)); -static int pppuwsrv __P((queue_t *)); -static int ppplrput __P((queue_t *, mblk_t *)); -static int ppplwput __P((queue_t *, mblk_t *)); -static int ppplrsrv __P((queue_t *)); -static int ppplwsrv __P((queue_t *)); +static int pppurput(queue_t *, mblk_t *); +static int pppuwput(queue_t *, mblk_t *); +static int pppursrv(queue_t *); +static int pppuwsrv(queue_t *); +static int ppplrput(queue_t *, mblk_t *); +static int ppplwput(queue_t *, mblk_t *); +static int ppplrsrv(queue_t *); +static int ppplwsrv(queue_t *); #ifndef NO_DLPI -static void dlpi_request __P((queue_t *, mblk_t *, upperstr_t *)); -static void dlpi_error __P((queue_t *, upperstr_t *, int, int, int)); -static void dlpi_ok __P((queue_t *, int)); +static void dlpi_request(queue_t *, mblk_t *, upperstr_t *); +static void dlpi_error(queue_t *, upperstr_t *, int, int, int); +static void dlpi_ok(queue_t *, int); #endif -static int send_data __P((mblk_t *, upperstr_t *)); -static void new_ppa __P((queue_t *, mblk_t *)); -static void attach_ppa __P((queue_t *, mblk_t *)); +static int send_data(mblk_t *, upperstr_t *); +static void new_ppa(queue_t *, mblk_t *); +static void attach_ppa(queue_t *, mblk_t *); #ifndef NO_DLPI -static void detach_ppa __P((queue_t *, mblk_t *)); +static void detach_ppa(queue_t *, mblk_t *); #endif -static void detach_lower __P((queue_t *, mblk_t *)); -static void debug_dump __P((queue_t *, mblk_t *)); -static upperstr_t *find_dest __P((upperstr_t *, int)); +static void detach_lower(queue_t *, mblk_t *); +static void debug_dump(queue_t *, mblk_t *); +static upperstr_t *find_dest(upperstr_t *, int); #if defined(SOL2) -static upperstr_t *find_promisc __P((upperstr_t *, int)); -static mblk_t *prepend_ether __P((upperstr_t *, mblk_t *, int)); -static mblk_t *prepend_udind __P((upperstr_t *, mblk_t *, int)); -static void promisc_sendup __P((upperstr_t *, mblk_t *, int, int)); +static upperstr_t *find_promisc(upperstr_t *, int); +static mblk_t *prepend_ether(upperstr_t *, mblk_t *, int); +static mblk_t *prepend_udind(upperstr_t *, mblk_t *, int); +static void promisc_sendup(upperstr_t *, mblk_t *, int, int); #endif /* defined(SOL2) */ -static int putctl2 __P((queue_t *, int, int, int)); -static int putctl4 __P((queue_t *, int, int, int)); -static int pass_packet __P((upperstr_t *ppa, mblk_t *mp, int outbound)); +static int putctl2(queue_t *, int, int, int); +static int putctl4(queue_t *, int, int, int); +static int pass_packet(upperstr_t *ppa, mblk_t *mp, int outbound); #ifdef FILTER_PACKETS -static int ip_hard_filter __P((upperstr_t *ppa, mblk_t *mp, int outbound)); +static int ip_hard_filter(upperstr_t *ppa, mblk_t *mp, int outbound); #endif /* FILTER_PACKETS */ #define PPP_ID 0xb1a6 diff --git a/solaris/ppp_ahdlc.c b/solaris/ppp_ahdlc.c index 28920f7..21b8c54 100644 --- a/solaris/ppp_ahdlc.c +++ b/solaris/ppp_ahdlc.c @@ -109,11 +109,11 @@ typedef unsigned int uintpointer_t; MOD_OPEN_DECL(ahdlc_open); MOD_CLOSE_DECL(ahdlc_close); -static int ahdlc_wput __P((queue_t *, mblk_t *)); -static int ahdlc_rput __P((queue_t *, mblk_t *)); -static void ahdlc_encode __P((queue_t *, mblk_t *)); -static void ahdlc_decode __P((queue_t *, mblk_t *)); -static int msg_byte __P((mblk_t *, unsigned int)); +static int ahdlc_wput(queue_t *, mblk_t *); +static int ahdlc_rput(queue_t *, mblk_t *); +static void ahdlc_encode(queue_t *, mblk_t *); +static void ahdlc_decode(queue_t *, mblk_t *); +static int msg_byte(mblk_t *, unsigned int); #if defined(SOL2) /* diff --git a/solaris/ppp_comp.c b/solaris/ppp_comp.c index 3420ebc..cda8ddf 100644 --- a/solaris/ppp_comp.c +++ b/solaris/ppp_comp.c @@ -74,12 +74,12 @@ MOD_OPEN_DECL(ppp_comp_open); MOD_CLOSE_DECL(ppp_comp_close); -static int ppp_comp_rput __P((queue_t *, mblk_t *)); -static int ppp_comp_rsrv __P((queue_t *)); -static int ppp_comp_wput __P((queue_t *, mblk_t *)); -static int ppp_comp_wsrv __P((queue_t *)); -static void ppp_comp_ccp __P((queue_t *, mblk_t *, int)); -static int msg_byte __P((mblk_t *, unsigned int)); +static int ppp_comp_rput(queue_t *, mblk_t *); +static int ppp_comp_rsrv(queue_t *); +static int ppp_comp_wput(queue_t *, mblk_t *); +static int ppp_comp_wsrv(queue_t *); +static void ppp_comp_ccp(queue_t *, mblk_t *, int); +static int msg_byte(mblk_t *, unsigned int); /* Extract byte i of message mp. */ #define MSG_BYTE(mp, i) ((i) < (mp)->b_wptr - (mp)->b_rptr? (mp)->b_rptr[i]: \ @@ -118,7 +118,7 @@ int ppp_comp_count; /* number of module instances in use */ #ifdef __osf__ -static void ppp_comp_alloc __P((comp_state_t *)); +static void ppp_comp_alloc(comp_state_t *); typedef struct memreq { unsigned char comp_opts[20]; int cmd; diff --git a/solaris/ppp_mod.c b/solaris/ppp_mod.c index 80ca203..d1bf025 100644 --- a/solaris/ppp_mod.c +++ b/solaris/ppp_mod.c @@ -47,16 +47,10 @@ #include #include -#ifdef __STDC__ -#define __P(x) x -#else -#define __P(x) () -#endif - -static int ppp_identify __P((dev_info_t *)); -static int ppp_attach __P((dev_info_t *, ddi_attach_cmd_t)); -static int ppp_detach __P((dev_info_t *, ddi_detach_cmd_t)); -static int ppp_devinfo __P((dev_info_t *, ddi_info_cmd_t, void *, void **)); +static int ppp_identify(dev_info_t *); +static int ppp_attach(dev_info_t *, ddi_attach_cmd_t); +static int ppp_detach(dev_info_t *, ddi_detach_cmd_t); +static int ppp_devinfo(dev_info_t *, ddi_info_cmd_t, void *, void **); extern struct streamtab pppinfo; extern krwlock_t ppp_lower_lock; diff --git a/solaris/ppp_mod.h b/solaris/ppp_mod.h index f0af008..792c4d4 100644 --- a/solaris/ppp_mod.h +++ b/solaris/ppp_mod.h @@ -143,10 +143,10 @@ typedef int minor_t; */ #ifdef SVR4 #define MOD_OPEN_DECL(name) \ -static int name __P((queue_t *, dev_t *, int, int, cred_t *)) +static int name(queue_t *, dev_t *, int, int, cred_t *) #define MOD_CLOSE_DECL(name) \ -static int name __P((queue_t *, int, cred_t *)) +static int name(queue_t *, int, cred_t *) #define MOD_OPEN(name) \ static int name(q, devp, flag, sflag, credp) \ @@ -168,10 +168,10 @@ static int name(q, flag, credp) \ #else /* not SVR4 */ #define MOD_OPEN_DECL(name) \ -static int name __P((queue_t *, int, int, int)) +static int name(queue_t *, int, int, int) #define MOD_CLOSE_DECL(name) \ -static int name __P((queue_t *, int)) +static int name(queue_t *, int) #define MOD_OPEN(name) \ static int name(q, dev, flag, sflag) \ -- 2.39.2