-/* $OpenBSD: addr_range.c,v 1.6 2017/05/30 17:22:00 yasuoka Exp $ */
+/* $OpenBSD: addr_range.c,v 1.7 2024/02/26 08:25:51 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* All rights reserved.
* Author:
* Yasuoka Masahiko <yasuoka@iij.ad.jp>
*
- * $Id: addr_range.c,v 1.6 2017/05/30 17:22:00 yasuoka Exp $
+ * $Id: addr_range.c,v 1.7 2024/02/26 08:25:51 yasuoka Exp $
*/
#ifdef ADDR_RANGE_DEBUG
#define IIJDEBUG
return 0;
}
-static int bitmask2masklen(mask)
- u_int32_t mask;
+static int bitmask2masklen(u_int32_t mask)
{
switch(mask) {
case 0x00000000: return 0;
-/* $OpenBSD: debugutil.c,v 1.6 2017/05/30 17:22:00 yasuoka Exp $ */
+/* $OpenBSD: debugutil.c,v 1.7 2024/02/26 08:25:51 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* All rights reserved.
}
void
-debug_set_debugfp(fp)
- FILE *fp;
+debug_set_debugfp(FILE *fp)
{
debugfp = fp;
}
void
-debug_use_syslog(b)
- int b;
+debug_use_syslog(int b)
{
if (b)
use_syslog = 1;
-/* $OpenBSD: hash.c,v 1.5 2015/12/17 08:01:55 tb Exp $ */
+/* $OpenBSD: hash.c,v 1.6 2024/02/26 08:25:51 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* All rights reserved.
* NULL.
*/
hash_table *
-hash_create(cmp_func, hash_func, hsz)
- int (*cmp_func) (const void *, const void *);
- uint32_t (*hash_func) (const void *, int);
- int hsz;
+hash_create(int (*cmp_func) (const void *, const void *),
+ uint32_t (*hash_func) (const void *, int), int hsz)
{
hash_table *htbl;
* NULL.
*/
hash_link *
-hash_first(htbl)
- hash_table *htbl;
+hash_first(hash_table *htbl)
{
htbl->cur = 0;
htbl->bucket_cur = NULL;
* NULL.
*/
hash_link *
-hash_next(htbl)
- hash_table *htbl;
+hash_next(hash_table *htbl)
{
hash_link *hlink;
* NULL
*/
hash_link *
-hash_lookup(htbl, k)
- hash_table *htbl;
- const void *k;
+hash_lookup(hash_table *htbl, const void *k)
{
int c;
hash_link *w;
* Return 0 on success. Return -1 on failure.
*/
int
-hash_insert(htbl, k, i)
- hash_table *htbl;
- const void *k;
- void *i;
+hash_insert(hash_table *htbl, const void *k, void *i)
{
int c;
hash_link *n;
* on failure.
*/
int
-hash_delete(htbl, k, memfree)
- hash_table *htbl;
- const void *k;
- int memfree;
+hash_delete(hash_table *htbl, const void *k, int memfree)
{
int i;
hash_link *b, *w;
* If memfree != 0 then free items.
*/
void
-hash_delete_all(htbl, memfree)
- hash_table *htbl;
- int memfree;
+hash_delete_all(hash_table *htbl, int memfree)
{
int i;
hash_link *w, *hl;
/* hash_free - Free hash table and all buckets.
*/
void
-hash_free(htbl)
- hash_table *htbl;
+hash_free(hash_table *htbl)
{
if (htbl != NULL) {
free(htbl->bucket);
-/* $OpenBSD: recvfromto.c,v 1.6 2015/12/17 08:01:55 tb Exp $ */
+/* $OpenBSD: recvfromto.c,v 1.7 2024/02/26 08:25:51 yasuoka Exp $ */
/* adapted from ipsec-tools 0.6 src/racoon/sockmisc.c */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* setsockopt() have already performed on socket.
*/
int
-recvfromto_nat_t(s, buf, buflen, flags, from, fromlen, to, tolen,
- ipsec, ipseclen)
- int s;
- void *buf;
- size_t buflen;
- int flags;
- struct sockaddr *from;
- u_int *fromlen;
- struct sockaddr *to;
- u_int *tolen;
- void *ipsec;
- u_int *ipseclen;
+recvfromto_nat_t(int s, void *buf, size_t buflen, int flags,
+ struct sockaddr *from, u_int *fromlen, struct sockaddr *to, u_int *tolen,
+ void *ipsec, u_int *ipseclen)
{
int otolen;
u_int oipseclen = 0;
}
int
-recvfromto(s, buf, buflen, flags, from, fromlen, to, tolen)
- int s;
- void *buf;
- size_t buflen;
- int flags;
- struct sockaddr *from;
- u_int *fromlen;
- struct sockaddr *to;
- u_int *tolen;
+recvfromto(int s, void *buf, size_t buflen, int flags, struct sockaddr *from,
+ u_int *fromlen, struct sockaddr *to, u_int *tolen)
{
return recvfromto_nat_t(s, buf, buflen, flags, from, fromlen,
to, tolen, NULL, NULL);
}
int
-sendto_nat_t(s, buf, buflen, flags, to, tolen, ipsec)
- int s;
- const void *buf;
- size_t buflen;
- int flags;
- struct sockaddr *to;
- u_int tolen;
- void *ipsec;
+sendto_nat_t(int s, const void *buf, size_t buflen, int flags,
+ struct sockaddr *to, u_int tolen, void *ipsec)
{
#ifdef IP_IPSECFLOWINFO
if (ipsec) {
-/* $OpenBSD: fsm.c,v 1.10 2019/02/27 04:52:19 denis Exp $ */
+/* $OpenBSD: fsm.c,v 1.11 2024/02/26 08:25:51 yasuoka Exp $ */
/**@file
* This file was adapted from NetBSD:/usr/src/usr.sbin/pppd/pppd/fsm.c
#endif
static void fsm_timeout(void *);
-static void fsm_rconfreq(fsm *, int, u_char *, int);
+static void fsm_rconfreq(fsm *, u_char, u_char *, int len);
static void fsm_rconfack(fsm *, int, u_char *, int);
static void fsm_rconfnakrej(fsm *, int, int, u_char *, int);
static void fsm_rtermreq(fsm *, int, u_char *, int);
* 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;
- const char *reason;
+fsm_close(fsm *f, const char *reason)
{
f->term_reason = (char *)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, u_char 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)
{
if (id != f->reqid || f->seen_ack) /* Expected id? */
return; /* Nope, toss... */
* 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)
{
switch (f->state) {
case ACKRCVD:
* fsm_rtermack - Receive Terminate-Ack.
*/
static void
-fsm_rtermack(f)
- fsm *f;
+fsm_rtermack(fsm *f)
{
switch (f->state) {
case CLOSING:
* 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, u_char code, u_char id, u_char *data, int datalen)
{
ppp_output(f->ppp, f->protocol, code, id, data, datalen);
}
-/* $OpenBSD: fsm.h,v 1.6 2017/05/30 17:22:00 yasuoka Exp $ */
+/* $OpenBSD: fsm.h,v 1.7 2024/02/26 08:25:51 yasuoka Exp $ */
/* $NetBSD: fsm.h,v 1.10 2000/09/23 22:39:35 christos Exp $ */
/*
void fsm_close(fsm *, const char *);
void fsm_input(fsm *, u_char *, int);
void fsm_protreject(fsm *);
-void fsm_sdata(fsm *, int, int, u_char *, int);
+void fsm_sdata(fsm *, u_char, u_char, u_char *, int);
void fsm_log(fsm *, uint32_t, const char *, ...) __attribute__((__format__ (__printf__, 3, 4)));