From b36a0a799c751864f65bc3384df301448b54f3bf Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Fri, 2 Jun 2000 19:55:55 +0000 Subject: [PATCH] area {} added to config. --- proto/ospf/config.Y | 25 ++++++++++++++++++++----- proto/ospf/lsupd.c | 9 +++++++-- proto/ospf/ospf.c | 5 +++++ proto/ospf/ospf.h | 15 +++++++++++---- 4 files changed, 43 insertions(+), 11 deletions(-) diff --git a/proto/ospf/config.Y b/proto/ospf/config.Y index 5a58bf2e..103d3b63 100644 --- a/proto/ospf/config.Y +++ b/proto/ospf/config.Y @@ -13,11 +13,12 @@ CF_HDR CF_DEFINES #define OSPF_CFG ((struct ospf_config *) this_proto) +static struct ospf_area_config *this_area; CF_DECLS CF_KEYWORDS(OSPF, AREA, OSPF_METRIC1, OSPF_METRIC2, OSPF_TAG) -CF_KEYWORDS(NEIGHBORS, RFC1583COMPAT) +CF_KEYWORDS(NEIGHBORS, RFC1583COMPAT, STUB, TICK) %type opttext @@ -28,21 +29,35 @@ CF_ADDTO(proto, ospf_proto '}') ospf_proto_start: proto_start OSPF { this_proto = proto_config_new(&proto_ospf, sizeof(struct ospf_config)); this_proto->preference = DEF_PREF_OSPF; + init_list(&OSPF_CFG->area_list); } ; ospf_proto: ospf_proto_start proto_name '{' | ospf_proto proto_item ';' - | ospf_proto ospf_area ';' | ospf_proto RFC1583COMPAT bool ';' { OSPF_CFG->rfc1583 = $3; } - ; + | ospf_proto ospf_area '}' +; -ospf_area: AREA idval { - ((struct ospf_config *)this_proto)->area = $2; +ospf_area_start: AREA idval '{' { + this_area = cfg_allocz(sizeof(struct ospf_area_config)); + add_tail(&OSPF_CFG->area_list, NODE this_area); + this_area->areaid = $2; + this_area->tick = DISPTICK; + this_area->stub = 0; } ; +ospf_area: ospf_area_start + | ospf_area_start ospf_area_item +; + +ospf_area_item: + | STUB bool ';' { this_area->stub = $2 ; } + | TICK NUM ';' { this_area->tick = $2 ; } +; + opttext: TEXT | /* empty */ { $$ = NULL; } diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c index 42f44c92..090be1d6 100644 --- a/proto/ospf/lsupd.c +++ b/proto/ospf/lsupd.c @@ -308,9 +308,14 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p, continue; } ntohlsah(lsa,&lsatmp); - DBG("Processing update Type: %u ID: %I RT: %I, Sn: 0x%08x\n",lsatmp.type, - lsatmp.id, lsatmp.rt, lsatmp.sn); + debug("Update Type: %u ID: %I RT: %I, Sn: 0x%08x Age: %u, Sum: %u\n", + lsatmp.type, lsatmp.id, lsatmp.rt, lsatmp.sn, lsatmp.age, + lsatmp.checksum); lsadb=ospf_hash_find_header(oa->gr, &lsatmp); + if(lsadb) + debug("I have Type: %u ID: %I RT: %I, Sn: 0x%08x Age: %u, Sum: %u\n", + lsadb->lsa.type, lsadb->lsa.id, lsadb->lsa.rt, lsadb->lsa.sn, + lsadb->lsa.age, lsadb->lsa.checksum); /* pg 143 (4) */ if((lsatmp.age==LSA_MAXAGE)&&(lsadb==NULL)) diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index 62bab70f..7de37bf0 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -62,6 +62,7 @@ ospf_init(struct proto_config *c) struct proto *p = proto_new(c, sizeof(struct proto_ospf)); struct proto_ospf *po=(struct proto_ospf *)p; struct ospf_config *oc=(struct ospf_config *)c; + struct ospf_area_config *ac; debug("OSPF: Init requested.\n"); p->import_control = ospf_import_control; @@ -73,6 +74,10 @@ ospf_init(struct proto_config *c) p->rte_same = ospf_rte_same; po->rfc1583=oc->rfc1583; + WALK_LIST(ac, oc->area_list) + { + debug("OSPF: area: %I, stub=%u tick=%u\n", ac->areaid, ac->stub, ac->tick); + } return p; } diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h index 4627af1b..92095cf9 100644 --- a/proto/ospf/ospf.h +++ b/proto/ospf/ospf.h @@ -48,8 +48,14 @@ struct ospf_config { struct proto_config c; int rfc1583; - u32 area; /* FIXME: Area ID !!! This is wrong !!! - * Should respect interface */ + list area_list; +}; + +struct ospf_area_config { + node n; + u32 areaid; + int stub; + unsigned tick; }; struct ospf_iface { @@ -105,6 +111,7 @@ struct ospf_iface { */ struct top_hash_entry *nlsa; /* Originated net lsa */ int fadj; /* Number of full adjacent neigh */ + unsigned tick; }; struct ospf_packet { @@ -334,8 +341,8 @@ struct ospf_area { slist lsal; /* List of all LSA's */ struct top_hash_entry *rt; /* My own router LSA */ list cand; /* List of candidates for RT calc. */ - u8 stub; - u8 trcap; /* Transit capability? */ + int stub; + int trcap; /* Transit capability? */ struct proto_ospf *po; struct fib infib; /* FIB for intra-area routes */ };