]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
interface {} added.
authorOndrej Filip <feela@network.cz>
Sat, 3 Jun 2000 01:29:00 +0000 (01:29 +0000)
committerOndrej Filip <feela@network.cz>
Sat, 3 Jun 2000 01:29:00 +0000 (01:29 +0000)
proto/ospf/config.Y
proto/ospf/dbdes.c
proto/ospf/hello.c
proto/ospf/lsack.c
proto/ospf/lsreq.c
proto/ospf/lsupd.c
proto/ospf/ospf.c
proto/ospf/ospf.h
proto/ospf/packet.c

index 103d3b638188ffc48d872891e504b2343e1253e8..3e13eaf9a8ba3c2f92790da882bd4d1e4a4978e1 100644 (file)
@@ -14,11 +14,14 @@ CF_DEFINES
 
 #define OSPF_CFG ((struct ospf_config *) this_proto)
 static struct ospf_area_config *this_area;
+static struct iface_patt *this_ipatt;
+#define OSPF_PATT ((struct ospf_iface_patt *) this_ipatt)
 
 CF_DECLS
 
 CF_KEYWORDS(OSPF, AREA, OSPF_METRIC1, OSPF_METRIC2, OSPF_TAG)
-CF_KEYWORDS(NEIGHBORS, RFC1583COMPAT, STUB, TICK)
+CF_KEYWORDS(NEIGHBORS, RFC1583COMPAT, STUB, TICK, COST, RETRANSMIT)
+CF_KEYWORDS(HELLO)
 
 %type <t> opttext
 
@@ -46,6 +49,7 @@ ospf_area_start: AREA idval '{' {
   this_area->areaid = $2;
   this_area->tick = DISPTICK;
   this_area->stub = 0;
+  init_list(&this_area->patt_list);
  }
 ;
 
@@ -56,8 +60,42 @@ ospf_area: ospf_area_start
 ospf_area_item:
  | STUB bool ';' { this_area->stub = $2 ; }
  | TICK NUM ';' { this_area->tick = $2 ; }
+ | ospf_iface_list
+;
+
+ospf_iface_item:
+ | COST NUM { OSPF_PATT->cost = $2 ; }
+ | HELLO NUM { OSPF_PATT->helloint = $2 ; }
+ | RETRANSMIT NUM { OSPF_PATT->rxmtint = $2 ; }
 ;
  
+ospf_iface_opts:
+   '{'
+ | ospf_iface_opts ospf_iface_item ';'
+ ;
+
+ospf_iface_opt_list: /* EMPTY */ | ospf_iface_opts '}'
+;
+
+ospf_iface_start:
+ {
+  this_ipatt = cfg_allocz(sizeof(struct ospf_iface_patt));
+  add_tail(&this_area->patt_list, NODE this_ipatt);
+  OSPF_PATT->cost=10;
+  OSPF_PATT->helloint=10;
+  OSPF_PATT->rxmtint=5;
+ }
+;
+
+ospf_iface:
+  ospf_iface_start iface_patt ospf_iface_opt_list
+;
+
+ospf_iface_list:
+   INTERFACE ospf_iface
+ | ospf_iface_list ',' ospf_iface
+ ;
+
 opttext:
     TEXT
 | /* empty */ { $$ = NULL; }
index cd46bf32bc78ab3d8a50b9a447d91e9fa4bb5511..44fc459d0c31dbfd5a81b7f37f5038871767338d 100644 (file)
@@ -27,7 +27,7 @@ ospf_dbdes_tx(struct ospf_neighbor *n)
       n->myimms.bit.i=1;
       pkt=(struct ospf_dbdes_packet *)(ifa->ip_sk->tbuf);
       op=(struct ospf_packet *)pkt;
-      fill_ospf_pkt_hdr(ifa, pkt, DBDES);
+      fill_ospf_pkt_hdr(ifa, pkt, DBDES_P);
       pkt->iface_mtu=htons(ifa->iface->mtu);   /*FIXME NOT for VLINK! */
       pkt->options= ifa->options;
       pkt->imms=n->myimms;
@@ -52,7 +52,7 @@ ospf_dbdes_tx(struct ospf_neighbor *n)
        pkt=n->ldbdes;
         op=(struct ospf_packet *)pkt;
        
