* Returns:
* Nothing
*/
-void ospf_gr_helper_init(struct ospf *ospf)
+void ospf_gr_helper_instance_init(struct ospf *ospf)
{
- int rc;
-
if (IS_DEBUG_OSPF_GR_HELPER)
zlog_debug("%s, GR Helper init.", __func__);
ospf->enable_rtr_list =
hash_create(ospf_enable_rtr_hash_key, ospf_enable_rtr_hash_cmp,
"OSPF enable router hash");
+}
+
+/*
+ * De-Initialize GR helper config data structures.
+ *
+ * OSPF
+ * OSPF pointer
+ *
+ * Returns:
+ * Nothing
+ */
+void ospf_gr_helper_instance_stop(struct ospf *ospf)
+{
+ if (IS_DEBUG_OSPF_GR_HELPER)
+ zlog_debug("%s, GR helper deinit.", __func__);
+
+ ospf_enable_rtr_hash_destroy(ospf);
+}
+
+/*
+ * Initialize GR helper config data structures.
+ *
+ * Returns:
+ * Nothing
+ */
+void ospf_gr_helper_init(void)
+{
+ int rc;
+
+ if (IS_DEBUG_OSPF_GR_HELPER)
+ zlog_debug("%s, GR Helper init.", __func__);
rc = ospf_register_opaque_functab(
OSPF_OPAQUE_LINK_LSA, OPAQUE_TYPE_GRACE_LSA, NULL, NULL, NULL,
/*
* De-Initialize GR helper config data structures.
*
- * OSPF
- * OSPF pointer
- *
* Returns:
* Nothing
*/
-void ospf_gr_helper_stop(struct ospf *ospf)
+void ospf_gr_helper_stop(void)
{
if (IS_DEBUG_OSPF_GR_HELPER)
zlog_debug("%s, GR helper deinit.", __func__);
- ospf_enable_rtr_hash_destroy(ospf);
-
ospf_delete_opaque_functab(OSPF_OPAQUE_LINK_LSA, OPAQUE_TYPE_GRACE_LSA);
}
lsah = (struct lsa_header *)lsa->data;
- length = ntohs(lsah->length);
-
/* Check LSA len */
- if (length <= OSPF_LSA_HEADER_SIZE) {
+ if (lsa->size <= OSPF_LSA_HEADER_SIZE) {
if (IS_DEBUG_OSPF_GR_HELPER)
zlog_debug("%s: Malformed packet: Invalid LSA len:%d",
__func__, length);
return OSPF_GR_FAILURE;
}
- length -= OSPF_LSA_HEADER_SIZE;
+ length = lsa->size - OSPF_LSA_HEADER_SIZE;
- for (tlvh = TLV_HDR_TOP(lsah); sum < length;
+ for (tlvh = TLV_HDR_TOP(lsah); sum < length && tlvh;
tlvh = TLV_HDR_NEXT(tlvh)) {
/* Check TLV len against overall LSA */
lsah = (struct lsa_header *)lsa->data;
- length = ntohs(lsah->length);
-
- if (length <= OSPF_LSA_HEADER_SIZE) {
+ if (lsa->size <= OSPF_LSA_HEADER_SIZE) {
vty_out(vty, "%% Invalid LSA length: %d\n", length);
return;
}
- length -= OSPF_LSA_HEADER_SIZE;
+ length = lsa->size - OSPF_LSA_HEADER_SIZE;
vty_out(vty, " TLV info:\n");
- for (tlvh = TLV_HDR_TOP(lsah); sum < length;
+ for (tlvh = TLV_HDR_TOP(lsah); sum < length && tlvh;
tlvh = TLV_HDR_NEXT(tlvh)) {
/* Check TLV len */
if (sum + TLV_SIZE(tlvh) > length) {