summaryrefslogtreecommitdiffstats
path: root/proto
diff options
context:
space:
mode:
Diffstat (limited to 'proto')
-rw-r--r--proto/ospf/config.Y15
-rw-r--r--proto/ospf/iface.c2
-rw-r--r--proto/ospf/ospf.c4
-rw-r--r--proto/rip/config.Y25
-rw-r--r--proto/rip/rip.c4
5 files changed, 23 insertions, 27 deletions
diff --git a/proto/ospf/config.Y b/proto/ospf/config.Y
index bfe2d9c..7f7d6a3 100644
--- a/proto/ospf/config.Y
+++ b/proto/ospf/config.Y
@@ -13,9 +13,9 @@ CF_HDR
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)
+
+static struct ospf_area_config *this_area;
static struct nbma_node *this_nbma;
static struct area_net_config *this_pref;
@@ -90,7 +90,7 @@ ospf_area_item:
STUB COST expr { this_area->stub = $3 ; if($3<=0) cf_error("Stub cost must be greater than zero"); }
| STUB bool {if($2) { if(!this_area->stub) this_area->stub=DEFAULT_STUB_COST;}else{ this_area->stub=0;}}
| NETWORKS '{' pref_list '}'
- | INTERFACE ospf_iface_list
+ | INTERFACE ospf_iface
| ospf_vlink
;
@@ -122,6 +122,7 @@ ospf_vlink_start: VIRTUAL LINK idval
if (this_area->areaid == 0) cf_error("Virtual link cannot be in backbone");
this_ipatt = cfg_allocz(sizeof(struct ospf_iface_patt));
add_tail(&this_area->vlink_list, NODE this_ipatt);
+ init_list(&this_ipatt->ipn_list);
OSPF_PATT->vid = $3;
OSPF_PATT->cost = COST_D;
OSPF_PATT->helloint = HELLOINT_D;
@@ -222,6 +223,7 @@ ospf_iface_start:
{
this_ipatt = cfg_allocz(sizeof(struct ospf_iface_patt));
add_tail(&this_area->patt_list, NODE this_ipatt);
+ init_list(&this_ipatt->ipn_list);
OSPF_PATT->cost = COST_D;
OSPF_PATT->helloint = HELLOINT_D;
OSPF_PATT->pollint = POLLINT_D;
@@ -251,12 +253,7 @@ ospf_iface_opt_list:
;
ospf_iface:
- ospf_iface_start iface_patt ospf_iface_opt_list { finish_iface_config(OSPF_PATT); }
- ;
-
-ospf_iface_list:
- ospf_iface
- | ospf_iface_list ',' ospf_iface
+ ospf_iface_start iface_patt_list ospf_iface_opt_list { finish_iface_config(OSPF_PATT); }
;
opttext:
diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c
index a4c9741..5162f9f 100644
--- a/proto/ospf/iface.c
+++ b/proto/ospf/iface.c
@@ -550,7 +550,7 @@ ospf_iface_notify(struct proto *p, unsigned flags, struct iface *iface)
WALK_LIST(ac, c->area_list)
{
if (ip = (struct ospf_iface_patt *)
- iface_patt_match(&ac->patt_list, iface))
+ iface_patt_find(&ac->patt_list, iface))
break;
}
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index 1eae376..0cab1d7 100644
--- a/proto/ospf/ospf.c
+++ b/proto/ospf/ospf.c
@@ -634,11 +634,11 @@ ospf_reconfigure(struct proto *p, struct proto_config *c)
WALK_LIST(ifa, po->iface_list)
{
if (oldip = (struct ospf_iface_patt *)
- iface_patt_match(&oldac->patt_list, ifa->iface))
+ iface_patt_find(&oldac->patt_list, ifa->iface))
{
/* Now reconfigure interface */
if (!(newip = (struct ospf_iface_patt *)
- iface_patt_match(&newac->patt_list, ifa->iface)))
+ iface_patt_find(&newac->patt_list, ifa->iface)))
return 0;
/* HELLO TIMER */
diff --git a/proto/rip/config.Y b/proto/rip/config.Y
index f1ae43c..9a11069 100644
--- a/proto/rip/config.Y
+++ b/proto/rip/config.Y
@@ -55,7 +55,7 @@ rip_cfg:
| rip_cfg HONOR ALWAYS ';' { RIP_CFG->honor = HO_ALWAYS; }
| rip_cfg HONOR NEIGHBOR ';' { RIP_CFG->honor = HO_NEIGHBOR; }
| rip_cfg HONOR NEVER ';' { RIP_CFG->honor = HO_NEVER; }
- | rip_cfg rip_iface_list ';'
+ | rip_cfg INTERFACE rip_iface ';'
;
rip_auth:
@@ -64,6 +64,7 @@ rip_auth:
| NONE { $$=AT_NONE; }
;
+
rip_mode:
BROADCAST { $$=IM_BROADCAST; }
| MULTICAST { $$=0; }
@@ -78,28 +79,26 @@ rip_iface_item:
;
rip_iface_opts:
- '{'
+ /* empty */
| rip_iface_opts rip_iface_item ';'
;
-rip_iface_opt_list: /* EMPTY */ | rip_iface_opts '}' ;
+rip_iface_opt_list:
+ /* empty */
+ | '{' rip_iface_opts '}'
+ ;
rip_iface_init:
/* EMPTY */ {
- struct rip_patt *k = cfg_allocz(sizeof(struct rip_patt));
- k->metric = 1;
- add_tail(&RIP_CFG->iface_list, &k->i.n);
- this_ipatt = &k->i;
+ this_ipatt = cfg_allocz(sizeof(struct rip_patt));
+ add_tail(&RIP_CFG->iface_list, NODE this_ipatt);
+ init_list(&this_ipatt->ipn_list);
+ RIP_IPATT->metric = 1;
}
;
rip_iface:
- rip_iface_init iface_patt rip_iface_opt_list
- ;
-
-rip_iface_list:
- INTERFACE rip_iface
- | rip_iface_list ',' rip_iface
+ rip_iface_init iface_patt_list rip_iface_opt_list
;
CF_ADDTO(dynamic_attr, RIP_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_RIP_METRIC); })
diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index b5a4cc3..12cc878 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -742,7 +742,7 @@ rip_real_if_add(struct object_lock *lock)
struct iface *iface = lock->iface;
struct proto *p = lock->data;
struct rip_interface *rif;
- struct iface_patt *k = iface_patt_match(&P_CF->iface_list, iface);
+ struct iface_patt *k = iface_patt_find(&P_CF->iface_list, iface);
if (!k)
bug("This can not happen! It existed few seconds ago!" );
@@ -771,7 +771,7 @@ rip_if_notify(struct proto *p, unsigned c, struct iface *iface)
}
}
if (c & IF_CHANGE_UP) {
- struct iface_patt *k = iface_patt_match(&P_CF->iface_list, iface);
+ struct iface_patt *k = iface_patt_find(&P_CF->iface_list, iface);
struct object_lock *lock;
struct rip_patt *PATT = (struct rip_patt *) k;