summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mrouted/cfparse.y
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-01-06 21:10:30 +0000
committerpeter <peter@FreeBSD.org>1996-01-06 21:10:30 +0000
commitd4c03f31b99ac4bd269582b4d2fee704364a2c1e (patch)
treef1d0a40a2a6e33e9f309cdfe59bfbb0d9a7d4628 /usr.sbin/mrouted/cfparse.y
parenta8e9d6a2eaa9df5881201d40c5c05c6154333fef (diff)
downloadFreeBSD-src-d4c03f31b99ac4bd269582b4d2fee704364a2c1e.zip
FreeBSD-src-d4c03f31b99ac4bd269582b4d2fee704364a2c1e.tar.gz
Resync our mainline to mrouted release 3.8.
This will make FreeBSD boxes better behaved 'MBONE Citizens', based on a couple of the comments about the severity of fixes.. Agreed to by: wollman, fenner@parc.xerox.com
Diffstat (limited to 'usr.sbin/mrouted/cfparse.y')
-rw-r--r--usr.sbin/mrouted/cfparse.y103
1 files changed, 88 insertions, 15 deletions
diff --git a/usr.sbin/mrouted/cfparse.y b/usr.sbin/mrouted/cfparse.y
index c08938d..ab5b89f 100644
--- a/usr.sbin/mrouted/cfparse.y
+++ b/usr.sbin/mrouted/cfparse.y
@@ -4,7 +4,7 @@
*
* Written by Bill Fenner, NRL, 1994
*
- * $Id: cfparse.y,v 3.6 1995/06/25 18:49:46 fenner Exp $
+ * $Id: cfparse.y,v 3.8 1995/11/29 22:36:57 fenner Rel $
*/
#include <stdio.h>
#ifdef __STDC__
@@ -13,6 +13,7 @@
#include <varargs.h>
#endif
#include "defs.h"
+#include <netdb.h>
/*
* Local function declarations
@@ -69,14 +70,16 @@ int numbounds = 0; /* Number of named boundaries */
%token CACHE_LIFETIME PRUNING
%token PHYINT TUNNEL NAME
-%token DISABLE METRIC THRESHOLD RATE_LIMIT SRCRT BOUNDARY NETMASK ALTNET
+%token DISABLE IGMPV1 SRCRT
+%token METRIC THRESHOLD RATE_LIMIT BOUNDARY NETMASK ALTNET
+%token SYSNAM SYSCONTACT SYSVERSION SYSLOCATION
%token <num> BOOLEAN
%token <num> NUMBER
%token <ptr> STRING
%token <addrmask> ADDRMASK
%token <addr> ADDR
-%type <addr> interface
+%type <addr> interface addrname
%type <addrmask> bound boundary addrmask
%start conf
@@ -109,10 +112,9 @@ stmt : error
fatal("%s is not a configured interface",
inet_fmt($2,s1));
- /*log(LOG_INFO, 0, "phyint: %x\n", v);*/
}
ifmods
- | TUNNEL interface ADDR {
+ | TUNNEL interface addrname {
struct ifreq *ifr;
struct ifreq ffr;
@@ -172,7 +174,6 @@ stmt : error
v->uv_flags |= VIFF_DOWN;
vifs_down = TRUE;
}
- /*log(LOG_INFO, 0, "tunnel: %x\n", v);*/
}
tunnelmods
{
@@ -195,10 +196,30 @@ stmt : error
strcpy(boundlist[numbounds].name, $2);
boundlist[numbounds++].bound = $3;
}
+ | SYSNAM STRING {
+#ifdef SNMP
+ set_sysName($2);
+#endif /* SNMP */
+ }
+ | SYSCONTACT STRING {
+#ifdef SNMP
+ set_sysContact($2);
+#endif /* SNMP */
+ }
+ | SYSVERSION STRING {
+#ifdef SNMP
+ set_sysVersion($2);
+#endif /* SNMP */
+ }
+ | SYSLOCATION STRING {
+#ifdef SNMP
+ set_sysLocation($2);
+#endif /* SNMP */
+ }
;
tunnelmods : /* empty */
- | tunnelmods /*{ log(LOG_INFO, 0, "tunnelmod: %x", v); }*/ tunnelmod
+ | tunnelmods tunnelmod
;
tunnelmod : mod
@@ -206,12 +227,13 @@ tunnelmod : mod
;
ifmods : /* empty */
- | ifmods /*{ log(LOG_INFO, 0, "ifmod: %x", v); }*/ ifmod
+ | ifmods ifmod
;
ifmod : mod
| DISABLE { v->uv_flags |= VIFF_DISABLED; }
- | NETMASK ADDR {
+ | IGMPV1 { v->uv_flags |= VIFF_IGMPV1; }
+ | NETMASK addrname {
u_int32 subnet, mask;
mask = $2;
@@ -222,6 +244,11 @@ ifmod : mod
v->uv_subnetmask = mask;
v->uv_subnetbcast = subnet | ~mask;
}
+ | NETMASK {
+
+ warn("Expected address after netmask keyword, ignored");
+
+ }
| ALTNET addrmask {
struct phaddr *ph;
@@ -242,6 +269,11 @@ ifmod : mod
v->uv_addrs = ph;
}
+ | ALTNET {
+
+ warn("Expected address after altnet keyword, ignored");
+
+ }
;
mod : THRESHOLD NUMBER { if ($2 < 1 || $2 > 255)
@@ -250,7 +282,7 @@ mod : THRESHOLD NUMBER { if ($2 < 1 || $2 > 255)
}
| THRESHOLD {
- warn("Expected number after threshold keyword");
+ warn("Expected number after threshold keyword, ignored");
}
| METRIC NUMBER { if ($2 < 1 || $2 > UNREACHABLE)
@@ -259,7 +291,7 @@ mod : THRESHOLD NUMBER { if ($2 < 1 || $2 > 255)
}
| METRIC {
- warn("Expected number after metric keyword");
+ warn("Expected number after metric keyword, ignored");
}
| RATE_LIMIT NUMBER { if ($2 > MAX_RATE_LIMIT)
@@ -268,7 +300,7 @@ mod : THRESHOLD NUMBER { if ($2 < 1 || $2 > 255)
}
| RATE_LIMIT {
- warn("Expected number after rate_limit keyword");
+ warn("Expected number after rate_limit keyword, ignored");
}
| BOUNDARY bound {
@@ -289,7 +321,7 @@ mod : THRESHOLD NUMBER { if ($2 < 1 || $2 > 255)
}
| BOUNDARY {
- warn("Expected boundary spec after boundary keyword");
+ warn("Expected boundary spec after boundary keyword, ignored");
}
;
@@ -302,6 +334,20 @@ interface : ADDR { $$ = $1; }
}
;
+addrname : ADDR { $$ = $1; }
+ | STRING { struct hostent *hp;
+
+ if ((hp = gethostbyname($1)) == NULL)
+ fatal("No such host %s", $1);
+
+ if (hp->h_addr_list[1])
+ fatal("Hostname %s does not %s",
+ $1, "map to a unique address");
+
+ bcopy(hp->h_addr_list[0], &$$,
+ hp->h_length);
+ }
+
bound : boundary { $$ = $1; }
| STRING { int i;
@@ -413,6 +459,15 @@ next_word()
continue;
}
q = p;
+#ifdef SNMP
+ if (*p == '"') {
+ p++;
+ while (*p && *p != '"' && *p != '\n')
+ p++; /* find next whitespace */
+ if (*p == '"')
+ p++;
+ } else
+#endif
while (*p && *p != ' ' && *p != '\t' && *p != '\n')
p++; /* find next whitespace */
*p++ = '\0'; /* null-terminate string */
@@ -459,10 +514,12 @@ yylex()
return BOUNDARY;
if (!strcmp(q,"netmask"))
return NETMASK;
- if (!strcmp(q,"name"))
- return NAME;
+ if (!strcmp(q,"igmpv1"))
+ return IGMPV1;
if (!strcmp(q,"altnet"))
return ALTNET;
+ if (!strcmp(q,"name"))
+ return NAME;
if (!strcmp(q,"on") || !strcmp(q,"yes")) {
yylval.num = 1;
return BOOLEAN;
@@ -494,6 +551,22 @@ yylex()
yylval.num = n;
return NUMBER;
}
+#ifdef SNMP
+ if (!strcmp(q,"sysName"))
+ return SYSNAM;
+ if (!strcmp(q,"sysContact"))
+ return SYSCONTACT;
+ if (!strcmp(q,"sysVersion"))
+ return SYSVERSION;
+ if (!strcmp(q,"sysLocation"))
+ return SYSLOCATION;
+ if (*q=='"') {
+ if (q[ strlen(q)-1 ]=='"')
+ q[ strlen(q)-1 ]='\0'; /* trash trailing quote */
+ yylval.ptr = q+1;
+ return STRING;
+ }
+#endif
yylval.ptr = q;
return STRING;
}
OpenPOWER on IntegriCloud