diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2020-01-31 19:04:00 +0100 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2020-02-04 21:19:04 +0100 |
commit | 362353195a9df13776a1999113720542f1bd8a14 (patch) | |
tree | 8c403ef53cdfe43d17d8006046d2afeb97b814d4 /bgpd/bgp_vty.h | |
parent | bgpd: use _RO list iter variant for gr macro (diff) | |
download | frr-362353195a9df13776a1999113720542f1bd8a14.tar.xz frr-362353195a9df13776a1999113720542f1bd8a14.zip |
bgpd, lib: fix style from BGP GR code
This patch fixes the noncompliant style for the following commit range:
4a6e80fbf
2ba1fe695
efcb2ebbb
8c48b3b69
dc95985fe
0f0444fbd
85ef4179a
eb451ee58
2d3dd828d
9e3b51a7f
d6e3c15b6
34aa74486
6102cb7fe
d7b3cda6f
2bb5d39b1
5f9c1aa29
5cce3f054
3a75afa4b
f009ff269
cfd47646b
2986cac29
055679e91
034e185dc
794b37d52
b0965c44e
949b0f24f
63696f1d8
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_vty.h')
-rw-r--r-- | bgpd/bgp_vty.h | 137 |
1 files changed, 67 insertions, 70 deletions
diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h index 2e33ed59b..fa7b96d87 100644 --- a/bgpd/bgp_vty.h +++ b/bgpd/bgp_vty.h @@ -68,86 +68,83 @@ struct bgp; vty, p, use_json, json); \ } while (0) -#define VTY_BGP_GR_DEFINE_LOOP_VARIABLE \ - struct peer *peer_loop = NULL; \ - struct listnode *node = NULL; \ - struct listnode *nnode = NULL; \ - bool gr_router_detected = false - -#define VTY_BGP_GR_ROUTER_DETECT( \ - _bgp, _peer, _peer_list) \ - do { \ - if (_peer->bgp->t_startup) \ - bgp_peer_gr_flags_update(_peer); \ - for (ALL_LIST_ELEMENTS(_peer_list, \ - node, nnode, peer_loop)) { \ - if (CHECK_FLAG(peer_loop->flags,\ - PEER_FLAG_GRACEFUL_RESTART)) \ - gr_router_detected = true; \ - } \ +#define VTY_BGP_GR_DEFINE_LOOP_VARIABLE \ + struct peer *peer_loop = NULL; \ + struct listnode *node = NULL; \ + struct listnode *nnode = NULL; \ + bool gr_router_detected = false + +#define VTY_BGP_GR_ROUTER_DETECT(_bgp, _peer, _peer_list) \ + do { \ + if (_peer->bgp->t_startup) \ + bgp_peer_gr_flags_update(_peer); \ + for (ALL_LIST_ELEMENTS(_peer_list, node, nnode, peer_loop)) { \ + if (CHECK_FLAG(peer_loop->flags, \ + PEER_FLAG_GRACEFUL_RESTART)) \ + gr_router_detected = true; \ + } \ } while (0) -#define VTY_SEND_BGP_GR_CAPABILITY_TO_ZEBRA(_bgp, _ret) \ - do { \ - if (gr_router_detected && \ - _bgp->present_zebra_gr_state == ZEBRA_GR_DISABLE) { \ - if (bgp_zebra_send_capabilities(_bgp, false)) \ - _ret = BGP_ERR_INVALID_VALUE;\ - } else if (!gr_router_detected && \ - _bgp->present_zebra_gr_state == ZEBRA_GR_ENABLE) { \ - if (bgp_zebra_send_capabilities(_bgp, true)) \ - _ret = BGP_ERR_INVALID_VALUE;\ - } \ +#define VTY_SEND_BGP_GR_CAPABILITY_TO_ZEBRA(_bgp, _ret) \ + do { \ + if (gr_router_detected \ + && _bgp->present_zebra_gr_state == ZEBRA_GR_DISABLE) { \ + if (bgp_zebra_send_capabilities(_bgp, false)) \ + _ret = BGP_ERR_INVALID_VALUE; \ + } else if (!gr_router_detected \ + && _bgp->present_zebra_gr_state \ + == ZEBRA_GR_ENABLE) { \ + if (bgp_zebra_send_capabilities(_bgp, true)) \ + _ret = BGP_ERR_INVALID_VALUE; \ + } \ } while (0) -#define VTY_BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA( \ - _bgp, _peer_list, _ret) \ - do { \ - struct peer *peer_loop; \ - bool gr_router_detected = false; \ - struct listnode *node = {0}; \ - struct listnode *nnode = {0}; \ - for (ALL_LIST_ELEMENTS( \ - _peer_list, node, \ - nnode, peer_loop)) { \ - if (peer_loop->bgp->t_startup) \ - bgp_peer_gr_flags_update(peer_loop); \ - if (CHECK_FLAG( \ - peer_loop->flags, \ - PEER_FLAG_GRACEFUL_RESTART)) \ - gr_router_detected = true; \ - } \ - if (gr_router_detected && \ - _bgp->present_zebra_gr_state == ZEBRA_GR_DISABLE) { \ - if (bgp_zebra_send_capabilities(_bgp, false)) \ - _ret = BGP_ERR_INVALID_VALUE;\ - } else if (!gr_router_detected && \ - _bgp->present_zebra_gr_state == ZEBRA_GR_ENABLE) { \ - if (bgp_zebra_send_capabilities(_bgp, true)) \ - _ret = BGP_ERR_INVALID_VALUE;\ - } \ +#define VTY_BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA( \ + _bgp, _peer_list, _ret) \ + do { \ + struct peer *peer_loop; \ + bool gr_router_detected = false; \ + struct listnode *node = {0}; \ + struct listnode *nnode = {0}; \ + for (ALL_LIST_ELEMENTS(_peer_list, node, nnode, peer_loop)) { \ + if (peer_loop->bgp->t_startup) \ + bgp_peer_gr_flags_update(peer_loop); \ + if (CHECK_FLAG(peer_loop->flags, \ + PEER_FLAG_GRACEFUL_RESTART)) \ + gr_router_detected = true; \ + } \ + if (gr_router_detected \ + && _bgp->present_zebra_gr_state == ZEBRA_GR_DISABLE) { \ + if (bgp_zebra_send_capabilities(_bgp, false)) \ + _ret = BGP_ERR_INVALID_VALUE; \ + } else if (!gr_router_detected \ + && _bgp->present_zebra_gr_state \ + == ZEBRA_GR_ENABLE) { \ + if (bgp_zebra_send_capabilities(_bgp, true)) \ + _ret = BGP_ERR_INVALID_VALUE; \ + } \ } while (0) -#define PRINT_EOR(_eor_flag) \ - do { \ - if (eor_flag) \ - vty_out(vty, "Yes\n"); \ - else \ - vty_out(vty, "No\n"); \ +#define PRINT_EOR(_eor_flag) \ + do { \ + if (eor_flag) \ + vty_out(vty, "Yes\n"); \ + else \ + vty_out(vty, "No\n"); \ } while (0) -#define PRINT_EOR_JSON(_eor_flag) \ - do { \ - if (eor_flag) \ - json_object_boolean_true_add( \ - json_endofrib_status, \ - "endOfRibSentAfterUpdate"); \ - else \ - json_object_boolean_false_add( \ - json_endofrib_status, \ - "endOfRibSentAfterUpdate"); \ +#define PRINT_EOR_JSON(_eor_flag) \ + do { \ + if (eor_flag) \ + json_object_boolean_true_add( \ + json_endofrib_status, \ + "endOfRibSentAfterUpdate"); \ + else \ + json_object_boolean_false_add( \ + json_endofrib_status, \ + "endOfRibSentAfterUpdate"); \ } while (0) extern void bgp_vty_init(void); |