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