{
listnode node;
struct ospf_interface *oi;
- struct ospf *ospf;
-
- ospf = ospf_get ();
- assert (ospf);
- for (node = listhead (ospf->oiflist); node; nextnode (node))
+ for (node = listhead (ospf_top->oiflist); node; nextnode (node))
{
if ((oi = getdata (node)) != NULL
&& oi->type != OSPF_IFTYPE_VIRTUALLINK)
{
listnode node;
struct ospf_interface *oi;
- struct ospf *ospf;
-
- ospf = ospf_get ();
- assert (ospf);
- for (node = listhead (ospf->oiflist); node; nextnode (node))
+ for (node = listhead (ospf_top->oiflist); node; nextnode (node))
{
if ((oi = getdata (node)) && oi->ifp == ifp)
{
u_char options = 0x0;
u_int16_t length;
+ struct ospf *ospf = ospf_top;
+
+#if 0
+ struct ospf *ospf = NULL;
+
+ switch(protolsa->type)
+ {
+ case OSPF_OPAQUE_LINK_LSA:
+ ospf = oi_to_top (oi); /* ospf_opaque.c */
+ break;
+ case OSPF_OPAQUE_AREA_LSA:
+ ospf = area->ospf;
+ break;
+ case OSPF_OPAQUE_AS_LSA:
+ ospf = ospf_top; /* XXX */
+ break;
+ }
+#endif
+
+ assert(ospf);
+
/* Create a stream for internal opaque LSA */
if ((s = stream_new (OSPF_MAX_LSA_SIZE)) == NULL)
{
/* Set opaque-LSA header fields. */
lsa_header_set (s, options, protolsa->type, protolsa->id,
- area->ospf->router_id);
+ ospf->router_id);
/* Set opaque-LSA body fields. */
stream_put (s, ((u_char *) protolsa) + sizeof (struct lsa_header),
{
struct msg_originate_request *omsg;
struct lsa_header *data;
- struct ospf *ospf;
struct ospf_lsa *new;
struct ospf_lsa *old;
struct ospf_area *area = NULL;
int ready = 0;
int rc = 0;
- ospf = ospf_get ();
- assert (ospf);
-
/* Extract opaque LSA data from message */
omsg = (struct msg_originate_request *) STREAM_DATA (msg->s);
data = &omsg->data;
lsdb = area->lsdb;
break;
case OSPF_OPAQUE_AREA_LSA:
- area = ospf_area_lookup_by_area_id (ospf, omsg->area_id);
+ area = ospf_area_lookup_by_area_id (ospf_top, omsg->area_id);
if (!area)
{
zlog_warn ("apiserver_originate: unknown area %s",
ospf_flood_through_area (lsa->area, NULL /*nbr */ , lsa);
break;
case OSPF_OPAQUE_AS_LSA:
- /* Increment counters? XXX */
+ {
+ /* Increment counters? XXX */
- /* Flood LSA through AS. */
- ospf_flood_through_as (lsa->oi->ospf, NULL /*nbr */ , lsa);
- break;
+ /* Flood LSA through AS. */
+ ospf_flood_through_as (ospf_top, NULL /*nbr */ , lsa);
+ break;
+ }
}
}
ospf_apiserver_originate1 (struct ospf_lsa *lsa)
{
/* Install this LSA into LSDB. */
- if (ospf_lsa_install (lsa->oi->ospf, lsa->oi, lsa) == NULL)
+ if (ospf_lsa_install (ospf_top, lsa->oi, lsa) == NULL)
{
zlog_warn ("ospf_apiserver_originate1: ospf_lsa_install failed");
return -1;
SET_FLAG (new->flags, OSPF_LSA_SELF);
/* Install LSA into LSDB. */
- if (ospf_lsa_install (new->area->ospf, new->oi, new) == NULL)
+ if (ospf_lsa_install (ospf_top, new->oi, new) == NULL)
{
zlog_warn ("ospf_apiserver_lsa_refresher: ospf_lsa_install failed");
ospf_lsa_free (new);
struct msg *msg)
{
struct msg_delete_request *dmsg;
- struct ospf *ospf;
struct ospf_lsa *old;
struct ospf_area *area = NULL;
struct in_addr id;
int lsa_type, opaque_type;
int rc = 0;
- ospf = ospf_get ();
- assert(ospf);
-
/* Extract opaque LSA from message */
dmsg = (struct msg_delete_request *) STREAM_DATA (msg->s);
{
case OSPF_OPAQUE_LINK_LSA:
case OSPF_OPAQUE_AREA_LSA:
- area = ospf_area_lookup_by_area_id (ospf, dmsg->area_id);
+ area = ospf_area_lookup_by_area_id (ospf_top, dmsg->area_id);
if (!area)
{
zlog_warn ("ospf_apiserver_lsa_delete: unknown area %s",