2 * This is an implementation of rfc2370.
3 * Copyright (C) 2001 KDD R&D Laboratories, Inc.
4 * http://www.kddlabs.co.jp/
6 * This file is part of GNU Zebra.
8 * GNU Zebra is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
13 * GNU Zebra is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with GNU Zebra; see the file COPYING. If not, write to the Free
20 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
37 #include "sockunion.h" /* for inet_aton() */
39 #include "ospfd/ospfd.h"
40 #include "ospfd/ospf_interface.h"
41 #include "ospfd/ospf_ism.h"
42 #include "ospfd/ospf_asbr.h"
43 #include "ospfd/ospf_lsa.h"
44 #include "ospfd/ospf_lsdb.h"
45 #include "ospfd/ospf_neighbor.h"
46 #include "ospfd/ospf_nsm.h"
47 #include "ospfd/ospf_flood.h"
48 #include "ospfd/ospf_packet.h"
49 #include "ospfd/ospf_spf.h"
50 #include "ospfd/ospf_dump.h"
51 #include "ospfd/ospf_route.h"
52 #include "ospfd/ospf_ase.h"
53 #include "ospfd/ospf_zebra.h"
55 DEFINE_MTYPE_STATIC(OSPFD
, OSPF_OPAQUE_FUNCTAB
, "OSPF opaque function table")
56 DEFINE_MTYPE_STATIC(OSPFD
, OPAQUE_INFO_PER_TYPE
, "OSPF opaque per-type info")
57 DEFINE_MTYPE_STATIC(OSPFD
, OPAQUE_INFO_PER_ID
, "OSPF opaque per-ID info")
59 /*------------------------------------------------------------------------*
60 * Followings are initialize/terminate functions for Opaque-LSAs handling.
61 *------------------------------------------------------------------------*/
63 #include "ospfd/ospf_te.h"
64 #include "ospfd/ospf_ri.h"
66 #ifdef SUPPORT_OSPF_API
67 int ospf_apiserver_init (void);
68 void ospf_apiserver_term (void);
69 /* Init apiserver? It's disabled by default. */
70 int ospf_apiserver_enable
;
71 #endif /* SUPPORT_OSPF_API */
73 static void ospf_opaque_register_vty (void);
74 static void ospf_opaque_funclist_init (void);
75 static void ospf_opaque_funclist_term (void);
76 static void free_opaque_info_per_type (void *val
);
77 static void free_opaque_info_per_id (void *val
);
78 static int ospf_opaque_lsa_install_hook (struct ospf_lsa
*lsa
);
79 static int ospf_opaque_lsa_delete_hook (struct ospf_lsa
*lsa
);
82 ospf_opaque_init (void)
84 ospf_opaque_register_vty ();
85 ospf_opaque_funclist_init ();
87 if (ospf_mpls_te_init () != 0)
90 if (ospf_router_info_init () != 0)
93 #ifdef SUPPORT_OSPF_API
94 if ((ospf_apiserver_enable
) && (ospf_apiserver_init () != 0))
96 #endif /* SUPPORT_OSPF_API */
102 ospf_opaque_term (void)
104 ospf_mpls_te_term ();
106 ospf_router_info_term ();
108 #ifdef SUPPORT_OSPF_API
109 ospf_apiserver_term ();
110 #endif /* SUPPORT_OSPF_API */
112 ospf_opaque_funclist_term ();
117 ospf_opaque_type9_lsa_init (struct ospf_interface
*oi
)
119 if (oi
->opaque_lsa_self
!= NULL
)
120 list_delete (oi
->opaque_lsa_self
);
122 oi
->opaque_lsa_self
= list_new ();
123 oi
->opaque_lsa_self
->del
= free_opaque_info_per_type
;
124 oi
->t_opaque_lsa_self
= NULL
;
129 ospf_opaque_type9_lsa_term (struct ospf_interface
*oi
)
131 OSPF_TIMER_OFF (oi
->t_opaque_lsa_self
);
132 if (oi
->opaque_lsa_self
!= NULL
)
133 list_delete (oi
->opaque_lsa_self
);
134 oi
->opaque_lsa_self
= NULL
;
139 ospf_opaque_type10_lsa_init (struct ospf_area
*area
)
141 if (area
->opaque_lsa_self
!= NULL
)
142 list_delete (area
->opaque_lsa_self
);
144 area
->opaque_lsa_self
= list_new ();
145 area
->opaque_lsa_self
->del
= free_opaque_info_per_type
;
146 area
->t_opaque_lsa_self
= NULL
;
148 #ifdef MONITOR_LSDB_CHANGE
149 area
->lsdb
->new_lsa_hook
= ospf_opaque_lsa_install_hook
;
150 area
->lsdb
->del_lsa_hook
= ospf_opaque_lsa_delete_hook
;
151 #endif /* MONITOR_LSDB_CHANGE */
156 ospf_opaque_type10_lsa_term (struct ospf_area
*area
)
158 #ifdef MONITOR_LSDB_CHANGE
159 area
->lsdb
->new_lsa_hook
=
160 area
->lsdb
->del_lsa_hook
= NULL
;
161 #endif /* MONITOR_LSDB_CHANGE */
163 OSPF_TIMER_OFF (area
->t_opaque_lsa_self
);
164 if (area
->opaque_lsa_self
!= NULL
)
165 list_delete (area
->opaque_lsa_self
);
166 area
->opaque_lsa_self
= NULL
;
171 ospf_opaque_type11_lsa_init (struct ospf
*top
)
173 if (top
->opaque_lsa_self
!= NULL
)
174 list_delete (top
->opaque_lsa_self
);
176 top
->opaque_lsa_self
= list_new ();
177 top
->opaque_lsa_self
->del
= free_opaque_info_per_type
;
178 top
->t_opaque_lsa_self
= NULL
;
180 #ifdef MONITOR_LSDB_CHANGE
181 top
->lsdb
->new_lsa_hook
= ospf_opaque_lsa_install_hook
;
182 top
->lsdb
->del_lsa_hook
= ospf_opaque_lsa_delete_hook
;
183 #endif /* MONITOR_LSDB_CHANGE */
188 ospf_opaque_type11_lsa_term (struct ospf
*top
)
190 #ifdef MONITOR_LSDB_CHANGE
191 top
->lsdb
->new_lsa_hook
=
192 top
->lsdb
->del_lsa_hook
= NULL
;
193 #endif /* MONITOR_LSDB_CHANGE */
195 OSPF_TIMER_OFF (top
->t_opaque_lsa_self
);
196 if (top
->opaque_lsa_self
!= NULL
)
197 list_delete (top
->opaque_lsa_self
);
198 top
->opaque_lsa_self
= NULL
;
203 ospf_opaque_type_name (u_char opaque_type
)
205 const char *name
= "Unknown";
209 case OPAQUE_TYPE_WILDCARD
: /* This is a special assignment! */
212 case OPAQUE_TYPE_TRAFFIC_ENGINEERING_LSA
:
213 name
= "Traffic Engineering LSA";
215 case OPAQUE_TYPE_SYCAMORE_OPTICAL_TOPOLOGY_DESC
:
216 name
= "Sycamore optical topology description";
218 case OPAQUE_TYPE_GRACE_LSA
:
221 case OPAQUE_TYPE_INTER_AS_LSA
:
222 name
= "Inter-AS TE-v2 LSA";
224 case OPAQUE_TYPE_ROUTER_INFORMATION_LSA
:
225 name
= "Router Information LSA";
228 if (OPAQUE_TYPE_RANGE_UNASSIGNED (opaque_type
))
232 u_int32_t bigger_range
= opaque_type
;
234 * Get around type-limits warning: comparison is always true due to limited range of data type
236 if (OPAQUE_TYPE_RANGE_RESERVED (bigger_range
))
237 name
= "Private/Experimental";
244 /*------------------------------------------------------------------------*
245 * Followings are management functions to store user specified callbacks.
246 *------------------------------------------------------------------------*/
248 struct opaque_info_per_type
; /* Forward declaration. */
250 struct ospf_opaque_functab
253 struct opaque_info_per_type
*oipt
;
255 int (* new_if_hook
)(struct interface
*ifp
);
256 int (* del_if_hook
)(struct interface
*ifp
);
257 void (* ism_change_hook
)(struct ospf_interface
*oi
, int old_status
);
258 void (* nsm_change_hook
)(struct ospf_neighbor
*nbr
, int old_status
);
259 void (* config_write_router
)(struct vty
*vty
);
260 void (* config_write_if
)(struct vty
*vty
, struct interface
*ifp
);
261 void (* config_write_debug
)(struct vty
*vty
);
262 void (* show_opaque_info
)(struct vty
*vty
, struct ospf_lsa
*lsa
);
263 int (* lsa_originator
)(void *arg
);
264 struct ospf_lsa
*(* lsa_refresher
)(struct ospf_lsa
*lsa
);
265 int (* new_lsa_hook
)(struct ospf_lsa
*lsa
);
266 int (* del_lsa_hook
)(struct ospf_lsa
*lsa
);
269 /* Handle LSA-9/10/11 altogether. */
270 static struct list
*ospf_opaque_wildcard_funclist
;
271 static struct list
*ospf_opaque_type9_funclist
;
272 static struct list
*ospf_opaque_type10_funclist
;
273 static struct list
*ospf_opaque_type11_funclist
;
276 ospf_opaque_del_functab (void *val
)
278 XFREE (MTYPE_OSPF_OPAQUE_FUNCTAB
, val
);
283 ospf_opaque_funclist_init (void)
285 struct list
*funclist
;
287 funclist
= ospf_opaque_wildcard_funclist
= list_new ();
288 funclist
->del
= ospf_opaque_del_functab
;
290 funclist
= ospf_opaque_type9_funclist
= list_new ();
291 funclist
->del
= ospf_opaque_del_functab
;
293 funclist
= ospf_opaque_type10_funclist
= list_new ();
294 funclist
->del
= ospf_opaque_del_functab
;
296 funclist
= ospf_opaque_type11_funclist
= list_new ();
297 funclist
->del
= ospf_opaque_del_functab
;
302 ospf_opaque_funclist_term (void)
304 struct list
*funclist
;
306 funclist
= ospf_opaque_wildcard_funclist
;
307 list_delete (funclist
);
309 funclist
= ospf_opaque_type9_funclist
;
310 list_delete (funclist
);
312 funclist
= ospf_opaque_type10_funclist
;
313 list_delete (funclist
);
315 funclist
= ospf_opaque_type11_funclist
;
316 list_delete (funclist
);
321 ospf_get_opaque_funclist (u_char lsa_type
)
323 struct list
*funclist
= NULL
;
327 case OPAQUE_TYPE_WILDCARD
:
329 * This is an ugly trick to handle type-9/10/11 LSA altogether.
330 * Yes, "OPAQUE_TYPE_WILDCARD (value 0)" is not an LSA-type, nor
331 * an officially assigned opaque-type.
332 * Though it is possible that the value might be officially used
333 * in the future, we use it internally as a special label, for now.
335 funclist
= ospf_opaque_wildcard_funclist
;
337 case OSPF_OPAQUE_LINK_LSA
:
338 funclist
= ospf_opaque_type9_funclist
;
340 case OSPF_OPAQUE_AREA_LSA
:
341 funclist
= ospf_opaque_type10_funclist
;
343 case OSPF_OPAQUE_AS_LSA
:
344 funclist
= ospf_opaque_type11_funclist
;
347 zlog_warn ("ospf_get_opaque_funclist: Unexpected LSA-type(%u)", lsa_type
);
353 /* XXX: such a huge argument list can /not/ be healthy... */
355 ospf_register_opaque_functab (
358 int (* new_if_hook
)(struct interface
*ifp
),
359 int (* del_if_hook
)(struct interface
*ifp
),
360 void (* ism_change_hook
)(struct ospf_interface
*oi
, int old_status
),
361 void (* nsm_change_hook
)(struct ospf_neighbor
*nbr
, int old_status
),
362 void (* config_write_router
)(struct vty
*vty
),
363 void (* config_write_if
)(struct vty
*vty
, struct interface
*ifp
),
364 void (* config_write_debug
)(struct vty
*vty
),
365 void (* show_opaque_info
)(struct vty
*vty
, struct ospf_lsa
*lsa
),
366 int (* lsa_originator
)(void *arg
),
367 struct ospf_lsa
*(* lsa_refresher
)(struct ospf_lsa
*lsa
),
368 int (* new_lsa_hook
)(struct ospf_lsa
*lsa
),
369 int (* del_lsa_hook
)(struct ospf_lsa
*lsa
))
371 struct list
*funclist
;
372 struct ospf_opaque_functab
*new;
375 if ((funclist
= ospf_get_opaque_funclist (lsa_type
)) == NULL
)
377 zlog_warn ("ospf_register_opaque_functab: Cannot get funclist"
378 " for Type-%u LSAs?",
384 struct listnode
*node
, *nnode
;
385 struct ospf_opaque_functab
*functab
;
387 for (ALL_LIST_ELEMENTS (funclist
, node
, nnode
, functab
))
388 if (functab
->opaque_type
== opaque_type
)
390 zlog_warn ("ospf_register_opaque_functab: Duplicated entry?:"
391 " lsa_type(%u), opaque_type(%u)",
392 lsa_type
, opaque_type
);
397 if ((new = XCALLOC (MTYPE_OSPF_OPAQUE_FUNCTAB
,
398 sizeof (struct ospf_opaque_functab
))) == NULL
)
400 zlog_warn ("ospf_register_opaque_functab: XMALLOC: %s",
401 safe_strerror (errno
));
405 new->opaque_type
= opaque_type
;
407 new->new_if_hook
= new_if_hook
;
408 new->del_if_hook
= del_if_hook
;
409 new->ism_change_hook
= ism_change_hook
;
410 new->nsm_change_hook
= nsm_change_hook
;
411 new->config_write_router
= config_write_router
;
412 new->config_write_if
= config_write_if
;
413 new->config_write_debug
= config_write_debug
;
414 new->show_opaque_info
= show_opaque_info
;
415 new->lsa_originator
= lsa_originator
;
416 new->lsa_refresher
= lsa_refresher
;
417 new->new_lsa_hook
= new_lsa_hook
;
418 new->del_lsa_hook
= del_lsa_hook
;
420 listnode_add (funclist
, new);
428 ospf_delete_opaque_functab (u_char lsa_type
, u_char opaque_type
)
430 struct list
*funclist
;
431 struct listnode
*node
, *nnode
;
432 struct ospf_opaque_functab
*functab
;
434 if ((funclist
= ospf_get_opaque_funclist (lsa_type
)) != NULL
)
435 for (ALL_LIST_ELEMENTS (funclist
, node
, nnode
, functab
))
437 if (functab
->opaque_type
== opaque_type
)
439 /* Cleanup internal control information, if it still remains. */
440 if (functab
->oipt
!= NULL
)
441 free_opaque_info_per_type (functab
->oipt
);
443 /* Dequeue listnode entry from the list. */
444 listnode_delete (funclist
, functab
);
446 /* Avoid misjudgement in the next lookup. */
447 if (listcount (funclist
) == 0)
448 funclist
->head
= funclist
->tail
= NULL
;
450 XFREE (MTYPE_OSPF_OPAQUE_FUNCTAB
, functab
);
458 static struct ospf_opaque_functab
*
459 ospf_opaque_functab_lookup (struct ospf_lsa
*lsa
)
461 struct list
*funclist
;
462 struct listnode
*node
;
463 struct ospf_opaque_functab
*functab
;
464 u_char key
= GET_OPAQUE_TYPE (ntohl (lsa
->data
->id
.s_addr
));
466 if ((funclist
= ospf_get_opaque_funclist (lsa
->data
->type
)) != NULL
)
467 for (ALL_LIST_ELEMENTS_RO (funclist
, node
, functab
))
468 if (functab
->opaque_type
== key
)
474 /*------------------------------------------------------------------------*
475 * Followings are management functions for self-originated LSA entries.
476 *------------------------------------------------------------------------*/
479 * Opaque-LSA control information per opaque-type.
480 * Single Opaque-Type may have multiple instances; each of them will be
481 * identified by their opaque-id.
483 struct opaque_info_per_type
488 enum { PROC_NORMAL
, PROC_SUSPEND
} status
;
491 * Thread for (re-)origination scheduling for this opaque-type.
493 * Initial origination of Opaque-LSAs is controlled by generic
494 * Opaque-LSA handling module so that same opaque-type entries are
495 * called all at once when certain conditions are met.
496 * However, there might be cases that some Opaque-LSA clients need
497 * to (re-)originate their own Opaque-LSAs out-of-sync with others.
498 * This thread is prepared for that specific purpose.
500 struct thread
*t_opaque_lsa_self
;
503 * Backpointer to an "owner" which is LSA-type dependent.
504 * type-9: struct ospf_interface
505 * type-10: struct ospf_area
506 * type-11: struct ospf
510 /* Collection of callback functions for this opaque-type. */
511 struct ospf_opaque_functab
*functab
;
513 /* List of Opaque-LSA control informations per opaque-id. */
514 struct list
*id_list
;
517 /* Opaque-LSA control information per opaque-id. */
518 struct opaque_info_per_id
522 /* Thread for refresh/flush scheduling for this opaque-type/id. */
523 struct thread
*t_opaque_lsa_self
;
525 /* Backpointer to Opaque-LSA control information per opaque-type. */
526 struct opaque_info_per_type
*opqctl_type
;
528 /* Here comes an actual Opaque-LSA entry for this opaque-type/id. */
529 struct ospf_lsa
*lsa
;
532 static struct opaque_info_per_type
*register_opaque_info_per_type (struct ospf_opaque_functab
*functab
, struct ospf_lsa
*new);
533 static struct opaque_info_per_type
*lookup_opaque_info_by_type (struct ospf_lsa
*lsa
);
534 static struct opaque_info_per_id
*register_opaque_info_per_id (struct opaque_info_per_type
*oipt
, struct ospf_lsa
*new);
535 static struct opaque_info_per_id
*lookup_opaque_info_by_id (struct opaque_info_per_type
*oipt
, struct ospf_lsa
*lsa
);
536 static struct opaque_info_per_id
*register_opaque_lsa (struct ospf_lsa
*new);
539 static struct opaque_info_per_type
*
540 register_opaque_info_per_type (struct ospf_opaque_functab
*functab
,
541 struct ospf_lsa
*new)
544 struct opaque_info_per_type
*oipt
;
546 if ((oipt
= XCALLOC (MTYPE_OPAQUE_INFO_PER_TYPE
,
547 sizeof (struct opaque_info_per_type
))) == NULL
)
549 zlog_warn ("register_opaque_info_per_type: XMALLOC: %s", safe_strerror (errno
));
553 switch (new->data
->type
)
555 case OSPF_OPAQUE_LINK_LSA
:
556 oipt
->owner
= new->oi
;
557 listnode_add (new->oi
->opaque_lsa_self
, oipt
);
559 case OSPF_OPAQUE_AREA_LSA
:
560 oipt
->owner
= new->area
;
561 listnode_add (new->area
->opaque_lsa_self
, oipt
);
563 case OSPF_OPAQUE_AS_LSA
:
564 top
= ospf_lookup ();
565 if (new->area
!= NULL
&& (top
= new->area
->ospf
) == NULL
)
567 free_opaque_info_per_type ((void *) oipt
);
569 goto out
; /* This case may not exist. */
572 listnode_add (top
->opaque_lsa_self
, oipt
);
575 zlog_warn ("register_opaque_info_per_type: Unexpected LSA-type(%u)", new->data
->type
);
576 free_opaque_info_per_type ((void *) oipt
);
578 goto out
; /* This case may not exist. */
581 oipt
->lsa_type
= new->data
->type
;
582 oipt
->opaque_type
= GET_OPAQUE_TYPE (ntohl (new->data
->id
.s_addr
));
583 oipt
->status
= PROC_NORMAL
;
584 oipt
->t_opaque_lsa_self
= NULL
;
585 oipt
->functab
= functab
;
586 functab
->oipt
= oipt
;
587 oipt
->id_list
= list_new ();
588 oipt
->id_list
->del
= free_opaque_info_per_id
;
595 free_opaque_info_per_type (void *val
)
597 struct opaque_info_per_type
*oipt
= (struct opaque_info_per_type
*) val
;
598 struct opaque_info_per_id
*oipi
;
599 struct ospf_lsa
*lsa
;
600 struct listnode
*node
, *nnode
;
602 /* Control information per opaque-id may still exist. */
603 for (ALL_LIST_ELEMENTS (oipt
->id_list
, node
, nnode
, oipi
))
605 if ((lsa
= oipi
->lsa
) == NULL
)
607 if (IS_LSA_MAXAGE (lsa
))
609 ospf_opaque_lsa_flush_schedule (lsa
);
612 /* Remove "oipt" from its owner's self-originated LSA list. */
613 switch (oipt
->lsa_type
)
615 case OSPF_OPAQUE_LINK_LSA
:
617 struct ospf_interface
*oi
= (struct ospf_interface
*)(oipt
->owner
);
618 listnode_delete (oi
->opaque_lsa_self
, oipt
);
621 case OSPF_OPAQUE_AREA_LSA
:
623 struct ospf_area
*area
= (struct ospf_area
*)(oipt
->owner
);
624 listnode_delete (area
->opaque_lsa_self
, oipt
);
627 case OSPF_OPAQUE_AS_LSA
:
629 struct ospf
*top
= (struct ospf
*)(oipt
->owner
);
630 listnode_delete (top
->opaque_lsa_self
, oipt
);
634 zlog_warn ("free_opaque_info_per_type: Unexpected LSA-type(%u)", oipt
->lsa_type
);
635 break; /* This case may not exist. */
638 OSPF_TIMER_OFF (oipt
->t_opaque_lsa_self
);
639 list_delete (oipt
->id_list
);
640 XFREE (MTYPE_OPAQUE_INFO_PER_TYPE
, oipt
);
644 static struct opaque_info_per_type
*
645 lookup_opaque_info_by_type (struct ospf_lsa
*lsa
)
648 struct ospf_area
*area
;
649 struct ospf_interface
*oi
;
650 struct list
*listtop
= NULL
;
651 struct listnode
*node
, *nnode
;
652 struct opaque_info_per_type
*oipt
= NULL
;
653 u_char key
= GET_OPAQUE_TYPE (ntohl (lsa
->data
->id
.s_addr
));
655 switch (lsa
->data
->type
)
657 case OSPF_OPAQUE_LINK_LSA
:
658 if ((oi
= lsa
->oi
) != NULL
)
659 listtop
= oi
->opaque_lsa_self
;
661 zlog_warn ("Type-9 Opaque-LSA: Reference to OI is missing?");
663 case OSPF_OPAQUE_AREA_LSA
:
664 if ((area
= lsa
->area
) != NULL
)
665 listtop
= area
->opaque_lsa_self
;
667 zlog_warn ("Type-10 Opaque-LSA: Reference to AREA is missing?");
669 case OSPF_OPAQUE_AS_LSA
:
670 top
= ospf_lookup ();
671 if ((area
= lsa
->area
) != NULL
&& (top
= area
->ospf
) == NULL
)
673 zlog_warn ("Type-11 Opaque-LSA: Reference to OSPF is missing?");
674 break; /* Unlikely to happen. */
676 listtop
= top
->opaque_lsa_self
;
679 zlog_warn ("lookup_opaque_info_by_type: Unexpected LSA-type(%u)", lsa
->data
->type
);
684 for (ALL_LIST_ELEMENTS (listtop
, node
, nnode
, oipt
))
685 if (oipt
->opaque_type
== key
)
691 static struct opaque_info_per_id
*
692 register_opaque_info_per_id (struct opaque_info_per_type
*oipt
,
693 struct ospf_lsa
*new)
695 struct opaque_info_per_id
*oipi
;
697 if ((oipi
= XCALLOC (MTYPE_OPAQUE_INFO_PER_ID
,
698 sizeof (struct opaque_info_per_id
))) == NULL
)
700 zlog_warn ("register_opaque_info_per_id: XMALLOC: %s", safe_strerror (errno
));
703 oipi
->opaque_id
= GET_OPAQUE_ID (ntohl (new->data
->id
.s_addr
));
704 oipi
->t_opaque_lsa_self
= NULL
;
705 oipi
->opqctl_type
= oipt
;
706 oipi
->lsa
= ospf_lsa_lock (new);
708 listnode_add (oipt
->id_list
, oipi
);
715 free_opaque_info_per_id (void *val
)
717 struct opaque_info_per_id
*oipi
= (struct opaque_info_per_id
*) val
;
719 OSPF_TIMER_OFF (oipi
->t_opaque_lsa_self
);
720 if (oipi
->lsa
!= NULL
)
721 ospf_lsa_unlock (&oipi
->lsa
);
722 XFREE (MTYPE_OPAQUE_INFO_PER_ID
, oipi
);
726 static struct opaque_info_per_id
*
727 lookup_opaque_info_by_id (struct opaque_info_per_type
*oipt
,
728 struct ospf_lsa
*lsa
)
730 struct listnode
*node
, *nnode
;
731 struct opaque_info_per_id
*oipi
;
732 u_int32_t key
= GET_OPAQUE_ID (ntohl (lsa
->data
->id
.s_addr
));
734 for (ALL_LIST_ELEMENTS (oipt
->id_list
, node
, nnode
, oipi
))
735 if (oipi
->opaque_id
== key
)
741 static struct opaque_info_per_id
*
742 register_opaque_lsa (struct ospf_lsa
*new)
744 struct ospf_opaque_functab
*functab
;
745 struct opaque_info_per_type
*oipt
;
746 struct opaque_info_per_id
*oipi
= NULL
;
748 if ((functab
= ospf_opaque_functab_lookup (new)) == NULL
)
751 if ((oipt
= lookup_opaque_info_by_type (new)) == NULL
752 && (oipt
= register_opaque_info_per_type (functab
, new)) == NULL
)
755 if ((oipi
= register_opaque_info_per_id (oipt
, new)) == NULL
)
762 /*------------------------------------------------------------------------*
763 * Followings are (vty) configuration functions for Opaque-LSAs handling.
764 *------------------------------------------------------------------------*/
766 DEFUN (capability_opaque
,
767 capability_opaque_cmd
,
769 "Enable specific OSPF feature\n"
772 VTY_DECLVAR_CONTEXT(ospf
, ospf
);
774 /* Turn on the "master switch" of opaque-lsa capability. */
775 if (!CHECK_FLAG (ospf
->config
, OSPF_OPAQUE_CAPABLE
))
777 if (IS_DEBUG_OSPF_EVENT
)
778 zlog_debug ("Opaque capability: OFF -> ON");
780 SET_FLAG (ospf
->config
, OSPF_OPAQUE_CAPABLE
);
781 ospf_renegotiate_optional_capabilities (ospf
);
789 "OSPF specific commands\n"
790 "Enable the Opaque-LSA capability (rfc2370)\n")
792 return capability_opaque (self
, vty
, argc
, argv
);
795 DEFUN (no_capability_opaque
,
796 no_capability_opaque_cmd
,
797 "no capability opaque",
799 "Enable specific OSPF feature\n"
802 VTY_DECLVAR_CONTEXT(ospf
, ospf
);
804 /* Turn off the "master switch" of opaque-lsa capability. */
805 if (CHECK_FLAG (ospf
->config
, OSPF_OPAQUE_CAPABLE
))
807 if (IS_DEBUG_OSPF_EVENT
)
808 zlog_debug ("Opaque capability: ON -> OFF");
810 UNSET_FLAG (ospf
->config
, OSPF_OPAQUE_CAPABLE
);
811 ospf_renegotiate_optional_capabilities (ospf
);
816 DEFUN (no_ospf_opaque
,
818 "no ospf opaque-lsa",
820 "OSPF specific commands\n"
821 "Enable the Opaque-LSA capability (rfc2370)\n")
823 return no_capability_opaque (self
, vty
, argc
, argv
);
827 ospf_opaque_register_vty (void)
829 install_element (OSPF_NODE
, &capability_opaque_cmd
);
830 install_element (OSPF_NODE
, &no_capability_opaque_cmd
);
831 install_element (OSPF_NODE
, &ospf_opaque_cmd
);
832 install_element (OSPF_NODE
, &no_ospf_opaque_cmd
);
836 /*------------------------------------------------------------------------*
837 * Followings are collection of user-registered function callers.
838 *------------------------------------------------------------------------*/
841 opaque_lsa_new_if_callback (struct list
*funclist
, struct interface
*ifp
)
843 struct listnode
*node
, *nnode
;
844 struct ospf_opaque_functab
*functab
;
847 for (ALL_LIST_ELEMENTS (funclist
, node
, nnode
, functab
))
848 if (functab
->new_if_hook
!= NULL
)
849 if ((* functab
->new_if_hook
)(ifp
) != 0)
857 opaque_lsa_del_if_callback (struct list
*funclist
, struct interface
*ifp
)
859 struct listnode
*node
, *nnode
;
860 struct ospf_opaque_functab
*functab
;
863 for (ALL_LIST_ELEMENTS (funclist
, node
, nnode
, functab
))
864 if (functab
->del_if_hook
!= NULL
)
865 if ((* functab
->del_if_hook
)(ifp
) != 0)
873 opaque_lsa_ism_change_callback (struct list
*funclist
,
874 struct ospf_interface
*oi
, int old_status
)
876 struct listnode
*node
, *nnode
;
877 struct ospf_opaque_functab
*functab
;
879 for (ALL_LIST_ELEMENTS (funclist
, node
, nnode
, functab
))
880 if (functab
->ism_change_hook
!= NULL
)
881 (* functab
->ism_change_hook
)(oi
, old_status
);
887 opaque_lsa_nsm_change_callback (struct list
*funclist
,
888 struct ospf_neighbor
*nbr
, int old_status
)
890 struct listnode
*node
, *nnode
;
891 struct ospf_opaque_functab
*functab
;
893 for (ALL_LIST_ELEMENTS (funclist
, node
, nnode
, functab
))
894 if (functab
->nsm_change_hook
!= NULL
)
895 (* functab
->nsm_change_hook
)(nbr
, old_status
);
900 opaque_lsa_config_write_router_callback (struct list
*funclist
,
903 struct listnode
*node
, *nnode
;
904 struct ospf_opaque_functab
*functab
;
906 for (ALL_LIST_ELEMENTS (funclist
, node
, nnode
, functab
))
907 if (functab
->config_write_router
!= NULL
)
908 (* functab
->config_write_router
)(vty
);
913 opaque_lsa_config_write_if_callback (struct list
*funclist
,
914 struct vty
*vty
, struct interface
*ifp
)
916 struct listnode
*node
, *nnode
;
917 struct ospf_opaque_functab
*functab
;
919 for (ALL_LIST_ELEMENTS (funclist
, node
, nnode
, functab
))
920 if (functab
->config_write_if
!= NULL
)
921 (* functab
->config_write_if
)(vty
, ifp
);
926 opaque_lsa_config_write_debug_callback (struct list
*funclist
, struct vty
*vty
)
928 struct listnode
*node
, *nnode
;
929 struct ospf_opaque_functab
*functab
;
931 for (ALL_LIST_ELEMENTS (funclist
, node
, nnode
, functab
))
932 if (functab
->config_write_debug
!= NULL
)
933 (* functab
->config_write_debug
)(vty
);
938 opaque_lsa_originate_callback (struct list
*funclist
, void *lsa_type_dependent
)
940 struct listnode
*node
, *nnode
;
941 struct ospf_opaque_functab
*functab
;
944 for (ALL_LIST_ELEMENTS (funclist
, node
, nnode
, functab
))
945 if (functab
->lsa_originator
!= NULL
)
946 if ((* functab
->lsa_originator
)(lsa_type_dependent
) != 0)
954 new_lsa_callback (struct list
*funclist
, struct ospf_lsa
*lsa
)
956 struct listnode
*node
, *nnode
;
957 struct ospf_opaque_functab
*functab
;
960 /* This function handles ALL types of LSAs, not only opaque ones. */
961 for (ALL_LIST_ELEMENTS (funclist
, node
, nnode
, functab
))
962 if (functab
->new_lsa_hook
!= NULL
)
963 if ((* functab
->new_lsa_hook
)(lsa
) != 0)
971 del_lsa_callback (struct list
*funclist
, struct ospf_lsa
*lsa
)
973 struct listnode
*node
, *nnode
;
974 struct ospf_opaque_functab
*functab
;
977 /* This function handles ALL types of LSAs, not only opaque ones. */
978 for (ALL_LIST_ELEMENTS (funclist
, node
, nnode
, functab
))
979 if (functab
->del_lsa_hook
!= NULL
)
980 if ((* functab
->del_lsa_hook
)(lsa
) != 0)
987 /*------------------------------------------------------------------------*
988 * Followings are glue functions to call Opaque-LSA specific processing.
989 *------------------------------------------------------------------------*/
992 ospf_opaque_new_if (struct interface
*ifp
)
994 struct list
*funclist
;
997 funclist
= ospf_opaque_wildcard_funclist
;
998 if (opaque_lsa_new_if_callback (funclist
, ifp
) != 0)
1001 funclist
= ospf_opaque_type9_funclist
;
1002 if (opaque_lsa_new_if_callback (funclist
, ifp
) != 0)
1005 funclist
= ospf_opaque_type10_funclist
;
1006 if (opaque_lsa_new_if_callback (funclist
, ifp
) != 0)
1009 funclist
= ospf_opaque_type11_funclist
;
1010 if (opaque_lsa_new_if_callback (funclist
, ifp
) != 0)
1019 ospf_opaque_del_if (struct interface
*ifp
)
1021 struct list
*funclist
;
1024 funclist
= ospf_opaque_wildcard_funclist
;
1025 if (opaque_lsa_del_if_callback (funclist
, ifp
) != 0)
1028 funclist
= ospf_opaque_type9_funclist
;
1029 if (opaque_lsa_del_if_callback (funclist
, ifp
) != 0)
1032 funclist
= ospf_opaque_type10_funclist
;
1033 if (opaque_lsa_del_if_callback (funclist
, ifp
) != 0)
1036 funclist
= ospf_opaque_type11_funclist
;
1037 if (opaque_lsa_del_if_callback (funclist
, ifp
) != 0)
1046 ospf_opaque_ism_change (struct ospf_interface
*oi
, int old_status
)
1048 struct list
*funclist
;
1050 funclist
= ospf_opaque_wildcard_funclist
;
1051 opaque_lsa_ism_change_callback (funclist
, oi
, old_status
);
1053 funclist
= ospf_opaque_type9_funclist
;
1054 opaque_lsa_ism_change_callback (funclist
, oi
, old_status
);
1056 funclist
= ospf_opaque_type10_funclist
;
1057 opaque_lsa_ism_change_callback (funclist
, oi
, old_status
);
1059 funclist
= ospf_opaque_type11_funclist
;
1060 opaque_lsa_ism_change_callback (funclist
, oi
, old_status
);
1066 ospf_opaque_nsm_change (struct ospf_neighbor
*nbr
, int old_state
)
1069 struct list
*funclist
;
1071 if ((top
= oi_to_top (nbr
->oi
)) == NULL
)
1074 if (old_state
!= NSM_Full
&& nbr
->state
== NSM_Full
)
1076 if (CHECK_FLAG (nbr
->options
, OSPF_OPTION_O
))
1078 if (! CHECK_FLAG (top
->opaque
, OPAQUE_OPERATION_READY_BIT
))
1080 if (IS_DEBUG_OSPF_EVENT
)
1081 zlog_debug ("Opaque-LSA: Now get operational!");
1083 SET_FLAG (top
->opaque
, OPAQUE_OPERATION_READY_BIT
);
1086 ospf_opaque_lsa_originate_schedule (nbr
->oi
, NULL
);
1090 if (old_state
== NSM_Full
&& nbr
->state
!= NSM_Full
)
1094 * If no more opaque-capable full-state neighbor remains in the
1095 * flooding scope which corresponds to Opaque-LSA type, periodic
1096 * LS flooding should be stopped.
1102 funclist
= ospf_opaque_wildcard_funclist
;
1103 opaque_lsa_nsm_change_callback (funclist
, nbr
, old_state
);
1105 funclist
= ospf_opaque_type9_funclist
;
1106 opaque_lsa_nsm_change_callback (funclist
, nbr
, old_state
);
1108 funclist
= ospf_opaque_type10_funclist
;
1109 opaque_lsa_nsm_change_callback (funclist
, nbr
, old_state
);
1111 funclist
= ospf_opaque_type11_funclist
;
1112 opaque_lsa_nsm_change_callback (funclist
, nbr
, old_state
);
1119 ospf_opaque_config_write_router (struct vty
*vty
, struct ospf
*ospf
)
1121 struct list
*funclist
;
1123 if (CHECK_FLAG (ospf
->config
, OSPF_OPAQUE_CAPABLE
))
1124 vty_out (vty
, " capability opaque%s", VTY_NEWLINE
);
1126 funclist
= ospf_opaque_wildcard_funclist
;
1127 opaque_lsa_config_write_router_callback (funclist
, vty
);
1129 funclist
= ospf_opaque_type9_funclist
;
1130 opaque_lsa_config_write_router_callback (funclist
, vty
);
1132 funclist
= ospf_opaque_type10_funclist
;
1133 opaque_lsa_config_write_router_callback (funclist
, vty
);
1135 funclist
= ospf_opaque_type11_funclist
;
1136 opaque_lsa_config_write_router_callback (funclist
, vty
);
1142 ospf_opaque_config_write_if (struct vty
*vty
, struct interface
*ifp
)
1144 struct list
*funclist
;
1146 funclist
= ospf_opaque_wildcard_funclist
;
1147 opaque_lsa_config_write_if_callback (funclist
, vty
, ifp
);
1149 funclist
= ospf_opaque_type9_funclist
;
1150 opaque_lsa_config_write_if_callback (funclist
, vty
, ifp
);
1152 funclist
= ospf_opaque_type10_funclist
;
1153 opaque_lsa_config_write_if_callback (funclist
, vty
, ifp
);
1155 funclist
= ospf_opaque_type11_funclist
;
1156 opaque_lsa_config_write_if_callback (funclist
, vty
, ifp
);
1162 ospf_opaque_config_write_debug (struct vty
*vty
)
1164 struct list
*funclist
;
1166 funclist
= ospf_opaque_wildcard_funclist
;
1167 opaque_lsa_config_write_debug_callback (funclist
, vty
);
1169 funclist
= ospf_opaque_type9_funclist
;
1170 opaque_lsa_config_write_debug_callback (funclist
, vty
);
1172 funclist
= ospf_opaque_type10_funclist
;
1173 opaque_lsa_config_write_debug_callback (funclist
, vty
);
1175 funclist
= ospf_opaque_type11_funclist
;
1176 opaque_lsa_config_write_debug_callback (funclist
, vty
);
1182 show_opaque_info_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
1184 struct lsa_header
*lsah
= (struct lsa_header
*) lsa
->data
;
1185 u_int32_t lsid
= ntohl (lsah
->id
.s_addr
);
1186 u_char opaque_type
= GET_OPAQUE_TYPE (lsid
);
1187 u_int32_t opaque_id
= GET_OPAQUE_ID (lsid
);
1188 struct ospf_opaque_functab
*functab
;
1190 /* Switch output functionality by vty address. */
1193 vty_out (vty
, " Opaque-Type %u (%s)%s", opaque_type
,
1194 ospf_opaque_type_name (opaque_type
), VTY_NEWLINE
);
1195 vty_out (vty
, " Opaque-ID 0x%x%s", opaque_id
, VTY_NEWLINE
);
1197 vty_out (vty
, " Opaque-Info: %u octets of data%s%s",
1198 ntohs (lsah
->length
) - OSPF_LSA_HEADER_SIZE
,
1199 VALID_OPAQUE_INFO_LEN(lsah
) ? "" : "(Invalid length?)",
1204 zlog_debug (" Opaque-Type %u (%s)", opaque_type
,
1205 ospf_opaque_type_name (opaque_type
));
1206 zlog_debug (" Opaque-ID 0x%x", opaque_id
);
1208 zlog_debug (" Opaque-Info: %u octets of data%s",
1209 ntohs (lsah
->length
) - OSPF_LSA_HEADER_SIZE
,
1210 VALID_OPAQUE_INFO_LEN(lsah
) ? "" : "(Invalid length?)");
1213 /* Call individual output functions. */
1214 if ((functab
= ospf_opaque_functab_lookup (lsa
)) != NULL
)
1215 if (functab
->show_opaque_info
!= NULL
)
1216 (* functab
->show_opaque_info
)(vty
, lsa
);
1222 ospf_opaque_lsa_dump (struct stream
*s
, u_int16_t length
)
1224 struct ospf_lsa lsa
;
1226 lsa
.data
= (struct lsa_header
*) STREAM_PNT (s
);
1227 show_opaque_info_detail (NULL
, &lsa
);
1232 ospf_opaque_lsa_install_hook (struct ospf_lsa
*lsa
)
1234 struct list
*funclist
;
1238 * Some Opaque-LSA user may want to monitor every LSA installation
1239 * into the LSDB, regardless with target LSA type.
1241 funclist
= ospf_opaque_wildcard_funclist
;
1242 if (new_lsa_callback (funclist
, lsa
) != 0)
1245 funclist
= ospf_opaque_type9_funclist
;
1246 if (new_lsa_callback (funclist
, lsa
) != 0)
1249 funclist
= ospf_opaque_type10_funclist
;
1250 if (new_lsa_callback (funclist
, lsa
) != 0)
1253 funclist
= ospf_opaque_type11_funclist
;
1254 if (new_lsa_callback (funclist
, lsa
) != 0)
1263 ospf_opaque_lsa_delete_hook (struct ospf_lsa
*lsa
)
1265 struct list
*funclist
;
1269 * Some Opaque-LSA user may want to monitor every LSA deletion
1270 * from the LSDB, regardless with target LSA type.
1272 funclist
= ospf_opaque_wildcard_funclist
;
1273 if (del_lsa_callback (funclist
, lsa
) != 0)
1276 funclist
= ospf_opaque_type9_funclist
;
1277 if (del_lsa_callback (funclist
, lsa
) != 0)
1280 funclist
= ospf_opaque_type10_funclist
;
1281 if (del_lsa_callback (funclist
, lsa
) != 0)
1284 funclist
= ospf_opaque_type11_funclist
;
1285 if (del_lsa_callback (funclist
, lsa
) != 0)
1293 /*------------------------------------------------------------------------*
1294 * Followings are Opaque-LSA origination/refresh management functions.
1295 *------------------------------------------------------------------------*/
1297 static int ospf_opaque_type9_lsa_originate (struct thread
*t
);
1298 static int ospf_opaque_type10_lsa_originate (struct thread
*t
);
1299 static int ospf_opaque_type11_lsa_originate (struct thread
*t
);
1300 static void ospf_opaque_lsa_reoriginate_resume (struct list
*listtop
, void *arg
);
1303 ospf_opaque_lsa_originate_schedule (struct ospf_interface
*oi
, int *delay0
)
1306 struct ospf_area
*area
;
1307 struct listnode
*node
, *nnode
;
1308 struct opaque_info_per_type
*oipt
;
1311 if ((top
= oi_to_top (oi
)) == NULL
|| (area
= oi
->area
) == NULL
)
1313 zlog_warn ("ospf_opaque_lsa_originate_schedule: Invalid argument?");
1317 /* It may not a right time to schedule origination now. */
1318 if (! CHECK_FLAG (top
->opaque
, OPAQUE_OPERATION_READY_BIT
))
1320 if (IS_DEBUG_OSPF_EVENT
)
1321 zlog_debug ("ospf_opaque_lsa_originate_schedule: Not operational.");
1322 goto out
; /* This is not an error. */
1329 * There might be some entries that have been waiting for triggering
1330 * of per opaque-type re-origination get resumed.
1332 ospf_opaque_lsa_reoriginate_resume ( oi
->opaque_lsa_self
, (void *) oi
);
1333 ospf_opaque_lsa_reoriginate_resume (area
->opaque_lsa_self
, (void *) area
);
1334 ospf_opaque_lsa_reoriginate_resume ( top
->opaque_lsa_self
, (void *) top
);
1337 * Now, schedule origination of all Opaque-LSAs per opaque-type.
1339 if (! list_isempty (ospf_opaque_type9_funclist
)
1340 && list_isempty (oi
->opaque_lsa_self
)
1341 && oi
->t_opaque_lsa_self
== NULL
)
1343 if (IS_DEBUG_OSPF_EVENT
)
1344 zlog_debug ("Schedule Type-9 Opaque-LSA origination in %d ms later.", delay
);
1345 oi
->t_opaque_lsa_self
=
1346 thread_add_timer_msec (master
, ospf_opaque_type9_lsa_originate
, oi
, delay
);
1347 delay
+= top
->min_ls_interval
;
1350 if (! list_isempty (ospf_opaque_type10_funclist
)
1351 && list_isempty (area
->opaque_lsa_self
)
1352 && area
->t_opaque_lsa_self
== NULL
)
1355 * One AREA may contain multiple OIs, but above 2nd and 3rd
1356 * conditions prevent from scheduling the originate function
1359 if (IS_DEBUG_OSPF_EVENT
)
1360 zlog_debug ("Schedule Type-10 Opaque-LSA origination in %d ms later.", delay
);
1361 area
->t_opaque_lsa_self
=
1362 thread_add_timer_msec (master
, ospf_opaque_type10_lsa_originate
,
1364 delay
+= top
->min_ls_interval
;
1367 if (! list_isempty (ospf_opaque_type11_funclist
)
1368 && list_isempty (top
->opaque_lsa_self
)
1369 && top
->t_opaque_lsa_self
== NULL
)
1372 * One OSPF may contain multiple AREAs, but above 2nd and 3rd
1373 * conditions prevent from scheduling the originate function
1376 if (IS_DEBUG_OSPF_EVENT
)
1377 zlog_debug ("Schedule Type-11 Opaque-LSA origination in %d ms later.", delay
);
1378 top
->t_opaque_lsa_self
=
1379 thread_add_timer_msec (master
, ospf_opaque_type11_lsa_originate
,
1381 delay
+= top
->min_ls_interval
;
1385 * Following section treats a special situation that this node's
1386 * opaque capability has changed as "ON -> OFF -> ON".
1388 if (! list_isempty (ospf_opaque_type9_funclist
)
1389 && ! list_isempty (oi
->opaque_lsa_self
))
1391 for (ALL_LIST_ELEMENTS (oi
->opaque_lsa_self
, node
, nnode
, oipt
))
1394 * removed the test for
1395 * (! list_isempty (oipt->id_list)) * Handler is already active. *
1396 * because opaque cababilities ON -> OFF -> ON result in list_isempty (oipt->id_list)
1399 if (oipt
->t_opaque_lsa_self
!= NULL
/* Waiting for a thread call. */
1400 || oipt
->status
== PROC_SUSPEND
) /* Cannot originate now. */
1403 ospf_opaque_lsa_reoriginate_schedule ((void *) oi
,
1404 OSPF_OPAQUE_LINK_LSA
, oipt
->opaque_type
);
1408 if (! list_isempty (ospf_opaque_type10_funclist
)
1409 && ! list_isempty (area
->opaque_lsa_self
))
1411 for (ALL_LIST_ELEMENTS (area
->opaque_lsa_self
, node
, nnode
, oipt
))
1414 * removed the test for
1415 * (! list_isempty (oipt->id_list)) * Handler is already active. *
1416 * because opaque cababilities ON -> OFF -> ON result in list_isempty (oipt->id_list)
1419 if (oipt
->t_opaque_lsa_self
!= NULL
/* Waiting for a thread call. */
1420 || oipt
->status
== PROC_SUSPEND
) /* Cannot originate now. */
1423 ospf_opaque_lsa_reoriginate_schedule ((void *) area
,
1424 OSPF_OPAQUE_AREA_LSA
, oipt
->opaque_type
);
1428 if (! list_isempty (ospf_opaque_type11_funclist
)
1429 && ! list_isempty (top
->opaque_lsa_self
))
1431 for (ALL_LIST_ELEMENTS (top
->opaque_lsa_self
, node
, nnode
, oipt
))
1434 * removed the test for
1435 * (! list_isempty (oipt->id_list)) * Handler is already active. *
1436 * because opaque cababilities ON -> OFF -> ON result in list_isempty (oipt->id_list)
1439 if (oipt
->t_opaque_lsa_self
!= NULL
/* Waiting for a thread call. */
1440 || oipt
->status
== PROC_SUSPEND
) /* Cannot originate now. */
1443 ospf_opaque_lsa_reoriginate_schedule ((void *) top
,
1444 OSPF_OPAQUE_AS_LSA
, oipt
->opaque_type
);
1456 ospf_opaque_type9_lsa_originate (struct thread
*t
)
1458 struct ospf_interface
*oi
;
1461 oi
= THREAD_ARG (t
);
1462 oi
->t_opaque_lsa_self
= NULL
;
1464 if (IS_DEBUG_OSPF_EVENT
)
1465 zlog_debug ("Timer[Type9-LSA]: Originate Opaque-LSAs for OI %s",
1468 rc
= opaque_lsa_originate_callback (ospf_opaque_type9_funclist
, oi
);
1474 ospf_opaque_type10_lsa_originate (struct thread
*t
)
1476 struct ospf_area
*area
;
1479 area
= THREAD_ARG (t
);
1480 area
->t_opaque_lsa_self
= NULL
;
1482 if (IS_DEBUG_OSPF_EVENT
)
1483 zlog_debug ("Timer[Type10-LSA]: Originate Opaque-LSAs for Area %s",
1484 inet_ntoa (area
->area_id
));
1486 rc
= opaque_lsa_originate_callback (ospf_opaque_type10_funclist
, area
);
1492 ospf_opaque_type11_lsa_originate (struct thread
*t
)
1497 top
= THREAD_ARG (t
);
1498 top
->t_opaque_lsa_self
= NULL
;
1500 if (IS_DEBUG_OSPF_EVENT
)
1501 zlog_debug ("Timer[Type11-LSA]: Originate AS-External Opaque-LSAs");
1503 rc
= opaque_lsa_originate_callback (ospf_opaque_type11_funclist
, top
);
1509 ospf_opaque_lsa_reoriginate_resume (struct list
*listtop
, void *arg
)
1511 struct listnode
*node
, *nnode
;
1512 struct opaque_info_per_type
*oipt
;
1513 struct ospf_opaque_functab
*functab
;
1515 if (listtop
== NULL
)
1519 * Pickup oipt entries those which in SUSPEND status, and give
1520 * them a chance to start re-origination now.
1522 for (ALL_LIST_ELEMENTS (listtop
, node
, nnode
, oipt
))
1524 if (oipt
->status
!= PROC_SUSPEND
)
1527 oipt
->status
= PROC_NORMAL
;
1529 if ((functab
= oipt
->functab
) == NULL
1530 || functab
->lsa_originator
== NULL
)
1533 if ((* functab
->lsa_originator
)(arg
) != 0)
1535 zlog_warn ("ospf_opaque_lsa_reoriginate_resume: Failed (opaque-type=%u)", oipt
->opaque_type
);
1545 ospf_opaque_lsa_install (struct ospf_lsa
*lsa
, int rt_recalc
)
1547 struct ospf_lsa
*new = NULL
;
1548 struct opaque_info_per_type
*oipt
;
1549 struct opaque_info_per_id
*oipi
;
1552 /* Don't take "rt_recalc" into consideration for now. *//* XXX */
1554 if (! IS_LSA_SELF (lsa
))
1556 new = lsa
; /* Don't touch this LSA. */
1560 if (IS_DEBUG_OSPF (lsa
, LSA_INSTALL
))
1561 zlog_debug ("Install Type-%u Opaque-LSA: [opaque-type=%u, opaque-id=%x]", lsa
->data
->type
, GET_OPAQUE_TYPE (ntohl (lsa
->data
->id
.s_addr
)), GET_OPAQUE_ID (ntohl (lsa
->data
->id
.s_addr
)));
1563 /* Replace the existing lsa with the new one. */
1564 if ((oipt
= lookup_opaque_info_by_type (lsa
)) != NULL
1565 && (oipi
= lookup_opaque_info_by_id (oipt
, lsa
)) != NULL
)
1567 ospf_lsa_unlock (&oipi
->lsa
);
1568 oipi
->lsa
= ospf_lsa_lock (lsa
);
1570 /* Register the new lsa entry and get its control info. */
1572 if ((oipi
= register_opaque_lsa (lsa
)) == NULL
)
1574 zlog_warn ("ospf_opaque_lsa_install: register_opaque_lsa() ?");
1579 * Make use of a common mechanism (ospf_lsa_refresh_walker)
1580 * for periodic refresh of self-originated Opaque-LSAs.
1582 switch (lsa
->data
->type
)
1584 case OSPF_OPAQUE_LINK_LSA
:
1585 if ((top
= oi_to_top (lsa
->oi
)) == NULL
)
1587 /* Above conditions must have passed. */
1588 zlog_warn ("ospf_opaque_lsa_install: Sonmething wrong?");
1592 case OSPF_OPAQUE_AREA_LSA
:
1593 if (lsa
->area
== NULL
|| (top
= lsa
->area
->ospf
) == NULL
)
1595 /* Above conditions must have passed. */
1596 zlog_warn ("ospf_opaque_lsa_install: Sonmething wrong?");
1600 case OSPF_OPAQUE_AS_LSA
:
1601 top
= ospf_lookup ();
1602 if (lsa
->area
!= NULL
&& (top
= lsa
->area
->ospf
) == NULL
)
1604 /* Above conditions must have passed. */
1605 zlog_warn ("ospf_opaque_lsa_install: Sonmething wrong?");
1610 zlog_warn ("ospf_opaque_lsa_install: Unexpected LSA-type(%u)", lsa
->data
->type
);
1614 ospf_refresher_register_lsa (top
, lsa
);
1622 ospf_opaque_lsa_refresh (struct ospf_lsa
*lsa
)
1625 struct ospf_opaque_functab
*functab
;
1626 struct ospf_lsa
*new = NULL
;
1628 ospf
= ospf_lookup ();
1630 if ((functab
= ospf_opaque_functab_lookup (lsa
)) == NULL
1631 || functab
->lsa_refresher
== NULL
)
1634 * Though this LSA seems to have originated on this node, the
1635 * handling module for this "lsa-type and opaque-type" was
1636 * already deleted sometime ago.
1637 * Anyway, this node still has a responsibility to flush this
1638 * LSA from the routing domain.
1640 if (IS_DEBUG_OSPF_EVENT
)
1641 zlog_debug ("LSA[Type%d:%s]: Flush stray Opaque-LSA", lsa
->data
->type
, inet_ntoa (lsa
->data
->id
));
1643 lsa
->data
->ls_age
= htons (OSPF_LSA_MAXAGE
);
1644 ospf_lsa_flush (ospf
, lsa
);
1647 new = (* functab
->lsa_refresher
)(lsa
);
1652 /*------------------------------------------------------------------------*
1653 * Followings are re-origination/refresh/flush operations of Opaque-LSAs,
1654 * triggered by external interventions (vty session, signaling, etc).
1655 *------------------------------------------------------------------------*/
1657 #define OSPF_OPAQUE_TIMER_ON(T,F,L,V) \
1659 (T) = thread_add_timer_msec (master, (F), (L), (V))
1661 static struct ospf_lsa
*pseudo_lsa (struct ospf_interface
*oi
, struct ospf_area
*area
, u_char lsa_type
, u_char opaque_type
);
1662 static int ospf_opaque_type9_lsa_reoriginate_timer (struct thread
*t
);
1663 static int ospf_opaque_type10_lsa_reoriginate_timer (struct thread
*t
);
1664 static int ospf_opaque_type11_lsa_reoriginate_timer (struct thread
*t
);
1665 static int ospf_opaque_lsa_refresh_timer (struct thread
*t
);
1668 ospf_opaque_lsa_reoriginate_schedule (void *lsa_type_dependent
,
1669 u_char lsa_type
, u_char opaque_type
)
1672 struct ospf_area dummy
, *area
= NULL
;
1673 struct ospf_interface
*oi
= NULL
;
1675 struct ospf_lsa
*lsa
;
1676 struct opaque_info_per_type
*oipt
;
1677 int (*func
) (struct thread
* t
) = NULL
;
1682 case OSPF_OPAQUE_LINK_LSA
:
1683 if ((oi
= (struct ospf_interface
*) lsa_type_dependent
) == NULL
)
1685 zlog_warn ("ospf_opaque_lsa_reoriginate_schedule:"
1686 " Type-9 Opaque-LSA: Invalid parameter?");
1689 if ((top
= oi_to_top (oi
)) == NULL
)
1691 zlog_warn ("ospf_opaque_lsa_reoriginate_schedule: OI(%s) -> TOP?",
1695 if (!list_isempty (ospf_opaque_type9_funclist
)
1696 && list_isempty (oi
->opaque_lsa_self
)
1697 && oi
->t_opaque_lsa_self
!= NULL
)
1699 zlog_warn ("Type-9 Opaque-LSA (opaque_type=%u):"
1700 " Common origination for OI(%s) has already started",
1701 opaque_type
, IF_NAME (oi
));
1704 func
= ospf_opaque_type9_lsa_reoriginate_timer
;
1706 case OSPF_OPAQUE_AREA_LSA
:
1707 if ((area
= (struct ospf_area
*) lsa_type_dependent
) == NULL
)
1709 zlog_warn ("ospf_opaque_lsa_reoriginate_schedule:"
1710 " Type-10 Opaque-LSA: Invalid parameter?");
1713 if ((top
= area
->ospf
) == NULL
)
1715 zlog_warn ("ospf_opaque_lsa_reoriginate_schedule:"
1716 " AREA(%s) -> TOP?", inet_ntoa (area
->area_id
));
1719 if (!list_isempty (ospf_opaque_type10_funclist
)
1720 && list_isempty (area
->opaque_lsa_self
)
1721 && area
->t_opaque_lsa_self
!= NULL
)
1723 zlog_warn ("Type-10 Opaque-LSA (opaque_type=%u):"
1724 " Common origination for AREA(%s) has already started",
1725 opaque_type
, inet_ntoa (area
->area_id
));
1728 func
= ospf_opaque_type10_lsa_reoriginate_timer
;
1730 case OSPF_OPAQUE_AS_LSA
:
1731 if ((top
= (struct ospf
*) lsa_type_dependent
) == NULL
)
1733 zlog_warn ("ospf_opaque_lsa_reoriginate_schedule:"
1734 " Type-11 Opaque-LSA: Invalid parameter?");
1737 if (!list_isempty (ospf_opaque_type11_funclist
)
1738 && list_isempty (top
->opaque_lsa_self
)
1739 && top
->t_opaque_lsa_self
!= NULL
)
1741 zlog_warn ("Type-11 Opaque-LSA (opaque_type=%u):"
1742 " Common origination has already started", opaque_type
);
1746 /* Fake "area" to pass "ospf" to a lookup function later. */
1750 func
= ospf_opaque_type11_lsa_reoriginate_timer
;
1753 zlog_warn ("ospf_opaque_lsa_reoriginate_schedule:"
1754 " Unexpected LSA-type(%u)",
1759 /* It may not a right time to schedule reorigination now. */
1760 if (!CHECK_FLAG (top
->opaque
, OPAQUE_OPERATION_READY_BIT
))
1762 if (IS_DEBUG_OSPF_EVENT
)
1763 zlog_debug ("ospf_opaque_lsa_reoriginate_schedule: Not operational.");
1764 goto out
; /* This is not an error. */
1767 /* Generate a dummy lsa to be passed for a lookup function. */
1768 lsa
= pseudo_lsa (oi
, area
, lsa_type
, opaque_type
);
1770 if ((oipt
= lookup_opaque_info_by_type (lsa
)) == NULL
)
1772 struct ospf_opaque_functab
*functab
;
1773 if ((functab
= ospf_opaque_functab_lookup (lsa
)) == NULL
)
1775 zlog_warn ("ospf_opaque_lsa_reoriginate_schedule:"
1776 " No associated function?: lsa_type(%u),"
1778 lsa_type
, opaque_type
);
1781 if ((oipt
= register_opaque_info_per_type (functab
, lsa
)) == NULL
)
1783 zlog_warn ("ospf_opaque_lsa_reoriginate_schedule:"
1784 " Cannot get a control info?: lsa_type(%u),"
1786 lsa_type
, opaque_type
);
1791 if (oipt
->t_opaque_lsa_self
!= NULL
)
1793 if (IS_DEBUG_OSPF_EVENT
)
1794 zlog_debug ("Type-%u Opaque-LSA has already scheduled to"
1795 " RE-ORIGINATE: [opaque-type=%u]",
1796 lsa_type
, GET_OPAQUE_TYPE (ntohl (lsa
->data
->id
.s_addr
)));
1801 * Different from initial origination time, in which various conditions
1802 * (opaque capability, neighbor status etc) are assured by caller of
1803 * the originating function "ospf_opaque_lsa_originate_schedule ()",
1804 * it is highly possible that these conditions might not be satisfied
1805 * at the time of re-origination function is to be called.
1807 delay
= top
->min_ls_interval
; /* XXX */
1809 if (IS_DEBUG_OSPF_EVENT
)
1810 zlog_debug ("Schedule Type-%u Opaque-LSA to RE-ORIGINATE in %d"
1811 " ms later: [opaque-type=%u]",
1813 GET_OPAQUE_TYPE (ntohl (lsa
->data
->id
.s_addr
)));
1815 OSPF_OPAQUE_TIMER_ON (oipt
->t_opaque_lsa_self
, func
, oipt
, delay
* 1000);
1821 static struct ospf_lsa
*
1822 pseudo_lsa (struct ospf_interface
*oi
, struct ospf_area
*area
,
1823 u_char lsa_type
, u_char opaque_type
)
1825 static struct ospf_lsa lsa
= { 0 };
1826 static struct lsa_header lsah
= { 0 };
1833 lsah
.type
= lsa_type
;
1834 tmp
= SET_OPAQUE_LSID (opaque_type
, 0); /* Opaque-ID is unused here. */
1835 lsah
.id
.s_addr
= htonl (tmp
);
1841 ospf_opaque_type9_lsa_reoriginate_timer (struct thread
*t
)
1843 struct opaque_info_per_type
*oipt
;
1844 struct ospf_opaque_functab
*functab
;
1846 struct ospf_interface
*oi
;
1849 oipt
= THREAD_ARG (t
);
1850 oipt
->t_opaque_lsa_self
= NULL
;
1852 if ((functab
= oipt
->functab
) == NULL
1853 || functab
->lsa_originator
== NULL
)
1855 zlog_warn ("ospf_opaque_type9_lsa_reoriginate_timer: No associated function?");
1859 oi
= (struct ospf_interface
*) oipt
->owner
;
1860 if ((top
= oi_to_top (oi
)) == NULL
)
1862 zlog_warn ("ospf_opaque_type9_lsa_reoriginate_timer: Something wrong?");
1866 if (! CHECK_FLAG (top
->config
, OSPF_OPAQUE_CAPABLE
)
1867 || ! ospf_if_is_enable (oi
)
1868 || ospf_nbr_count_opaque_capable (oi
) == 0)
1870 if (IS_DEBUG_OSPF_EVENT
)
1871 zlog_debug ("Suspend re-origination of Type-9 Opaque-LSAs (opaque-type=%u) for a while...", oipt
->opaque_type
);
1873 oipt
->status
= PROC_SUSPEND
;
1878 if (IS_DEBUG_OSPF_EVENT
)
1879 zlog_debug ("Timer[Type9-LSA]: Re-originate Opaque-LSAs (opaque-type=%u) for OI (%s)", oipt
->opaque_type
, IF_NAME (oi
));
1881 rc
= (* functab
->lsa_originator
)(oi
);
1887 ospf_opaque_type10_lsa_reoriginate_timer (struct thread
*t
)
1889 struct opaque_info_per_type
*oipt
;
1890 struct ospf_opaque_functab
*functab
;
1891 struct listnode
*node
, *nnode
;
1893 struct ospf_area
*area
;
1894 struct ospf_interface
*oi
;
1897 oipt
= THREAD_ARG (t
);
1898 oipt
->t_opaque_lsa_self
= NULL
;
1900 if ((functab
= oipt
->functab
) == NULL
1901 || functab
->lsa_originator
== NULL
)
1903 zlog_warn ("ospf_opaque_type10_lsa_reoriginate_timer: No associated function?");
1907 area
= (struct ospf_area
*) oipt
->owner
;
1908 if (area
== NULL
|| (top
= area
->ospf
) == NULL
)
1910 zlog_warn ("ospf_opaque_type10_lsa_reoriginate_timer: Something wrong?");
1914 /* There must be at least one "opaque-capable, full-state" neighbor. */
1916 for (ALL_LIST_ELEMENTS (area
->oiflist
, node
, nnode
, oi
))
1918 if ((n
= ospf_nbr_count_opaque_capable (oi
)) > 0)
1922 if (n
== 0 || ! CHECK_FLAG (top
->config
, OSPF_OPAQUE_CAPABLE
))
1924 if (IS_DEBUG_OSPF_EVENT
)
1925 zlog_debug ("Suspend re-origination of Type-10 Opaque-LSAs"
1926 " (opaque-type=%u) for a while...",
1929 oipt
->status
= PROC_SUSPEND
;
1934 if (IS_DEBUG_OSPF_EVENT
)
1935 zlog_debug ("Timer[Type10-LSA]: Re-originate Opaque-LSAs"
1936 " (opaque-type=%u) for Area %s",
1937 oipt
->opaque_type
, inet_ntoa (area
->area_id
));
1939 rc
= (* functab
->lsa_originator
)(area
);
1945 ospf_opaque_type11_lsa_reoriginate_timer (struct thread
*t
)
1947 struct opaque_info_per_type
*oipt
;
1948 struct ospf_opaque_functab
*functab
;
1952 oipt
= THREAD_ARG (t
);
1953 oipt
->t_opaque_lsa_self
= NULL
;
1955 if ((functab
= oipt
->functab
) == NULL
1956 || functab
->lsa_originator
== NULL
)
1958 zlog_warn ("ospf_opaque_type11_lsa_reoriginate_timer:"
1959 " No associated function?");
1963 if ((top
= (struct ospf
*) oipt
->owner
) == NULL
)
1965 zlog_warn ("ospf_opaque_type11_lsa_reoriginate_timer: Something wrong?");
1969 if (! CHECK_FLAG (top
->config
, OSPF_OPAQUE_CAPABLE
))
1971 if (IS_DEBUG_OSPF_EVENT
)
1972 zlog_debug ("Suspend re-origination of Type-11 Opaque-LSAs (opaque-type=%u) for a while...", oipt
->opaque_type
);
1974 oipt
->status
= PROC_SUSPEND
;
1979 if (IS_DEBUG_OSPF_EVENT
)
1980 zlog_debug ("Timer[Type11-LSA]: Re-originate Opaque-LSAs (opaque-type=%u).", oipt
->opaque_type
);
1982 rc
= (* functab
->lsa_originator
)(top
);
1988 ospf_opaque_lsa_refresh_schedule (struct ospf_lsa
*lsa0
)
1990 struct opaque_info_per_type
*oipt
;
1991 struct opaque_info_per_id
*oipi
;
1992 struct ospf_lsa
*lsa
;
1996 if ((oipt
= lookup_opaque_info_by_type (lsa0
)) == NULL
1997 || (oipi
= lookup_opaque_info_by_id (oipt
, lsa0
)) == NULL
)
1999 zlog_warn ("ospf_opaque_lsa_refresh_schedule: Invalid parameter?");
2003 /* Given "lsa0" and current "oipi->lsa" may different, but harmless. */
2004 if ((lsa
= oipi
->lsa
) == NULL
)
2006 zlog_warn ("ospf_opaque_lsa_refresh_schedule: Something wrong?");
2010 if (oipi
->t_opaque_lsa_self
!= NULL
)
2012 if (IS_DEBUG_OSPF_EVENT
)
2013 zlog_debug ("Type-%u Opaque-LSA has already scheduled to REFRESH: [opaque-type=%u, opaque-id=%x]", lsa
->data
->type
, GET_OPAQUE_TYPE (ntohl (lsa
->data
->id
.s_addr
)), GET_OPAQUE_ID (ntohl (lsa
->data
->id
.s_addr
)));
2017 /* Delete this lsa from neighbor retransmit-list. */
2018 switch (lsa
->data
->type
)
2020 case OSPF_OPAQUE_LINK_LSA
:
2021 case OSPF_OPAQUE_AREA_LSA
:
2022 ospf_ls_retransmit_delete_nbr_area (lsa
->area
, lsa
);
2024 case OSPF_OPAQUE_AS_LSA
:
2025 top
= ospf_lookup ();
2026 if ((lsa0
->area
!= NULL
) && (lsa0
->area
->ospf
!= NULL
))
2027 top
= lsa0
->area
->ospf
;
2028 ospf_ls_retransmit_delete_nbr_as (top
, lsa
);
2031 zlog_warn ("ospf_opaque_lsa_refresh_schedule: Unexpected LSA-type(%u)", lsa
->data
->type
);
2035 delay
= ospf_lsa_refresh_delay (lsa
);
2037 if (IS_DEBUG_OSPF_EVENT
)
2038 zlog_debug ("Schedule Type-%u Opaque-LSA to REFRESH in %d sec later: [opaque-type=%u, opaque-id=%x]", lsa
->data
->type
, delay
, GET_OPAQUE_TYPE (ntohl (lsa
->data
->id
.s_addr
)), GET_OPAQUE_ID (ntohl (lsa
->data
->id
.s_addr
)));
2040 OSPF_OPAQUE_TIMER_ON (oipi
->t_opaque_lsa_self
,
2041 ospf_opaque_lsa_refresh_timer
, oipi
, delay
* 1000);
2047 ospf_opaque_lsa_refresh_timer (struct thread
*t
)
2049 struct opaque_info_per_id
*oipi
;
2050 struct ospf_opaque_functab
*functab
;
2051 struct ospf_lsa
*lsa
;
2053 if (IS_DEBUG_OSPF_EVENT
)
2054 zlog_debug ("Timer[Opaque-LSA]: (Opaque-LSA Refresh expire)");
2056 oipi
= THREAD_ARG (t
);
2057 oipi
->t_opaque_lsa_self
= NULL
;
2059 if ((lsa
= oipi
->lsa
) != NULL
)
2060 if ((functab
= oipi
->opqctl_type
->functab
) != NULL
)
2061 if (functab
->lsa_refresher
!= NULL
)
2062 (* functab
->lsa_refresher
)(lsa
);
2068 ospf_opaque_lsa_flush_schedule (struct ospf_lsa
*lsa0
)
2070 struct opaque_info_per_type
*oipt
;
2071 struct opaque_info_per_id
*oipi
;
2072 struct ospf_lsa
*lsa
;
2075 top
= ospf_lookup ();
2077 if ((oipt
= lookup_opaque_info_by_type (lsa0
)) == NULL
2078 || (oipi
= lookup_opaque_info_by_id (oipt
, lsa0
)) == NULL
)
2080 zlog_warn ("ospf_opaque_lsa_flush_schedule: Invalid parameter?");
2084 /* Given "lsa0" and current "oipi->lsa" may different, but harmless. */
2085 if ((lsa
= oipi
->lsa
) == NULL
)
2087 zlog_warn ("ospf_opaque_lsa_flush_schedule: Something wrong?");
2091 /* Delete this lsa from neighbor retransmit-list. */
2092 switch (lsa
->data
->type
)
2094 case OSPF_OPAQUE_LINK_LSA
:
2095 case OSPF_OPAQUE_AREA_LSA
:
2096 ospf_ls_retransmit_delete_nbr_area (lsa
->area
, lsa
);
2098 case OSPF_OPAQUE_AS_LSA
:
2099 if ((lsa0
->area
!= NULL
) && (lsa0
->area
->ospf
!= NULL
))
2100 top
= lsa0
->area
->ospf
;
2101 ospf_ls_retransmit_delete_nbr_as (top
, lsa
);
2104 zlog_warn ("ospf_opaque_lsa_flush_schedule: Unexpected LSA-type(%u)", lsa
->data
->type
);
2108 /* Dequeue listnode entry from the list. */
2109 listnode_delete (oipt
->id_list
, oipi
);
2111 /* Avoid misjudgement in the next lookup. */
2112 if (listcount (oipt
->id_list
) == 0)
2113 oipt
->id_list
->head
= oipt
->id_list
->tail
= NULL
;
2115 /* Disassociate internal control information with the given lsa. */
2116 free_opaque_info_per_id ((void *) oipi
);
2118 /* Force given lsa's age to MaxAge. */
2119 lsa
->data
->ls_age
= htons (OSPF_LSA_MAXAGE
);
2121 if (IS_DEBUG_OSPF_EVENT
)
2122 zlog_debug ("Schedule Type-%u Opaque-LSA to FLUSH: [opaque-type=%u, opaque-id=%x]", lsa
->data
->type
, GET_OPAQUE_TYPE (ntohl (lsa
->data
->id
.s_addr
)), GET_OPAQUE_ID (ntohl (lsa
->data
->id
.s_addr
)));
2124 /* This lsa will be flushed and removed eventually. */
2125 ospf_lsa_flush (top
, lsa
);
2132 ospf_opaque_self_originated_lsa_received (struct ospf_neighbor
*nbr
,
2133 struct ospf_lsa
*lsa
)
2137 if ((top
= oi_to_top (nbr
->oi
)) == NULL
)
2141 * Since these LSA entries are not yet installed into corresponding
2142 * LSDB, just flush them without calling ospf_ls_maxage() afterward.
2144 lsa
->data
->ls_age
= htons (OSPF_LSA_MAXAGE
);
2145 switch (lsa
->data
->type
)
2147 case OSPF_OPAQUE_LINK_LSA
:
2148 ospf_flood_through_area (nbr
->oi
->area
, NULL
/*inbr*/, lsa
);
2150 case OSPF_OPAQUE_AREA_LSA
:
2151 ospf_flood_through_area (nbr
->oi
->area
, NULL
/*inbr*/, lsa
);
2153 case OSPF_OPAQUE_AS_LSA
:
2154 ospf_flood_through_as (top
, NULL
/*inbr*/, lsa
);
2157 zlog_warn ("ospf_opaque_self_originated_lsa_received: Unexpected LSA-type(%u)", lsa
->data
->type
);
2160 ospf_lsa_discard (lsa
); /* List "lsas" will be deleted by caller. */
2163 /*------------------------------------------------------------------------*
2164 * Followings are util functions; probably be used by Opaque-LSAs only...
2165 *------------------------------------------------------------------------*/
2168 oi_to_top (struct ospf_interface
*oi
)
2170 struct ospf
*top
= NULL
;
2171 struct ospf_area
*area
;
2173 if (oi
== NULL
|| (area
= oi
->area
) == NULL
|| (top
= area
->ospf
) == NULL
)
2174 zlog_warn ("Broken relationship for \"OI -> AREA -> OSPF\"?");