-        fill_ospf_pkt_hdr(ifa, pkt, DBDES);
+        fill_ospf_pkt_hdr(ifa, pkt, DBDES_P);
         pkt->iface_mtu=htons(ifa->iface->mtu);
         pkt->options= ifa->options;
        pkt->ddseq=htonl(n->dds);
index b2594ecb33292974b25871f6d773ebb6f451e765..18e15618bc47db32a6d963481fe247ea58b9b64f 100644 (file)
@@ -198,7 +198,7 @@ hello_timer_hook(timer *timer)
     pkt=(struct ospf_hello_packet *)(ifa->hello_sk->tbuf);
     op=(struct ospf_packet *)pkt;
 
-    fill_ospf_pkt_hdr(ifa, pkt, HELLO);
+    fill_ospf_pkt_hdr(ifa, pkt, HELLO_P);
 
     pkt->netmask=ipa_mkmask(ifa->iface->addr->pxlen);
     ipa_hton(pkt->netmask);
index acbc834c98a96c2ee6443623bce0f2b71086fb83..eac17489ee34691cb36574d35d4dbbc1df1e69ea 100644 (file)
@@ -24,7 +24,7 @@ ospf_lsack_direct_tx(struct ospf_neighbor *n,struct ospf_lsa_header *h)
   pk=(struct ospf_lsack_packet *)sk->tbuf;
   op=(struct ospf_packet *)sk->tbuf;
 
-  fill_ospf_pkt_hdr(n->ifa, pk, LSACK);
+  fill_ospf_pkt_hdr(n->ifa, pk, LSACK_P);
 
   memcpy(pk+1,h,sizeof(struct ospf_lsa_header));
   len=sizeof(struct ospf_lsack_packet)+sizeof(struct ospf_lsa_header);
@@ -79,7 +79,7 @@ ospf_lsack_delay_tx(struct ospf_neighbor *n)
   pk=(struct ospf_lsack_packet *)sk->tbuf;
   op=(struct ospf_packet *)sk->tbuf;
 
-  fill_ospf_pkt_hdr(n->ifa, pk, LSACK);
+  fill_ospf_pkt_hdr(n->ifa, pk, LSACK_P);
   h=(struct ospf_lsa_header *)(pk+1);
 
   while(!EMPTY_LIST(n->ackl))
@@ -116,7 +116,7 @@ ospf_lsack_delay_tx(struct ospf_neighbor *n)
           sk_send_to_agt(sk, len, ifa, NEIGHBOR_EXCHANGE);
        }
 
-       fill_ospf_pkt_hdr(n->ifa, pk, LSACK);
+       fill_ospf_pkt_hdr(n->ifa, pk, LSACK_P);
        i=0;
       }
     }
index 818aacc57c1aff3e7005c43e722d6f1050d34547..acd36a81fd38d41313d0440449d0538b31723b5d 100644 (file)
@@ -23,7 +23,7 @@ ospf_lsreq_tx(struct ospf_neighbor *n)
   pk=(struct ospf_lsreq_packet *)n->ifa->ip_sk->tbuf;
   op=(struct ospf_packet *)n->ifa->ip_sk->tbuf;
 
-  fill_ospf_pkt_hdr(n->ifa, pk, LSREQ);
+  fill_ospf_pkt_hdr(n->ifa, pk, LSREQ_P);
 
   sn=SHEAD(n->lsrql);
   if(EMPTY_SLIST(n->lsrql))
