summaryrefslogtreecommitdiff
path: root/zebra/irdp_main.c
diff options
context:
space:
mode:
authorpaul <paul>2004-09-24 08:24:42 +0000
committerpaul <paul>2004-09-24 08:24:42 +0000
commit0c0f9112e1530e8e7497cbb75853b9e4da93ea95 (patch)
tree3cbc10ed3495b7813a6921fa417f4987514d3d90 /zebra/irdp_main.c
parent1603c06ba3ad07b8f9380209a137569abe3700e1 (diff)
2004-09-24 Paul Jakma <paul@dishone.st>
* irdp_{interface,main}.c: lists typedef removal cleanup. update some list loops to LIST_LOOP. some miscellaneous style and indent fixups. (no_ip_irdp_address_preference_cmd) Fix delete of referenced node in loop. * irdp_packet.c: (irdp_recvmsg) Fix buggy assignment of integer to pointer. * if_ioctl{,_solaris}.c: lists typedef removal cleanup. update some list loops to LIST_LOOP.
Diffstat (limited to 'zebra/irdp_main.c')
-rw-r--r--zebra/irdp_main.c80
1 files changed, 39 insertions, 41 deletions
diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c
index f711d852..9e31950e 100644
--- a/zebra/irdp_main.c
+++ b/zebra/irdp_main.c
@@ -138,18 +138,18 @@ irdp_sock_init (void)
int get_pref(struct irdp_interface *irdp, struct prefix *p)
{
- listnode node;
+ struct listnode *node;
struct Adv *adv;
/* Use default preference or use the override pref */
- if( irdp->AdvPrefList == NULL ) return irdp->Preference;
+ if( irdp->AdvPrefList == NULL )
+ return irdp->Preference;
- for (node = listhead (irdp->AdvPrefList); node; nextnode (node)) {
- adv = getdata (node);
+ LIST_LOOP (irdp->AdvPrefList, adv, node)
if( p->u.prefix4.s_addr == adv->ip.s_addr )
return adv->pref;
- }
+
return irdp->Preference;
}
@@ -231,21 +231,18 @@ int irdp_send_thread(struct thread *t_advert)
struct zebra_if *zi=ifp->info;
struct irdp_interface *irdp=&zi->irdp;
struct prefix *p;
- listnode node;
+ struct listnode *node;
struct connected *ifc;
irdp->flags &= ~IF_SOLICIT;
if(ifp->connected)
- for (node = listhead (ifp->connected); node; nextnode (node)) {
- ifc = getdata (node);
-
- p = ifc->address;
-
- irdp_advertisement(ifp, p);
- irdp->irdp_sent++;
-
- }
+ LIST_LOOP (ifp->connected, ifc, node)
+ {
+ p = ifc->address;
+ irdp_advertisement(ifp, p);
+ irdp->irdp_sent++;
+ }
tmp = irdp->MaxAdvertInterval-irdp->MinAdvertInterval;
timer = (random () % tmp ) + 1;
@@ -266,7 +263,7 @@ void irdp_advert_off(struct interface *ifp)
{
struct zebra_if *zi=ifp->info;
struct irdp_interface *irdp=&zi->irdp;
- listnode node;
+ struct listnode *node;
int i;
struct connected *ifc;
struct prefix *p;
@@ -275,21 +272,20 @@ void irdp_advert_off(struct interface *ifp)
irdp->t_advertise = NULL;
if(ifp->connected)
- for (node = listhead (ifp->connected); node; nextnode (node)) {
- ifc = getdata (node);
-
- p = ifc->address;
-
- /* Output some packets with Lifetime 0
- we should add a wait...
- */
-
- for(i=0; i< IRDP_LAST_ADVERT_MESSAGES; i++) {
-
- irdp->irdp_sent++;
- irdp_advertisement(ifp, p);
+ LIST_LOOP (ifp->connected, ifc, node)
+ {
+ p = ifc->address;
+
+ /* Output some packets with Lifetime 0
+ we should add a wait...
+ */
+
+ for(i=0; i< IRDP_LAST_ADVERT_MESSAGES; i++)
+ {
+ irdp->irdp_sent++;
+ irdp_advertisement(ifp, p);
+ }
}
- }
}
@@ -320,7 +316,7 @@ void process_solicit (struct interface *ifp)
void irdp_finish()
{
- listnode node;
+ struct listnode *node;
struct interface *ifp;
struct zebra_if *zi;
struct irdp_interface *irdp;
@@ -330,15 +326,19 @@ void irdp_finish()
for (node = listhead (iflist); node; node = nextnode (node))
{
ifp = getdata(node);
- zi= ifp->info;
- if(! zi) continue;
+ zi = ifp->info;
+
+ if (!zi)
+ continue;
irdp = &zi->irdp;
- if(!irdp) continue;
-
- if(irdp->flags & IF_ACTIVE ) {
- irdp->flags |= IF_SHUTDOWN;
- irdp_advert_off(ifp);
- }
+ if (!irdp)
+ continue;
+
+ if (irdp->flags & IF_ACTIVE )
+ {
+ irdp->flags |= IF_SHUTDOWN;
+ irdp_advert_off(ifp);
+ }
}
}
@@ -348,8 +348,6 @@ void irdp_init()
irdp_if_init ();
}
-
-
#endif /* HAVE_IRDP */