area {} added to config.

This commit is contained in:
Ondrej Filip 2000-06-02 19:55:55 +00:00
parent 7e602d5ea7
commit b36a0a799c
4 changed files with 43 additions and 11 deletions

View file

@ -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 <t> 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; }

View file

@ -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))

View file

@ -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;
}

View file

@ -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 */
};