index 090be1d6fedd9b1f1fc4a11ba0aa93cea8bb2ce2..4c52d9cea26d8e4765d8fbd3508fe680d08a24dd 100644 (file)
@@ -117,7 +117,7 @@ flood_lsa(struct ospf_neighbor *n, struct ospf_lsa_header *hn,
       pk=(struct ospf_lsupd_packet *)sk->tbuf;
       op=(struct ospf_packet *)sk->tbuf;
 
-      fill_ospf_pkt_hdr(ifa, pk, LSUPD);
+      fill_ospf_pkt_hdr(ifa, pk, LSUPD_P);
       pk->lsano=htonl(1);
       if(hn!=NULL)
       {
@@ -183,7 +183,7 @@ ospf_lsupd_tx_list(struct ospf_neighbor *n, list *l)
 
   DBG("LSupd: 1st packet\n");
        
-  fill_ospf_pkt_hdr(n->ifa, pk, LSUPD);
+  fill_ospf_pkt_hdr(n->ifa, pk, LSUPD_P);
   len=SIPH+sizeof(struct ospf_lsupd_packet);
   lsano=0;
   pktpos=(pk+1);
@@ -205,7 +205,7 @@ ospf_lsupd_tx_list(struct ospf_neighbor *n, list *l)
       debug("%s: LS upd sent to %I (%d LSAs)\n", p->name, n->ip, lsano);
 
       DBG("LSupd: next packet\n");
-      fill_ospf_pkt_hdr(n->ifa, pk, LSUPD);
+      fill_ospf_pkt_hdr(n->ifa, pk, LSUPD_P);
       len=SIPH+sizeof(struct ospf_lsupd_packet);
       lsano=0;
       pktpos=(pk+1);
index 7de37bf021fa6ba1dadde95264bab83001c3c06c..80a0ccaca98d6f1fa24c0f5f4dcb31b61e6a84d8 100644 (file)
@@ -63,6 +63,7 @@ ospf_init(struct proto_config *c)
   struct proto_ospf *po=(struct proto_ospf *)p;
   struct ospf_config *oc=(struct ospf_config *)c;
   struct ospf_area_config *ac;
+  struct ospf_iface_patt *patt;
 
   debug("OSPF: Init requested.\n");
   p->import_control = ospf_import_control;
@@ -77,6 +78,9 @@ ospf_init(struct proto_config *c)
   WALK_LIST(ac, oc->area_list)
   {
     debug("OSPF: area: %I, stub=%u tick=%u\n", ac->areaid, ac->stub, ac->tick);
+    WALK_LIST(patt, ac->patt_list)
+      debug("Patt cost=%d hello=%d ret=%d\n",patt->cost, patt->helloint,
+        patt->rxmtint);
   }
 
   return p;
index 92095cf9787d9efe789549a08221e589c64970a8..9461fb68c67db945822afe39e333b35812585a46 100644 (file)
@@ -56,6 +56,7 @@ struct ospf_area_config {
   u32 areaid;
   int stub;
   unsigned tick;
+  list patt_list;
 };
 
 struct ospf_iface {
@@ -117,11 +118,11 @@ struct ospf_iface {
 struct ospf_packet {
   u8 version;
   u8 type;
-#define HELLO 1 /* Hello */
-#define DBDES 2 /* Database description */
-#define LSREQ 3 /* Link state request */
-#define LSUPD 4 /* Link state update */
-#define LSACK 5 /* Link state acknowledgement */
+#define HELLO_P 1 /* Hello */
+#define DBDES_P 2 /* Database description */
+#define LSREQ_P 3 /* Link state request */
+#define LSUPD_P 4 /* Link state update */
+#define LSACK_P 5 /* Link state acknowledgement */
   u16 length;
   u32 routerid;
   u32 areaid;
@@ -356,6 +357,13 @@ struct proto_ospf {
   int rfc1583;
 };
 
+struct ospf_iface_patt {
+  struct iface_patt i;
+  int cost;
+  int helloint;
+  int rxmtint;
+};
+
 static int ospf_start(struct proto *p);
 static void ospf_dump(struct proto *p);
 static struct proto *ospf_init(struct proto_config *c);
index 67db36166c18dcf25f231d7e14e359a0715873fb..fc60a4200dd358b32974995efd565b1f81816a73 100644 (file)
@@ -127,23 +127,23 @@ ospf_rx_hook(sock *sk, int size)
 
   switch(ps->type)
   {
-    case HELLO:
+    case HELLO_P:
       DBG("%s: Hello received.\n", p->name);
       ospf_hello_rx((struct ospf_hello_packet *)ps, p, ifa, size, sk->faddr);
       break;
-    case DBDES:
+    case DBDES_P:
       DBG("%s: Database description received.\n", p->name);
       ospf_dbdes_rx((struct ospf_dbdes_packet *)ps, p, ifa, size);
       break;
-    case LSREQ:
+    case LSREQ_P:
       DBG("%s: Link state request received.\n", p->name);
       ospf_lsreq_rx((struct ospf_lsreq_packet *)ps, p, ifa, size);
       break;
-    case LSUPD:
+    case LSUPD_P:
       DBG("%s: Link state update received.\n", p->name);
       ospf_lsupd_rx((struct ospf_lsupd_packet *)ps, p, ifa, size);
       break;
-    case LSACK:
+    case LSACK_P:
       DBG("%s: Link state ack received.\n", p->name);
       ospf_lsack_rx((struct ospf_lsack_packet *)ps, p, ifa, size);
       break;