You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.6 KiB

  1. From 153bdb3d03542530ed1deccbefc716cb4b699a67 Mon Sep 17 00:00:00 2001
  2. From: Donald Sharp <sharpd@nvidia.com>
  3. Date: Thu, 28 Jan 2021 14:56:11 -0500
  4. Subject: [PATCH] ospfd: ospf_nbr_nbma_lookup_next always returns NULL
  5. The calling function of ospf_nbr_nbma_lookup_next calls
  6. this function and then immediately returns when it
  7. gets the NULL. Just cleanup a bit more code.
  8. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
  9. ---
  10. ospfd/ospf_snmp.c | 23 +----------------------
  11. ospfd/ospfd.c | 9 ---------
  12. ospfd/ospfd.h | 2 --
  13. 3 files changed, 1 insertion(+), 33 deletions(-)
  14. --- a/ospfd/ospf_snmp.c
  15. +++ b/ospfd/ospf_snmp.c
  16. @@ -1236,7 +1236,6 @@ static struct ospf_nbr_nbma *ospfHostLoo
  17. size_t *length,
  18. struct in_addr *addr, int exact)
  19. {
  20. - int len;
  21. struct ospf_nbr_nbma *nbr_nbma;
  22. struct ospf *ospf;
  23. @@ -1258,28 +1257,8 @@ static struct ospf_nbr_nbma *ospfHostLoo
  24. nbr_nbma = ospf_nbr_nbma_lookup(ospf, *addr);
  25. return nbr_nbma;
  26. - } else {
  27. - len = *length - v->namelen;
  28. - if (len > 4)
  29. - len = 4;
  30. -
  31. - oid2in_addr(name + v->namelen, len, addr);
  32. -
  33. - nbr_nbma =
  34. - ospf_nbr_nbma_lookup_next(ospf, addr, len == 0 ? 1 : 0);
  35. -
  36. - if (nbr_nbma == NULL)
  37. - return NULL;
  38. -
  39. - oid_copy_addr(name + v->namelen, addr, IN_ADDR_SIZE);
  40. -
  41. - /* Set TOS 0. */
  42. - name[v->namelen + IN_ADDR_SIZE] = 0;
  43. -
  44. - *length = v->namelen + IN_ADDR_SIZE + 1;
  45. -
  46. - return nbr_nbma;
  47. }
  48. +
  49. return NULL;
  50. }
  51. --- a/ospfd/ospfd.c
  52. +++ b/ospfd/ospfd.c
  53. @@ -1932,35 +1932,6 @@ struct ospf_nbr_nbma *ospf_nbr_nbma_look
  54. return NULL;
  55. }
  56. -struct ospf_nbr_nbma *ospf_nbr_nbma_lookup_next(struct ospf *ospf,
  57. - struct in_addr *addr, int first)
  58. -{
  59. -#if 0
  60. - struct ospf_nbr_nbma *nbr_nbma;
  61. - struct listnode *node;
  62. -#endif
  63. -
  64. - if (ospf == NULL)
  65. - return NULL;
  66. -
  67. -#if 0
  68. - for (ALL_LIST_ELEMENTS_RO (ospf->nbr_nbma, node, nbr_nbma))
  69. - {
  70. - if (first)
  71. - {
  72. - *addr = nbr_nbma->addr;
  73. - return nbr_nbma;
  74. - }
  75. - else if (ntohl (nbr_nbma->addr.s_addr) > ntohl (addr->s_addr))
  76. - {
  77. - *addr = nbr_nbma->addr;
  78. - return nbr_nbma;
  79. - }
  80. - }
  81. -#endif
  82. - return NULL;
  83. -}
  84. -
  85. int ospf_nbr_nbma_set(struct ospf *ospf, struct in_addr nbr_addr)
  86. {
  87. struct ospf_nbr_nbma *nbr_nbma;
  88. --- a/ospfd/ospfd.h
  89. +++ b/ospfd/ospfd.h
  90. @@ -567,8 +567,6 @@ extern void ospf_terminate(void);
  91. extern void ospf_nbr_nbma_if_update(struct ospf *, struct ospf_interface *);
  92. extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup(struct ospf *,
  93. struct in_addr);
  94. -extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup_next(struct ospf *,
  95. - struct in_addr *, int);
  96. extern int ospf_oi_count(struct interface *);
  97. extern struct ospf_area *ospf_area_get(struct ospf *, struct in_addr);