setkey(8): ansify parser
Sponsored by: NVidia networking MFC after: 1 week
This commit is contained in:
parent
462c3d3cf4
commit
bef81bc0ae
@ -773,11 +773,7 @@ policy_requests
|
||||
%%
|
||||
|
||||
int
|
||||
setkeymsg0(msg, type, satype, l)
|
||||
struct sadb_msg *msg;
|
||||
unsigned int type;
|
||||
unsigned int satype;
|
||||
size_t l;
|
||||
setkeymsg0(struct sadb_msg *msg, unsigned type, unsigned satype, size_t l)
|
||||
{
|
||||
|
||||
msg->sadb_msg_version = PF_KEY_V2;
|
||||
@ -793,14 +789,8 @@ setkeymsg0(msg, type, satype, l)
|
||||
|
||||
/* XXX NO BUFFER OVERRUN CHECK! BAD BAD! */
|
||||
static int
|
||||
setkeymsg_spdaddr(type, upper, policy, srcs, splen, dsts, dplen)
|
||||
unsigned int type;
|
||||
unsigned int upper;
|
||||
vchar_t *policy;
|
||||
struct addrinfo *srcs;
|
||||
int splen;
|
||||
struct addrinfo *dsts;
|
||||
int dplen;
|
||||
setkeymsg_spdaddr(unsigned type, unsigned upper, vchar_t *policy,
|
||||
struct addrinfo *srcs, int splen, struct addrinfo *dsts, int dplen)
|
||||
{
|
||||
struct sadb_msg *msg;
|
||||
char buf[BUFSIZ];
|
||||
@ -892,12 +882,8 @@ setkeymsg_spdaddr(type, upper, policy, srcs, splen, dsts, dplen)
|
||||
|
||||
/* XXX NO BUFFER OVERRUN CHECK! BAD BAD! */
|
||||
static int
|
||||
setkeymsg_addr(type, satype, srcs, dsts, no_spi)
|
||||
unsigned int type;
|
||||
unsigned int satype;
|
||||
struct addrinfo *srcs;
|
||||
struct addrinfo *dsts;
|
||||
int no_spi;
|
||||
setkeymsg_addr(unsigned type, unsigned satype, struct addrinfo *srcs,
|
||||
struct addrinfo *dsts, int no_spi)
|
||||
{
|
||||
struct sadb_msg *msg;
|
||||
char buf[BUFSIZ];
|
||||
@ -1023,11 +1009,8 @@ setkeymsg_addr(type, satype, srcs, dsts, no_spi)
|
||||
|
||||
/* XXX NO BUFFER OVERRUN CHECK! BAD BAD! */
|
||||
static int
|
||||
setkeymsg_add(type, satype, srcs, dsts)
|
||||
unsigned int type;
|
||||
unsigned int satype;
|
||||
struct addrinfo *srcs;
|
||||
struct addrinfo *dsts;
|
||||
setkeymsg_add(unsigned type, unsigned satype, struct addrinfo *srcs,
|
||||
struct addrinfo *dsts)
|
||||
{
|
||||
struct sadb_msg *msg;
|
||||
char buf[BUFSIZ];
|
||||
@ -1211,9 +1194,7 @@ setkeymsg_add(type, satype, srcs, dsts)
|
||||
}
|
||||
|
||||
static struct addrinfo *
|
||||
parse_addr(host, port)
|
||||
char *host;
|
||||
char *port;
|
||||
parse_addr(char *host, char *port)
|
||||
{
|
||||
struct addrinfo hints, *res = NULL;
|
||||
int error;
|
||||
@ -1232,8 +1213,7 @@ parse_addr(host, port)
|
||||
}
|
||||
|
||||
static int
|
||||
fix_portstr(spec, sport, dport)
|
||||
vchar_t *spec, *sport, *dport;
|
||||
fix_portstr(vchar_t *spec, vchar_t *sport, vchar_t *dport)
|
||||
{
|
||||
char *p, *p2;
|
||||
u_int l;
|
||||
@ -1273,13 +1253,8 @@ fix_portstr(spec, sport, dport)
|
||||
}
|
||||
|
||||
static int
|
||||
setvarbuf(buf, off, ebuf, elen, vbuf, vlen)
|
||||
char *buf;
|
||||
int *off;
|
||||
struct sadb_ext *ebuf;
|
||||
int elen;
|
||||
caddr_t vbuf;
|
||||
int vlen;
|
||||
setvarbuf(char *buf, int *off, struct sadb_ext *ebuf, int elen, caddr_t vbuf,
|
||||
int vlen)
|
||||
{
|
||||
memset(buf + *off, 0, PFKEY_UNUNIT64(ebuf->sadb_ext_len));
|
||||
memcpy(buf + *off, (caddr_t)ebuf, elen);
|
||||
@ -1290,7 +1265,7 @@ setvarbuf(buf, off, ebuf, elen, vbuf, vlen)
|
||||
}
|
||||
|
||||
void
|
||||
parse_init()
|
||||
parse_init(void)
|
||||
{
|
||||
p_spi = 0;
|
||||
|
||||
@ -1309,7 +1284,7 @@ parse_init()
|
||||
}
|
||||
|
||||
void
|
||||
free_buffer()
|
||||
free_buffer(void)
|
||||
{
|
||||
/* we got tons of memory leaks in the parser anyways, leave them */
|
||||
}
|
||||
|
@ -253,23 +253,20 @@ any { return(ANY); }
|
||||
%%
|
||||
|
||||
void
|
||||
yyfatal(s)
|
||||
const char *s;
|
||||
yyfatal(const char *s)
|
||||
{
|
||||
yyerror(s);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
yyerror(s)
|
||||
const char *s;
|
||||
yyerror(const char *s)
|
||||
{
|
||||
printf("line %d: %s at [%s]\n", lineno, s, yytext);
|
||||
}
|
||||
|
||||
int
|
||||
parse(fp)
|
||||
FILE **fp;
|
||||
parse(FILE **fp)
|
||||
{
|
||||
yyin = *fp;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user