-/* $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.
* Do what's necessary to bring the physical layer up.
*/
void
-link_required(unit)
- int unit;
+link_required(int unit)
{
}
* physical layer down.
*/
void
-link_terminated(unit)
- int unit;
+link_terminated(int unit)
{
if (phase == PHASE_DEAD)
return;
* 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;
* 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];
* Proceed to the network phase.
*/
static void
-network_phase(unit)
- int unit;
+network_phase(int unit)
{
int i;
struct protent *protp;
* 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
* 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;
* 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);
* 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;
* 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) {
/*
* 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);
* 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. */
* 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;
* 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 */
* 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];
* 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;
*/
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;
* and return 1.
*/
static int
-null_login(unit)
- int unit;
+null_login(int unit)
{
char *filename;
FILE *f;
* could be found.
*/
static int
-get_pap_passwd(passwd)
- char *passwd;
+get_pap_passwd(char *passwd)
{
char *filename;
FILE *f;
* 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;
* (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;
* 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]);
* 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;
* 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
* 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;
* 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;
* free_wordlist - release memory allocated for a wordlist.
*/
static void
-free_wordlist(wp)
- struct wordlist *wp;
+free_wordlist(struct wordlist *wp)
{
struct wordlist *next;
* 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;
-/* $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.
cbcp_up(us);
}
-extern int persist;
+extern volatile sig_atomic_t persist;
/* ok peer will do callback */
static void
-/* $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.
* ccp_init - initialize CCP.
*/
static void
-ccp_init(unit)
- int unit;
+ccp_init(int unit)
{
fsm *f = &ccp_fsm[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];
* 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);
* ccp_lowerup - we may now transmit CCP packets.
*/
static void
-ccp_lowerup(unit)
- int unit;
+ccp_lowerup(int unit)
{
fsm_lowerup(&ccp_fsm[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]);
}
* 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;
* 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:
* 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]);
* 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];
* 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];
* 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];
* 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;
* 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 */
* 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 */
* 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;
* 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];
* 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];
* 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);
};
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;
* 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;
* Timeout waiting for reset-ack.
*/
static void
-ccp_rack_timeout(arg)
- void *arg;
+ccp_rack_timeout(void *arg)
{
fsm *f = arg;
-/* $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.
* ChapInit - Initialize a CHAP unit.
*/
static void
-ChapInit(unit)
- int unit;
+ChapInit(int unit)
{
chap_state *cstate = &chap[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];
* 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];
* ChapChallengeTimeout - Timeout expired on sending challenge.
*/
static void
-ChapChallengeTimeout(arg)
- void *arg;
+ChapChallengeTimeout(void *arg)
{
chap_state *cstate = (chap_state *) arg;
* ChapResponseTimeout - Timeout expired on sending response.
*/
static void
-ChapResponseTimeout(arg)
- void *arg;
+ChapResponseTimeout(void *arg)
{
chap_state *cstate = (chap_state *) arg;
* ChapRechallenge - Time to challenge the peer again.
*/
static void
-ChapRechallenge(arg)
- void *arg;
+ChapRechallenge(void *arg)
{
chap_state *cstate = (chap_state *) arg;
* Start up if we have pending requests.
*/
static void
-ChapLowerUp(unit)
- int unit;
+ChapLowerUp(int unit)
{
chap_state *cstate = &chap[unit];
* Cancel all timeouts.
*/
static void
-ChapLowerDown(unit)
- int unit;
+ChapLowerDown(int unit)
{
chap_state *cstate = &chap[unit];
* ChapProtocolReject - Peer doesn't grok CHAP.
*/
static void
-ChapProtocolReject(unit)
- int unit;
+ChapProtocolReject(int unit)
{
chap_state *cstate = &chap[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;
* 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;
* 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;
* 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));
* 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));
* ChapSendChallenge - Send an Authenticate challenge.
*/
static void
-ChapSendChallenge(cstate)
- chap_state *cstate;
+ChapSendChallenge(chap_state *cstate)
{
u_char *outp;
int chal_len, name_len;
* 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;
*/
static void
-ChapGenChallenge(cstate)
- chap_state *cstate;
+ChapGenChallenge(chap_state *cstate)
{
int chal_len;
* in *cstate.
*/
static void
-ChapSendResponse(cstate)
- chap_state *cstate;
+ChapSendResponse(chap_state *cstate)
{
u_char *outp;
int outlen, md_len, name_len;
};
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;
-/* $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
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, ...);
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);
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)
return ans;
}
-void *copy_of (s)
-char *s;
+void *copy_of (char *s)
{
return dup_mem (s, strlen (s) + 1);
}
* 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;
break;
case 'f':
- chat_file = copy_of(optarg);
+ chat_file = strdup(optarg);
break;
case 't':
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 ':':
* 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;
int alarmed = 0;
-SIGTYPE sigalrm(signo)
-int signo;
+SIGTYPE sigalrm(int signo)
{
int flags;
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");
}
#endif
}
-void terminate(status)
-int status;
+void terminate(int status)
{
echo_stderr(-1);
if (report_file != (char *) 0 && report_fp != (FILE *) NULL) {
/*
* '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'))
* 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;
* Process the expect string
*/
-void chat_expect (s)
-char *s;
+void chat_expect (char *s)
{
char *expect;
char *reply;
* the data.
*/
-char *character(c)
-int c;
+char *character(int c)
{
static char string[10];
char *meta;
/*
* process the reply string
*/
-void chat_send (s)
-register char *s;
+void chat_send (char *s)
{
if (say_next) {
say_next = 0;
}
}
-int put_char(c)
-int c;
+int put_char(int c)
{
int status;
char ch = c;
}
}
-int write_char (c)
-int c;
+int write_char (int c)
{
if (alarmed || put_char(c) < 0) {
alarm(0);
return (1);
}
-int put_string (s)
-register char *s;
+int put_string (char *s)
{
quiet = 0;
s = clean(s, 1);
alarm(timeout); alarmed = 0;
while (*s) {
- register char c = *s++;
+ char c = *s++;
if (c != '\\') {
if (!write_char (c))
* 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;
/*
* '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;
}
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;
#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;
-/* $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.
* 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;
* bring up the link.
*/
int
-loop_frame(frame, len)
- unsigned char *frame;
- int len;
+loop_frame(unsigned char *frame, int len)
{
struct packet *pkt;
* loopback, now that the real serial link is up.
*/
void
-demand_rexmit(proto)
- int proto;
+demand_rexmit(int proto)
{
struct packet *pkt, *prev, *nextpkt;
* 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;
-/* $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.
* Initialize fsm state.
*/
void
-fsm_init(f)
- fsm *f;
+fsm_init(fsm *f)
{
f->state = INITIAL;
f->flags = 0;
* fsm_lowerup - The lower layer is up.
*/
void
-fsm_lowerup(f)
- fsm *f;
+fsm_lowerup(fsm *f)
{
switch( f->state ){
case INITIAL:
* Cancel all timeouts and inform upper layers.
*/
void
-fsm_lowerdown(f)
- fsm *f;
+fsm_lowerdown(fsm *f)
{
switch( f->state ){
case CLOSED:
* fsm_open - Link is allowed to come up.
*/
void
-fsm_open(f)
- fsm *f;
+fsm_open(fsm *f)
{
switch( f->state ){
case INITIAL:
* 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));
* fsm_timeout - Timeout expired.
*/
static void
-fsm_timeout(arg)
- void *arg;
+fsm_timeout(void *arg)
{
fsm *f = (fsm *) 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;
* 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;
* 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));
* 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;
* 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];
* 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)));
* 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;
* Treat this as a catastrophic error (RXJ-).
*/
void
-fsm_protreject(f)
- fsm *f;
+fsm_protreject(fsm *f)
{
switch( f->state ){
case CLOSING:
* 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;
* 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;
-/* $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.
* 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];
* 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];
* 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_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);
}
* ipcp_lowerup - The lower layer is up.
*/
static void
-ipcp_lowerup(unit)
- int unit;
+ipcp_lowerup(int unit)
{
fsm_lowerup(&ipcp_fsm[unit]);
}
* ipcp_lowerdown - The lower layer is down.
*/
static void
-ipcp_lowerdown(unit)
- int unit;
+ipcp_lowerdown(int unit)
{
fsm_lowerdown(&ipcp_fsm[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);
}
* 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]);
}
* ipcp_resetci - Reset our CI.
*/
static void
-ipcp_resetci(f)
- fsm *f;
+ipcp_resetci(fsm *f)
{
ipcp_options *wo = &ipcp_wantoptions[f->unit];
* 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];
* 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;
* 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;
* 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;
* 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;
* 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];
* 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];
* 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];
* 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);
* proxy arp entries, etc.
*/
static void
-ipcp_clear_addrs(unit)
- int unit;
+ipcp_clear_addrs(int unit)
{
u_int32_t ouraddr, hisaddr;
* 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);
}
* 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];
};
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;
#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;
-/* $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.
/* 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 */
-/* $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.
* 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];
* 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];
* 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];
* lcp_lowerup - The lower layer is up.
*/
void
-lcp_lowerup(unit)
- int unit;
+lcp_lowerup(int unit)
{
lcp_options *wo = &lcp_wantoptions[unit];
* lcp_lowerdown - The lower layer is down.
*/
void
-lcp_lowerdown(unit)
- int unit;
+lcp_lowerdown(int unit)
{
fsm_lowerdown(&lcp_fsm[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];
* 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;
* 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;
* lcp_protrej - A Protocol-Reject was received.
*/
static void
-lcp_protrej(unit)
- int unit;
+lcp_protrej(int unit)
{
/*
* Can't reject LCP!
* 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
* 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;
* 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];
* 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;
* 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;
* 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];
* 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;
* 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];
* 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];
* Alert other protocols.
*/
static void
-lcp_down(f)
- fsm *f;
+lcp_down(fsm *f)
{
lcp_options *go = &lcp_gotoptions[f->unit];
* lcp_starting - LCP needs the lower layer up.
*/
static void
-lcp_starting(f)
- fsm *f;
+lcp_starting(fsm *f)
{
link_required(f->unit);
}
* lcp_finished - LCP has finished with the lower layer.
*/
static void
-lcp_finished(f)
- fsm *f;
+lcp_finished(fsm *f)
{
link_terminated(f->unit);
}
};
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;
* 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);
*/
static void
-LcpEchoCheck (f)
- fsm *f;
+LcpEchoCheck(fsm *f)
{
LcpSendEchoRequest (f);
*/
static void
-LcpEchoTimeout (arg)
- void *arg;
+LcpEchoTimeout(void *arg)
{
if (lcp_echo_timer_running != 0) {
lcp_echo_timer_running = 0;
*/
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;
*/
static void
-LcpSendEchoRequest (f)
- fsm *f;
+LcpSendEchoRequest(fsm *f)
{
u_int32_t lcp_magic;
u_char pkt[4], *pktp;
*/
static void
-lcp_echo_lowerup (unit)
- int unit;
+lcp_echo_lowerup(int unit)
{
fsm *f = &lcp_fsm[unit];
*/
static void
-lcp_echo_lowerdown (unit)
- int unit;
+lcp_echo_lowerdown(int unit)
{
fsm *f = &lcp_fsm[unit];
-/* $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.
* 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 */
-/* $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
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 */
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 */
};
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
int i, fdflags;
struct sigaction sa;
* 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;
}
* 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;
* 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;
* untimeout - Unschedule a timeout.
*/
void
-untimeout(func, arg)
- void (*func)(void *);
- void *arg;
+untimeout(void (*func)(void *), void *arg)
{
struct callout **copp, *freep;
* 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;
* 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;
* 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;
* 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;
* Calls reap_kids to get status for any dead kids.
*/
static void
-chld(sig)
- int sig;
+chld(int sig)
{
int save_errno = errno;
* Toggle debug flag.
*/
static void
-toggle_debug(sig)
- int sig;
+toggle_debug(int sig)
{
debug = !debug;
if (debug) {
* Try to (re)negotiate compression.
*/
static void
-open_ccp(sig)
- int sig;
+open_ccp(int sig)
{
open_ccp_flag = 1;
}
* 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;
* 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;
* 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;
* and log a message for abnormal terminations.
*/
static void
-reap_kids()
+reap_kids(void)
{
int status;
pid_t pid;
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);
* 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;
* 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;
* 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);
#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;
* 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;
-/* $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.
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 */
* 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;
* if specified.
*/
void
-scan_args(argc, argv)
- int argc;
- char **argv;
+scan_args(int argc, char **argv)
{
char *arg;
struct cmd *cmdp;
* showhelp - print out usage message and exit.
*/
static int
-showhelp(argv)
- char **argv;
+showhelp(char **argv)
{
if (phase == PHASE_INITIALIZE) {
usage();
* 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",
* 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;
* 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;
* \<newline> 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;
* 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;
* 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;
* readfile - take commands from a file.
*/
static int
-readfile(argv)
- char **argv;
+readfile(char **argv)
{
return options_from_file(*argv, 1, 1, privileged_option);
}
* 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;
* setdebug - Set debug (command line argument).
*/
static int
-setdebug(argv)
- char **argv;
+setdebug(char **argv)
{
debug++;
return (1);
* setkdebug - Set kernel debugging level.
*/
static int
-setkdebug(argv)
- char **argv;
+setkdebug(char **argv)
{
return int_option(*argv, &kdebugflag);
}
* setpdebug - Set libpcap debugging level.
*/
static int
-setpdebug(argv)
- char **argv;
+setpdebug(char **argv)
{
return int_option(*argv, &dflag);
}
* setpassfilter - Set the pass filter for packets
*/
static int
-setpassfilter(argv)
- char **argv;
+setpassfilter(char **argv)
{
pc.linktype = DLT_PPP;
pc.snapshot = PPP_HDRLEN;
* setactivefilter - Set the active filter for packets
*/
static int
-setactivefilter(argv)
- char **argv;
+setactivefilter(char **argv)
{
pc.linktype = DLT_PPP;
pc.snapshot = PPP_HDRLEN;
* 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));
* 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;
* 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;
* noip - Disable IP and IPCP.
*/
static int
-noip(argv)
- char **argv;
+noip(char **argv)
{
ipcp_protent.enabled_flag = 0;
return (1);
* 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;
* 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;
* setmru - Set MRU for negotiation.
*/
static int
-setmru(argv)
- char **argv;
+setmru(char **argv)
{
u_int32_t mru;
* setmru - Set the largest MTU we'll use.
*/
static int
-setmtu(argv)
- char **argv;
+setmtu(char **argv)
{
u_int32_t mtu;
* 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;
* LCP configure-requests).
*/
static int
-setpassive(argv)
- char **argv;
+setpassive(char **argv)
{
lcp_wantoptions[0].passive = 1;
return (1);
* until we get one from the peer).
*/
static int
-setsilent(argv)
- char **argv;
+setsilent(char **argv)
{
lcp_wantoptions[0].silent = 1;
return 1;
* nopap - Disable PAP authentication with peer.
*/
static int
-nopap(argv)
- char **argv;
+nopap(char **argv)
{
refuse_pap = 1;
return (1);
* reqpap - Require PAP authentication from peer.
*/
static int
-reqpap(argv)
- char **argv;
+reqpap(char **argv)
{
lcp_wantoptions[0].neg_upap = 1;
setauth(NULL);
* nochap - Disable CHAP authentication with peer.
*/
static int
-nochap(argv)
- char **argv;
+nochap(char **argv)
{
refuse_chap = 1;
return (1);
* reqchap - Require CHAP authentication from peer.
*/
static int
-reqchap(argv)
- char **argv;
+reqchap(char **argv)
{
lcp_wantoptions[0].neg_chap = 1;
setauth(NULL);
* 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;
* 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;
* setvjslots - set maximum number of connection slots for VJ compression
*/
static int
-setvjslots(argv)
- char **argv;
+setvjslots(char **argv)
{
int value;
* 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)
* 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)
* 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)
* setmaxconnect - Set the maximum connect time
*/
static int
-setmaxconnect(argv)
- char **argv;
+setmaxconnect(char **argv)
{
int value;
* 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");
* setasyncmap - add bits to asyncmap (what we request peer to escape).
*/
static int
-setasyncmap(argv)
- char **argv;
+setasyncmap(char **argv)
{
u_int32_t asyncmap;
* 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;
* setspeed - Set the speed.
*/
static int
-setspeed(arg)
- char *arg;
+setspeed(char *arg)
{
char *ptr;
int spd;
* 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];
* setipaddr - Set the IP address
*/
static int
-setipaddr(arg)
- char *arg;
+setipaddr(char *arg)
{
struct hostent *hp;
char *colon;
* setnoipdflt - disable setipdefault()
*/
static int
-setnoipdflt(argv)
- char **argv;
+setnoipdflt(char **argv)
{
disable_defaultip = 1;
return 1;
* 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;
* 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;
* setnetmask - set the netmask to be used on the interface.
*/
static int
-setnetmask(argv)
- char **argv;
+setnetmask(char **argv)
{
struct in_addr ina;
}
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;
}
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;
}
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");
}
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) {
}
static int
-setnoauth(argv)
- char **argv;
+setnoauth(char **argv)
{
if (auth_required && privileged_option < auth_req_info.priv) {
if (auth_req_info.source == NULL)
}
static int
-setdefaultroute(argv)
- char **argv;
+setdefaultroute(char **argv)
{
if (!ipcp_allowoptions[0].default_route) {
option_error("defaultroute option is disabled");
}
static int
-setnodefaultroute(argv)
- char **argv;
+setnodefaultroute(char **argv)
{
ipcp_allowoptions[0].default_route = 0;
ipcp_wantoptions[0].default_route = 0;
}
static int
-setproxyarp(argv)
- char **argv;
+setproxyarp(char **argv)
{
if (!ipcp_allowoptions[0].proxy_arp) {
option_error("proxyarp option is disabled");
}
static int
-setnoproxyarp(argv)
- char **argv;
+setnoproxyarp(char **argv)
{
ipcp_wantoptions[0].proxy_arp = 0;
ipcp_allowoptions[0].proxy_arp = 0;
}
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;
*/
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);
}
* 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;
}
static int
-setnobsdcomp(argv)
- char **argv;
+setnobsdcomp(char **argv)
{
ccp_wantoptions[0].bsd_compress = 0;
ccp_allowoptions[0].bsd_compress = 0;
}
static int
-setdeflate(argv)
- char **argv;
+setdeflate(char **argv)
{
int rbits, abits;
char *str, *endp;
}
static int
-setnodeflate(argv)
- char **argv;
+setnodeflate(char **argv)
{
ccp_wantoptions[0].deflate = 0;
ccp_allowoptions[0].deflate = 0;
}
static int
-setnodeflatedraft(argv)
- char **argv;
+setnodeflatedraft(char **argv)
{
ccp_wantoptions[0].deflate_draft = 0;
ccp_allowoptions[0].deflate_draft = 0;
}
static int
-setpred1comp(argv)
- char **argv;
+setpred1comp(char **argv)
{
ccp_wantoptions[0].predictor_1 = 1;
ccp_allowoptions[0].predictor_1 = 1;
}
static int
-setnopred1comp(argv)
- char **argv;
+setnopred1comp(char **argv)
{
ccp_wantoptions[0].predictor_1 = 0;
ccp_allowoptions[0].predictor_1 = 0;
}
static int
-setipparam(argv)
- char **argv;
+setipparam(char **argv)
{
ipparam = strdup(*argv);
if (ipparam == NULL)
}
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);
}
* setdnsaddr - set the dns address(es)
*/
static int
-setdnsaddr(argv)
- char **argv;
+setdnsaddr(char **argv)
{
struct in_addr ina;
struct hostent *hp;
* 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;
#ifdef MSLANMAN
static int
-setmslanman(argv)
- char **argv;
+setmslanman(char **argv)
{
ms_lanman = 1;
return (1);
-/* $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.
#include <net/ppp_defs.h>
#include <stdio.h> /* for FILE */
#include <stdarg.h>
+#include <signal.h>
/*
* Limits.
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 */
-/* $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:
* 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;
}
void
-get_ppp_cstats(csp)
- struct ppp_comp_stats *csp;
+get_ppp_cstats(struct ppp_comp_stats *csp)
{
struct ifpppcstatsreq creq;
}
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
int c;
struct ifreq ifr;
-/* $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
* 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;
* 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)
* 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;
* 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) {
* 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;
* 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);
* if timo is NULL).
*/
void
-wait_input(timo)
- struct timeval *timo;
+wait_input(struct timeval *timo)
{
fd_set *fdsp = NULL;
int fdsn;
* if timo is NULL).
*/
void
-wait_loop_output(timo)
- struct timeval *timo;
+wait_loop_output(struct timeval *timo)
{
fd_set *fdsp = NULL;
int fdsn;
* signal is received.
*/
void
-wait_time(timo)
- struct timeval *timo;
+wait_time(struct timeval *timo)
{
int n;
* read_packet - get a PPP packet from the serial device.
*/
int
-read_packet(buf)
- u_char *buf;
+read_packet(u_char *buf)
{
int len;
* 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;
* 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");
* 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;
* (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;
* 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;
* 0 otherwise. This is necessary because of patent nonsense.
*/
int
-ccp_fatal_error(unit)
- int unit;
+ccp_fatal_error(int unit)
{
int x;
* 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;
}
* 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;
* 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;
* sifup - Config the interface up and enable IP packets to pass.
*/
int
-sifup(u)
- int u;
+sifup(int u)
{
struct ifreq ifr;
* 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;
* sifdown - Config the interface down and disable IP.
*/
int
-sifdown(u)
- int u;
+sifdown(int u)
{
struct ifreq ifr;
int rv;
* 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;
* 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;
* 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');
}
* 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');
}
* 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 {
static int arpmsg_valid;
int
-sifproxyarp(unit, hisaddr)
- int unit;
- u_int32_t hisaddr;
+sifproxyarp(int unit, u_int32_t hisaddr)
{
int routes;
* 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;
#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;
* 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;
#define LOCK_PREFIX "/var/spool/lock/LCK.."
int
-lock(dev)
- char *dev;
+lock(char *dev)
{
char hdb_lock_buffer[12];
int fd, n;
-/* $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.
* upap_init - Initialize a UPAP unit.
*/
static void
-upap_init(unit)
- int unit;
+upap_init(int unit)
{
upap_state *u = &upap[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];
* Set new state.
*/
void
-upap_authpeer(unit)
- int unit;
+upap_authpeer(int unit)
{
upap_state *u = &upap[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;
* 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;
* Start authenticating if pending.
*/
static void
-upap_lowerup(unit)
- int unit;
+upap_lowerup(int unit)
{
upap_state *u = &upap[unit];
* Cancel all timeouts.
*/
static void
-upap_lowerdown(unit)
- int unit;
+upap_lowerdown(int unit)
{
upap_state *u = &upap[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];
* 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;
* 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;
* 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;
* 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;
* upap_sauthreq - Send an Authenticate-Request.
*/
static void
-upap_sauthreq(u)
- upap_state *u;
+upap_sauthreq(upap_state *u)
{
u_char *outp;
int outlen;
* 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;
};
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;