summaryrefslogtreecommitdiffstats
path: root/proto
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2000-06-03 03:29:00 +0200
committerOndrej Filip <feela@network.cz>2000-06-03 03:29:00 +0200
commit89d6782dd1a7775a292db3b2b622c8a48dbd757c (patch)
tree5f5c0a7bc59c95289b3bda941ad3dab78abfe329 /proto
parentb36a0a799c751864f65bc3384df301448b54f3bf (diff)
downloadbird-89d6782dd1a7775a292db3b2b622c8a48dbd757c.tar
bird-89d6782dd1a7775a292db3b2b622c8a48dbd757c.zip
interface {} added.
Diffstat (limited to 'proto')
-rw-r--r--proto/ospf/config.Y40
-rw-r--r--proto/ospf/dbdes.c4
-rw-r--r--proto/ospf/hello.c2
-rw-r--r--proto/ospf/lsack.c6
-rw-r--r--proto/ospf/lsreq.c2
-rw-r--r--proto/ospf/lsupd.c6
-rw-r--r--proto/ospf/ospf.c4
-rw-r--r--proto/ospf/ospf.h18
-rw-r--r--proto/ospf/packet.c10
9 files changed, 71 insertions, 21 deletions
diff --git a/proto/ospf/config.Y b/proto/ospf/config.Y
index 103d3b6..3e13eaf 100644
--- a/proto/ospf/config.Y
+++ b/proto/ospf/config.Y
@@ -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; }
diff --git a/proto/ospf/dbdes.c b/proto/ospf/dbdes.c
index cd46bf3..44fc459 100644
--- a/proto/ospf/dbdes.c
+++ b/proto/ospf/dbdes.c
@@ -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);
diff --git a/proto/ospf/hello.c b/proto/ospf/hello.c
index b2594ec..18e1561 100644
--- a/proto/ospf/hello.c
+++ b/proto/ospf/hello.c
@@ -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);
diff --git a/proto/ospf/lsack.c b/proto/ospf/lsack.c
index acbc834..eac1748 100644
--- a/proto/ospf/lsack.c
+++ b/proto/ospf/lsack.c
@@ -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;
}
}
diff --git a/proto/ospf/lsreq.c b/proto/ospf/lsreq.c
index 818aacc..acd36a8 100644
--- a/proto/ospf/lsreq.c
+++ b/proto/ospf/lsreq.c
@@ -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))
diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c
index 090be1d..4c52d9c 100644
--- a/proto/ospf/lsupd.c
+++ b/proto/ospf/lsupd.c
@@ -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);
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index 7de37bf..80a0cca 100644
--- a/proto/ospf/ospf.c
+++ b/proto/ospf/ospf.c
@@ -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;
diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h
index 92095cf..9461fb6 100644
--- a/proto/ospf/ospf.h
+++ b/proto/ospf/ospf.h
@@ -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);
diff --git a/proto/ospf/packet.c b/proto/ospf/packet.c
index 67db361..fc60a42 100644
--- a/proto/ospf/packet.c
+++ b/proto/ospf/packet.c
@@ -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;