diff options
| author | paul <paul> | 2003-03-25 05:07:42 +0000 | 
|---|---|---|
| committer | paul <paul> | 2003-03-25 05:07:42 +0000 | 
| commit | 6898008484a562ff5bae178a6fb0bd885fe8b1e5 (patch) | |
| tree | 27797ca6532ca0ef85f538ac8f3070639e579229 /ospfd/ospfd.c | |
| parent | 1ef74ef70bdab672458c4d1e4cea24197066c0af (diff) | |
2003-03-25 Paul Jakma <paul@dishone.st>
	* sync to latest zebra CVS
	* spec file: updated and added define for ospf-api/client
NB: OSPF-API has been broken by the zebra.org changes, which
has added struct ospf * as a new arg to many functions
Diffstat (limited to 'ospfd/ospfd.c')
| -rw-r--r-- | ospfd/ospfd.c | 275 | 
1 files changed, 146 insertions, 129 deletions
| diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 6e205e64..8d1b7868 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -58,8 +58,8 @@ struct ospf *ospf_top;  extern struct zclient *zclient; -void ospf_remove_vls_through_area (struct ospf_area *); -void ospf_network_free (struct ospf_network *); +void ospf_remove_vls_through_area (struct ospf *, struct ospf_area *); +void ospf_network_free (struct ospf *, struct ospf_network *);  void ospf_area_free (struct ospf_area *);  void ospf_network_run (struct ospf *, struct prefix *, struct ospf_area *); @@ -93,29 +93,29 @@ ospf_router_id_get (list if_list)  #define OSPF_EXTERNAL_LSA_ORIGINATE_DELAY 1  void -ospf_router_id_update () +ospf_router_id_update (struct ospf *ospf)  { -  listnode node;    struct in_addr router_id, router_id_old; +  listnode node;    if (IS_DEBUG_OSPF_EVENT) -    zlog_info ("Router-ID[OLD:%s]: Update",inet_ntoa (ospf_top->router_id)); +    zlog_info ("Router-ID[OLD:%s]: Update", inet_ntoa (ospf->router_id)); -  router_id_old = ospf_top->router_id; +  router_id_old = ospf->router_id; -  if (ospf_top->router_id_static.s_addr != 0) -    router_id = ospf_top->router_id_static; +  if (ospf->router_id_static.s_addr != 0) +    router_id = ospf->router_id_static;    else -    router_id = ospf_router_id_get (ospf_top->oiflist); +    router_id = ospf_router_id_get (ospf->oiflist); -  ospf_top->router_id = router_id; +  ospf->router_id = router_id;    if (IS_DEBUG_OSPF_EVENT) -    zlog_info ("Router-ID[NEW:%s]: Update", inet_ntoa (ospf_top->router_id)); +    zlog_info ("Router-ID[NEW:%s]: Update", inet_ntoa (ospf->router_id));    if (!IPV4_ADDR_SAME (&router_id_old, &router_id))      { -      for (node = listhead (ospf_top->oiflist); node; nextnode (node)) +      for (node = listhead (ospf->oiflist); node; nextnode (node))          {  	  struct ospf_interface *oi = getdata (node); @@ -124,23 +124,23 @@ ospf_router_id_update ()          }        /* If AS-external-LSA is queued, then flush those LSAs. */ -      if (router_id_old.s_addr == 0 && ospf_top->external_origin) +      if (router_id_old.s_addr == 0 && ospf->external_origin)  	{  	  int type;  	  /* Originate each redistributed external route. */  	  for (type = 0; type < ZEBRA_ROUTE_MAX; type++) -	    if (ospf_top->external_origin & (1 << type)) +	    if (ospf->external_origin & (1 << type))  	      thread_add_event (master, ospf_external_lsa_originate_timer, -				NULL, type); +				ospf, type);  	  /* Originate Deafult. */ -	  if (ospf_top->external_origin & (1 << ZEBRA_ROUTE_MAX)) +	  if (ospf->external_origin & (1 << ZEBRA_ROUTE_MAX))  	    thread_add_event (master, ospf_default_originate_timer, -			      &ospf_top->default_originate, 0); +			      &ospf->default_originate, 0); -	  ospf_top->external_origin = 0; +	  ospf->external_origin = 0;  	} -      OSPF_TIMER_ON (ospf_top->t_router_lsa_update, +      OSPF_TIMER_ON (ospf->t_router_lsa_update,  		     ospf_router_lsa_update_timer, OSPF_LSA_UPDATE_DELAY);      }  } @@ -148,11 +148,13 @@ ospf_router_id_update ()  int  ospf_router_id_update_timer (struct thread *thread)  { +  struct ospf *ospf = ospf_top; +    if (IS_DEBUG_OSPF_EVENT)      zlog_info ("Router-ID: Update timer fired!"); -  ospf_top->t_router_id_update = NULL; -  ospf_router_id_update (); +  ospf->t_router_id_update = NULL; +  ospf_router_id_update (ospf);    return 0;  } @@ -213,7 +215,7 @@ ospf_new ()    new->maxage_lsa = list_new ();    new->t_maxage_walker =      thread_add_timer (master, ospf_lsa_maxage_walker, -                      NULL, OSPF_LSA_MAXAGE_CHECK_INTERVAL); +                      new, OSPF_LSA_MAXAGE_CHECK_INTERVAL);    /* Distance table init. */    new->distance_table = route_table_init (); @@ -235,19 +237,23 @@ ospf_new ()  struct ospf *  ospf_get ()  { -  if (ospf_top != NULL) -    return ospf_top; +  struct ospf *ospf = ospf_top; -  ospf_top = ospf_new (); +  if (ospf != NULL) +    return ospf; -  if (ospf_top->router_id_static.s_addr == 0) -    ospf_router_id_update (); +  ospf = ospf_new (); + +  if (ospf->router_id_static.s_addr == 0) +    ospf_router_id_update (ospf);  #ifdef HAVE_OPAQUE_LSA -  ospf_opaque_type11_lsa_init (ospf_top); +  ospf_opaque_type11_lsa_init (ospf);  #endif /* HAVE_OPAQUE_LSA */ -  return ospf_top; +  ospf_top = ospf; + +  return ospf;  }  void @@ -255,6 +261,7 @@ ospf_finish (struct ospf *ospf)  {    struct route_node *rn;    struct ospf_nbr_nbma *nbr_nbma; +  struct ospf_lsa *lsa;    listnode node;    int i; @@ -271,7 +278,7 @@ ospf_finish (struct ospf *ospf)        struct ospf_area *area = getdata (node);        nextnode (node); -      ospf_remove_vls_through_area (area); +      ospf_remove_vls_through_area (ospf, area);      }    for (node = listhead (ospf->vlinks); node; ) @@ -279,7 +286,7 @@ ospf_finish (struct ospf *ospf)        struct ospf_vl_data *vl_data = node->data;        nextnode (node); -      ospf_vl_delete (vl_data); +      ospf_vl_delete (ospf, vl_data);      }    list_delete (ospf->vlinks); @@ -324,7 +331,7 @@ ospf_finish (struct ospf *ospf)        if ((network = rn->info) != NULL)  	{ -	  ospf_network_free (network); +	  ospf_network_free (ospf, network);  	  rn->info = NULL;  	  route_unlock_node (rn);  	} @@ -356,11 +363,12 @@ ospf_finish (struct ospf *ospf)    close (ospf->fd);  #ifdef HAVE_OPAQUE_LSA -  foreach_lsa (OPAQUE_AS_LSDB (ospf), ospf_top->lsdb, 0, -	       ospf_lsa_discard_callback); +  LSDB_LOOP (OPAQUE_AS_LSDB (ospf), rn, lsa) +    ospf_discard_from_db (ospf, ospf->lsdb, lsa);  #endif /* HAVE_OPAQUE_LSA */ -  foreach_lsa (EXTERNAL_LSDB (ospf), ospf->lsdb, 0, -	       ospf_lsa_discard_callback); +  LSDB_LOOP (EXTERNAL_LSDB (ospf), rn, lsa) +    ospf_discard_from_db (ospf, ospf->lsdb, lsa); +    ospf_lsdb_delete_all (ospf->lsdb);    ospf_lsdb_free (ospf->lsdb); @@ -409,7 +417,7 @@ ospf_finish (struct ospf *ospf)  	  route_unlock_node (rn);  	} -  ospf_distance_reset (); +  ospf_distance_reset (ospf);    route_table_finish (ospf->distance_table);    XFREE (MTYPE_OSPF_TOP, ospf); @@ -420,14 +428,14 @@ ospf_finish (struct ospf *ospf)  /* allocate new OSPF Area object */  struct ospf_area * -ospf_area_new (struct in_addr area_id) +ospf_area_new (struct ospf *ospf, struct in_addr area_id)  {    struct ospf_area *new;    /* Allocate new config_network. */    new = XCALLOC (MTYPE_OSPF_AREA, sizeof (struct ospf_area)); -  new->top = ospf_top; +  new->ospf = ospf;    new->area_id = area_id; @@ -449,7 +457,7 @@ ospf_area_new (struct in_addr area_id)    new->ranges = route_table_init ();    if (area_id.s_addr == OSPF_AREA_BACKBONE) -    ospf_top->backbone = new; +    ospf->backbone = new;    return new;  } @@ -457,22 +465,28 @@ ospf_area_new (struct in_addr area_id)  void  ospf_area_free (struct ospf_area *area)  { +  struct route_node *rn; +  struct ospf_lsa *lsa; +    /* Free LSDBs. */ -  foreach_lsa (ROUTER_LSDB (area), area->lsdb, 0, ospf_lsa_discard_callback); -  foreach_lsa (NETWORK_LSDB (area), area->lsdb, 0, ospf_lsa_discard_callback); -  foreach_lsa (SUMMARY_LSDB (area), area->lsdb, 0, ospf_lsa_discard_callback); -  foreach_lsa (ASBR_SUMMARY_LSDB (area), area->lsdb, 0, -	       ospf_lsa_discard_callback); +  LSDB_LOOP (ROUTER_LSDB (area), rn, lsa) +    ospf_discard_from_db (area->ospf, area->lsdb, lsa); +  LSDB_LOOP (NETWORK_LSDB (area), rn, lsa) +    ospf_discard_from_db (area->ospf, area->lsdb, lsa); +  LSDB_LOOP (SUMMARY_LSDB (area), rn, lsa) +    ospf_discard_from_db (area->ospf, area->lsdb, lsa); +  LSDB_LOOP (ASBR_SUMMARY_LSDB (area), rn, lsa) +    ospf_discard_from_db (area->ospf, area->lsdb, lsa);  #ifdef HAVE_NSSA -  foreach_lsa (NSSA_LSDB (area), area->lsdb, 0, ospf_lsa_discard_callback); +  LSDB_LOOP (NSSA_LSDB (area), rn, lsa) +    ospf_discard_from_db (area->ospf, area->lsdb, lsa);  #endif /* HAVE_NSSA */  #ifdef HAVE_OPAQUE_LSA -  foreach_lsa (OPAQUE_AREA_LSDB (area), area->lsdb, 0, -               ospf_lsa_discard_callback); -  foreach_lsa (OPAQUE_LINK_LSDB (area), area->lsdb, 0, -               ospf_lsa_discard_callback); -  ospf_opaque_type10_lsa_term (area); +  LSDB_LOOP (OPAQUE_AREA_LSDB (area), rn, lsa) +    ospf_discard_from_db (area->ospf, area->lsdb, lsa); +  LSDB_LOOP (OPAQUE_LINK_LSDB (area), rn, lsa) +    ospf_discard_from_db (area->ospf, area->lsdb, lsa);  #endif /* HAVE_OPAQUE_LSA */    ospf_lsdb_delete_all (area->lsdb); @@ -493,17 +507,17 @@ ospf_area_free (struct ospf_area *area)    OSPF_TIMER_OFF (area->t_router_lsa_self);    if (OSPF_IS_AREA_BACKBONE (area)) -    ospf_top->backbone = NULL; +    area->ospf->backbone = NULL;    XFREE (MTYPE_OSPF_AREA, area);  }  void -ospf_area_check_free (struct in_addr area_id) +ospf_area_check_free (struct ospf *ospf, struct in_addr area_id)  {    struct ospf_area *area; -  area = ospf_area_lookup_by_area_id (area_id); +  area = ospf_area_lookup_by_area_id (ospf, area_id);    if (area &&        listcount (area->oiflist) == 0 &&        area->ranges->top == NULL && @@ -515,35 +529,35 @@ ospf_area_check_free (struct in_addr area_id)        IMPORT_NAME (area) == NULL &&        area->auth_type == OSPF_AUTH_NULL)      { -      listnode_delete (ospf_top->areas, area); +      listnode_delete (ospf->areas, area);        ospf_area_free (area);      }  }  struct ospf_area * -ospf_area_get (struct in_addr area_id, int format) +ospf_area_get (struct ospf *ospf, struct in_addr area_id, int format)  {    struct ospf_area *area; -  area = ospf_area_lookup_by_area_id (area_id); +  area = ospf_area_lookup_by_area_id (ospf, area_id);    if (!area)      { -      area = ospf_area_new (area_id); +      area = ospf_area_new (ospf, area_id);        area->format = format; -      listnode_add_sort (ospf_top->areas, area); -      ospf_check_abr_status ();   +      listnode_add_sort (ospf->areas, area); +      ospf_check_abr_status (ospf);        }    return area;  }  struct ospf_area * -ospf_area_lookup_by_area_id (struct in_addr area_id) +ospf_area_lookup_by_area_id (struct ospf *ospf, struct in_addr area_id)  {    struct ospf_area *area;    listnode node; -  for (node = listhead (ospf_top->areas); node; nextnode (node)) +  for (node = listhead (ospf->areas); node; nextnode (node))      {        area = getdata (node); @@ -581,10 +595,10 @@ ospf_network_new (struct in_addr area_id, int format)  }  void -ospf_network_free (struct ospf_network *network) +ospf_network_free (struct ospf *ospf, struct ospf_network *network)  { -  ospf_area_check_free (network->area_id); -  ospf_schedule_abr_task (); +  ospf_area_check_free (ospf, network->area_id); +  ospf_schedule_abr_task (ospf);    XFREE (MTYPE_OSPF_NETWORK, network);  } @@ -607,7 +621,7 @@ ospf_network_set (struct ospf *ospf, struct prefix_ipv4 *p,      }    rn->info = network = ospf_network_new (area_id, ret); -  area = ospf_area_get (area_id, ret); +  area = ospf_area_get (ospf, area_id, ret);    /* Run network config now. */    ospf_network_run (ospf, (struct prefix *)p, area); @@ -618,12 +632,12 @@ ospf_network_set (struct ospf *ospf, struct prefix_ipv4 *p,        for (rn = route_top (EXTERNAL_INFO (ZEBRA_ROUTE_CONNECT));  	   rn; rn = route_next (rn))  	if ((ei = rn->info) != NULL) -	  if (ospf_external_info_find_lsa (&ei->p)) -	    if (!ospf_distribute_check_connected (ei)) -	      ospf_external_lsa_flush (ei->type, &ei->p, +	  if (ospf_external_info_find_lsa (ospf, &ei->p)) +	    if (!ospf_distribute_check_connected (ospf, ei)) +	      ospf_external_lsa_flush (ospf, ei->type, &ei->p,  				       ei->ifindex, ei->nexthop); -  ospf_area_check_free (area_id); +  ospf_area_check_free (ospf, area_id);    return 1;  } @@ -644,11 +658,11 @@ ospf_network_unset (struct ospf *ospf, struct prefix_ipv4 *p,    if (!IPV4_ADDR_SAME (&area_id, &network->area_id))      return 0; -  ospf_network_free (rn->info); +  ospf_network_free (ospf, rn->info);    rn->info = NULL;    route_unlock_node (rn); -  ospf_if_update (); +  ospf_if_update (ospf);    /* Update connected redistribute. */    if (ospf_is_type_redistributed (ZEBRA_ROUTE_CONNECT)) @@ -656,9 +670,9 @@ ospf_network_unset (struct ospf *ospf, struct prefix_ipv4 *p,        for (rn = route_top (EXTERNAL_INFO (ZEBRA_ROUTE_CONNECT));  	   rn; rn = route_next (rn))  	if ((ei = rn->info) != NULL) -	  if (!ospf_external_info_find_lsa (&ei->p)) -	    if (ospf_distribute_check_connected (ei)) -	      ospf_external_lsa_originate (ei); +	  if (!ospf_external_info_find_lsa (ospf, &ei->p)) +	    if (ospf_distribute_check_connected (ospf, ei)) +	      ospf_external_lsa_originate (ospf, ei);    return 1;  } @@ -721,13 +735,13 @@ ospf_network_run (struct ospf *ospf, struct prefix *p, struct ospf_area *area)  	    addr = co->address;  	  if (p->family == co->address->family  -	      && ! ospf_if_is_configured (&(addr->u.prefix4)) +	      && ! ospf_if_is_configured (ospf, &(addr->u.prefix4))  	      && ospf_network_match_iface(co,p))  	    {  		struct ospf_interface *oi;  		assert(co); -		oi = ospf_if_new (ifp, co->address); +		oi = ospf_if_new (ospf, ifp, co->address);  		oi->connected = co;  		oi->nbr_self->address = *oi->address; @@ -746,11 +760,11 @@ ospf_network_run (struct ospf *ospf, struct prefix *p, struct ospf_area *area)  		ospf_nbr_add_self (oi);  		/* Make sure pseudo neighbor's router_id. */ -		oi->nbr_self->router_id = ospf_top->router_id; +		oi->nbr_self->router_id = ospf->router_id;  		oi->nbr_self->src = oi->address->u.prefix4;  		/* Relate ospf interface to ospf instance. */ -		oi->ospf = ospf_top; +		oi->ospf = ospf;  		/* update network type as interface flag */  		/* If network type is specified previously, @@ -814,7 +828,7 @@ ospf_ls_upd_queue_empty (struct ospf_interface *oi)  }  void -ospf_if_update () +ospf_if_update (struct ospf *ospf)  {    struct route_node *rn;    listnode node; @@ -822,19 +836,19 @@ ospf_if_update ()    struct ospf_network *network;    struct ospf_area *area; -  if (ospf_top != NULL) +  if (ospf != NULL)      {        /* Update Router ID scheduled. */ -      if (ospf_top->router_id_static.s_addr == 0) -        if (ospf_top->t_router_id_update == NULL) +      if (ospf->router_id_static.s_addr == 0) +        if (ospf->t_router_id_update == NULL)            { -            ospf_top->t_router_id_update = +            ospf->t_router_id_update =                thread_add_timer (master, ospf_router_id_update_timer, NULL,                                  OSPF_ROUTER_ID_UPDATE_DELAY);            }        /* Find interfaces that not configured already.  */ -      for (node = listhead (ospf_top->oiflist); node; node = next) +      for (node = listhead (ospf->oiflist); node; node = next)  	{  	  int found = 0;  	  struct ospf_interface *oi = getdata (node); @@ -845,7 +859,7 @@ ospf_if_update ()  	  if (oi->type == OSPF_IFTYPE_VIRTUALLINK)  	    continue; -	  for (rn = route_top (ospf_top->networks); rn; rn = route_next (rn)) +	  for (rn = route_top (ospf->networks); rn; rn = route_next (rn))  	    {  	      if (rn->info == NULL)  		continue; @@ -863,28 +877,28 @@ ospf_if_update ()  	}        /* Run each interface. */ -      for (rn = route_top (ospf_top->networks); rn; rn = route_next (rn)) +      for (rn = route_top (ospf->networks); rn; rn = route_next (rn))  	if (rn->info != NULL)  	  {  	    network = (struct ospf_network *) rn->info; -	    area = ospf_area_get (network->area_id, network->format); -	    ospf_network_run (ospf_top, &rn->p, area); +	    area = ospf_area_get (ospf, network->area_id, network->format); +	    ospf_network_run (ospf, &rn->p, area);  	  }      }  }  void -ospf_remove_vls_through_area (struct ospf_area *area) +ospf_remove_vls_through_area (struct ospf *ospf, struct ospf_area *area)  {    listnode node, next;    struct ospf_vl_data *vl_data; -  for (node = listhead (ospf_top->vlinks); node; node = next) +  for (node = listhead (ospf->vlinks); node; node = next)      {        next = node->next;        if ((vl_data = getdata (node)) != NULL)  	if (IPV4_ADDR_SAME (&vl_data->vl_area_id, &area->area_id)) -	  ospf_vl_delete (vl_data); +	  ospf_vl_delete (ospf, vl_data);      }  } @@ -956,31 +970,31 @@ ospf_area_type_set (struct ospf_area *area, int type)      }    ospf_router_lsa_timer_add (area); -  ospf_schedule_abr_task (); +  ospf_schedule_abr_task (area->ospf);  }  int -ospf_area_shortcut_set (struct ospf_area *area, int mode) +ospf_area_shortcut_set (struct ospf *ospf, struct ospf_area *area, int mode)  {    if (area->shortcut_configured == mode)      return 0;    area->shortcut_configured = mode;    ospf_router_lsa_timer_add (area); -  ospf_schedule_abr_task (); +  ospf_schedule_abr_task (ospf); -  ospf_area_check_free (area->area_id); +  ospf_area_check_free (ospf, area->area_id);    return 1;  }  int -ospf_area_shortcut_unset (struct ospf_area *area) +ospf_area_shortcut_unset (struct ospf *ospf, struct ospf_area *area)  {    area->shortcut_configured = OSPF_SHORTCUT_DEFAULT;    ospf_router_lsa_timer_add (area); -  ospf_area_check_free (area->area_id); -  ospf_schedule_abr_task (); +  ospf_area_check_free (ospf, area->area_id); +  ospf_schedule_abr_task (ospf);    return 1;  } @@ -1008,7 +1022,7 @@ ospf_area_stub_set (struct ospf *ospf, struct in_addr area_id)    struct ospf_area *area;    int format = OSPF_AREA_ID_FORMAT_DECIMAL; -  area = ospf_area_get (area_id, format); +  area = ospf_area_get (ospf, area_id, format);    if (ospf_area_vlink_count (ospf, area))      return 0; @@ -1023,14 +1037,14 @@ ospf_area_stub_unset (struct ospf *ospf, struct in_addr area_id)  {    struct ospf_area *area; -  area = ospf_area_lookup_by_area_id (area_id); +  area = ospf_area_lookup_by_area_id (ospf, area_id);    if (area == NULL)      return 1;    if (area->external_routing == OSPF_AREA_STUB)      ospf_area_type_set (area, OSPF_AREA_DEFAULT); -  ospf_area_check_free (area_id); +  ospf_area_check_free (ospf, area_id);    return 1;  } @@ -1041,7 +1055,7 @@ ospf_area_no_summary_set (struct ospf *ospf, struct in_addr area_id)    struct ospf_area *area;    int format = OSPF_AREA_ID_FORMAT_DECIMAL; -  area = ospf_area_get (area_id, format); +  area = ospf_area_get (ospf, area_id, format);    area->no_summary = 1;    return 1; @@ -1052,12 +1066,12 @@ ospf_area_no_summary_unset (struct ospf *ospf, struct in_addr area_id)  {    struct ospf_area *area; -  area = ospf_area_lookup_by_area_id (area_id); +  area = ospf_area_lookup_by_area_id (ospf, area_id);    if (area == NULL)      return 0;    area->no_summary = 0; -  ospf_area_check_free (area_id); +  ospf_area_check_free (ospf, area_id);    return 1;  } @@ -1068,7 +1082,7 @@ ospf_area_nssa_set (struct ospf *ospf, struct in_addr area_id)    struct ospf_area *area;    int format = OSPF_AREA_ID_FORMAT_DECIMAL; -  area = ospf_area_get (area_id, format); +  area = ospf_area_get (ospf, area_id, format);    if (ospf_area_vlink_count (ospf, area))      return 0; @@ -1086,7 +1100,7 @@ ospf_area_nssa_unset (struct ospf *ospf, struct in_addr area_id)  {    struct ospf_area *area; -  area = ospf_area_lookup_by_area_id (area_id); +  area = ospf_area_lookup_by_area_id (ospf, area_id);    if (area == NULL)      return 0; @@ -1096,7 +1110,7 @@ ospf_area_nssa_unset (struct ospf *ospf, struct in_addr area_id)        ospf_area_type_set (area, OSPF_AREA_DEFAULT);      } -  ospf_area_check_free (area_id); +  ospf_area_check_free (ospf, area_id);    return 1;  } @@ -1107,7 +1121,7 @@ ospf_area_nssa_translator_role_set (struct ospf *ospf, struct in_addr area_id,  {    struct ospf_area *area; -  area = ospf_area_lookup_by_area_id (area_id); +  area = ospf_area_lookup_by_area_id (ospf, area_id);    if (area == NULL)      return 0; @@ -1122,19 +1136,20 @@ ospf_area_nssa_translator_role_unset (struct ospf *ospf,  {    struct ospf_area *area; -  area = ospf_area_lookup_by_area_id (area_id); +  area = ospf_area_lookup_by_area_id (ospf, area_id);    if (area == NULL)      return 0;    area->NSSATranslator = OSPF_NSSA_ROLE_CANDIDATE; -  ospf_area_check_free (area_id); +  ospf_area_check_free (ospf, area_id);    return 1;  }  int -ospf_area_export_list_set (struct ospf_area *area, char *list_name) +ospf_area_export_list_set (struct ospf *ospf, +			   struct ospf_area *area, char *list_name)  {    struct access_list *list;    list = access_list_lookup (AFI_IP, list_name); @@ -1145,13 +1160,13 @@ ospf_area_export_list_set (struct ospf_area *area, char *list_name)      free (EXPORT_NAME (area));    EXPORT_NAME (area) = strdup (list_name); -  ospf_schedule_abr_task (); +  ospf_schedule_abr_task (ospf);    return 1;  }  int -ospf_area_export_list_unset (struct ospf_area * area) +ospf_area_export_list_unset (struct ospf *ospf, struct ospf_area * area)  {    EXPORT_LIST (area) = 0; @@ -1161,15 +1176,16 @@ ospf_area_export_list_unset (struct ospf_area * area)    EXPORT_NAME (area) = NULL; -  ospf_area_check_free (area->area_id); +  ospf_area_check_free (ospf, area->area_id); -  ospf_schedule_abr_task (); +  ospf_schedule_abr_task (ospf);    return 1;  }  int -ospf_area_import_list_set (struct ospf_area *area, char *name) +ospf_area_import_list_set (struct ospf *ospf, +			   struct ospf_area *area, char *name)  {    struct access_list *list;    list = access_list_lookup (AFI_IP, name); @@ -1180,13 +1196,13 @@ ospf_area_import_list_set (struct ospf_area *area, char *name)      free (IMPORT_NAME (area));    IMPORT_NAME (area) = strdup (name); -  ospf_schedule_abr_task (); +  ospf_schedule_abr_task (ospf);    return 1;  }  int -ospf_area_import_list_unset (struct ospf_area * area) +ospf_area_import_list_unset (struct ospf *ospf, struct ospf_area * area)  {    IMPORT_LIST (area) = 0; @@ -1194,9 +1210,9 @@ ospf_area_import_list_unset (struct ospf_area * area)      free (IMPORT_NAME (area));    IMPORT_NAME (area) = NULL; -  ospf_area_check_free (area->area_id); +  ospf_area_check_free (ospf, area->area_id); -  ospf_schedule_abr_task (); +  ospf_schedule_abr_task (ospf);    return 1;  } @@ -1369,7 +1385,7 @@ ospf_nbr_nbma_add (struct ospf_nbr_nbma *nbr_nbma,  }  void -ospf_nbr_nbma_if_update (struct ospf_interface *oi) +ospf_nbr_nbma_if_update (struct ospf *ospf, struct ospf_interface *oi)  {    struct ospf_nbr_nbma *nbr_nbma;    struct route_node *rn; @@ -1378,7 +1394,7 @@ ospf_nbr_nbma_if_update (struct ospf_interface *oi)    if (oi->type != OSPF_IFTYPE_NBMA)      return; -  for (rn = route_top (ospf_top->nbr_nbma); rn; rn = route_next (rn)) +  for (rn = route_top (ospf->nbr_nbma); rn; rn = route_next (rn))      if ((nbr_nbma = rn->info))        if (nbr_nbma->oi == NULL && nbr_nbma->nbr == NULL)  	{ @@ -1411,18 +1427,18 @@ ospf_nbr_nbma_lookup (struct ospf *ospf, struct in_addr nbr_addr)  }  struct ospf_nbr_nbma * -ospf_nbr_nbma_lookup_next (struct in_addr *addr, int first) +ospf_nbr_nbma_lookup_next (struct ospf *ospf, struct in_addr *addr, int first)  {  #if 0    struct ospf_nbr_nbma *nbr_nbma;    listnode node;  #endif -  if (! ospf_top) +  if (ospf == NULL)      return NULL;  #if 0 -  for (node = listhead (ospf_top->nbr_nbma); node; nextnode (node)) +  for (node = listhead (ospf->nbr_nbma); node; nextnode (node))      {        nbr_nbma = getdata (node); @@ -1567,16 +1583,17 @@ ospf_nbr_nbma_poll_interval_unset (struct ospf *ospf, struct in_addr addr)  void  ospf_prefix_list_update (struct prefix_list *plist)  { +  struct ospf *ospf = ospf_top;    struct ospf_area *area;    listnode node;    int abr_inv = 0;    /* If OSPF instatnce does not exist, return right now. */ -  if (!ospf_top) +  if (ospf == NULL)      return;    /* Update Area prefix-list. */ -  for (node = listhead (ospf_top->areas); node; nextnode (node)) +  for (node = listhead (ospf->areas); node; nextnode (node))      {        area = getdata (node); @@ -1601,7 +1618,7 @@ ospf_prefix_list_update (struct prefix_list *plist)    /* Schedule ABR tasks. */    if (OSPF_IS_ABR && abr_inv) -    ospf_schedule_abr_task (); +    ospf_schedule_abr_task (ospf);  }  void | 
