ippool_y.y revision 7c478bd95313f5f23a4c958a745db2134aa03244
%{
#endif
#if __FreeBSD_version >= 300000
#endif
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <ctype.h>
#include <unistd.h>
#include "ipf.h"
#if SOLARIS2 >= 10
#include "ip_lookup.h"
#include "ip_pool.h"
#include "ip_htable.h"
#else
#include "netinet/ip_lookup.h"
#include "netinet/ip_htable.h"
#endif
#include "ippool_l.h"
#include "kmem.h"
#define YYDEBUG 1
extern int yydebug;
static iphtable_t ipht;
static char poolname[FR_GROUPLEN];
%}
%union {
char *str;
}
%%
| assign
;
resetlexer();
}
resetlexer();
}
resetlexer();
}
;
eol: ';'
;
resetlexer();
free($1);
free($3);
}
;
;
}
;
}
;
;
role:
;
$$ = $6;
}
;
$$ = $7;
}
;
{ iphtent_t *e;
for (e = $4; e != NULL;
e = e->ipe_next)
if (e->ipe_group[0] == '\0')
$1,
$$ = $4;
}
;
$$ = poolname;
}
| { $$ = ""; }
;
}
}
;
| size
| seed
;
| range { $$ = $1; }
;
bcopy((char *)&($1[0]),
(char *)&($$->ipe_addr),
sizeof($$->ipe_addr));
(char *)&($$->ipe_mask),
sizeof($$->ipe_mask));
$$->ipe_next = $3;
}
bcopy((char *)&($1[0]),
(char *)&($$->ipe_addr),
sizeof($$->ipe_addr));
(char *)&($$->ipe_mask),
sizeof($$->ipe_mask));
}
;
;
bcopy((char *)&($1[0]),
(char *)&($$->ipe_addr),
sizeof($$->ipe_addr));
(char *)&($$->ipe_mask),
sizeof($$->ipe_mask));
free($3);
}
;
$$->ipn_info = 0;
}
$$->ipn_info = 1;
}
;
bcopy((char *)&($1[0]),
(char *)&($$->ipe_addr),
sizeof($$->ipe_addr));
(char *)&($$->ipe_mask),
sizeof($$->ipe_mask));
}
;
;
;
| ipv4 { $$ = $1; }
;
;
;
{ if ($1 > 255 || $3 > 255 || $5 > 255 || $7 > 255) {
yyerror("Invalid octet string for IP address");
return 0;
}
}
;
%%
{ "auth", IPT_AUTH },
{ "count", IPT_COUNT },
{ "group", IPT_GROUP },
{ "group-map", IPT_GROUPMAP },
{ "hash", IPT_HASH },
{ "in", IPT_IN },
{ "ipf", IPT_IPF },
{ "name", IPT_NAME },
{ "nat", IPT_NAT },
{ "number", IPT_NUM },
{ "out", IPT_OUT },
{ "role", IPT_ROLE },
{ "seed", IPT_SEED },
{ "size", IPT_SIZE },
{ "table", IPT_TABLE },
{ "tree", IPT_TREE },
{ "type", IPT_TYPE },
{ NULL, 0 }
};
int fd;
char *filename;
{
char *s;
yylineNum = 1;
s = getenv("YYDEBUG");
if (s)
else
yydebug = 0;
if (!fp) {
return -1;
}
} else
;
return 0;
}
int fd;
{
char *s;
int i;
return 0;
if (i == EOF)
return 0;
return 0;
return 0;
s = getenv("YYDEBUG");
if (s)
else
yydebug = 0;
yyparse();
return 1;
}