]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Patterns expanded in the right way
authorPavel Machek <pavel@ucw.cz>
Tue, 12 Jan 1999 16:40:55 +0000 (16:40 +0000)
committerPavel Machek <pavel@ucw.cz>
Tue, 12 Jan 1999 16:40:55 +0000 (16:40 +0000)
proto/rip/config.Y
proto/rip/rip.c
proto/rip/rip.h

index 65565609bb7b8ed5f6e31ecab803e5bd0cd0de51..7d6c9932b9355fd84434701700503b1e31b3d3e0 100644 (file)
@@ -8,8 +8,12 @@
 To add:
 
 passive option (== do not send routing updates to this interface)
+version1 switch
+multicast off option for interface
 
+interface mode broadcast/multicast/quiet
 
+*/
 
 
 CF_HDR
@@ -18,13 +22,15 @@ CF_HDR
 #include "nest/iface.h"
 
 void rip_dev_add_iface(char *);
-struct iface_patt *rip_get_iface(void);
+struct rip_patt *rip_get_iface(void);
 
 #define THIS_PROTO ((struct rip_proto *) this_proto)
 
 CF_DECLS
 
-CF_KEYWORDS(RIP, INFINITY, METRIC, PORT, PERIOD, GARBAGETIME)
+CF_KEYWORDS(RIP, INFINITY, METRIC, PORT, PERIOD, GARBAGETIME, MODE, MULTICAST, BROADCAST, QUIET, DEFAULT)
+
+%type <i> rip_mode
 
 CF_GRAMMAR
 
@@ -46,10 +52,22 @@ rip_proto:
  | rip_proto rip_iface_list ';'
  ;
 
+
+rip_mode: 
+    MULTICAST { $$=IM_MULTICAST; }
+  | BROADCAST { $$=IM_BROADCAST; }
+  | QUIET     { $$=IM_QUIET; }
+  | DEFAULT   { $$=IM_DEFAULT; }
+ ;
+
 rip_iface_item:
  | METRIC expr { 
-   struct iface_patt *k = rip_get_iface();
-   k->u.rip.metric = $2;
+   struct rip_patt *k = rip_get_iface();
+   k->metric = $2;
+ }
+ | MODE rip_mode {
+   struct rip_patt *k = rip_get_iface();
+   k->mode = $2;
  }
  ;
 
@@ -70,16 +88,16 @@ CF_CODE
 void
 rip_dev_add_iface(char *n)
 {
-  struct iface_patt *k = cfg_alloc(sizeof(struct iface_patt));
+  struct rip_patt *k = cfg_alloc(sizeof(struct rip_patt));
 
-  k->pattern = cfg_strdup(n);
-  add_tail(&THIS_PROTO->iface_list, &k->n);
+  k->i.pattern = cfg_strdup(n);
+  add_tail(&THIS_PROTO->iface_list, &k->i.n);
 }
 
-struct iface_patt *
+struct rip_patt *
 rip_get_iface(void)
 {
-  struct iface_patt *k = TAIL(THIS_PROTO->iface_list);
+  struct rip_patt *k = TAIL(THIS_PROTO->iface_list);
   if (!k)
     cf_error( "This cannot happen" );
   return k;
index 2ca1e1e2efccfba67a612e4b4ce1530b7a743188..68d294974e99163965f2868fdd9f5b80503bb1c3 100644 (file)
@@ -455,6 +455,7 @@ new_iface(struct proto *p, struct iface *new, unsigned long flags)
 
   want_multicast = 0 && (flags & IF_MULTICAST);
   /* FIXME: should have config option to disable this one */
+  /* FIXME: lookup multicasts over unnumbered links */
 
   rif->sock = sk_new( p->pool );
   rif->sock->type = want_multicast?SK_UDP_MC:SK_UDP;
index cfe0d6714b82a46d7f06f95fe994eb0ea0b8ab5d..0fcda20dae997cadf02bc3a4bab62b62edaa206e 100644 (file)
@@ -65,8 +65,21 @@ struct rip_interface {
   struct iface *iface;
   sock *sock;
   struct rip_connection *busy;
+  
 
   int metric;          /* User configurable data */
+  int mode;
+#define IM_DEFAULT 0
+#define IM_QUIET 1
+#define IM_MULTICAST 2
+#define IM_BROADCAST 3
+};
+
+struct rip_patt {
+  struct iface_patt i;
+
+  int metric;
+  int mode;
 };
 
 struct rip_proto {