0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-13 22:58:42 +00:00

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 CF_DEFINES
#define OSPF_CFG ((struct ospf_config *) this_proto) #define OSPF_CFG ((struct ospf_config *) this_proto)
static struct ospf_area_config *this_area;
CF_DECLS CF_DECLS
CF_KEYWORDS(OSPF, AREA, OSPF_METRIC1, OSPF_METRIC2, OSPF_TAG) CF_KEYWORDS(OSPF, AREA, OSPF_METRIC1, OSPF_METRIC2, OSPF_TAG)
CF_KEYWORDS(NEIGHBORS, RFC1583COMPAT) CF_KEYWORDS(NEIGHBORS, RFC1583COMPAT, STUB, TICK)
%type <t> opttext %type <t> opttext
@ -28,21 +29,35 @@ CF_ADDTO(proto, ospf_proto '}')
ospf_proto_start: proto_start OSPF { ospf_proto_start: proto_start OSPF {
this_proto = proto_config_new(&proto_ospf, sizeof(struct ospf_config)); this_proto = proto_config_new(&proto_ospf, sizeof(struct ospf_config));
this_proto->preference = DEF_PREF_OSPF; this_proto->preference = DEF_PREF_OSPF;
init_list(&OSPF_CFG->area_list);
} }
; ;
ospf_proto: ospf_proto:
ospf_proto_start proto_name '{' ospf_proto_start proto_name '{'
| ospf_proto proto_item ';' | ospf_proto proto_item ';'
| ospf_proto ospf_area ';'
| ospf_proto RFC1583COMPAT bool ';' { OSPF_CFG->rfc1583 = $3; } | ospf_proto RFC1583COMPAT bool ';' { OSPF_CFG->rfc1583 = $3; }
| ospf_proto ospf_area '}'
; ;
ospf_area: AREA idval { ospf_area_start: AREA idval '{' {
((struct ospf_config *)this_proto)->area = $2; 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: opttext:
TEXT TEXT
| /* empty */ { $$ = NULL; } | /* empty */ { $$ = NULL; }

View File

@ -308,9 +308,14 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p,
continue; continue;
} }
ntohlsah(lsa,&lsatmp); ntohlsah(lsa,&lsatmp);
DBG("Processing update Type: %u ID: %I RT: %I, Sn: 0x%08x\n",lsatmp.type, debug("Update Type: %u ID: %I RT: %I, Sn: 0x%08x Age: %u, Sum: %u\n",
lsatmp.id, lsatmp.rt, lsatmp.sn); lsatmp.type, lsatmp.id, lsatmp.rt, lsatmp.sn, lsatmp.age,
lsatmp.checksum);
lsadb=ospf_hash_find_header(oa->gr, &lsatmp); 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) */ /* pg 143 (4) */
if((lsatmp.age==LSA_MAXAGE)&&(lsadb==NULL)) 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 *p = proto_new(c, sizeof(struct proto_ospf));
struct proto_ospf *po=(struct proto_ospf *)p; struct proto_ospf *po=(struct proto_ospf *)p;
struct ospf_config *oc=(struct ospf_config *)c; struct ospf_config *oc=(struct ospf_config *)c;
struct ospf_area_config *ac;
debug("OSPF: Init requested.\n"); debug("OSPF: Init requested.\n");
p->import_control = ospf_import_control; p->import_control = ospf_import_control;
@ -73,6 +74,10 @@ ospf_init(struct proto_config *c)
p->rte_same = ospf_rte_same; p->rte_same = ospf_rte_same;
po->rfc1583=oc->rfc1583; 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; return p;
} }

View File

@ -48,8 +48,14 @@
struct ospf_config { struct ospf_config {
struct proto_config c; struct proto_config c;
int rfc1583; int rfc1583;
u32 area; /* FIXME: Area ID !!! This is wrong !!! list area_list;
* Should respect interface */ };
struct ospf_area_config {
node n;
u32 areaid;
int stub;
unsigned tick;
}; };
struct ospf_iface { struct ospf_iface {
@ -105,6 +111,7 @@ struct ospf_iface {
*/ */
struct top_hash_entry *nlsa; /* Originated net lsa */ struct top_hash_entry *nlsa; /* Originated net lsa */
int fadj; /* Number of full adjacent neigh */ int fadj; /* Number of full adjacent neigh */
unsigned tick;
}; };
struct ospf_packet { struct ospf_packet {
@ -334,8 +341,8 @@ struct ospf_area {
slist lsal; /* List of all LSA's */ slist lsal; /* List of all LSA's */
struct top_hash_entry *rt; /* My own router LSA */ struct top_hash_entry *rt; /* My own router LSA */
list cand; /* List of candidates for RT calc. */ list cand; /* List of candidates for RT calc. */
u8 stub; int stub;
u8 trcap; /* Transit capability? */ int trcap; /* Transit capability? */
struct proto_ospf *po; struct proto_ospf *po;
struct fib infib; /* FIB for intra-area routes */ struct fib infib; /* FIB for intra-area routes */
}; };