summaryrefslogtreecommitdiff
path: root/usr.sbin/snmpd/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/snmpd/parse.y')
-rw-r--r--usr.sbin/snmpd/parse.y31
1 files changed, 28 insertions, 3 deletions
diff --git a/usr.sbin/snmpd/parse.y b/usr.sbin/snmpd/parse.y
index 6982519d778..b6503233529 100644
--- a/usr.sbin/snmpd/parse.y
+++ b/usr.sbin/snmpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.19 2010/10/18 13:29:49 sthen Exp $ */
+/* $OpenBSD: parse.y,v 1.20 2011/04/21 14:55:22 sthen Exp $ */
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@vantronix.net>
@@ -112,13 +112,13 @@ typedef struct {
%token INCLUDE
%token LISTEN ON
-%token SYSTEM CONTACT DESCR LOCATION NAME OBJECTID SERVICES
+%token SYSTEM CONTACT DESCR LOCATION NAME OBJECTID SERVICES RTFILTER
%token READONLY READWRITE OCTETSTRING INTEGER COMMUNITY TRAP RECEIVER
%token ERROR
%token <v.string> STRING
%token <v.number> NUMBER
%type <v.string> hostcmn
-%type <v.number> optwrite
+%type <v.number> optwrite yesno
%type <v.data> objtype
%type <v.oid> oid hostoid
@@ -157,6 +157,21 @@ varset : STRING '=' STRING {
}
;
+yesno : STRING {
+ if (!strcmp($1, "yes"))
+ $$ = 1;
+ else if (!strcmp($1, "no"))
+ $$ = 0;
+ else {
+ yyerror("syntax error, "
+ "either yes or no expected");
+ free($1);
+ YYERROR;
+ }
+ free($1);
+ }
+ ;
+
main : LISTEN ON STRING {
struct addresslist al;
struct address *h;
@@ -212,6 +227,15 @@ main : LISTEN ON STRING {
} host {
hlist = NULL;
}
+ | RTFILTER yesno {
+ if ($2 == 1)
+ conf->sc_rtfilter = ROUTE_FILTER(RTM_NEWADDR) |
+ ROUTE_FILTER(RTM_DELADDR) |
+ ROUTE_FILTER(RTM_IFINFO) |
+ ROUTE_FILTER(RTM_IFANNOUNCE);
+ else
+ conf->sc_rtfilter = 0;
+ }
;
system : SYSTEM sysmib
@@ -378,6 +402,7 @@ lookup(char *s)
{ "community", COMMUNITY },
{ "contact", CONTACT },
{ "description", DESCR },
+ { "filter-routes", RTFILTER },
{ "include", INCLUDE },
{ "integer", INTEGER },
{ "listen", LISTEN },