--- embedaddon/quagga/ospfd/ospf_interface.c 2012/02/21 17:26:12 1.1.1.1 +++ embedaddon/quagga/ospfd/ospf_interface.c 2016/11/02 10:09:12 1.1.1.3 @@ -49,7 +49,7 @@ #include "ospfd/ospf_snmp.h" #endif /* HAVE_SNMP */ - + int ospf_if_get_output_cost (struct ospf_interface *oi) { @@ -241,9 +241,7 @@ ospf_if_new (struct ospf *ospf, struct interface *ifp, oi->crypt_seqnum = time (NULL); -#ifdef HAVE_OPAQUE_LSA ospf_opaque_type9_lsa_init (oi); -#endif /* HAVE_OPAQUE_LSA */ oi->ospf = ospf; @@ -295,9 +293,7 @@ ospf_if_cleanup (struct ospf_interface *oi) ospf_ls_upd_queue_empty (oi); /* Reset pseudo neighbor. */ - ospf_nbr_delete (oi->nbr_self); - oi->nbr_self = ospf_nbr_new (oi); - ospf_nbr_add_self (oi); + ospf_nbr_self_reset (oi); } void @@ -307,9 +303,7 @@ ospf_if_free (struct ospf_interface *oi) assert (oi->state == ISM_Down); -#ifdef HAVE_OPAQUE_LSA ospf_opaque_type9_lsa_term (oi); -#endif /* HAVE_OPAQUE_LSA */ /* Free Pseudo Neighbour */ ospf_nbr_delete (oi->nbr_self); @@ -334,7 +328,7 @@ ospf_if_free (struct ospf_interface *oi) XFREE (MTYPE_OSPF_IF, oi); } - + /* * check if interface with given address is configured and * return it if yes. special treatment for PtP networks. @@ -392,7 +386,22 @@ ospf_if_exists (struct ospf_interface *oic) return NULL; } +/* Lookup OSPF interface by router LSA posistion */ struct ospf_interface * +ospf_if_lookup_by_lsa_pos (struct ospf_area *area, int lsa_pos) +{ + struct listnode *node; + struct ospf_interface *oi; + + for (ALL_LIST_ELEMENTS_RO (area->oiflist, node, oi)) + { + if (lsa_pos >= oi->lsa_pos_beg && lsa_pos < oi->lsa_pos_end) + return oi; + } + return NULL; +} + +struct ospf_interface * ospf_if_lookup_by_local_addr (struct ospf *ospf, struct interface *ifp, struct in_addr address) { @@ -474,7 +483,7 @@ ospf_if_lookup_recv_if (struct ospf *ospf, struct in_a return match; } - + void ospf_if_stream_set (struct ospf_interface *oi) { @@ -503,7 +512,7 @@ ospf_if_stream_unset (struct ospf_interface *oi) } } - + static struct ospf_if_params * ospf_new_if_params (void) { @@ -673,9 +682,7 @@ ospf_if_new_hook (struct interface *ifp) SET_IF_PARAM (IF_DEF_PARAMS (ifp), auth_type); IF_DEF_PARAMS (ifp)->auth_type = OSPF_AUTH_NOTSET; -#ifdef HAVE_OPAQUE_LSA rc = ospf_opaque_new_if (ifp); -#endif /* HAVE_OPAQUE_LSA */ return rc; } @@ -684,9 +691,7 @@ ospf_if_delete_hook (struct interface *ifp) { int rc = 0; struct route_node *rn; -#ifdef HAVE_OPAQUE_LSA rc = ospf_opaque_del_if (ifp); -#endif /* HAVE_OPAQUE_LSA */ route_table_finish (IF_OIFS (ifp)); @@ -801,13 +806,16 @@ ospf_if_down (struct ospf_interface *oi) return 0; OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); + /* delete position in router LSA */ + oi->lsa_pos_beg = 0; + oi->lsa_pos_end = 0; /* Shutdown packet reception and sending */ ospf_if_stream_unset (oi); return 1; } - + /* Virtual Link related functions. */ struct ospf_vl_data * @@ -995,7 +1003,7 @@ ospf_vl_set_params (struct ospf_vl_data *vl_data, stru struct ospf_interface *voi; struct listnode *node; struct vertex_parent *vp = NULL; - int i; + unsigned int i; struct router_lsa *rl; voi = vl_data->vl_oi; @@ -1176,7 +1184,7 @@ ospf_vls_in_area (struct ospf_area *area) return c; } - + struct crypt_key * ospf_crypt_key_new () { @@ -1236,7 +1244,6 @@ void ospf_if_init () { /* Initialize Zebra interface data structure. */ - if_init (); om->iflist = iflist; if_add_hook (IF_NEW_HOOK, ospf_if_new_hook); if_add_hook (IF_DELETE_HOOK, ospf_if_delete_hook);