#include "command.h"
#include "stream.h"
#include "log.h"
+#include "zclient.h"
+#include "bfd.h"
#include "ospfd/ospfd.h"
#include "ospfd/ospf_spf.h"
#include "ospfd/ospf_snmp.h"
#endif /* HAVE_SNMP */
-\f
+
int
ospf_if_get_output_cost (struct ospf_interface *oi)
{
XFREE (MTYPE_OSPF_IF, oi);
}
-\f
+
/*
* check if interface with given address is configured and
* return it if yes. special treatment for PtP networks.
for (ALL_LIST_ELEMENTS (ospf->oiflist, node, nnode, oi))
if (oi->type != OSPF_IFTYPE_VIRTUALLINK)
{
- if (oi->type == OSPF_IFTYPE_POINTOPOINT)
+ if (CHECK_FLAG(oi->connected->flags, ZEBRA_IFA_UNNUMBERED))
+ {
+ if (htonl(oi->ifp->ifindex) == address->s_addr)
+ return oi;
+ }
+ else if (oi->type == OSPF_IFTYPE_POINTOPOINT)
{
/* special leniency: match if addr is anywhere on peer subnet */
if (prefix_match(CONNECTED_PREFIX(oi->connected),
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)
if (if_is_loopback (oi->ifp))
continue;
- if (prefix_match (CONNECTED_PREFIX(oi->connected),
- (struct prefix *) &addr))
+ if (CHECK_FLAG(oi->connected->flags, ZEBRA_IFA_UNNUMBERED))
+ match = oi;
+ else if (prefix_match (CONNECTED_PREFIX(oi->connected),
+ (struct prefix *) &addr))
{
if ( (match == NULL) ||
(match->address->prefixlen < oi->address->prefixlen)
return match;
}
-\f
+
void
ospf_if_stream_set (struct ospf_interface *oi)
{
}
}
-\f
+
static struct ospf_if_params *
ospf_new_if_params (void)
{
ospf_del_if_params (struct ospf_if_params *oip)
{
list_delete (oip->auth_crypt);
+ bfd_info_free(&(oip->bfd_info));
XFREE (MTYPE_OSPF_IF_PARAMS, oip);
}
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;
}
-\f
+
/* Virtual Link related functions. */
struct ospf_vl_data *
snprintf (ifname, sizeof(ifname), "VLINK%d", vlink_count);
vi = if_create (ifname, strnlen(ifname, sizeof(ifname)));
+ /*
+ * if_create sets ZEBRA_INTERFACE_LINKDETECTION
+ * virtual links don't need this.
+ */
+ UNSET_FLAG (vi->status, ZEBRA_INTERFACE_LINKDETECTION);
co = connected_new ();
co->ifp = vi;
listnode_add (vi->connected, co);
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;
return c;
}
-\f
+
struct crypt_key *
ospf_crypt_key_new ()
{
ospf_if_init ()
{
/* Initialize Zebra interface data structure. */
- if_init ();
- om->iflist = iflist;
+ om->iflist = vrf_iflist (VRF_DEFAULT);
if_add_hook (IF_NEW_HOOK, ospf_if_new_hook);
if_add_hook (IF_DELETE_HOOK, ospf_if_delete_hook);
}