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.

69 lines
2.2 KiB

  1. From 34f6d0c67a48e2117c061f6ccdcf1f512982fe8f Mon Sep 17 00:00:00 2001
  2. From: Donald Sharp <sharpd@cumulusnetworks.com>
  3. Date: Tue, 2 Jun 2020 16:10:48 -0400
  4. Subject: [PATCH] bgpd: Actually find the sequence number for `bgp
  5. extcommunity-list...`
  6. The code in the bgp extcommunity-list function was using
  7. argv_find to get the correct idx. The problem was that
  8. we had already done argv_finds before and idx was non-zero
  9. thus having us always set the seq pointer to what was last
  10. looked up. This causes us to pass in a value to the
  11. underlying function and it would just wisely ignore it
  12. causing a seq number of 0.
  13. We would then write this seq number of 0 and then immediately
  14. reject it on read in again. BOO!
  15. Actually handle argv_find the way it was meant to be.
  16. Ticket:CM-29926
  17. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
  18. ---
  19. bgpd/bgp_vty.c | 12 ++++--------
  20. 1 file changed, 4 insertions(+), 8 deletions(-)
  21. diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
  22. index 3669205ee3..9c8f1e1def 100644
  23. --- a/bgpd/bgp_vty.c
  24. +++ b/bgpd/bgp_vty.c
  25. @@ -17617,8 +17617,7 @@ DEFUN (extcommunity_list_standard,
  26. argv_find(argv, argc, "WORD", &idx);
  27. cl_number_or_name = argv[idx]->arg;
  28. - argv_find(argv, argc, "(1-4294967295)", &idx);
  29. - if (idx)
  30. + if (argv_find(argv, argc, "(1-4294967295)", &idx))
  31. seq = argv[idx]->arg;
  32. direct = argv_find(argv, argc, "permit", &idx) ? COMMUNITY_PERMIT
  33. @@ -17663,8 +17662,7 @@ DEFUN (extcommunity_list_name_expanded,
  34. argv_find(argv, argc, "WORD", &idx);
  35. cl_number_or_name = argv[idx]->arg;
  36. - argv_find(argv, argc, "(1-4294967295)", &idx);
  37. - if (idx)
  38. + if (argv_find(argv, argc, "(1-4294967295)", &idx))
  39. seq = argv[idx]->arg;
  40. direct = argv_find(argv, argc, "permit", &idx) ? COMMUNITY_PERMIT
  41. @@ -17707,8 +17705,7 @@ DEFUN (no_extcommunity_list_standard_all,
  42. char *seq = NULL;
  43. int idx = 0;
  44. - argv_find(argv, argc, "(1-4294967295)", &idx);
  45. - if (idx)
  46. + if (argv_find(argv, argc, "(1-4294967295)", &idx))
  47. seq = argv[idx]->arg;
  48. idx = 0;
  49. @@ -17772,8 +17769,7 @@ DEFUN (no_extcommunity_list_expanded_all,
  50. char *seq = NULL;
  51. int idx = 0;
  52. - argv_find(argv, argc, "(1-4294967295)", &idx);
  53. - if (idx)
  54. + if (argv_find(argv, argc, "(1-4294967295)", &idx))
  55. seq = argv[idx]->arg;
  56. idx = 0;