static struct iface_patt *this_ipatt;
#define OSPF_PATT ((struct ospf_iface_patt *) this_ipatt)
static struct nbma_node *this_nbma;
+static struct area_net *this_pref;
CF_DECLS
CF_KEYWORDS(OSPF, AREA, OSPF_METRIC1, OSPF_METRIC2, OSPF_TAG)
CF_KEYWORDS(NEIGHBORS, RFC1583COMPAT, STUB, TICK, COST, RETRANSMIT)
CF_KEYWORDS(HELLO, TRANSMIT, PRIORITY, DEAD, NONBROADCAST, POINTOPOINT, TYPE)
-CF_KEYWORDS(NEIGHBORS, NONE, SIMPLE, AUTHENTICATION, PASSWORD, STRICT)
-CF_KEYWORDS(ELIGIBLE, POLL)
+CF_KEYWORDS(NONE, SIMPLE, AUTHENTICATION, PASSWORD, STRICT)
+CF_KEYWORDS(ELIGIBLE, POLL, NETWORKS, HIDDEN)
%type <t> opttext
this_area->tick = DISPTICK;
this_area->stub = 0;
init_list(&this_area->patt_list);
+ init_list(&this_area->net_list);
}
;
ospf_area_item:
STUB COST expr { this_area->stub = $3 ; if($3<=0) cf_error("Stub cost must be greater than zero"); }
| TICK expr { this_area->tick = $2 ; if($2<=0) cf_error("Tick must be greater than zero"); }
+ | NETWORKS '{' pref_list '}'
| INTERFACE ospf_iface_list
;
|
;
+pref_list:
+ /* empty */
+ | pref_list pref_item
+ ;
+
+pref_item:
+ pref_el;
+ | pref_hid;
+
+pref_el: prefix ';'
+ {
+ this_pref = cfg_allocz(sizeof(struct area_net));
+ add_tail(&this_area->net_list, NODE this_pref);
+ this_pref->net = $1.addr;
+ this_pref->mlen = $1.len;
+ }
+;
+
+pref_hid: prefix HIDDEN ';'
+ {
+ this_pref = cfg_allocz(sizeof(struct area_net));
+ add_tail(&this_area->net_list, NODE this_pref);
+ this_pref->net = $1.addr;
+ this_pref->mlen = $1.len;
+ this_pref->hidden = 1;
+ }
+;
+
ipa_list:
/* empty */
| ipa_list ipa_item
struct ospf_config *c=(struct ospf_config *)(p->cf);
struct ospf_area_config *ac;
struct ospf_area *oa;
+ struct area_net *anet,*antmp;
fib_init(&po->efib,p->pool,sizeof(struct extfib),16,init_efib);
init_list(&(po->iface_list));
WALK_LIST(ac,c->area_list)
{
oa=mb_allocz(po->proto.pool, sizeof(struct ospf_area));
- add_tail(&po->area_list,NODE oa);
+ add_tail(&po->area_list, NODE oa);
po->areano++;
oa->stub=ac->stub;
oa->tick=ac->tick;
tm_start(oa->disp_timer,oa->tick);
oa->calcrt=0;
oa->origrt=0;
+ init_list(&oa->net_list);
+ WALK_LIST(anet,ac->net_list)
+ {
+ antmp=mb_allocz(po->proto.pool, sizeof(struct area_net));
+ antmp->net=anet->net;
+ antmp->mlen=anet->mlen;
+ antmp->hidden=anet->hidden;
+ add_tail(&oa->net_list, NODE antmp);
+ }
fib_init(&oa->infib,po->proto.pool,sizeof(struct infib),16,init_infib);
}
return PS_UP;
struct ospf_iface_patt *ip1,*ip2;
struct ospf_iface *ifa;
struct nbma_node *nb1,*nb2,*nbnx;
- struct ospf_area *oa;
+ struct ospf_area *oa=NULL;
+ struct area_net *anet,*antmp;
int found;
po->rfc1583=new->rfc1583;
while(((NODE (ac1))->next!=NULL) && ((NODE (ac2))->next!=NULL))
{
if(ac1->areaid!=ac2->areaid) return 0;
- if(ac1->stub!=ac2->stub) return 0;
+ if(ac1->stub!=ac2->stub) return 0; /* FIXME: non zero values can change */
+
+ WALK_LIST(oa,po->area_list)
+ if(oa->areaid==ac2->areaid) break;
+
+ if(!oa) return 0;
+
if(ac1->tick!=ac2->tick)
{
- WALK_LIST(oa,po->area_list)
+ if(oa->areaid==ac2->areaid)
{
- if(oa->areaid==ac2->areaid)
- {
- oa->tick=ac2->tick;
- tm_start(oa->disp_timer,oa->tick);
- OSPF_TRACE(D_EVENTS,
- "Changing tick interval on area %I from %d to %d",
- oa->areaid, ac1->tick, ac2->tick);
- break;
- }
+ oa->tick=ac2->tick;
+ tm_start(oa->disp_timer,oa->tick);
+ OSPF_TRACE(D_EVENTS,
+ "Changing tick interval on area %I from %d to %d",
+ oa->areaid, ac1->tick, ac2->tick);
+ break;
}
}
+ /* Change net_list */
+ WALK_LIST_DELSAFE(anet, antmp, oa->net_list)
+ {
+ rem_node(NODE anet);
+ mb_free(anet);
+ }
+ WALK_LIST(anet, ac2->net_list)
+ {
+ antmp=mb_alloc(p->pool, sizeof(struct area_net));
+ antmp->net=anet->net;
+ antmp->mlen=anet->mlen;
+ antmp->hidden=anet->hidden;
+ add_tail(&oa->net_list, NODE antmp);
+ }
+
if(!iface_patts_equal(&ac1->patt_list, &ac2->patt_list,
(void *) ospf_patt_compare))
return 0;
cli_msg(-1014,"\t\tNumber of LSAs in DB:\t%u", oa->gr->hash_entries);
cli_msg(-1014,"\t\tNumber of neighbors:\t%u", nno);
cli_msg(-1014,"\t\tNumber of adjacent neighbors:\t%u", adjno);
+ if(!EMPTY_LIST(oa->net_list))
+ {
+ struct area_net *anet;
+ cli_msg(-1014,"\t\tArea networks:");
+ WALK_LIST(anet, oa->net_list)
+ {
+ cli_msg(-1014,"\t\t\t%18I/%u\t%s", anet->net, anet->mlen,
+ anet->hidden ? "Hidden" : "Advertise");
+ }
+ }
}
cli_msg(0,"");
}