%{
/*
* Copyright (C) 2003 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include "ipf.h"
#include <syslog.h>
#ifdef IPFILTER_BPF
# include "pcap-bpf.h"
# define _NET_BPF_H_
# include <pcap.h>
#endif
#include "netinet/ip_htable.h"
#include "ipf_l.h"
#define YYDEBUG 1
#define OPTION_LOG 0x1
#define OPTION_QUICK 0x2
#define OPTION_DUP 0x4
#define OPTION_PROUTE 0x8
#define OPTION_ON 0x10
#define OPTION_REPLYTO 0x20
#define OPTION_FROUTE 0x40
extern int yydebug;
extern int yylineNum;
static void setipftype __P((void));
static void unsetsyslog __P((void));
static int ifpflag = 0;
static int nowith = 0;
static int dynamic = -1;
static int pooled = 0;
static int hashed = 0;
static int nrules = 0;
static int newlist = 0;
static int added = 0;
static int ipffd = -1;
static int ruleopts = 0;
static int *yycont = 0;
static int set_ipv6_addr = 0;
%}
%union {
char *str;
struct {
int pc;
} pc;
struct {
union i6addr a;
union i6addr m;
} ipp;
};
%%
| assign
;
}
resetlexer();
}
| set
;
;
resetlexer();
free($1);
free($3);
yyvarnext = 0;
}
;
;
set:
{
int data;
yyerror("ipf rules before \"set\"");
return 0;
}
data = 1;
data = 0;
else {
yyerror("invalid argument for ipf_loopback");
return 0;
}
if (((opts & OPT_DONOTHING) == 0) &&
perror("ioctl(SIOCIPFLP)");
}
;
;
;
;
;
;
;
;
| bpfrule
;
;
;
;
;
;
;
;
;
| log
| auth
;
;
;
;
;
;
free($1); }
;
;
{
if ( ruleopts & OPTION_LOG )
yyerror("Duplicate log option");
ruleopts |= OPTION_LOG;
}
| quick
{
if ( ruleopts & OPTION_QUICK )
yyerror("Duplicate quick option");
ruleopts |= OPTION_QUICK;
}
| on
{
yyerror("Duplicate on option");
}
| dup
{
if ( ruleopts & OPTION_DUP )
yyerror("Duplicate dup option");
ruleopts |= OPTION_DUP;
}
| froute
{
if ( ruleopts & OPTION_FROUTE )
yyerror("Duplicate froute option");
}
| proute
{
if ( ruleopts & OPTION_PROUTE )
yyerror("Duplicate proute option");
}
| replyto
{
if ( ruleopts & OPTION_REPLYTO )
yyerror("Duplicate replyto option");
}
;
;
{
if ( ruleopts & OPTION_LOG )
yyerror("Duplicate log option");
ruleopts |= OPTION_LOG;
}
| quick
{
if ( ruleopts & OPTION_QUICK )
yyerror("Duplicate quick option");
ruleopts |= OPTION_QUICK;
}
| on
{
yyerror("Duplicate on option");
}
| dup
{
if ( ruleopts & OPTION_DUP )
yyerror("Duplicate dup option");
ruleopts |= OPTION_DUP;
}
| proute
{
if ( ruleopts & OPTION_PROUTE )
yyerror("Duplicate proute option");
}
| replyto
{
if ( ruleopts & OPTION_REPLYTO )
yyerror("Duplicate replyto option");
}
;
;
;
;
;
;
;
newlist = 0;
}
*yycont = 1;
}
;
| ','
;
;
;
;
;
;
FR_GROUPLEN); \
free($2); }
$2); \
;
FR_GROUPLEN););
free($2); }
$2);) }
;
;
;
;
$3, IPFTAG_LEN););
free($3); }
"%d", $3 & 0xffffffff);) }
;
;
;
;
| nattag
;
;
;
;
;
'{'
;
'}'
;
;
;
;
free($1);
}
free($1);
free($3);
}
;
free($1);
}
free($1);
free($3);
}
;
free($2);
}
if (use_inet6 == 0)
else
yyexpectaddr = 0;
free($2);
}
yyexpectaddr = 0;
free($2);
}
;
;
;
free($2);
}
if (use_inet6 == 0)
else
yyexpectaddr = 0;
free($2);
}
yyexpectaddr = 0;
free($2);
}
;
;
free($2);
}
if (use_inet6 == 0)
else
yyexpectaddr = 0;
free($2);
}
yyexpectaddr = 0;
free($2);
}
;
;
;
;
;
| fromto
;
} else {
int p = getproto($1);
if (p == -1)
yyerror("protocol unknown");
}
free($1);
}
} else
free($1);
free($3);
}
;
;
;
yyexpectaddr = 1;
if (yydebug)
printf("set yyexpectaddr\n");
yycont = &yyexpectaddr;
resetaddr(); }
;
yyexpectaddr = 1;
if (yydebug)
printf("set yyexpectaddr\n");
yycont = &yyexpectaddr;
resetaddr(); }
;
;
;
;
yyerror("flags with non-ipf type rule");
yyerror("flags with non-TCP rule");
}
;
| YY_HEX { $$ = $1; }
;
{ yyresetdict(); } fromport
;
if (dynamic != -1) { \
}
;
if (dynamic != -1) { \
}
if (dynamic != -1) { \
}
;
| portcomp
{ yyresetdict(); }
;
{ yyresetdict(); }
;
;
{ yyresetdict(); } toport
;
if (dynamic != -1) { \
}
;
if (dynamic != -1) { \
}
if (dynamic != -1) { \
}
;
| portcomp
{ yyresetdict(); }
;
{ yyresetdict(); }
;
;
yyexpectaddr = 0;
$$.a.iplookuptype = IPLT_POOL;
$$.a.iplookupnum = $3; }
yyexpectaddr = 0;
$$.a.iplookuptype = IPLT_POOL;
yyexpectaddr = 0;
$$.a.iplookuptype = IPLT_HASH;
$$.a.iplookupnum = $3; }
yyexpectaddr = 0;
$$.a.iplookuptype = IPLT_HASH;
yyexpectaddr = 0; }
;
yyresetdict();
yyexpectaddr = 0; }
$$.m.in4_addr = 0xffffffff;
} else {
set_ipv6_addr = 1;
bcopy(&$1, &$$.a, sizeof($$.a));
}
yyexpectaddr = 0; }
| hostname { yyresetdict();
if (use_inet6 == 0)
else {
set_ipv6_addr = 1;
bcopy(&$1, &$$.a, sizeof($$.a));
}
}
} else
bcopy(&$5, &$$.m, sizeof($$.m));
yyresetdict();
yyexpectaddr = 0; }
bcopy(&$1, &$$.a, sizeof($$.a));
yyresetdict();
yyexpectaddr = 0; }
yyresetdict();
bcopy(&$1, &$$.a, sizeof($$.a)); }
yyresetdict();
yyexpectaddr = 0; }
;
'/'
;
mask:
else {
yyerror("Bad value specified for netmask");
return 0;
}
}
bzero(&$$, sizeof($$));
} else
}
bzero(&$$, sizeof($$));
} else
}
bzero(&$$, sizeof($$));
} else
}
bzero(&$$, sizeof($$));
} else
}
;
free($1);
else {
free($1);
if (ifpflag != FRI_DYNAMIC)
yyerror("Unknown hostname");
}
}
;
if (set_ipv6_addr)
else
set_ipv6_addr = 0;
{ $$ = newalist($1);
if (set_ipv6_addr)
else
set_ipv6_addr = 0;
;
;
;
if (set_ipv6_addr)
else
set_ipv6_addr = 0;
$$->al_not = 1;
if (set_ipv6_addr)
else
set_ipv6_addr = 0;
{ $$ = newalist($1);
if (set_ipv6_addr)
else
set_ipv6_addr = 0;
{ $$ = newalist($1);
$$->al_not = 1;
if (set_ipv6_addr)
else
set_ipv6_addr = 0;
;
}
;
| porteq { $$ = $1; }
;
;
;
$$.p1 = $2;
yyresetdict(); }
;
$$.pc = $3;
$$.p2 = $4;
yyresetdict(); }
;
;
yyresetdict();
}
;
IPFY_ICMPTYPE { setipftype();
;
yyresetdict();
}
;
;
;
;
;
;
;
;
;
| fragopt
;
;
;
| stateopt
;
YYERROR; \
} else \
}
YYERROR; \
} else \
}
;
yyerror("service unknown");
else
$$ = ntohs($$);
free($1);
}
yyerror("invalid port number");
else
$$ = $1;
}
;
;
;
;
IPF6_V6HDRS { if (use_inet6 == 0)
yyerror("only available with IPv6");
}
;
;
IPFY_IPOPTS { $$ = FI_OPTIONS; }
| IPFY_SHORT { $$ = FI_SHORT; }
| IPFY_BADNAT { $$ = FI_BADNAT; }
| IPFY_BADSRC { $$ = FI_BADSRC; }
| IPFY_LOWTTL { $$ = FI_LOWTTL; }
| IPFY_FRAGBODY { $$ = FI_FRAGBODY; }
| IPFY_FRAGS { $$ = FI_FRAG; }
| IPFY_MBCAST { $$ = FI_MBCAST; }
| IPFY_MULTICAST { $$ = FI_MULTICAST; }
| IPFY_BROADCAST { $$ = FI_BROADCAST; }
| IPFY_STATE { $$ = FI_STATE; }
;
if (!nowith)
}
;
opt { $$ |= $1; }
;
if (!nowith)
}
;
ipv6hdr { $$ |= $1; }
;
seclevel { $$ |= $1; }
;
;
YY_NUMBER { $$ = $1; }
| IPFY_ICMPT_UNR { $$ = ICMP_UNREACH; }
| IPFY_ICMPT_ECHO { $$ = ICMP_ECHO; }
| IPFY_ICMPT_ECHOR { $$ = ICMP_ECHOREPLY; }
| IPFY_ICMPT_SQUENCH { $$ = ICMP_SOURCEQUENCH; }
| IPFY_ICMPT_REDIR { $$ = ICMP_REDIRECT; }
| IPFY_ICMPT_TIMEX { $$ = ICMP_TIMXCEED; }
| IPFY_ICMPT_PARAMP { $$ = ICMP_PARAMPROB; }
| IPFY_ICMPT_TIMEST { $$ = ICMP_TSTAMP; }
| IPFY_ICMPT_TIMESTREP { $$ = ICMP_TSTAMPREPLY; }
| IPFY_ICMPT_INFOREQ { $$ = ICMP_IREQ; }
| IPFY_ICMPT_INFOREP { $$ = ICMP_IREQREPLY; }
| IPFY_ICMPT_MASKREQ { $$ = ICMP_MASKREQ; }
| IPFY_ICMPT_MASKREP { $$ = ICMP_MASKREPLY; }
| IPFY_ICMPT_ROUTERAD { $$ = ICMP_ROUTERADVERT; }
| IPFY_ICMPT_ROUTERSOL { $$ = ICMP_ROUTERSOLICIT; }
;
YY_NUMBER { $$ = $1; }
| IPFY_ICMPC_NETUNR { $$ = ICMP_UNREACH_NET; }
| IPFY_ICMPC_HSTUNR { $$ = ICMP_UNREACH_HOST; }
| IPFY_ICMPC_PROUNR { $$ = ICMP_UNREACH_PROTOCOL; }
| IPFY_ICMPC_PORUNR { $$ = ICMP_UNREACH_PORT; }
| IPFY_ICMPC_NEEDF { $$ = ICMP_UNREACH_NEEDFRAG; }
| IPFY_ICMPC_SRCFAIL { $$ = ICMP_UNREACH_SRCFAIL; }
| IPFY_ICMPC_NETUNK { $$ = ICMP_UNREACH_NET_UNKNOWN; }
| IPFY_ICMPC_HSTUNK { $$ = ICMP_UNREACH_HOST_UNKNOWN; }
| IPFY_ICMPC_ISOLATE { $$ = ICMP_UNREACH_ISOLATED; }
| IPFY_ICMPC_NETPRO { $$ = ICMP_UNREACH_NET_PROHIB; }
| IPFY_ICMPC_HSTPRO { $$ = ICMP_UNREACH_HOST_PROHIB; }
| IPFY_ICMPC_NETTOS { $$ = ICMP_UNREACH_TOSNET; }
| IPFY_ICMPC_HSTTOS { $$ = ICMP_UNREACH_TOSHOST; }
| IPFY_ICMPC_FLTPRO { $$ = ICMP_UNREACH_ADMIN_PROHIBIT; }
| IPFY_ICMPC_HSTPRE { $$ = 14; }
| IPFY_ICMPC_CUTPRE { $$ = 15; }
;
opt:
if (!nowith)
$$ = 0;
yyresetdict();
}
;
;
;
;
;
IPFY_FAC_KERN { $$ = LOG_KERN; }
| IPFY_FAC_USER { $$ = LOG_USER; }
| IPFY_FAC_MAIL { $$ = LOG_MAIL; }
| IPFY_FAC_DAEMON { $$ = LOG_DAEMON; }
| IPFY_FAC_AUTH { $$ = LOG_AUTH; }
| IPFY_FAC_SYSLOG { $$ = LOG_SYSLOG; }
| IPFY_FAC_LPR { $$ = LOG_LPR; }
| IPFY_FAC_NEWS { $$ = LOG_NEWS; }
| IPFY_FAC_UUCP { $$ = LOG_UUCP; }
| IPFY_FAC_CRON { $$ = LOG_CRON; }
| IPFY_FAC_FTP { $$ = LOG_FTP; }
| IPFY_FAC_AUTHPRIV { $$ = LOG_AUTHPRIV; }
| IPFY_FAC_AUDIT { $$ = LOG_AUDIT; }
| IPFY_FAC_LFMT { $$ = LOG_LFMT; }
| IPFY_FAC_LOCAL0 { $$ = LOG_LOCAL0; }
| IPFY_FAC_LOCAL1 { $$ = LOG_LOCAL1; }
| IPFY_FAC_LOCAL2 { $$ = LOG_LOCAL2; }
| IPFY_FAC_LOCAL3 { $$ = LOG_LOCAL3; }
| IPFY_FAC_LOCAL4 { $$ = LOG_LOCAL4; }
| IPFY_FAC_LOCAL5 { $$ = LOG_LOCAL5; }
| IPFY_FAC_LOCAL6 { $$ = LOG_LOCAL6; }
| IPFY_FAC_LOCAL7 { $$ = LOG_LOCAL7; }
| IPFY_FAC_SECURITY { $$ = LOG_SECURITY; }
;
IPFY_PRI_EMERG { $$ = LOG_EMERG; }
| IPFY_PRI_ALERT { $$ = LOG_ALERT; }
| IPFY_PRI_CRIT { $$ = LOG_CRIT; }
| IPFY_PRI_ERR { $$ = LOG_ERR; }
| IPFY_PRI_WARN { $$ = LOG_WARNING; }
| IPFY_PRI_NOTICE { $$ = LOG_NOTICE; }
| IPFY_PRI_INFO { $$ = LOG_INFO; }
| IPFY_PRI_DEBUG { $$ = LOG_DEBUG; }
;
| YY_CMP_GT { $$ = FR_GREATERT; }
| YY_CMP_GE { $$ = FR_GREATERTE; }
;
| YY_RANGE_OUT { $$ = FR_OUTRANGE; }
| ':' { $$ = FR_INCRANGE; }
;
YY_STR { $$ = $1; }
;
{ $$ = $1;
"use the physical interface %s instead.\n",
}
;
;
{ if ($1 > 255 || $3 > 255) {
yyerror("Invalid octet string for IP address");
return 0;
}
}
;
{ if ($3 > 255) {
yyerror("Invalid octet string for IP address");
return 0;
}
}
;
{ if ($3 > 255) {
yyerror("Invalid octet string for IP address");
return 0;
}
}
| ipv4_24
| ipv4_16
;
%%
{ "age", IPFY_AGE },
{ "ah", IPFY_AH },
{ "all", IPFY_ALL },
{ "and", IPFY_AND },
{ "auth", IPFY_AUTH },
{ "bad", IPFY_BAD },
{ "bad-nat", IPFY_BADNAT },
{ "bad-src", IPFY_BADSRC },
{ "bcast", IPFY_BROADCAST },
{ "block", IPFY_BLOCK },
{ "body", IPFY_BODY },
{ "bpf-v4", IPFY_BPFV4 },
#ifdef USE_INET6
{ "bpf-v6", IPFY_BPFV6 },
#endif
{ "call", IPFY_CALL },
{ "code", IPFY_ICMPCODE },
{ "count", IPFY_COUNT },
{ "dup-to", IPFY_DUPTO },
{ "eq", YY_CMP_EQ },
{ "esp", IPFY_ESP },
{ "fastroute", IPFY_FROUTE },
{ "first", IPFY_FIRST },
{ "flags", IPFY_FLAGS },
{ "frag", IPFY_FRAG },
{ "frag-body", IPFY_FRAGBODY },
{ "frags", IPFY_FRAGS },
{ "from", IPFY_FROM },
{ "ge", YY_CMP_GE },
{ "group", IPFY_GROUP },
{ "gt", YY_CMP_GT },
{ "head", IPFY_HEAD },
{ "icmp", IPFY_ICMP },
{ "icmp-type", IPFY_ICMPTYPE },
{ "in", IPFY_IN },
{ "in-via", IPFY_INVIA },
{ "intercept_loopback", IPFY_SET_LOOPBACK },
{ "ipopt", IPFY_IPOPTS },
{ "ipopts", IPFY_IPOPTS },
{ "keep", IPFY_KEEP },
{ "le", YY_CMP_LE },
{ "level", IPFY_LEVEL },
{ "limit", IPFY_LIMIT },
{ "log", IPFY_LOG },
{ "lowttl", IPFY_LOWTTL },
{ "lt", YY_CMP_LT },
{ "mask", IPFY_MASK },
{ "match-tag", IPFY_MATCHTAG },
{ "mbcast", IPFY_MBCAST },
{ "mcast", IPFY_MULTICAST },
{ "multicast", IPFY_MULTICAST },
{ "nat", IPFY_NAT },
{ "ne", YY_CMP_NE },
{ "net", IPFY_NETWORK },
{ "newisn", IPFY_NEWISN },
{ "no", IPFY_NO },
{ "no-icmp-err", IPFY_NOICMPERR },
{ "now", IPFY_NOW },
{ "not", IPFY_NOT },
{ "oow", IPFY_OOW },
{ "on", IPFY_ON },
{ "opt", IPFY_OPT },
{ "or-block", IPFY_ORBLOCK },
{ "out", IPFY_OUT },
{ "out-via", IPFY_OUTVIA },
{ "pass", IPFY_PASS },
{ "port", IPFY_PORT },
{ "pps", IPFY_PPS },
{ "preauth", IPFY_PREAUTH },
{ "proto", IPFY_PROTO },
{ "quick", IPFY_QUICK },
{ "reply-to", IPFY_REPLY_TO },
{ "return-icmp", IPFY_RETICMP },
{ "return-icmp-as-dest", IPFY_RETICMPASDST },
{ "return-rst", IPFY_RETRST },
{ "route-to", IPFY_ROUTETO },
{ "sec-class", IPFY_SECCLASS },
{ "set-tag", IPFY_SETTAG },
{ "set", IPFY_SET },
{ "skip", IPFY_SKIP },
{ "short", IPFY_SHORT },
{ "state", IPFY_STATE },
{ "state-age", IPFY_AGE },
{ "strict", IPFY_STRICT },
{ "sync", IPFY_SYNC },
{ "tcp", IPFY_TCP },
{ "tcp-udp", IPFY_TCPUDP },
{ "tos", IPFY_TOS },
{ "to", IPFY_TO },
{ "ttl", IPFY_TTL },
{ "udp", IPFY_UDP },
{ "v6hdrs", IPF6_V6HDRS },
{ "with", IPFY_WITH },
{ NULL, 0 }
};
{ "any", IPFY_ANY },
{ "hash", IPFY_HASH },
{ "pool", IPFY_POOL },
{ NULL, 0 }
};
{ "broadcast", IPFY_BROADCAST },
{ "netmasked", IPFY_NETMASKED },
{ "network", IPFY_NETWORK },
{ "peer", IPFY_PEER },
{ NULL, 0 }
};
{ "echo", IPFY_ICMPT_ECHO },
{ "echorep", IPFY_ICMPT_ECHOR },
{ "inforeq", IPFY_ICMPT_INFOREQ },
{ "inforep", IPFY_ICMPT_INFOREP },
{ "maskrep", IPFY_ICMPT_MASKREP },
{ "maskreq", IPFY_ICMPT_MASKREQ },
{ "paramprob", IPFY_ICMPT_PARAMP },
{ "redir", IPFY_ICMPT_REDIR },
{ "unreach", IPFY_ICMPT_UNR },
{ "routerad", IPFY_ICMPT_ROUTERAD },
{ "routersol", IPFY_ICMPT_ROUTERSOL },
{ "squench", IPFY_ICMPT_SQUENCH },
{ "timest", IPFY_ICMPT_TIMEST },
{ "timestrep", IPFY_ICMPT_TIMESTREP },
{ "timex", IPFY_ICMPT_TIMEX },
{ NULL, 0 },
};
{ "cutoff-preced", IPFY_ICMPC_CUTPRE },
{ "filter-prohib", IPFY_ICMPC_FLTPRO },
{ "isolate", IPFY_ICMPC_ISOLATE },
{ "needfrag", IPFY_ICMPC_NEEDF },
{ "net-prohib", IPFY_ICMPC_NETPRO },
{ "net-tos", IPFY_ICMPC_NETTOS },
{ "host-preced", IPFY_ICMPC_HSTPRE },
{ "host-prohib", IPFY_ICMPC_HSTPRO },
{ "host-tos", IPFY_ICMPC_HSTTOS },
{ "host-unk", IPFY_ICMPC_HSTUNK },
{ "host-unr", IPFY_ICMPC_HSTUNR },
{ "net-unk", IPFY_ICMPC_NETUNK },
{ "net-unr", IPFY_ICMPC_NETUNR },
{ "port-unr", IPFY_ICMPC_PORUNR },
{ "proto-unr", IPFY_ICMPC_PROUNR },
{ "srcfail", IPFY_ICMPC_SRCFAIL },
{ NULL, 0 },
};
{ "addext", IPFY_IPOPT_ADDEXT },
{ "cipso", IPFY_IPOPT_CIPSO },
{ "dps", IPFY_IPOPT_DPS },
{ "e-sec", IPFY_IPOPT_ESEC },
{ "eip", IPFY_IPOPT_EIP },
{ "encode", IPFY_IPOPT_ENCODE },
{ "finn", IPFY_IPOPT_FINN },
{ "imitd", IPFY_IPOPT_IMITD },
{ "lsrr", IPFY_IPOPT_LSRR },
{ "mtup", IPFY_IPOPT_MTUP },
{ "mtur", IPFY_IPOPT_MTUR },
{ "nop", IPFY_IPOPT_NOP },
{ "nsapa", IPFY_IPOPT_NSAPA },
{ "rr", IPFY_IPOPT_RR },
{ "rtralrt", IPFY_IPOPT_RTRALRT },
{ "satid", IPFY_IPOPT_SATID },
{ "sdb", IPFY_IPOPT_SDB },
{ "sec", IPFY_IPOPT_SEC },
{ "ssrr", IPFY_IPOPT_SSRR },
{ "tr", IPFY_IPOPT_TR },
{ "ts", IPFY_IPOPT_TS },
{ "ump", IPFY_IPOPT_UMP },
{ "visa", IPFY_IPOPT_VISA },
{ "zsu", IPFY_IPOPT_ZSU },
{ NULL, 0 },
};
{ "confid", IPFY_SEC_CONF },
{ "reserv-1", IPFY_SEC_RSV1 },
{ "reserv-2", IPFY_SEC_RSV2 },
{ "reserv-3", IPFY_SEC_RSV3 },
{ "reserv-4", IPFY_SEC_RSV4 },
{ "secret", IPFY_SEC_SEC },
{ "topsecret", IPFY_SEC_TS },
{ "unclass", IPFY_SEC_UNC },
{ NULL, 0 },
};
{ "dstopts", IPFY_IPV6OPT_DSTOPTS },
{ "esp", IPFY_ESP },
{ "frag", IPFY_FRAG },
{ "hopopts", IPFY_IPV6OPT_HOPOPTS },
{ "ipv6", IPFY_IPV6OPT_IPV6 },
{ "none", IPFY_IPV6OPT_NONE },
{ "routing", IPFY_IPV6OPT_ROUTING },
{ NULL, 0 },
};
{ "kern", IPFY_FAC_KERN },
{ "user", IPFY_FAC_USER },
{ "mail", IPFY_FAC_MAIL },
{ "daemon", IPFY_FAC_DAEMON },
{ "auth", IPFY_FAC_AUTH },
{ "syslog", IPFY_FAC_SYSLOG },
{ "lpr", IPFY_FAC_LPR },
{ "news", IPFY_FAC_NEWS },
{ "uucp", IPFY_FAC_UUCP },
{ "cron", IPFY_FAC_CRON },
{ "ftp", IPFY_FAC_FTP },
{ "authpriv", IPFY_FAC_AUTHPRIV },
{ "audit", IPFY_FAC_AUDIT },
{ "logalert", IPFY_FAC_LFMT },
{ "console", IPFY_FAC_CONSOLE },
{ "security", IPFY_FAC_SECURITY },
{ "local0", IPFY_FAC_LOCAL0 },
{ "local1", IPFY_FAC_LOCAL1 },
{ "local2", IPFY_FAC_LOCAL2 },
{ "local3", IPFY_FAC_LOCAL3 },
{ "local4", IPFY_FAC_LOCAL4 },
{ "local5", IPFY_FAC_LOCAL5 },
{ "local6", IPFY_FAC_LOCAL6 },
{ "local7", IPFY_FAC_LOCAL7 },
{ "emerg", IPFY_PRI_EMERG },
{ "alert", IPFY_PRI_ALERT },
{ "crit", IPFY_PRI_CRIT },
{ "err", IPFY_PRI_ERR },
{ "warn", IPFY_PRI_WARN },
{ "notice", IPFY_PRI_NOTICE },
{ "info", IPFY_PRI_INFO },
{ "debug", IPFY_PRI_DEBUG },
{ NULL, 0 },
};
int fd;
char *filename;
{
char *s;
yylineNum = 1;
s = getenv("YYDEBUG");
if (s != NULL)
else
yydebug = 0;
return -1;
}
} else
;
return 0;
}
int fd;
{
char *s;
int i;
for (i = 0; i <= IPL_LOGMAX; i++)
return 0;
if (i == EOF)
return 0;
return 0;
return 0;
s = getenv("YYDEBUG");
if (s != NULL)
else
yydebug = 0;
yyparse();
return 1;
}
static void newrule()
{
yyerror("sorry, out of memory");
;
if (use_inet6 != 0)
else
nrules = 1;
}
static void setipftype()
{
yyerror("sorry, out of memory");
}
}
}
}
{
int count;
;
if (count == 0) {
if (f == NULL)
yyerror("sorry, out of memory");
added++;
yyerror("sorry, out of memory");
}
return f;
}
f = f2;
yyerror("sorry, out of memory");
added++;
f = f->fr_next;
yyerror("sorry, out of memory");
}
}
}
char *name;
{
int i;
hashed = 0;
pooled = 0;
dynamic = -1;
for (i = 0; i < 4; i++) {
sizeof(frc->fr_ifnames[i])) == 0) {
dynamic = i;
return 0;
}
}
return 0;
}
return 1;
}
int v;
char *phrase;
{
#ifdef IPFILTER_BPF
struct bpf_program bpf;
struct pcap *p;
#endif
u_32_t l;
char *s;
int i;
return;
}
phrase++;
yyerror("sorry, out of memory");
yyerror("sorry, out of memory");
switch (i & 3)
{
case 0 :
break;
case 1 :
break;
case 2 :
break;
case 3 :
break;
}
}
if ((i & 3) != 0) {
"Odd number of bytes in BPF code\n");
exit(1);
}
i--;
return;
}
#ifdef IPFILTER_BPF
if (!p) {
return;
}
pcap_perror(p, "ipf");
pcap_close(p);
return;
}
pcap_close(p);
yyerror("sorry, out of memory");
return;
}
#endif
}
#ifdef IPFILTER_BPF
#else
exit(1);
#endif
}
static void resetaddr()
{
hashed = 0;
pooled = 0;
dynamic = -1;
}
{
return NULL;
return al;
}
{
ip_pool_node_t *n, *top;
alist_t *a;
int num;
return 0;
return 0;
yyerror("sorry, out of memory");
n = n->ipn_next;
}
}
free(n);
}
return num;
}
{
alist_t *a;
int num;
return 0;
return 0;
n->ipe_family = a->al_family;
(void *)&n->ipe_addr,
sizeof(n->ipe_addr));
(void *)&n->ipe_mask,
sizeof(n->ipe_mask));
n->ipe_value = 0;
yyerror("sorry, out of memory");
n = n->ipe_next;
}
}
else
num = 0;
free(n);
}
return num;
}
int fd;
void *ptr;
{
add = 0;
del = 0;
if ((opts & OPT_DONOTHING) != 0)
fd = -1;
if (opts & OPT_ZERORULEST) {
} else if (opts & OPT_INACTIVE) {
} else {
}
}
if ((opts & OPT_ZERORULEST) != 0) {
if ((opts & OPT_DONOTHING) == 0) {
perror("ioctl(SIOCZRLST)");
}
} else {
#ifdef USE_QUAD_T
printf("hits %qd bytes %qd ",
#else
printf("hits %ld bytes %ld ",
#endif
}
} else if ((opts & OPT_REMOVE) != 0) {
if ((opts & OPT_DONOTHING) != 0) {
perror("ioctl(delete rule)");
}
}
} else {
if (!(opts & OPT_DONOTHING)) {
}
}
}
}
static void setsyslog()
{
yybreakondot = 1;
}
static void unsetsyslog()
{
yyresetdict();
yybreakondot = 0;
}
{
frentry_t *f;
break;
if (f == NULL)
return;
/*
* Only copy down matching fields if the rules are of the same type
* and are of ipf type. The only fields that are copied are those
* that impact the rule parsing itself, eg. need for knowing what the
* protocol should be for rules with port comparisons in them.
*/
return;
}