From 153bdb3d03542530ed1deccbefc716cb4b699a67 Mon Sep 17 00:00:00 2001
|
|
From: Donald Sharp <sharpd@nvidia.com>
|
|
Date: Thu, 28 Jan 2021 14:56:11 -0500
|
|
Subject: [PATCH] ospfd: ospf_nbr_nbma_lookup_next always returns NULL
|
|
|
|
The calling function of ospf_nbr_nbma_lookup_next calls
|
|
this function and then immediately returns when it
|
|
gets the NULL. Just cleanup a bit more code.
|
|
|
|
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
|
|
---
|
|
ospfd/ospf_snmp.c | 23 +----------------------
|
|
ospfd/ospfd.c | 9 ---------
|
|
ospfd/ospfd.h | 2 --
|
|
3 files changed, 1 insertion(+), 33 deletions(-)
|
|
|
|
--- a/ospfd/ospf_snmp.c
|
|
+++ b/ospfd/ospf_snmp.c
|
|
@@ -1236,7 +1236,6 @@ static struct ospf_nbr_nbma *ospfHostLoo
|
|
size_t *length,
|
|
struct in_addr *addr, int exact)
|
|
{
|
|
- int len;
|
|
struct ospf_nbr_nbma *nbr_nbma;
|
|
struct ospf *ospf;
|
|
|
|
@@ -1258,28 +1257,8 @@ static struct ospf_nbr_nbma *ospfHostLoo
|
|
nbr_nbma = ospf_nbr_nbma_lookup(ospf, *addr);
|
|
|
|
return nbr_nbma;
|
|
- } else {
|
|
- len = *length - v->namelen;
|
|
- if (len > 4)
|
|
- len = 4;
|
|
-
|
|
- oid2in_addr(name + v->namelen, len, addr);
|
|
-
|
|
- nbr_nbma =
|
|
- ospf_nbr_nbma_lookup_next(ospf, addr, len == 0 ? 1 : 0);
|
|
-
|
|
- if (nbr_nbma == NULL)
|
|
- return NULL;
|
|
-
|
|
- oid_copy_addr(name + v->namelen, addr, IN_ADDR_SIZE);
|
|
-
|
|
- /* Set TOS 0. */
|
|
- name[v->namelen + IN_ADDR_SIZE] = 0;
|
|
-
|
|
- *length = v->namelen + IN_ADDR_SIZE + 1;
|
|
-
|
|
- return nbr_nbma;
|
|
}
|
|
+
|
|
return NULL;
|
|
}
|
|
|
|
--- a/ospfd/ospfd.c
|
|
+++ b/ospfd/ospfd.c
|
|
@@ -1919,35 +1919,6 @@ struct ospf_nbr_nbma *ospf_nbr_nbma_look
|
|
return NULL;
|
|
}
|
|
|
|
-struct ospf_nbr_nbma *ospf_nbr_nbma_lookup_next(struct ospf *ospf,
|
|
- struct in_addr *addr, int first)
|
|
-{
|
|
-#if 0
|
|
- struct ospf_nbr_nbma *nbr_nbma;
|
|
- struct listnode *node;
|
|
-#endif
|
|
-
|
|
- if (ospf == NULL)
|
|
- return NULL;
|
|
-
|
|
-#if 0
|
|
- for (ALL_LIST_ELEMENTS_RO (ospf->nbr_nbma, node, nbr_nbma))
|
|
- {
|
|
- if (first)
|
|
- {
|
|
- *addr = nbr_nbma->addr;
|
|
- return nbr_nbma;
|
|
- }
|
|
- else if (ntohl (nbr_nbma->addr.s_addr) > ntohl (addr->s_addr))
|
|
- {
|
|
- *addr = nbr_nbma->addr;
|
|
- return nbr_nbma;
|
|
- }
|
|
- }
|
|
-#endif
|
|
- return NULL;
|
|
-}
|
|
-
|
|
int ospf_nbr_nbma_set(struct ospf *ospf, struct in_addr nbr_addr)
|
|
{
|
|
struct ospf_nbr_nbma *nbr_nbma;
|
|
--- a/ospfd/ospfd.h
|
|
+++ b/ospfd/ospfd.h
|
|
@@ -563,8 +563,6 @@ extern void ospf_terminate(void);
|
|
extern void ospf_nbr_nbma_if_update(struct ospf *, struct ospf_interface *);
|
|
extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup(struct ospf *,
|
|
struct in_addr);
|
|
-extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup_next(struct ospf *,
|
|
- struct in_addr *, int);
|
|
extern int ospf_oi_count(struct interface *);
|
|
|
|
extern struct ospf_area *ospf_area_get(struct ospf *, struct in_addr);
|