From: deraadt Date: Fri, 9 Aug 2024 05:16:13 +0000 (+0000) Subject: ansi functions and prototypes X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6798d9df8413db5c7614951a6304f0d50f58b417;p=openbsd ansi functions and prototypes ok denis --- diff --git a/usr.sbin/pppd/auth.c b/usr.sbin/pppd/auth.c index c6418162dfa..28555f7970e 100644 --- a/usr.sbin/pppd/auth.c +++ b/usr.sbin/pppd/auth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auth.c,v 1.40 2022/05/06 15:51:09 claudio Exp $ */ +/* $OpenBSD: auth.c,v 1.41 2024/08/09 05:16:13 deraadt Exp $ */ /* * auth.c - PPP authentication and phase control. @@ -177,8 +177,7 @@ static void set_allowed_addrs(int, struct wordlist *); * Do what's necessary to bring the physical layer up. */ void -link_required(unit) - int unit; +link_required(int unit) { } @@ -187,8 +186,7 @@ link_required(unit) * physical layer down. */ void -link_terminated(unit) - int unit; +link_terminated(int unit) { if (phase == PHASE_DEAD) return; @@ -202,8 +200,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) { int i; struct protent *protp; @@ -231,8 +228,7 @@ link_down(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]; @@ -293,8 +289,7 @@ link_established(unit) * Proceed to the network phase. */ static void -network_phase(unit) - int unit; +network_phase(int unit) { int i; struct protent *protp; @@ -341,8 +336,7 @@ network_phase(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 @@ -354,10 +348,7 @@ auth_peer_fail(unit, protocol) * The peer has been successfully authenticated using `protocol'. */ void -auth_peer_success(unit, protocol, name, namelen) - int unit, protocol; - char *name; - int namelen; +auth_peer_success(int unit, int protocol, char *name, int namelen) { int bit; @@ -395,8 +386,7 @@ auth_peer_success(unit, protocol, 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) EXPLICIT_BZERO(passwd, MAXSECRETLEN); @@ -411,8 +401,7 @@ auth_withpeer_fail(unit, protocol) * We have successfully authenticated ourselves with the peer using `protocol'. */ void -auth_withpeer_success(unit, protocol) - int unit, protocol; +auth_withpeer_success(int unit, int protocol) { int bit; @@ -444,8 +433,7 @@ auth_withpeer_success(unit, protocol) * np_up - a network protocol has come up. */ void -np_up(unit, proto) - int unit, proto; +np_up(int unit, int proto) { if (num_np_up == 0) { /* @@ -476,8 +464,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 && idle_time_limit > 0) { UNTIMEOUT(check_idle, NULL); @@ -488,8 +475,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 roto) { if (--num_np_open <= 0) { /* no further use for the link: shut up shop. */ @@ -502,8 +488,7 @@ np_finished(unit, proto) * 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; @@ -524,8 +509,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) { syslog(LOG_INFO, "Connect time expired"); lcp_close(0, "Connect time expired"); /* Close connection */ @@ -599,8 +583,8 @@ 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[0]; @@ -632,14 +616,8 @@ auth_reset(unit) * In either case, msg points to an appropriate message. */ int -check_passwd(unit, auser, userlen, apasswd, passwdlen, msg, msglen) - int unit; - char *auser; - int userlen; - char *apasswd; - int passwdlen; - char **msg; - int *msglen; +check_passwd(int unit, char *auser, int userlen, + char *apasswd, int passwdlen, char **msg, int *msglen) { int ret; char *filename; @@ -735,11 +713,7 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg, msglen) */ static int -plogin(user, passwd, msg, msglen) - char *user; - char *passwd; - char **msg; - int *msglen; +plogin(char *user, char *passwd, char **msg, int *msglen) { struct passwd *pw; char *tty; @@ -803,8 +777,7 @@ plogout() * and return 1. */ static int -null_login(unit) - int unit; +null_login(int unit) { char *filename; FILE *f; @@ -843,8 +816,7 @@ null_login(unit) * could be found. */ static int -get_pap_passwd(passwd) - char *passwd; +get_pap_passwd(char *passwd) { char *filename; FILE *f; @@ -904,10 +876,7 @@ have_pap_secret() * know the identity yet. */ static int -have_chap_secret(client, server, remote) - char *client; - char *server; - u_int32_t remote; +have_chap_secret(char *client, char *server, u_int32_t remote) { FILE *f; int ret; @@ -938,13 +907,8 @@ have_chap_secret(client, server, remote) * (We could be either client or server). */ int -get_secret(unit, client, server, secret, secret_len, save_addrs) - int unit; - char *client; - char *server; - char *secret; - int *secret_len; - int save_addrs; +get_secret(int unit, char *client, char *server, + char *secret, int *secret_len, int save_addrs) { FILE *f; int ret, len; @@ -988,9 +952,7 @@ get_secret(unit, client, server, secret, secret_len, save_addrs) * set_allowed_addrs() - set the list of allowed addresses. */ static void -set_allowed_addrs(unit, addrs) - int unit; - struct wordlist *addrs; +set_allowed_addrs(int unit, struct wordlist *addrs) { if (addresses[unit] != NULL) free_wordlist(addresses[unit]); @@ -1021,17 +983,13 @@ set_allowed_addrs(unit, addrs) * 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) { return ip_addr_check(addr, addresses[unit]); } static int -ip_addr_check(addr, addrs) - u_int32_t addr; - struct wordlist *addrs; +ip_addr_check(u_int32_t addr, struct wordlist *addrs) { u_int32_t mask, ah; struct in_addr ina; @@ -1115,8 +1073,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 @@ -1127,9 +1084,7 @@ bad_ip_adrs(addr) * check_access - complain if a secret file has too-liberal permissions. */ void -check_access(f, filename) - FILE *f; - char *filename; +check_access(FILE *f, char *filename) { struct stat sbuf; @@ -1151,14 +1106,8 @@ check_access(f, filename) * info) are placed in a wordlist and returned in *addrs. */ static int -scan_authfile(f, client, server, ipaddr, secret, addrs, filename) - FILE *f; - char *client; - char *server; - u_int32_t ipaddr; - char *secret; - struct wordlist **addrs; - char *filename; +scan_authfile(FILE *f, char *client, char *server, u_int32_t ipaddr, + char *secret, struct wordlist **addrs, char *filename) { int newline, xxx; int got_flag, best_flag; @@ -1302,8 +1251,7 @@ scan_authfile(f, client, server, ipaddr, secret, addrs, filename) * free_wordlist - release memory allocated for a wordlist. */ static void -free_wordlist(wp) - struct wordlist *wp; +free_wordlist(struct wordlist *wp) { struct wordlist *next; @@ -1319,8 +1267,7 @@ free_wordlist(wp) * 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; diff --git a/usr.sbin/pppd/cbcp.c b/usr.sbin/pppd/cbcp.c index 9e64cec18b8..599d8ee5b1a 100644 --- a/usr.sbin/pppd/cbcp.c +++ b/usr.sbin/pppd/cbcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cbcp.c,v 1.9 2018/07/28 22:57:27 deraadt Exp $ */ +/* $OpenBSD: cbcp.c,v 1.10 2024/08/09 05:16:13 deraadt Exp $ */ /* * cbcp - Call Back Configuration Protocol. @@ -408,7 +408,7 @@ cbcp_recvack(cbcp_state *us, char *pckt, int len) cbcp_up(us); } -extern int persist; +extern volatile sig_atomic_t persist; /* ok peer will do callback */ static void diff --git a/usr.sbin/pppd/ccp.c b/usr.sbin/pppd/ccp.c index 70c205a0d80..4736092282e 100644 --- a/usr.sbin/pppd/ccp.c +++ b/usr.sbin/pppd/ccp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ccp.c,v 1.13 2009/10/27 23:59:53 deraadt Exp $ */ +/* $OpenBSD: ccp.c,v 1.14 2024/08/09 05:16:13 deraadt Exp $ */ /* * ccp.c - PPP Compression Control Protocol. @@ -138,8 +138,7 @@ static int all_rejected[NUM_PPP]; /* we rejected all peer's options */ * ccp_init - initialize CCP. */ static void -ccp_init(unit) - int unit; +ccp_init(int unit) { fsm *f = &ccp_fsm[unit]; @@ -174,8 +173,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]; @@ -197,9 +195,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); @@ -209,8 +205,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]); } @@ -219,8 +214,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]); } @@ -229,10 +223,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; @@ -258,11 +249,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: @@ -291,8 +278,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]); @@ -302,8 +288,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[16]; @@ -360,8 +345,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]; @@ -375,10 +359,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]; @@ -467,10 +448,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; @@ -540,10 +518,7 @@ ccp_ackci(f, p, len) * Returns 1 iff the nak was OK. */ static int -ccp_nakci(f, p, len) - fsm *f; - u_char *p; - int len; +ccp_nakci(fsm *f, u_char *p, int len) { ccp_options *go = &ccp_gotoptions[f->unit]; ccp_options no; /* options we've seen already */ @@ -609,10 +584,7 @@ ccp_nakci(f, p, len) * 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 */ @@ -687,11 +659,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; @@ -866,8 +834,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]; @@ -907,8 +874,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]; @@ -937,8 +903,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); @@ -957,11 +922,7 @@ static char *ccp_codenames[] = { }; static int -ccp_printpkt(p, plen, printer, arg) - u_char *p; - int plen; - void (*printer)(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; @@ -1069,10 +1030,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; @@ -1104,8 +1062,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/usr.sbin/pppd/chap.c b/usr.sbin/pppd/chap.c index b98e7fc57e4..5dc66600024 100644 --- a/usr.sbin/pppd/chap.c +++ b/usr.sbin/pppd/chap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: chap.c,v 1.20 2023/03/08 04:43:14 guenther Exp $ */ +/* $OpenBSD: chap.c,v 1.21 2024/08/09 05:16:13 deraadt Exp $ */ /* * chap.c - Challenge Handshake Authentication Protocol. @@ -112,8 +112,7 @@ static void ChapGenChallenge(chap_state *); * ChapInit - Initialize a CHAP unit. */ static void -ChapInit(unit) - int unit; +ChapInit(int unit) { chap_state *cstate = &chap[unit]; @@ -132,10 +131,7 @@ ChapInit(unit) * */ void -ChapAuthWithPeer(unit, our_name, digest) - int unit; - char *our_name; - int digest; +ChapAuthWithPeer(int unit, char *our_name, int digest) { chap_state *cstate = &chap[unit]; @@ -162,10 +158,7 @@ ChapAuthWithPeer(unit, our_name, digest) * ChapAuthPeer - Authenticate our peer (start server). */ void -ChapAuthPeer(unit, our_name, digest) - int unit; - char *our_name; - int digest; +ChapAuthPeer(int unit, char *our_name, int digest) { chap_state *cstate = &chap[unit]; @@ -189,8 +182,7 @@ ChapAuthPeer(unit, our_name, digest) * ChapChallengeTimeout - Timeout expired on sending challenge. */ static void -ChapChallengeTimeout(arg) - void *arg; +ChapChallengeTimeout(void *arg) { chap_state *cstate = (chap_state *) arg; @@ -216,8 +208,7 @@ ChapChallengeTimeout(arg) * ChapResponseTimeout - Timeout expired on sending response. */ static void -ChapResponseTimeout(arg) - void *arg; +ChapResponseTimeout(void *arg) { chap_state *cstate = (chap_state *) arg; @@ -233,8 +224,7 @@ ChapResponseTimeout(arg) * ChapRechallenge - Time to challenge the peer again. */ static void -ChapRechallenge(arg) - void *arg; +ChapRechallenge(void *arg) { chap_state *cstate = (chap_state *) arg; @@ -254,8 +244,7 @@ ChapRechallenge(arg) * Start up if we have pending requests. */ static void -ChapLowerUp(unit) - int unit; +ChapLowerUp(int unit) { chap_state *cstate = &chap[unit]; @@ -280,8 +269,7 @@ ChapLowerUp(unit) * Cancel all timeouts. */ static void -ChapLowerDown(unit) - int unit; +ChapLowerDown(int unit) { chap_state *cstate = &chap[unit]; @@ -304,8 +292,7 @@ ChapLowerDown(unit) * ChapProtocolReject - Peer doesn't grok CHAP. */ static void -ChapProtocolReject(unit) - int unit; +ChapProtocolReject(int unit) { chap_state *cstate = &chap[unit]; @@ -323,10 +310,7 @@ ChapProtocolReject(unit) * ChapInput - Input CHAP packet. */ static void -ChapInput(unit, inpacket, packet_len) - int unit; - u_char *inpacket; - int packet_len; +ChapInput(int unit, u_char *inpacket, int packet_len) { chap_state *cstate = &chap[unit]; u_char *inp; @@ -386,11 +370,7 @@ ChapInput(unit, inpacket, packet_len) * ChapReceiveChallenge - Receive Challenge and send Response. */ static void -ChapReceiveChallenge(cstate, inp, id, len) - chap_state *cstate; - u_char *inp; - int id; - int len; +ChapReceiveChallenge(chap_state *cstate, u_char *inp, int id, int len) { int rchallenge_len; u_char *rchallenge; @@ -479,11 +459,7 @@ ChapReceiveChallenge(cstate, inp, id, len) * ChapReceiveResponse - Receive and process response. */ static void -ChapReceiveResponse(cstate, inp, id, len) - chap_state *cstate; - u_char *inp; - int id; - int len; +ChapReceiveResponse(chap_state *cstate, u_char *inp, int id, int len) { u_char *remmd, remmd_len; int secret_len, old_state; @@ -602,11 +578,7 @@ ChapReceiveResponse(cstate, inp, id, len) * ChapReceiveSuccess - Receive Success */ static void -ChapReceiveSuccess(cstate, inp, id, len) - chap_state *cstate; - u_char *inp; - u_char id; - int len; +ChapReceiveSuccess(chap_state *cstate, u_char *inp, int id, int len) { CHAPDEBUG((LOG_INFO, "ChapReceiveSuccess: Rcvd id %d.", id)); @@ -640,11 +612,7 @@ ChapReceiveSuccess(cstate, inp, id, len) * ChapReceiveFailure - Receive failure. */ static void -ChapReceiveFailure(cstate, inp, id, len) - chap_state *cstate; - u_char *inp; - u_char id; - int len; +ChapReceiveFailure(chap_state *cstate, u_char *inp, int id, int len) { CHAPDEBUG((LOG_INFO, "ChapReceiveFailure: Rcvd id %d.", id)); @@ -672,8 +640,7 @@ ChapReceiveFailure(cstate, inp, id, len) * ChapSendChallenge - Send an Authenticate challenge. */ static void -ChapSendChallenge(cstate) - chap_state *cstate; +ChapSendChallenge(chap_state *cstate) { u_char *outp; int chal_len, name_len; @@ -709,9 +676,7 @@ ChapSendChallenge(cstate) * ChapSendStatus - Send a status response (ack or nak). */ static void -ChapSendStatus(cstate, code) - chap_state *cstate; - int code; +ChapSendStatus(chap_state *cstate, int code) { u_char *outp; int outlen, msglen; @@ -746,8 +711,7 @@ ChapSendStatus(cstate, code) */ static void -ChapGenChallenge(cstate) - chap_state *cstate; +ChapGenChallenge(chap_state *cstate) { int chal_len; @@ -769,8 +733,7 @@ ChapGenChallenge(cstate) * in *cstate. */ static void -ChapSendResponse(cstate) - chap_state *cstate; +ChapSendResponse(chap_state *cstate) { u_char *outp; int outlen, md_len, name_len; @@ -808,11 +771,7 @@ static char *ChapCodenames[] = { }; static int -ChapPrintPkt(p, plen, printer, arg) - u_char *p; - int plen; - void (*printer)(void *, char *, ...); - void *arg; +ChapPrintPkt(u_char *p, int plen, void (*printer)(void *, char *, ...), void *arg) { int code, id, len; int clen, nlen; diff --git a/usr.sbin/pppd/chat/chat.c b/usr.sbin/pppd/chat/chat.c index 9f4ac4dd698..ae2bc1a211d 100644 --- a/usr.sbin/pppd/chat/chat.c +++ b/usr.sbin/pppd/chat/chat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: chat.c,v 1.35 2016/04/05 21:24:02 krw Exp $ */ +/* $OpenBSD: chat.c,v 1.36 2024/08/09 05:16:15 deraadt Exp $ */ /* * Chat -- a program for automatic session establishment (i.e. dial @@ -173,7 +173,6 @@ int clear_report_next = 0; int say_next = 0, hup_next = 0; void *dup_mem(void *b, size_t c); -void *copy_of(char *s); void usage(void); void logmsg(const char *fmt, ...); void fatal(int code, const char *fmt, ...); @@ -188,15 +187,15 @@ 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 get_string(char *string); +int put_string(char *s); int write_char(int c); int put_char(int c); int get_char(void); -void chat_send(register char *s); +void chat_send(char *s); char *character(int c); -void chat_expect(register char *s); -char *clean(register char *s, int sending); +void chat_expect(char *s); +char *clean(char *s, int sending); void break_sequence(void); void terminate(int status); void pack_array(char **array, int end); @@ -205,9 +204,8 @@ int vfmtmsg(char *, int, const char *, va_list); /* vsnprintf++ */ int main(int, char *[]); -void *dup_mem(b, c) -void *b; -size_t c; +void * +dup_mem(void *b, size_t c) { void *ans = malloc (c); if (!ans) @@ -217,8 +215,7 @@ size_t c; return ans; } -void *copy_of (s) -char *s; +void *copy_of (char *s) { return dup_mem (s, strlen (s) + 1); } @@ -231,9 +228,7 @@ char *s; * 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; @@ -262,7 +257,7 @@ main(argc, argv) break; case 'f': - chat_file = copy_of(optarg); + chat_file = strdup(optarg); break; case 't': @@ -283,11 +278,11 @@ main(argc, argv) break; case 'T': - phone_num = copy_of(optarg); + phone_num = strdup(optarg); break; case 'U': - phone_num2 = copy_of(optarg); + phone_num2 = strdup(optarg); break; case ':': @@ -345,8 +340,8 @@ 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; @@ -459,8 +454,7 @@ void fatal(int code, const char *fmt, ...) int alarmed = 0; -SIGTYPE sigalrm(signo) -int signo; +SIGTYPE sigalrm(int signo) { int flags; @@ -489,20 +483,17 @@ 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"); } @@ -550,8 +541,7 @@ void break_sequence() #endif } -void terminate(status) -int status; +void terminate(int status) { echo_stderr(-1); if (report_file != (char *) 0 && report_fp != (FILE *) NULL) { @@ -593,13 +583,11 @@ 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(char *s, int sending) { char *ret, *t, cur_chr; int new_length; - register char *s1, *phchar; + char *s1, *phchar; int add_return = sending; #define isoctal(chr) (((chr) >= '0') && ((chr) <= '7')) @@ -808,8 +796,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; @@ -863,8 +850,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; @@ -952,8 +938,7 @@ char *s; * the data. */ -char *character(c) -int c; +char *character(int c) { static char string[10]; char *meta; @@ -974,8 +959,7 @@ int c; /* * process the reply string */ -void chat_send (s) -register char *s; +void chat_send (char *s) { if (say_next) { say_next = 0; @@ -1149,8 +1133,7 @@ int get_char() } } -int put_char(c) -int c; +int put_char(int c) { int status; char ch = c; @@ -1177,8 +1160,7 @@ int c; } } -int write_char (c) -int c; +int write_char (int c) { if (alarmed || put_char(c) < 0) { alarm(0); @@ -1195,8 +1177,7 @@ int c; return (1); } -int put_string (s) -register char *s; +int put_string (char *s) { quiet = 0; s = clean(s, 1); @@ -1211,7 +1192,7 @@ register char *s; alarm(timeout); alarmed = 0; while (*s) { - register char c = *s++; + char c = *s++; if (c != '\\') { if (!write_char (c)) @@ -1250,8 +1231,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; @@ -1278,12 +1258,11 @@ int n; /* * 'Wait for' this string to appear on this file descriptor. */ -int get_string(string) -register char *string; +int get_string(char *string) { char temp[STR_LEN]; int c, printed = 0, len, minlen; - register char *s = temp, *end = s + STR_LEN; + char *s = temp, *end = s + STR_LEN; char *logged = temp; fail_reason = NULL; @@ -1427,9 +1406,7 @@ register char *string; } 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_ */ +pack_array (char **array, int end) { int i, j; @@ -1455,11 +1432,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/usr.sbin/pppd/demand.c b/usr.sbin/pppd/demand.c index 5d09d0beb19..2ac37049e58 100644 --- a/usr.sbin/pppd/demand.c +++ b/usr.sbin/pppd/demand.c @@ -1,4 +1,4 @@ -/* $OpenBSD: demand.c,v 1.11 2015/01/16 06:40:19 deraadt Exp $ */ +/* $OpenBSD: demand.c,v 1.12 2024/08/09 05:16:13 deraadt Exp $ */ /* * demand.c - Support routines for demand-dialling. @@ -200,9 +200,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; @@ -252,9 +250,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; @@ -285,8 +281,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; @@ -316,9 +311,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/usr.sbin/pppd/fsm.c b/usr.sbin/pppd/fsm.c index 0a95205bf4d..891ac55226c 100644 --- a/usr.sbin/pppd/fsm.c +++ b/usr.sbin/pppd/fsm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fsm.c,v 1.8 2009/10/27 23:59:53 deraadt Exp $ */ +/* $OpenBSD: fsm.c,v 1.9 2024/08/09 05:16:13 deraadt Exp $ */ /* * fsm.c - {Link, IP} Control Protocol Finite State Machine. @@ -76,8 +76,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 +93,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: @@ -125,8 +123,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: @@ -169,8 +166,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: @@ -210,9 +206,7 @@ fsm_open(f) * 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)); @@ -253,8 +247,7 @@ fsm_close(f, reason) * fsm_timeout - Timeout expired. */ static void -fsm_timeout(arg) - void *arg; +fsm_timeout(void *arg) { fsm *f = (fsm *) arg; @@ -308,10 +301,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; @@ -390,11 +380,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; @@ -461,11 +447,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) { FSMDEBUG((LOG_INFO, "fsm_rconfack(%s): Rcvd id %d.", PROTO_NAME(f), id)); @@ -523,11 +505,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 (*proc)(fsm *, u_char *, int); int ret; @@ -585,11 +563,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) { char str[80]; @@ -624,8 +598,7 @@ fsm_rtermreq(f, id, p, len) * fsm_rtermack - Receive Terminate-Ack. */ static void -fsm_rtermack(f) - fsm *f; +fsm_rtermack(fsm *f) { FSMDEBUG((LOG_INFO, "fsm_rtermack(%s).", PROTO_NAME(f))); @@ -660,10 +633,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; @@ -689,8 +659,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: @@ -739,9 +708,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 +759,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/usr.sbin/pppd/ipcp.c b/usr.sbin/pppd/ipcp.c index 1296d897b14..0e4e936b60d 100644 --- a/usr.sbin/pppd/ipcp.c +++ b/usr.sbin/pppd/ipcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipcp.c,v 1.15 2015/12/14 03:25:59 mmcc Exp $ */ +/* $OpenBSD: ipcp.c,v 1.16 2024/08/09 05:16:13 deraadt Exp $ */ /* * ipcp.c - PPP IP Control Protocol. @@ -159,8 +159,7 @@ static void ipcp_clear_addrs(int); * 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]; @@ -179,8 +178,7 @@ u_int32_t ipaddr; * 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]; @@ -222,8 +220,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]); } @@ -233,9 +230,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); } @@ -245,8 +240,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]); } @@ -256,8 +250,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]); } @@ -267,10 +260,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); } @@ -282,8 +272,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]); } @@ -293,8 +282,7 @@ ipcp_protrej(unit) * ipcp_resetci - Reset our CI. */ static void -ipcp_resetci(f) - fsm *f; +ipcp_resetci(fsm *f) { ipcp_options *wo = &ipcp_wantoptions[f->unit]; @@ -312,8 +300,7 @@ ipcp_resetci(f) * ipcp_cilen - Return length of our CI. */ 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]; @@ -355,10 +342,7 @@ ipcp_cilen(f) * ipcp_addci - Add our desired CIs to a packet. */ 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; @@ -415,10 +399,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; @@ -505,10 +486,7 @@ bad: * 1 - Nak was good. */ static int -ipcp_nakci(f, p, len) - fsm *f; - u_char *p; - int len; +ipcp_nakci(fsm *f, u_char *p, int len) { ipcp_options *go = &ipcp_gotoptions[f->unit]; u_char cimaxslotindex, cicflag; @@ -677,10 +655,7 @@ bad: * ipcp_rejci - Reject some of our CIs. */ 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; @@ -771,11 +746,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]; @@ -1119,8 +1090,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]; @@ -1150,8 +1120,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]; @@ -1290,8 +1259,7 @@ ipcp_up(f) * and delete routes through it. */ static void -ipcp_down(f) - fsm *f; +ipcp_down(fsm *f) { IPCPDEBUG((LOG_INFO, "ipcp: down")); np_down(f->unit, PPP_IP); @@ -1318,8 +1286,7 @@ ipcp_down(f) * proxy arp entries, etc. */ static void -ipcp_clear_addrs(unit) - int unit; +ipcp_clear_addrs(int unit) { u_int32_t ouraddr, hisaddr; @@ -1341,8 +1308,7 @@ ipcp_clear_addrs(unit) * ipcp_finished - possibly shut down the lower layers. */ static void -ipcp_finished(f) - fsm *f; +ipcp_finished(fsm *f) { np_finished(f->unit, PPP_IP); } @@ -1353,9 +1319,7 @@ ipcp_finished(f) * interface-name tty-name speed local-IP remote-IP. */ static void -ipcp_script(f, script) - fsm *f; - char *script; +ipcp_script(fsm *f, char *script) { char strspeed[32], strlocal[32], strremote[32]; char *argv[8]; @@ -1386,11 +1350,7 @@ static char *ipcp_codenames[] = { }; static int -ipcp_printpkt(p, plen, printer, arg) - u_char *p; - int plen; - void (*printer)(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; @@ -1527,9 +1487,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/usr.sbin/pppd/ipcp.h b/usr.sbin/pppd/ipcp.h index a9064f00844..6f36d3f1f08 100644 --- a/usr.sbin/pppd/ipcp.h +++ b/usr.sbin/pppd/ipcp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ipcp.h,v 1.7 2002/07/01 19:31:37 deraadt Exp $ */ +/* $OpenBSD: ipcp.h,v 1.8 2024/08/09 05:16:13 deraadt Exp $ */ /* * ipcp.h - IP Control Protocol definitions. @@ -66,15 +66,15 @@ /* compression option*/ typedef struct ipcp_options { - int neg_addr : 1; /* Negotiate IP Address? */ - int old_addrs : 1; /* Use old (IP-Addresses) option? */ - int req_addr : 1; /* Ask peer to send IP address? */ - int default_route : 1; /* Assign default route through interface? */ - int proxy_arp : 1; /* Make proxy ARP entry for peer? */ - int neg_vj : 1; /* Van Jacobson Compression? */ - int old_vj : 1; /* use old (short) form of VJ option? */ - int accept_local : 1; /* accept peer's value for ouraddr */ - int accept_remote : 1; /* accept peer's value for hisaddr */ + u_int neg_addr : 1; /* Negotiate IP Address? */ + u_int old_addrs : 1; /* Use old (IP-Addresses) option? */ + u_int req_addr : 1; /* Ask peer to send IP address? */ + u_int default_route : 1; /* Assign default route through interface? */ + u_int proxy_arp : 1; /* Make proxy ARP entry for peer? */ + u_int neg_vj : 1; /* Van Jacobson Compression? */ + u_int old_vj : 1; /* use old (short) form of VJ option? */ + u_int accept_local : 1; /* accept peer's value for ouraddr */ + u_int accept_remote : 1; /* accept peer's value for hisaddr */ u_short vj_protocol; /* protocol value to use in VJ option */ u_char maxslotindex, cflag; /* values for RFC1332 VJ compression neg. */ u_int32_t ouraddr, hisaddr; /* Addresses in NETWORK BYTE ORDER */ diff --git a/usr.sbin/pppd/lcp.c b/usr.sbin/pppd/lcp.c index 254309c0239..d751a0bd1dc 100644 --- a/usr.sbin/pppd/lcp.c +++ b/usr.sbin/pppd/lcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lcp.c,v 1.14 2023/03/08 04:43:14 guenther Exp $ */ +/* $OpenBSD: lcp.c,v 1.15 2024/08/09 05:16:13 deraadt Exp $ */ /* * lcp.c - PPP Link Control Protocol. @@ -172,8 +172,7 @@ int lcp_loopbackfail = DEFLOOPBACKFAIL; * 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]; @@ -228,8 +227,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]; @@ -247,9 +245,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]; @@ -274,8 +270,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]; @@ -299,8 +294,7 @@ lcp_lowerup(unit) * lcp_lowerdown - The lower layer is down. */ void -lcp_lowerdown(unit) - int unit; +lcp_lowerdown(int unit) { fsm_lowerdown(&lcp_fsm[unit]); } @@ -310,10 +304,7 @@ lcp_lowerdown(unit) * 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]; @@ -325,11 +316,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; @@ -367,10 +354,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; @@ -418,8 +402,7 @@ lcp_rprotrej(f, inp, len) * lcp_protrej - A Protocol-Reject was received. */ static void -lcp_protrej(unit) - int unit; +lcp_protrej(int unit) { /* * Can't reject LCP! @@ -434,10 +417,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 @@ -455,8 +435,7 @@ lcp_sprotrej(unit, p, len) * lcp_resetci - Reset our CI. */ static void -lcp_resetci(f) - fsm *f; +lcp_resetci(fsm *f) { lcp_wantoptions[f->unit].magicnumber = magic(); lcp_wantoptions[f->unit].numloops = 0; @@ -470,8 +449,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]; @@ -501,10 +479,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; @@ -574,10 +549,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; @@ -704,10 +676,7 @@ bad: * 1 - Nak was good. */ static int -lcp_nakci(f, p, len) - fsm *f; - u_char *p; - int len; +lcp_nakci(fsm *f, u_char *p, int len) { lcp_options *go = &lcp_gotoptions[f->unit]; lcp_options *wo = &lcp_wantoptions[f->unit]; @@ -1011,10 +980,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; @@ -1151,11 +1117,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]; @@ -1477,8 +1439,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]; @@ -1518,8 +1479,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]; @@ -1539,8 +1499,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); } @@ -1550,8 +1509,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); } @@ -1567,11 +1525,7 @@ static char *lcp_codenames[] = { }; static int -lcp_printpkt(p, plen, printer, arg) - u_char *p; - int plen; - void (*printer)(void *, char *, ...); - void *arg; +lcp_printpkt(u_char *p, int plen, void (*printer)(void *, char *, ...), void *arg) { int code, id, len, olen; u_char *pstart, *optend; @@ -1732,9 +1686,8 @@ lcp_printpkt(p, plen, printer, arg) * Time to shut down the link because there is nothing out there. */ -static -void LcpLinkFailure (f) - fsm *f; +static void +LcpLinkFailure(fsm *f) { if (f->state == OPENED) { syslog(LOG_INFO, "No response to %d echo-requests", lcp_echos_pending); @@ -1748,8 +1701,7 @@ void LcpLinkFailure (f) */ static void -LcpEchoCheck (f) - fsm *f; +LcpEchoCheck(fsm *f) { LcpSendEchoRequest (f); @@ -1766,8 +1718,7 @@ LcpEchoCheck (f) */ static void -LcpEchoTimeout (arg) - void *arg; +LcpEchoTimeout(void *arg) { if (lcp_echo_timer_running != 0) { lcp_echo_timer_running = 0; @@ -1780,9 +1731,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; @@ -1807,8 +1756,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; @@ -1840,8 +1788,7 @@ LcpSendEchoRequest (f) */ static void -lcp_echo_lowerup (unit) - int unit; +lcp_echo_lowerup(int unit) { fsm *f = &lcp_fsm[unit]; @@ -1860,8 +1807,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/usr.sbin/pppd/lcp.h b/usr.sbin/pppd/lcp.h index 54d8beae97d..fe660de214d 100644 --- a/usr.sbin/pppd/lcp.h +++ b/usr.sbin/pppd/lcp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: lcp.h,v 1.7 2002/07/01 19:31:37 deraadt Exp $ */ +/* $OpenBSD: lcp.h,v 1.8 2024/08/09 05:16:13 deraadt Exp $ */ /* * lcp.h - Link Control Protocol definitions. @@ -67,18 +67,18 @@ * The state of options is described by an lcp_options structure. */ typedef struct lcp_options { - int passive : 1; /* Don't die if we don't get a response */ - int silent : 1; /* Wait for the other end to start first */ - int restart : 1; /* Restart vs. exit after close */ - int neg_mru : 1; /* Negotiate the MRU? */ - int neg_asyncmap : 1; /* Negotiate the async map? */ - int neg_upap : 1; /* Ask for UPAP authentication? */ - int neg_chap : 1; /* Ask for CHAP authentication? */ - int neg_magicnumber : 1; /* Ask for magic number? */ - int neg_pcompression : 1; /* HDLC Protocol Field Compression? */ - int neg_accompression : 1; /* HDLC Address/Control Field Compression? */ - int neg_lqr : 1; /* Negotiate use of Link Quality Reports */ - int neg_cbcp : 1; /* Negotiate use of CBCP */ + u_int passive : 1; /* Don't die if we don't get a response */ + u_int silent : 1; /* Wait for the other end to start first */ + u_int restart : 1; /* Restart vs. exit after close */ + u_int neg_mru : 1; /* Negotiate the MRU? */ + u_int neg_asyncmap : 1; /* Negotiate the async map? */ + u_int neg_upap : 1; /* Ask for UPAP authentication? */ + u_int neg_chap : 1; /* Ask for CHAP authentication? */ + u_int neg_magicnumber : 1; /* Ask for magic number? */ + u_int neg_pcompression : 1; /* HDLC Protocol Field Compression? */ + u_int neg_accompression : 1; /* HDLC Address/Control Field Compression? */ + u_int neg_lqr : 1; /* Negotiate use of Link Quality Reports */ + u_int neg_cbcp : 1; /* Negotiate use of CBCP */ u_short mru; /* Value of MRU */ u_char chap_mdtype; /* which MD type (hashing algorithm) */ u_int32_t asyncmap; /* Value of async map */ diff --git a/usr.sbin/pppd/main.c b/usr.sbin/pppd/main.c index 6497187cbcc..74dc4ad5cea 100644 --- a/usr.sbin/pppd/main.c +++ b/usr.sbin/pppd/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.56 2023/03/08 04:43:14 guenther Exp $ */ +/* $OpenBSD: main.c,v 1.57 2024/08/09 05:16:13 deraadt Exp $ */ /* * main.c - Point-to-Point Protocol main module @@ -95,7 +95,7 @@ static char default_devnam[PATH_MAX]; /* name of default device */ static pid_t pid; /* Our pid */ static uid_t uid; /* Our real user-id */ static int conn_running; /* we have a [dis]connector running */ -static int crashed = 0; +static volatile sig_atomic_t crashed = 0; int ttyfd = -1; /* Serial port file descriptor */ mode_t tty_mode = -1; /* Original access permissions to tty */ @@ -106,8 +106,8 @@ int need_holdoff; /* need holdoff period before restarting */ int detached; /* have detached from terminal */ int phase; /* where the link is at */ -int kill_link; -int open_ccp_flag; +volatile sig_atomic_t kill_link; +volatile sig_atomic_t open_ccp_flag; char **script_env; /* Env. variable values for scripts */ int s_env_nalloc; /* # words avail at script_env */ @@ -174,9 +174,7 @@ struct protent *protocols[] = { }; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int i, fdflags; struct sigaction sa; @@ -624,8 +622,7 @@ detach() * holdoff_end - called via a timeout when the holdoff period ends. */ static void -holdoff_end(arg) - void *arg; +holdoff_end(void *arg) { phase = PHASE_DORMANT; } @@ -722,8 +719,7 @@ quit() * die - like quit, except we can specify an exit status. */ void -die(status) - int status; +die(int status) { struct syslog_data sdata = SYSLOG_DATA_INIT; @@ -792,10 +788,7 @@ static struct timeval timenow; /* Current time */ * the kernel). */ void -timeout(func, arg, time) - void (*func)(void *); - void *arg; - int time; +timeout(void (*func)(void *), void *arg, int time) { struct callout *newp, *p, **pp; @@ -832,9 +825,7 @@ timeout(func, arg, time) * untimeout - Unschedule a timeout. */ void -untimeout(func, arg) - void (*func)(void *); - void *arg; +untimeout(void (*func)(void *), void *arg) { struct callout **copp, *freep; @@ -884,8 +875,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; @@ -908,8 +898,7 @@ timeleft(tvp) * kill_my_pg - send a signal to our process group, and ignore it ourselves. */ static void -kill_my_pg(sig) - int sig; +kill_my_pg(int sig) { struct sigaction act, oldact; @@ -929,8 +918,7 @@ kill_my_pg(sig) * signal, we just take the link down. */ static void -hup(sig) - int sig; +hup(int sig) { int save_errno = errno; struct syslog_data sdata = SYSLOG_DATA_INIT; @@ -952,8 +940,7 @@ hup(sig) * Indicates that we should initiate a graceful disconnect and exit. */ static void -term(sig) - int sig; +term(int sig) { int save_errno = errno; struct syslog_data sdata = SYSLOG_DATA_INIT; @@ -975,8 +962,7 @@ term(sig) * Calls reap_kids to get status for any dead kids. */ static void -chld(sig) - int sig; +chld(int sig) { int save_errno = errno; @@ -991,8 +977,7 @@ chld(sig) * Toggle debug flag. */ static void -toggle_debug(sig) - int sig; +toggle_debug(int sig) { debug = !debug; if (debug) { @@ -1009,8 +994,7 @@ toggle_debug(sig) * Try to (re)negotiate compression. */ static void -open_ccp(sig) - int sig; +open_ccp(int sig) { open_ccp_flag = 1; } @@ -1020,8 +1004,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) { struct syslog_data sdata = SYSLOG_DATA_INIT; @@ -1040,9 +1023,7 @@ bad_signal(sig) * serial device. */ static int -device_script(program, in, out) - char *program; - int in, out; +device_script(char *program, int in, int out) { pid_t pid; int status; @@ -1122,10 +1103,7 @@ device_script(program, in, out) * must_exist is 0 and the program file doesn't exist. */ int -run_program(prog, args, must_exist) - char *prog; - char **args; - int must_exist; +run_program(char *prog, char **args, int must_exist) { pid_t pid; uid_t uid; @@ -1194,7 +1172,7 @@ run_program(prog, args, must_exist) * and log a message for abnormal terminations. */ static void -reap_kids() +reap_kids(void) { int status; pid_t pid; @@ -1224,11 +1202,7 @@ char line[256]; /* line to be logged accumulated here */ char *linep; 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) { strlcpy(line, prefix, sizeof line); linep = line + strlen(line); @@ -1242,11 +1216,7 @@ log_packet(p, len, prefix, level) * calling `printer(arg, format, ...)' to output it. */ void -format_packet(p, len, printer, arg) - u_char *p; - int len; - void (*printer)(void *, char *, ...); - void *arg; +format_packet(u_char *p, int len, void (*printer)(void *, char *, ...), void *arg) { int i, n; u_short proto; @@ -1302,11 +1272,7 @@ pr_log(void *arg, char *fmt, ...) * printer. */ void -print_string(p, len, printer, arg) - char *p; - int len; - void (*printer)(void *, char *, ...); - void *arg; +print_string(char *p, int len, void (*printer)(void *, char *, ...), void *arg) { int c; @@ -1340,8 +1306,7 @@ print_string(p, len, printer, arg) * novm - log an error message saying we ran out of memory, and die. */ void -novm(msg) - char *msg; +novm(char *msg) { syslog(LOG_ERR, "Virtual memory exhausted allocating %s", msg); die(1); @@ -1372,11 +1337,7 @@ fmtmsg(char *buf, int buflen, char *fmt, ...) #define OUTCHAR(c) (buflen > 0? (--buflen, *buf++ = (c)): 0) int -vfmtmsg(buf, buflen, fmt, args) - char *buf; - int buflen; - char *fmt; - va_list args; +vfmtmsg(char *buf, int buflen, char *fmt, va_list args) { int c, i, n; int width, prec, fillch; @@ -1580,8 +1541,7 @@ vfmtmsg(buf, buflen, fmt, args) * for scripts that we run (e.g. ip-up, auth-up, etc.) */ void -script_setenv(var, value) - char *var, *value; +script_setenv(char *var, char *value) { int vl = strlen(var); int i; diff --git a/usr.sbin/pppd/options.c b/usr.sbin/pppd/options.c index a66719484c4..b76e8025361 100644 --- a/usr.sbin/pppd/options.c +++ b/usr.sbin/pppd/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.30 2022/12/28 21:30:18 jmc Exp $ */ +/* $OpenBSD: options.c,v 1.31 2024/08/09 05:16:13 deraadt Exp $ */ /* * options.c - handles option processing for PPP. @@ -112,7 +112,7 @@ int maxconnect = 0; /* Maximum connect time */ char user[MAXNAMELEN]; /* Username for PAP */ char passwd[MAXSECRETLEN]; /* Password for PAP */ int auth_required = 0; /* Peer is required to authenticate */ -int persist = 0; /* Reopen link after it goes down */ +volatile sig_atomic_t persist = 0; /* Reopen link after it goes down */ int uselogin = 0; /* Use /etc/passwd for checking PAP */ int lcp_echo_interval = 0; /* Interval between LCP echo-requests */ int lcp_echo_fails = 0; /* Tolerance to unanswered echo-requests */ @@ -427,9 +427,7 @@ static char *option_source; /* string saying where the option came from */ * 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; struct cmd *cmdp; @@ -482,9 +480,7 @@ parse_args(argc, argv) * if specified. */ void -scan_args(argc, argv) - int argc; - char **argv; +scan_args(int argc, char **argv) { char *arg; struct cmd *cmdp; @@ -524,8 +520,7 @@ usage() * showhelp - print out usage message and exit. */ static int -showhelp(argv) - char **argv; +showhelp(char **argv) { if (phase == PHASE_INITIALIZE) { usage(); @@ -538,8 +533,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(stderr, "pppd version %s patch level %d%s\n", @@ -554,11 +548,7 @@ showversion(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; @@ -695,8 +685,7 @@ option_error(char *fmt, ...) * readable - check if a file is readable by the real user. */ static int -readable(fd) - int fd; +readable(int fd) { uid_t uid; int ngroups, i; @@ -726,11 +715,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; @@ -971,10 +956,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; @@ -994,9 +976,7 @@ number_option(str, valp, base) * if there is an error. */ static int -int_option(str, valp) - char *str; - int *valp; +int_option(char *str, int *valp) { u_int32_t v; @@ -1015,8 +995,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); } @@ -1026,8 +1005,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; @@ -1070,8 +1048,7 @@ callfile(argv) * setdebug - Set debug (command line argument). */ static int -setdebug(argv) - char **argv; +setdebug(char **argv) { debug++; return (1); @@ -1081,8 +1058,7 @@ setdebug(argv) * setkdebug - Set kernel debugging level. */ static int -setkdebug(argv) - char **argv; +setkdebug(char **argv) { return int_option(*argv, &kdebugflag); } @@ -1092,8 +1068,7 @@ setkdebug(argv) * setpdebug - Set libpcap debugging level. */ static int -setpdebug(argv) - char **argv; +setpdebug(char **argv) { return int_option(*argv, &dflag); } @@ -1102,8 +1077,7 @@ setpdebug(argv) * setpassfilter - Set the pass filter for packets */ static int -setpassfilter(argv) - char **argv; +setpassfilter(char **argv) { pc.linktype = DLT_PPP; pc.snapshot = PPP_HDRLEN; @@ -1118,8 +1092,7 @@ setpassfilter(argv) * setactivefilter - Set the active filter for packets */ static int -setactivefilter(argv) - char **argv; +setactivefilter(char **argv) { pc.linktype = DLT_PPP; pc.snapshot = PPP_HDRLEN; @@ -1135,8 +1108,7 @@ setactivefilter(argv) * noopt - Disable all options. */ 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)); @@ -1150,8 +1122,7 @@ noopt(argv) * noaccomp - Disable Address/Control field compression negotiation. */ static int -noaccomp(argv) - char **argv; +noaccomp(char **argv) { lcp_wantoptions[0].neg_accompression = 0; lcp_allowoptions[0].neg_accompression = 0; @@ -1163,8 +1134,7 @@ noaccomp(argv) * noasyncmap - Disable async map negotiation. */ static int -noasyncmap(argv) - char **argv; +noasyncmap(char **argv) { lcp_wantoptions[0].neg_asyncmap = 0; lcp_allowoptions[0].neg_asyncmap = 0; @@ -1176,8 +1146,7 @@ noasyncmap(argv) * noip - Disable IP and IPCP. */ static int -noip(argv) - char **argv; +noip(char **argv) { ipcp_protent.enabled_flag = 0; return (1); @@ -1188,8 +1157,7 @@ noip(argv) * nomagicnumber - Disable magic number negotiation. */ static int -nomagicnumber(argv) - char **argv; +nomagicnumber(char **argv) { lcp_wantoptions[0].neg_magicnumber = 0; lcp_allowoptions[0].neg_magicnumber = 0; @@ -1201,8 +1169,7 @@ nomagicnumber(argv) * nomru - Disable mru negotiation. */ static int -nomru(argv) - char **argv; +nomru(char **argv) { lcp_wantoptions[0].neg_mru = 0; lcp_allowoptions[0].neg_mru = 0; @@ -1214,8 +1181,7 @@ nomru(argv) * setmru - Set MRU for negotiation. */ static int -setmru(argv) - char **argv; +setmru(char **argv) { u_int32_t mru; @@ -1231,8 +1197,7 @@ setmru(argv) * setmru - Set the largest MTU we'll use. */ static int -setmtu(argv) - char **argv; +setmtu(char **argv) { u_int32_t mtu; @@ -1267,8 +1232,7 @@ setcbcp(argv) * nopcomp - Disable Protocol field compression negotiation. */ static int -nopcomp(argv) - char **argv; +nopcomp(char **argv) { lcp_wantoptions[0].neg_pcompression = 0; lcp_allowoptions[0].neg_pcompression = 0; @@ -1281,8 +1245,7 @@ nopcomp(argv) * LCP configure-requests). */ static int -setpassive(argv) - char **argv; +setpassive(char **argv) { lcp_wantoptions[0].passive = 1; return (1); @@ -1294,8 +1257,7 @@ setpassive(argv) * until we get one from the peer). */ static int -setsilent(argv) - char **argv; +setsilent(char **argv) { lcp_wantoptions[0].silent = 1; return 1; @@ -1306,8 +1268,7 @@ setsilent(argv) * nopap - Disable PAP authentication with peer. */ static int -nopap(argv) - char **argv; +nopap(char **argv) { refuse_pap = 1; return (1); @@ -1318,8 +1279,7 @@ nopap(argv) * reqpap - Require PAP authentication from peer. */ static int -reqpap(argv) - char **argv; +reqpap(char **argv) { lcp_wantoptions[0].neg_upap = 1; setauth(NULL); @@ -1330,8 +1290,7 @@ reqpap(argv) * nochap - Disable CHAP authentication with peer. */ static int -nochap(argv) - char **argv; +nochap(char **argv) { refuse_chap = 1; return (1); @@ -1342,8 +1301,7 @@ nochap(argv) * reqchap - Require CHAP authentication from peer. */ static int -reqchap(argv) - char **argv; +reqchap(char **argv) { lcp_wantoptions[0].neg_chap = 1; setauth(NULL); @@ -1355,8 +1313,7 @@ reqchap(argv) * setnovj - disable vj compression */ static int -setnovj(argv) - char **argv; +setnovj(char **argv) { ipcp_wantoptions[0].neg_vj = 0; ipcp_allowoptions[0].neg_vj = 0; @@ -1368,8 +1325,7 @@ setnovj(argv) * setnovjccomp - disable VJ connection-ID compression */ static int -setnovjccomp(argv) - char **argv; +setnovjccomp(char **argv) { ipcp_wantoptions[0].cflag = 0; ipcp_allowoptions[0].cflag = 0; @@ -1381,8 +1337,7 @@ setnovjccomp(argv) * setvjslots - set maximum number of connection slots for VJ compression */ static int -setvjslots(argv) - char **argv; +setvjslots(char **argv) { int value; @@ -1402,8 +1357,7 @@ setvjslots(argv) * setconnector - Set a program to connect to a serial line */ static int -setconnector(argv) - char **argv; +setconnector(char **argv) { connector = strdup(*argv); if (connector == NULL) @@ -1418,8 +1372,7 @@ setconnector(argv) * setdisconnector - Set a program to disconnect from the serial line */ static int -setdisconnector(argv) - char **argv; +setdisconnector(char **argv) { disconnector = strdup(*argv); if (disconnector == NULL) @@ -1434,8 +1387,7 @@ setdisconnector(argv) * setwelcomer - Set a program to welcome a client after connection */ static int -setwelcomer(argv) - char **argv; +setwelcomer(char **argv) { welcomer = strdup(*argv); if (welcomer == NULL) @@ -1450,8 +1402,7 @@ setwelcomer(argv) * setmaxconnect - Set the maximum connect time */ static int -setmaxconnect(argv) - char **argv; +setmaxconnect(char **argv) { int value; @@ -1473,8 +1424,7 @@ setmaxconnect(argv) * setdomain - Set domain name to append to hostname */ static int -setdomain(argv) - char **argv; +setdomain(char **argv) { if (!privileged_option) { option_error("using the domain option requires root privilege"); @@ -1495,8 +1445,7 @@ setdomain(argv) * setasyncmap - add bits to asyncmap (what we request peer to escape). */ static int -setasyncmap(argv) - char **argv; +setasyncmap(char **argv) { u_int32_t asyncmap; @@ -1512,8 +1461,7 @@ setasyncmap(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; @@ -1544,8 +1492,7 @@ setescape(argv) * setspeed - Set the speed. */ static int -setspeed(arg) - char *arg; +setspeed(char *arg) { char *ptr; int spd; @@ -1562,9 +1509,7 @@ setspeed(arg) * setdevname - Set the device name. */ static int -setdevname(cp, quiet) - char *cp; - int quiet; +setdevname(char *cp, int quiet) { struct stat statbuf; char dev[PATH_MAX]; @@ -1601,8 +1546,7 @@ setdevname(cp, quiet) * setipaddr - Set the IP address */ static int -setipaddr(arg) - char *arg; +setipaddr(char *arg) { struct hostent *hp; char *colon; @@ -1672,8 +1616,7 @@ setipaddr(arg) * setnoipdflt - disable setipdefault() */ static int -setnoipdflt(argv) - char **argv; +setnoipdflt(char **argv) { disable_defaultip = 1; return 1; @@ -1684,8 +1627,7 @@ setnoipdflt(argv) * setipcpaccl - accept peer's idea of our address */ static int -setipcpaccl(argv) - char **argv; +setipcpaccl(char **argv) { ipcp_wantoptions[0].accept_local = 1; return 1; @@ -1696,8 +1638,7 @@ setipcpaccl(argv) * setipcpaccr - accept peer's idea of its address */ static int -setipcpaccr(argv) - char **argv; +setipcpaccr(char **argv) { ipcp_wantoptions[0].accept_remote = 1; return 1; @@ -1708,8 +1649,7 @@ setipcpaccr(argv) * setnetmask - set the netmask to be used on the interface. */ static int -setnetmask(argv) - char **argv; +setnetmask(char **argv) { struct in_addr ina; @@ -1723,24 +1663,21 @@ setnetmask(argv) } static int -setcrtscts(argv) - char **argv; +setcrtscts(char **argv) { crtscts = 1; return (1); } static int -setnocrtscts(argv) - char **argv; +setnocrtscts(char **argv) { crtscts = -1; return (1); } static int -setxonxoff(argv) - char **argv; +setxonxoff(char **argv) { lcp_wantoptions[0].asyncmap |= 0x000A0000; /* escape ^S and ^Q */ lcp_wantoptions[0].neg_asyncmap = 1; @@ -1750,24 +1687,21 @@ setxonxoff(argv) } static int -setnodetach(argv) - char **argv; +setnodetach(char **argv) { nodetach = 1; return (1); } static int -setupdetach(argv) - char **argv; +setupdetach(char **argv) { nodetach = -1; return (1); } static int -setdemand(argv) - char **argv; +setdemand(char **argv) { demand = 1; persist = 1; @@ -1775,48 +1709,42 @@ setdemand(argv) } static int -setmodem(argv) - char **argv; +setmodem(char **argv) { modem = 1; return 1; } static int -setmodem_chat(argv) - char **argv; +setmodem_chat(char **argv) { modem_chat = 1; return 1; } static int -setlocal(argv) - char **argv; +setlocal(char **argv) { modem = 0; return 1; } static int -setlock(argv) - char **argv; +setlock(char **argv) { lockflag = 1; return 1; } static int -setusehostname(argv) - char **argv; +setusehostname(char **argv) { usehostname = 1; return 1; } static int -setname(argv) - char **argv; +setname(char **argv) { if (!privileged_option) { option_error("using the name option requires root privilege"); @@ -1827,24 +1755,21 @@ setname(argv) } static int -setuser(argv) - char **argv; +setuser(char **argv) { strlcpy(user, argv[0], MAXNAMELEN); return 1; } static int -setremote(argv) - char **argv; +setremote(char **argv) { strlcpy(remote_name, argv[0], MAXNAMELEN); return 1; } static int -setauth(argv) - char **argv; +setauth(char **argv) { auth_required = 1; if (privileged_option > auth_req_info.priv) { @@ -1855,8 +1780,7 @@ setauth(argv) } static int -setnoauth(argv) - char **argv; +setnoauth(char **argv) { if (auth_required && privileged_option < auth_req_info.priv) { if (auth_req_info.source == NULL) @@ -1871,8 +1795,7 @@ setnoauth(argv) } static int -setdefaultroute(argv) - char **argv; +setdefaultroute(char **argv) { if (!ipcp_allowoptions[0].default_route) { option_error("defaultroute option is disabled"); @@ -1883,8 +1806,7 @@ setdefaultroute(argv) } static int -setnodefaultroute(argv) - char **argv; +setnodefaultroute(char **argv) { ipcp_allowoptions[0].default_route = 0; ipcp_wantoptions[0].default_route = 0; @@ -1892,8 +1814,7 @@ setnodefaultroute(argv) } static int -setproxyarp(argv) - char **argv; +setproxyarp(char **argv) { if (!ipcp_allowoptions[0].proxy_arp) { option_error("proxyarp option is disabled"); @@ -1904,8 +1825,7 @@ setproxyarp(argv) } static int -setnoproxyarp(argv) - char **argv; +setnoproxyarp(char **argv) { ipcp_wantoptions[0].proxy_arp = 0; ipcp_allowoptions[0].proxy_arp = 0; @@ -1913,24 +1833,21 @@ setnoproxyarp(argv) } static int -setpersist(argv) - char **argv; +setpersist(char **argv) { persist = 1; return 1; } static int -setnopersist(argv) - char **argv; +setnopersist(char **argv) { persist = 0; return 1; } static int -setdologin(argv) - char **argv; +setdologin(char **argv) { uselogin = 1; return 1; @@ -1941,15 +1858,13 @@ setdologin(argv) */ static int -setlcpechointv(argv) - char **argv; +setlcpechointv(char **argv) { return int_option(*argv, &lcp_echo_interval); } static int -setlcpechofails(argv) - char **argv; +setlcpechofails(char **argv) { return int_option(*argv, &lcp_echo_fails); } @@ -1958,114 +1873,98 @@ setlcpechofails(argv) * Functions to set timeouts, max transmits, etc. */ static int -setlcptimeout(argv) - char **argv; +setlcptimeout(char **argv) { return int_option(*argv, &lcp_fsm[0].timeouttime); } static int -setlcpterm(argv) - char **argv; +setlcpterm(char **argv) { return int_option(*argv, &lcp_fsm[0].maxtermtransmits); } static int -setlcpconf(argv) - char **argv; +setlcpconf(char **argv) { return int_option(*argv, &lcp_fsm[0].maxconfreqtransmits); } static int -setlcpfails(argv) - char **argv; +setlcpfails(char **argv) { return int_option(*argv, &lcp_fsm[0].maxnakloops); } static int -setipcptimeout(argv) - char **argv; +setipcptimeout(char **argv) { return int_option(*argv, &ipcp_fsm[0].timeouttime); } static int -setipcpterm(argv) - char **argv; +setipcpterm(char **argv) { return int_option(*argv, &ipcp_fsm[0].maxtermtransmits); } static int -setipcpconf(argv) - char **argv; +setipcpconf(char **argv) { return int_option(*argv, &ipcp_fsm[0].maxconfreqtransmits); } static int -setipcpfails(argv) - char **argv; +setipcpfails(char **argv) { return int_option(*argv, &lcp_fsm[0].maxnakloops); } static int -setpaptimeout(argv) - char **argv; +setpaptimeout(char **argv) { return int_option(*argv, &upap[0].us_timeouttime); } static int -setpapreqtime(argv) - char **argv; +setpapreqtime(char **argv) { return int_option(*argv, &upap[0].us_reqtimeout); } static int -setpapreqs(argv) - char **argv; +setpapreqs(char **argv) { return int_option(*argv, &upap[0].us_maxtransmits); } static int -setchaptimeout(argv) - char **argv; +setchaptimeout(char **argv) { return int_option(*argv, &chap[0].timeouttime); } static int -setchapchal(argv) - char **argv; +setchapchal(char **argv) { return int_option(*argv, &chap[0].max_transmits); } static int -setchapintv(argv) - char **argv; +setchapintv(char **argv) { return int_option(*argv, &chap[0].chal_interval); } static int -noccp(argv) - char **argv; +noccp(char **argv) { ccp_protent.enabled_flag = 0; return 1; } static int -setbsdcomp(argv) - char **argv; +setbsdcomp(char **argv) { int rbits, abits; char *str, *endp; @@ -2100,8 +1999,7 @@ setbsdcomp(argv) } static int -setnobsdcomp(argv) - char **argv; +setnobsdcomp(char **argv) { ccp_wantoptions[0].bsd_compress = 0; ccp_allowoptions[0].bsd_compress = 0; @@ -2109,8 +2007,7 @@ setnobsdcomp(argv) } static int -setdeflate(argv) - char **argv; +setdeflate(char **argv) { int rbits, abits; char *str, *endp; @@ -2146,8 +2043,7 @@ setdeflate(argv) } static int -setnodeflate(argv) - char **argv; +setnodeflate(char **argv) { ccp_wantoptions[0].deflate = 0; ccp_allowoptions[0].deflate = 0; @@ -2155,8 +2051,7 @@ setnodeflate(argv) } static int -setnodeflatedraft(argv) - char **argv; +setnodeflatedraft(char **argv) { ccp_wantoptions[0].deflate_draft = 0; ccp_allowoptions[0].deflate_draft = 0; @@ -2164,8 +2059,7 @@ setnodeflatedraft(argv) } static int -setpred1comp(argv) - char **argv; +setpred1comp(char **argv) { ccp_wantoptions[0].predictor_1 = 1; ccp_allowoptions[0].predictor_1 = 1; @@ -2173,8 +2067,7 @@ setpred1comp(argv) } static int -setnopred1comp(argv) - char **argv; +setnopred1comp(char **argv) { ccp_wantoptions[0].predictor_1 = 0; ccp_allowoptions[0].predictor_1 = 0; @@ -2182,8 +2075,7 @@ setnopred1comp(argv) } static int -setipparam(argv) - char **argv; +setipparam(char **argv) { ipparam = strdup(*argv); if (ipparam == NULL) @@ -2193,23 +2085,20 @@ setipparam(argv) } static int -setpapcrypt(argv) - char **argv; +setpapcrypt(char **argv) { cryptpap = 1; return 1; } static int -setidle(argv) - char **argv; +setidle(char **argv) { return int_option(*argv, &idle_time_limit); } static int -setholdoff(argv) - char **argv; +setholdoff(char **argv) { return int_option(*argv, &holdoff); } @@ -2218,8 +2107,7 @@ setholdoff(argv) * setdnsaddr - set the dns address(es) */ static int -setdnsaddr(argv) - char **argv; +setdnsaddr(char **argv) { struct in_addr ina; struct hostent *hp; @@ -2249,8 +2137,7 @@ setdnsaddr(argv) * the caller to the existing WINS server on a Windows NT platform. */ static int -setwinsaddr(argv) - char **argv; +setwinsaddr(char **argv) { struct in_addr ina; struct hostent *hp; @@ -2276,8 +2163,7 @@ setwinsaddr(argv) #ifdef MSLANMAN static int -setmslanman(argv) - char **argv; +setmslanman(char **argv) { ms_lanman = 1; return (1); diff --git a/usr.sbin/pppd/pppd.h b/usr.sbin/pppd/pppd.h index 9cd332939a3..464dd11a324 100644 --- a/usr.sbin/pppd/pppd.h +++ b/usr.sbin/pppd/pppd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pppd.h,v 1.22 2017/11/17 20:48:30 jca Exp $ */ +/* $OpenBSD: pppd.h,v 1.23 2024/08/09 05:16:13 deraadt Exp $ */ /* * pppd.h - PPP daemon global declarations. @@ -54,6 +54,7 @@ #include #include /* for FILE */ #include +#include /* * Limits. @@ -108,7 +109,7 @@ extern char user[]; /* Our name for authenticating ourselves */ extern char passwd[]; /* Password for PAP */ extern int auth_required; /* Peer is required to authenticate */ extern int proxyarp; /* Set up proxy ARP entry for peer */ -extern int persist; /* Reopen link after it goes down */ +extern volatile sig_atomic_t persist; /* Reopen link after it goes down */ extern int uselogin; /* Use /etc/passwd for checking PAP */ extern int lcp_echo_interval; /* Interval between LCP echo-requests */ extern int lcp_echo_fails; /* Tolerance to unanswered echo-requests */ diff --git a/usr.sbin/pppd/pppstats/pppstats.c b/usr.sbin/pppd/pppstats/pppstats.c index a606caf129a..90d71f542ee 100644 --- a/usr.sbin/pppd/pppstats/pppstats.c +++ b/usr.sbin/pppd/pppstats/pppstats.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pppstats.c,v 1.12 2015/02/09 23:00:14 deraadt Exp $ */ +/* $OpenBSD: pppstats.c,v 1.13 2024/08/09 05:16:15 deraadt Exp $ */ /* * print PPP statistics: @@ -97,15 +97,13 @@ usage() * Sets a flag to not wait for the alarm. */ void -catchalarm(arg) - int arg; +catchalarm(int arg) { signalled = 1; } void -get_ppp_stats(curp) - struct ppp_stats *curp; +get_ppp_stats(struct ppp_stats *curp) { struct ifpppstatsreq req; @@ -122,8 +120,7 @@ get_ppp_stats(curp) } void -get_ppp_cstats(csp) - struct ppp_comp_stats *csp; +get_ppp_cstats(struct ppp_comp_stats *csp) { struct ifpppcstatsreq creq; @@ -306,9 +303,7 @@ intpr() } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int c; struct ifreq ifr; diff --git a/usr.sbin/pppd/sys-bsd.c b/usr.sbin/pppd/sys-bsd.c index 8827aab57f3..8e5c2ad6993 100644 --- a/usr.sbin/pppd/sys-bsd.c +++ b/usr.sbin/pppd/sys-bsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys-bsd.c,v 1.33 2024/02/19 16:39:03 denis Exp $ */ +/* $OpenBSD: sys-bsd.c,v 1.34 2024/08/09 05:16:13 deraadt Exp $ */ /* * sys-bsd.c - System-dependent procedures for setting up @@ -231,8 +231,7 @@ ifconfig and that the kernel supports PPP. See ifconfig(8) and ppp(4)."; * establish_ppp - Turn the serial port into a ppp interface. */ void -establish_ppp(fd) - int fd; +establish_ppp(int fd) { int pppdisc = PPPDISC; int x; @@ -349,8 +348,7 @@ restore_loop() * This shouldn't call die() because it's called from die(). */ void -disestablish_ppp(fd) - int fd; +disestablish_ppp(int fd) { /* Reset non-blocking mode on fd. */ if (initfdflags != -1 && fcntl(fd, F_SETFL, initfdflags) == -1) @@ -406,8 +404,7 @@ clean_check() * For *BSD, we assume that speed_t values numerically equal bits/second. */ void -set_up_tty(fd, local) - int fd, local; +set_up_tty(int fd, int local) { struct termios tios; @@ -471,8 +468,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) { @@ -497,8 +493,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; @@ -572,10 +567,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) { if (debug) log_packet(p, len, "sent ", LOG_DEBUG); @@ -593,8 +585,7 @@ output(unit, p, len) * if timo is NULL). */ void -wait_input(timo) - struct timeval *timo; +wait_input(struct timeval *timo) { fd_set *fdsp = NULL; int fdsn; @@ -622,8 +613,7 @@ wait_input(timo) * if timo is NULL). */ void -wait_loop_output(timo) - struct timeval *timo; +wait_loop_output(struct timeval *timo) { fd_set *fdsp = NULL; int fdsn; @@ -650,8 +640,7 @@ wait_loop_output(timo) * signal is received. */ void -wait_time(timo) - struct timeval *timo; +wait_time(struct timeval *timo) { int n; @@ -667,8 +656,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) { int len; @@ -715,10 +703,7 @@ get_loop_output() * the ppp interface. */ void -ppp_send_config(unit, mtu, asyncmap, pcomp, accomp) - int unit, mtu; - u_int32_t asyncmap; - int pcomp, accomp; +ppp_send_config(int unit, int mtu, u_int32_t asyncmap, int pcomp, int accomp) { u_int x; struct ifreq ifr; @@ -752,9 +737,7 @@ ppp_send_config(unit, mtu, asyncmap, pcomp, accomp) * ppp_set_xaccm - set the extended transmit ACCM for the interface. */ void -ppp_set_xaccm(unit, accm) - int unit; - ext_accm accm; +ppp_set_xaccm(int unit, ext_accm accm) { if (ioctl(ppp_fd, PPPIOCSXASYNCMAP, accm) == -1 && errno != ENOTTY) syslog(LOG_WARNING, "ioctl(set extended ACCM): %m"); @@ -766,10 +749,7 @@ ppp_set_xaccm(unit, accm) * the ppp interface. */ void -ppp_recv_config(unit, mru, asyncmap, pcomp, accomp) - int unit, mru; - u_int32_t asyncmap; - int pcomp, accomp; +ppp_recv_config(int unit, int mru, u_int32_t asyncmap, int pcomp, int accomp) { int x; @@ -799,9 +779,7 @@ ppp_recv_config(unit, mru, asyncmap, pcomp, accomp) * (e.g. code size should be reduced), or -1 if the method is unknown. */ 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) { struct ppp_option_data data; @@ -817,8 +795,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 x; @@ -838,8 +815,7 @@ ccp_flags_set(unit, isopen, isup) * 0 otherwise. This is necessary because of patent nonsense. */ int -ccp_fatal_error(unit) - int unit; +ccp_fatal_error(int unit) { int x; @@ -854,9 +830,7 @@ ccp_fatal_error(unit) * 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_fd, PPPIOCGIDLE, ip) >= 0; } @@ -867,8 +841,7 @@ get_idle_time(u, ip) * 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; @@ -892,8 +865,7 @@ set_filters(pass, active) * sifvjcomp - config tcp header compression */ int -sifvjcomp(u, vjcomp, cidcomp, maxcid) - int u, vjcomp, cidcomp, maxcid; +sifvjcomp(int u, int vjcomp, int cidcomp, int maxcid) { u_int x; @@ -918,8 +890,7 @@ sifvjcomp(u, vjcomp, cidcomp, maxcid) * sifup - Config the interface up and enable IP packets to pass. */ int -sifup(u) - int u; +sifup(int u) { struct ifreq ifr; @@ -941,10 +912,7 @@ sifup(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) { struct npioctl npi; @@ -961,8 +929,7 @@ sifnpmode(u, proto, mode) * sifdown - Config the interface down and disable IP. */ int -sifdown(u) - int u; +sifdown(int u) { struct ifreq ifr; int rv; @@ -1002,9 +969,7 @@ sifdown(u) * 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 ifaliasreq ifra; struct ifreq ifr; @@ -1047,9 +1012,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) { struct ifaliasreq ifra; @@ -1072,9 +1035,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) { return dodefaultroute(g, 's'); } @@ -1083,9 +1044,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) { return dodefaultroute(g, 'c'); } @@ -1094,9 +1053,7 @@ cifdefaultroute(u, l, g) * dodefaultroute - talk to a routing socket to add/delete a default route. */ static int -dodefaultroute(g, cmd) - u_int32_t g; - int cmd; +dodefaultroute(u_int32_t g, int cmd) { int routes; struct { @@ -1154,9 +1111,7 @@ static struct { static int arpmsg_valid; int -sifproxyarp(unit, hisaddr) - int unit; - u_int32_t hisaddr; +sifproxyarp(int unit, u_int32_t hisaddr) { int routes; @@ -1204,9 +1159,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) { int routes; @@ -1305,9 +1258,7 @@ cifproxyarp(unit, hisaddr) #define MAX_IFS 32 static int -get_ether_addr(ipaddr, hwaddr) - u_int32_t ipaddr; - struct sockaddr_dl *hwaddr; +get_ether_addr(u_int32_t ipaddr, struct sockaddr_dl *hwaddr) { u_int32_t ina, mask; struct sockaddr_dl *dla; @@ -1384,8 +1335,7 @@ get_ether_addr(ipaddr, hwaddr) * user-specified netmask. */ u_int32_t -GetMask(addr) - u_int32_t addr; +GetMask(u_int32_t addr) { u_int32_t mask, nmask, ina; struct ifaddrs *ifap, *ifa; @@ -1439,8 +1389,7 @@ GetMask(addr) #define LOCK_PREFIX "/var/spool/lock/LCK.." int -lock(dev) - char *dev; +lock(char *dev) { char hdb_lock_buffer[12]; int fd, n; diff --git a/usr.sbin/pppd/upap.c b/usr.sbin/pppd/upap.c index 2d07cfb9f92..78d1c593081 100644 --- a/usr.sbin/pppd/upap.c +++ b/usr.sbin/pppd/upap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: upap.c,v 1.11 2017/11/17 20:48:30 jca Exp $ */ +/* $OpenBSD: upap.c,v 1.12 2024/08/09 05:16:13 deraadt Exp $ */ /* * upap.c - User/Password Authentication Protocol. @@ -98,8 +98,7 @@ 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]; @@ -123,9 +122,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]; @@ -153,8 +150,7 @@ upap_authwithpeer(unit, user, password) * Set new state. */ void -upap_authpeer(unit) - int unit; +upap_authpeer(int unit) { upap_state *u = &upap[unit]; @@ -175,8 +171,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; @@ -199,8 +194,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; @@ -218,8 +212,7 @@ upap_reqtimeout(arg) * Start authenticating if pending. */ static void -upap_lowerup(unit) - int unit; +upap_lowerup(int unit) { upap_state *u = &upap[unit]; @@ -245,8 +238,7 @@ upap_lowerup(unit) * Cancel all timeouts. */ static void -upap_lowerdown(unit) - int unit; +upap_lowerdown(int unit) { upap_state *u = &upap[unit]; @@ -266,8 +258,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]; @@ -287,10 +278,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; @@ -345,11 +333,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; @@ -423,11 +407,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; @@ -462,11 +442,7 @@ upap_rauthack(u, inp, id, len) * upap_rauthnak - Receive Authenticate-Nakk. */ 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; @@ -502,8 +478,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; @@ -537,11 +512,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; @@ -568,11 +539,7 @@ static char *upap_codenames[] = { }; static int -upap_printpkt(p, plen, printer, arg) - u_char *p; - int plen; - void (*printer)(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;