Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgpd:BGP Graceful Restart Per Neighbor(BGPN) Feature. #5210

Merged
merged 25 commits into from
Jan 28, 2020

Conversation

bisdhdh
Copy link
Member

@bisdhdh bisdhdh commented Oct 23, 2019

This PR contain the below sub-features and fixes in summary :

  1. BGP Graceful Restart per Neighbor Feature (BGPN).
  2. Selection Deferral Time Feature.
  3. Fix for certain open BGP GR feature bugs.
  4. Fix for End-of-Rib feature - Restarting node does not send EOR after the convergence. After a restarting router comes up and the bgp session is successfully established with the peer. If the restarting router does-not have any route to send, it send EOR to the peer immediately before receiving updates from its peers.
  5. Added hidden CLI command: bgp graceful-restart disable-eor. BGP disable EOR sending is a useful command for testing various scenarios of BGP graceful restart.
  6. Signalling from BGPD to ZEBRA to enable or disable GR feature in ZEBRA depending on bgp per peer gr configuration.
  7. CLI commands to update of rib-stale-time(running in Zebra)
    command : bgp graceful-restart rib-stale-time.
  8. While the Deferral timer is running, signal route update pending (ZEBRA_CLIENT_ROUTE_UPDATE_PENDING) from BGPD to Zebra.
  9. After expiry of the Deferral timer, the deferred routes are processed. When the deferred route_list becomes empty, End-of-Rib is send to the peer and route processing complete message (ZEBRA_CLIENT_ROUTE_UPDATE_COMPLETE) is sent to Zebra. So that Zebra would delete any stale routes still present in the rib.
  10. Documentation of all the above features including the cli commands to enable/disable the respective features is added to doc/user/bgp.rst

All the above code changes would be submitted in multiple patches.

I am also attaching documentation for the same : BGP Graceful Restart-FS for FRR .pdf

The BGP Graceful Restart-Test-Cases successfully executed attached :
BGP Graceful Restart-Test Cases_Succesfully-Executed.pdf

Signed-off-by: Biswajit Sadhu [email protected]

@polychaeta polychaeta added the bgp label Oct 23, 2019
@bisdhdh bisdhdh changed the title bgpd:BGP Graceful Restart Per Neighbor(BGPN), DS & header files. bgpd:BGP Graceful Restart Per Neighbor(BGPN) Feature. Oct 23, 2019
bgpd/bgp_debug.c Outdated Show resolved Hide resolved
bgpd/bgp_debug.c Outdated Show resolved Hide resolved
@LabN-CI

This comment has been minimized.

bgpd/bgpd.c Show resolved Hide resolved
bgpd/bgpd.c Outdated Show resolved Hide resolved
bgpd/bgpd.c Outdated Show resolved Hide resolved
bgpd/bgpd.h Outdated Show resolved Hide resolved
bgpd/bgpd.h Outdated Show resolved Hide resolved
Copy link
Member

@ton31337 ton31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you just iterate over the code and remove all not necessary lines, spaces and I left some very small notes :)

@bisdhdh bisdhdh force-pushed the master branch 2 times, most recently from 3a13f05 to 63146c8 Compare October 23, 2019 06:10
@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: FAILED

See below for issues.
CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Get source / Pull Request: Successful

Building Stage: Failed

CentOS 7 amd64 build: Failed (click for details)

Make failed for CentOS 7 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI005BUILD/ErrorLog/log_make.txt)

In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_advertise.c:36:
./bgpd/bgp_updgrp.h:77:1: error: expected =, ,, ;, asm or __attribute__ before typedef
 typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
 ^
./bgpd/bgp_updgrp.h:420:7: error: unknown type name bpacket_attr_vec_type
       bpacket_attr_vec_type type,
       ^
make[1]: *** [bgpd/bgp_advertise.o] Error 1

CentOS 7 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI005BUILD/config.status/config.status

Ubuntu 14.04 amd64 build: Failed (click for details)

Make failed for Ubuntu 14.04 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI001BUILD/ErrorLog/log_make.txt)

In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_advertise.c:36:
./bgpd/bgp_updgrp.h:77:1: error: expected =, ,, ;, asm or __attribute__ before typedef
 typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
 ^
./bgpd/bgp_updgrp.h:420:7: error: unknown type name bpacket_attr_vec_type
       bpacket_attr_vec_type type,
       ^
make[1]: *** [bgpd/bgp_advertise.o] Error 1

Ubuntu 14.04 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI001BUILD/config.status/config.status

Debian 8 amd64 build: Failed (click for details)

Make failed for Debian 8 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI008BLD/ErrorLog/log_make.txt)

In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_advertise.c:36:
./bgpd/bgp_updgrp.h:77:1: error: expected =, ,, ;, asm or __attribute__ before typedef
 typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
 ^
./bgpd/bgp_updgrp.h:420:7: error: unknown type name bpacket_attr_vec_type
       bpacket_attr_vec_type type,
       ^
Makefile:6938: recipe for target 'bgpd/bgp_advertise.o' failed

Debian 8 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI008BLD/config.status/config.status

Debian 10 amd64 build: Failed (click for details)

Make failed for Debian 10 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/DEB10BUILD/ErrorLog/log_make.txt)

  CC       lib/json.lo
  CC       lib/keychain.lo
  CC       lib/lib_errors.lo
  CC       lib/libfrr.lo
  CC       lib/linklist.lo
  CC       lib/log.lo
  CLIPPY   lib/log_vty_clippy.c
  CC       lib/log_vty.lo
  CC       lib/md5.lo

Debian 10 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/DEB10BUILD/config.status/config.status

FreeBSD 12 amd64 build: Failed (click for details)

Make failed for FreeBSD 12 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/FBSD12AMD64/ErrorLog/log_make.txt)

  CC       lib/json.lo
  CC       lib/keychain.lo
  CC       lib/lib_errors.lo
  CC       lib/libfrr.lo
  CC       lib/linklist.lo
  CC       lib/log.lo
  CLIPPY   lib/log_vty_clippy.c
  CC       lib/log_vty.lo
  CC       lib/md5.lo

FreeBSD 12 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/FBSD12AMD64/config.status/config.status

OpenBSD 6 amd64 build: Failed (click for details)

Make failed for OpenBSD 6 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI011BUILD/ErrorLog/log_make.txt)

  CC       lib/json.lo
  CC       lib/keychain.lo
  CC       lib/lib_errors.lo
  CC       lib/libfrr.lo
  CC       lib/linklist.lo
  CC       lib/log.lo
  CLIPPY   lib/log_vty_clippy.c
  CC       lib/log_vty.lo
  CC       lib/md5.lo

OpenBSD 6 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI011BUILD/config.status/config.status

NetBSD 7 amd64 build: Failed (click for details)

Make failed for NetBSD 7 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI012BUILD/ErrorLog/log_make.txt)

  CC       lib/json.lo
  CC       lib/keychain.lo
  CC       lib/lib_errors.lo
  CC       lib/libfrr.lo
  CC       lib/linklist.lo
  CC       lib/log.lo
  CLIPPY   lib/log_vty_clippy.c
  CC       lib/log_vty.lo
  CC       lib/md5.lo

NetBSD 7 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI012BUILD/config.status/config.status

Debian 9 amd64 build: Failed (click for details)

Make failed for Debian 9 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI021BUILD/ErrorLog/log_make.txt)

In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_advertise.c:36:
./bgpd/bgp_updgrp.h:77:1: error: expected =, ,, ;, asm or __attribute__ before typedef
 typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
 ^~~~~~~
./bgpd/bgp_updgrp.h:420:7: error: unknown type name bpacket_attr_vec_type
       bpacket_attr_vec_type type,
       ^~~~~~~~~~~~~~~~~~~~~
Makefile:6950: recipe for target 'bgpd/bgp_advertise.o' failed

Debian 9 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI021BUILD/config.status/config.status

FreeBSD 11 amd64 build: Failed (click for details)

Make failed for FreeBSD 11 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI009BUILD/ErrorLog/log_make.txt)

  CC       lib/json.lo
  CC       lib/keychain.lo
  CC       lib/lib_errors.lo
  CC       lib/libfrr.lo
  CC       lib/linklist.lo
  CC       lib/log.lo
  CLIPPY   lib/log_vty_clippy.c
  CC       lib/log_vty.lo
  CC       lib/md5.lo

FreeBSD 11 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI009BUILD/config.status/config.status

Ubuntu 16.04 amd64 build: Failed (click for details)

Make failed for Ubuntu 16.04 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI014BUILD/ErrorLog/log_make.txt)

In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_advertise.c:36:
./bgpd/bgp_updgrp.h:77:1: error: expected =, ,, ;, asm or __attribute__ before typedef
 typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
 ^
./bgpd/bgp_updgrp.h:420:7: error: unknown type name bpacket_attr_vec_type
       bpacket_attr_vec_type type,
       ^
Makefile:6950: recipe for target 'bgpd/bgp_advertise.o' failed

Ubuntu 16.04 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI014BUILD/config.status/config.status

NetBSD 6 amd64 build: Failed (click for details)

Make failed for NetBSD 6 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI007BUILD/ErrorLog/log_make.txt)

In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_advertise.c:36:
./bgpd/bgp_updgrp.h:77:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'
./bgpd/bgp_updgrp.h:420:7: error: expected declaration specifiers or '...' before 'bpacket_attr_vec_type'
gmake[1]: *** [Makefile:6949: bgpd/bgp_advertise.o] Error 1
  CC       bgpd/bgp_aspath.o
In file included from ./bgpd/bgp_attr.h:25:0,
                 from ./bgpd/bgp_debug.h:24,
                 from bgpd/bgp_aspath.c:36:

NetBSD 6 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI007BUILD/config.status/config.status

Ubuntu 18.04 amd64 build: Failed (click for details)

Make failed for Ubuntu 18.04 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/U1804AMD64/ErrorLog/log_make.txt)

In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_advertise.c:36:
./bgpd/bgp_updgrp.h:77:1: error: expected =, ,, ;, asm or __attribute__ before typedef
 typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
 ^~~~~~~
./bgpd/bgp_updgrp.h:420:7: error: unknown type name bpacket_attr_vec_type; did you mean bpacket_attr_vec_arr?
       bpacket_attr_vec_type type,
       ^~~~~~~~~~~~~~~~~~~~~
       bpacket_attr_vec_arr

Ubuntu 18.04 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/U1804AMD64/config.status/config.status

Ubuntu 18.04 ppc64le build: Failed (click for details)

Make failed for Ubuntu 18.04 ppc64le build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/U1804PPC64LEBUILD/ErrorLog/log_make.txt)

  CC       bgpd/bgp_ecommunity.o
  CC       bgpd/bgp_encap_tlv.o
  CC       bgpd/bgp_errors.o
  CC       bgpd/bgp_evpn.o
In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_evpn.c:45:
./bgpd/bgp_updgrp.h:77:1: error: expected =, ,, ;, asm or __attribute__ before typedef
 typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
 ^~~~~~~

Ubuntu 18.04 ppc64le build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/U1804PPC64LEBUILD/config.status/config.status
Ubuntu 18.04 ppc64le build: config.log output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/U1804PPC64LEBUILD/config.log/

Fedora 29 amd64 build: Failed (click for details)

Make failed for Fedora 29 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/F29BUILD/ErrorLog/log_make.txt)

  CC       lib/json.lo
  CC       lib/keychain.lo
  CC       lib/lib_errors.lo
  CC       lib/libfrr.lo
  CC       lib/linklist.lo
  CC       lib/log.lo
  CLIPPY   lib/log_vty_clippy.c
  CC       lib/log_vty.lo
  CC       lib/md5.lo

Fedora 29 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/F29BUILD/config.status/config.status

Ubuntu 16.04 i386 build: Failed (click for details)

Make failed for Ubuntu 16.04 i386 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/U1604I386/ErrorLog/log_make.txt)

In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_advertise.c:36:
./bgpd/bgp_updgrp.h:77:1: error: expected =, ,, ;, asm or __attribute__ before typedef
 typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
 ^
./bgpd/bgp_updgrp.h:420:7: error: unknown type name bpacket_attr_vec_type
       bpacket_attr_vec_type type,
       ^
Makefile:6950: recipe for target 'bgpd/bgp_advertise.o' failed

Ubuntu 16.04 i386 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/U1604I386/config.status/config.status

Successful on other platforms
  • Ubuntu 12.04 amd64 build

Warnings Generated during build:

Checkout code: Successful with additional warnings
CentOS 7 amd64 build: Failed (click for details)

Make failed for CentOS 7 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI005BUILD/ErrorLog/log_make.txt)

In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_advertise.c:36:
./bgpd/bgp_updgrp.h:77:1: error: expected =, ,, ;, asm or __attribute__ before typedef
 typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
 ^
./bgpd/bgp_updgrp.h:420:7: error: unknown type name bpacket_attr_vec_type
       bpacket_attr_vec_type type,
       ^
make[1]: *** [bgpd/bgp_advertise.o] Error 1

CentOS 7 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI005BUILD/config.status/config.status

Ubuntu 14.04 amd64 build: Failed (click for details)

Make failed for Ubuntu 14.04 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI001BUILD/ErrorLog/log_make.txt)

In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_advertise.c:36:
./bgpd/bgp_updgrp.h:77:1: error: expected =, ,, ;, asm or __attribute__ before typedef
 typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
 ^
./bgpd/bgp_updgrp.h:420:7: error: unknown type name bpacket_attr_vec_type
       bpacket_attr_vec_type type,
       ^
make[1]: *** [bgpd/bgp_advertise.o] Error 1

Ubuntu 14.04 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI001BUILD/config.status/config.status

Debian 8 amd64 build: Failed (click for details)

Make failed for Debian 8 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI008BLD/ErrorLog/log_make.txt)

In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_advertise.c:36:
./bgpd/bgp_updgrp.h:77:1: error: expected =, ,, ;, asm or __attribute__ before typedef
 typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
 ^
./bgpd/bgp_updgrp.h:420:7: error: unknown type name bpacket_attr_vec_type
       bpacket_attr_vec_type type,
       ^
Makefile:6938: recipe for target 'bgpd/bgp_advertise.o' failed

Debian 8 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI008BLD/config.status/config.status

Debian 10 amd64 build: Failed (click for details)

Make failed for Debian 10 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/DEB10BUILD/ErrorLog/log_make.txt)

  CC       lib/json.lo
  CC       lib/keychain.lo
  CC       lib/lib_errors.lo
  CC       lib/libfrr.lo
  CC       lib/linklist.lo
  CC       lib/log.lo
  CLIPPY   lib/log_vty_clippy.c
  CC       lib/log_vty.lo
  CC       lib/md5.lo

Debian 10 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/DEB10BUILD/config.status/config.status

FreeBSD 12 amd64 build: Failed (click for details)

Make failed for FreeBSD 12 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/FBSD12AMD64/ErrorLog/log_make.txt)

  CC       lib/json.lo
  CC       lib/keychain.lo
  CC       lib/lib_errors.lo
  CC       lib/libfrr.lo
  CC       lib/linklist.lo
  CC       lib/log.lo
  CLIPPY   lib/log_vty_clippy.c
  CC       lib/log_vty.lo
  CC       lib/md5.lo

FreeBSD 12 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/FBSD12AMD64/config.status/config.status

OpenBSD 6 amd64 build: Failed (click for details)

Make failed for OpenBSD 6 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI011BUILD/ErrorLog/log_make.txt)

  CC       lib/json.lo
  CC       lib/keychain.lo
  CC       lib/lib_errors.lo
  CC       lib/libfrr.lo
  CC       lib/linklist.lo
  CC       lib/log.lo
  CLIPPY   lib/log_vty_clippy.c
  CC       lib/log_vty.lo
  CC       lib/md5.lo

OpenBSD 6 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI011BUILD/config.status/config.status

NetBSD 7 amd64 build: Failed (click for details)

Make failed for NetBSD 7 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI012BUILD/ErrorLog/log_make.txt)

  CC       lib/json.lo
  CC       lib/keychain.lo
  CC       lib/lib_errors.lo
  CC       lib/libfrr.lo
  CC       lib/linklist.lo
  CC       lib/log.lo
  CLIPPY   lib/log_vty_clippy.c
  CC       lib/log_vty.lo
  CC       lib/md5.lo

NetBSD 7 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI012BUILD/config.status/config.status

Debian 9 amd64 build: Failed (click for details)

Make failed for Debian 9 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI021BUILD/ErrorLog/log_make.txt)

In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_advertise.c:36:
./bgpd/bgp_updgrp.h:77:1: error: expected =, ,, ;, asm or __attribute__ before typedef
 typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
 ^~~~~~~
./bgpd/bgp_updgrp.h:420:7: error: unknown type name bpacket_attr_vec_type
       bpacket_attr_vec_type type,
       ^~~~~~~~~~~~~~~~~~~~~
Makefile:6950: recipe for target 'bgpd/bgp_advertise.o' failed

Debian 9 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI021BUILD/config.status/config.status

FreeBSD 11 amd64 build: Failed (click for details)

Make failed for FreeBSD 11 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI009BUILD/ErrorLog/log_make.txt)

  CC       lib/json.lo
  CC       lib/keychain.lo
  CC       lib/lib_errors.lo
  CC       lib/libfrr.lo
  CC       lib/linklist.lo
  CC       lib/log.lo
  CLIPPY   lib/log_vty_clippy.c
  CC       lib/log_vty.lo
  CC       lib/md5.lo

FreeBSD 11 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI009BUILD/config.status/config.status

Ubuntu 16.04 amd64 build: Failed (click for details)

Make failed for Ubuntu 16.04 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI014BUILD/ErrorLog/log_make.txt)

In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_advertise.c:36:
./bgpd/bgp_updgrp.h:77:1: error: expected =, ,, ;, asm or __attribute__ before typedef
 typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
 ^
./bgpd/bgp_updgrp.h:420:7: error: unknown type name bpacket_attr_vec_type
       bpacket_attr_vec_type type,
       ^
Makefile:6950: recipe for target 'bgpd/bgp_advertise.o' failed

Ubuntu 16.04 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI014BUILD/config.status/config.status

NetBSD 6 amd64 build: Failed (click for details)

Make failed for NetBSD 6 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI007BUILD/ErrorLog/log_make.txt)

In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_advertise.c:36:
./bgpd/bgp_updgrp.h:77:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'
./bgpd/bgp_updgrp.h:420:7: error: expected declaration specifiers or '...' before 'bpacket_attr_vec_type'
gmake[1]: *** [Makefile:6949: bgpd/bgp_advertise.o] Error 1
  CC       bgpd/bgp_aspath.o
In file included from ./bgpd/bgp_attr.h:25:0,
                 from ./bgpd/bgp_debug.h:24,
                 from bgpd/bgp_aspath.c:36:

NetBSD 6 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/CI007BUILD/config.status/config.status

Ubuntu 18.04 amd64 build: Failed (click for details)

Make failed for Ubuntu 18.04 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/U1804AMD64/ErrorLog/log_make.txt)

In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_advertise.c:36:
./bgpd/bgp_updgrp.h:77:1: error: expected =, ,, ;, asm or __attribute__ before typedef
 typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
 ^~~~~~~
./bgpd/bgp_updgrp.h:420:7: error: unknown type name bpacket_attr_vec_type; did you mean bpacket_attr_vec_arr?
       bpacket_attr_vec_type type,
       ^~~~~~~~~~~~~~~~~~~~~
       bpacket_attr_vec_arr

Ubuntu 18.04 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/U1804AMD64/config.status/config.status

Ubuntu 18.04 ppc64le build: Failed (click for details)

Make failed for Ubuntu 18.04 ppc64le build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/U1804PPC64LEBUILD/ErrorLog/log_make.txt)

  CC       bgpd/bgp_ecommunity.o
  CC       bgpd/bgp_encap_tlv.o
  CC       bgpd/bgp_errors.o
  CC       bgpd/bgp_evpn.o
In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_evpn.c:45:
./bgpd/bgp_updgrp.h:77:1: error: expected =, ,, ;, asm or __attribute__ before typedef
 typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
 ^~~~~~~

Ubuntu 18.04 ppc64le build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/U1804PPC64LEBUILD/config.status/config.status
Ubuntu 18.04 ppc64le build: config.log output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/U1804PPC64LEBUILD/config.log/

Fedora 29 amd64 build: Failed (click for details)

Make failed for Fedora 29 amd64 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/F29BUILD/ErrorLog/log_make.txt)

  CC       lib/json.lo
  CC       lib/keychain.lo
  CC       lib/lib_errors.lo
  CC       lib/libfrr.lo
  CC       lib/linklist.lo
  CC       lib/log.lo
  CLIPPY   lib/log_vty_clippy.c
  CC       lib/log_vty.lo
  CC       lib/md5.lo

Fedora 29 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/F29BUILD/config.status/config.status

Ubuntu 16.04 i386 build: Failed (click for details)

Make failed for Ubuntu 16.04 i386 build:
(see full Make log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/U1604I386/ErrorLog/log_make.txt)

In file included from ./bgpd/bgp_debug.h:25:0,
                 from bgpd/bgp_advertise.c:36:
./bgpd/bgp_updgrp.h:77:1: error: expected =, ,, ;, asm or __attribute__ before typedef
 typedef enum { BGP_ATTR_VEC_NH = 0, BGP_ATTR_VEC_MAX } bpacket_attr_vec_type;
 ^
./bgpd/bgp_updgrp.h:420:7: error: unknown type name bpacket_attr_vec_type
       bpacket_attr_vec_type type,
       ^
Makefile:6950: recipe for target 'bgpd/bgp_advertise.o' failed

Ubuntu 16.04 i386 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9377/artifact/U1604I386/config.status/config.status

Report for bgp_debug.h | 2 issues
===============================================
< WARNING: Block comments should align the * on each line
< #2: FILE: /tmp/f1-30085/bgp_debug.h:2:

@bisdhdh bisdhdh force-pushed the master branch 2 times, most recently from 26dd0d3 to a1768c0 Compare October 23, 2019 06:26
@LabN-CI

This comment has been minimized.

@LabN-CI

This comment has been minimized.

@bisdhdh
Copy link
Member Author

bisdhdh commented Oct 23, 2019

could you just iterate over the code and remove all not necessary lines, spaces and I left some very small notes :)

Few new line got appended due to manual merging of the code. I had cleaned up, so it should be ok now.

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9373/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.


CLANG Static Analyzer Summary

  • Github Pull Request 5210, comparing to Git base SHA 3e6fd94

No Changes in Static Analysis warnings compared to base

1 Static Analyzer issues remaining.

See details at
https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9373/artifact/shared/static_analysis/index.html

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9374/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.


CLANG Static Analyzer Summary

  • Github Pull Request 5210, comparing to Git base SHA 3e6fd94

New warnings:

Static Analysis warning summary compared to base:

  • Fixed warnings: 0
  • New warnings: 2

3 Static Analyzer issues remaining.

See details at
https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9374/artifact/shared/static_analysis/index.html

@LabN-CI

This comment has been minimized.

@LabN-CI

This comment has been minimized.

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9378/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.


CLANG Static Analyzer Summary

  • Github Pull Request 5210, comparing to Git base SHA 3e6fd94

New warnings:

Static Analysis warning summary compared to base:

  • Fixed warnings: 0
  • New warnings: 2

3 Static Analyzer issues remaining.

See details at
https://ci1.netdef.org/browse/FRR-FRRPULLREQ-9378/artifact/shared/static_analysis/index.html

 * Added FSM for peer and global configuration for graceful restart
 * Added debug option BGP_GRACEFUL_RESTART for logs specific to
 graceful restart processing

Signed-off-by: Biswajit Sadhu <[email protected]>
* Changes to the capability sending function to advertise
graceful restart capability in the bgp OPEN message.

Signed-off-by: Biswajit Sadhu <[email protected]>
* Added configuration commands for enabling and disabling graceful restart
per neighbour.
Cmd : neighbor A.B.C.D graceful-restart
Cmd : no neighbor A.B.C.D graceful-restart
Cmd : neighbor A.B.C.D graceful-restart-helper
Cmd : no neighbor A.B.C.D graceful-restart-helper
Cmd : neighbor A.B.C.D graceful-restart-disable
Cmd : no neighbor A.B.C.D graceful-restart-disable
* Added configuration commands for disabling graceful restart at the global
Level.
Cmd : bgp graceful-restart disable
Cmd : no  bgp graceful-restart disable

Signed-off-by: Biswajit Sadhu <[email protected]>
* Added new show command to show the graceful restart
information for each neighbor.
Cmd: show bgp [<ipv4|ipv6>] neighbors [<A.B.C.D|X:X::X:X|WORD>] graceful-restart
* Changes to show neighbors commands for displaying
graceful restart information.
Cmd :show [ip] bgp [<view|vrf> VIEWVRFNAME] [<ipv4|ipv6>] neighbors [<A.B.C.D|X:X::X:X|

Signed-off-by: Biswajit Sadhu <[email protected]>
and DS.

* Added config commands and data structures for deferral timer
configuration and processing.
Cmd : bgp graceful-restart select-defer-time (0-3600)
Cmd : no bgp graceful-restart select-defertime (0-3600)

Signed-off-by: Biswajit Sadhu <[email protected]>
Signed-off-by: Soman K S <[email protected]>
* Selection Deferral Timer for Graceful Restart.
* Added selection deferral timer handling function.
* Route marking as selection defer when update message is received.
* Staggered processing of routes which are pending best selection.
* Fix for multi-path test case.

Signed-off-by: Biswajit Sadhu <[email protected]>
* BGP GR Neighbour mode in show command would show as
“NotApplicable”, when local mode is “Disable”. As the bgp
gr neighbour capability was not processed, since the local mode
is “Disable”.
* Minor changes in show Selection Deferral Time.

Signed-off-by: Biswajit Sadhu <[email protected]>
…eceived.

* Changing GR mode on a router needs a session reset from the
SAME router to negotiate new GR capability.
* The present GR implementation needs a session reset after every
new BGP GR mode change.
* When BGP session reset happens due to sending or receiving BGP
notification after changing BGP GR mode, there is no need of
explicit session reset.

Signed-off-by: Biswajit Sadhu <[email protected]>
& GR is enabled.

When GR with deferral is enabled and connected routes are
distributed then in one race condition route node gets added
in to both deferred queue and work queue. If deferred queue
gets processed first then it ends up delete only flag while
leaving the entry in the work queue as it is. When a new update
comes for the same route node next time from peer then it hits
assert. Assert check is added to ensure we don’t add to work queue
again while it is already present.
So, check before adding in to deferred queue if it is already present
in work queue and bail if so.

Signed-off-by: Biswajit Sadhu <[email protected]>
… “Disable”.

BGP GR Neighbor mode is showing the default string as “NotRecieved”,
as the bgp gr neighbour capability was not processed,
since the local mode is “Disable”.
However now it would be changed to  “NotApplicable”.

Signed-off-by: Biswajit Sadhu <[email protected]>
…rred

bgp tcp connection.

When the BGP peer is configured between two bgp routes  both routers would create
peer structure , when they receive each other’s open message. In this event both
speakers, open duplicate TCP sessions and send OPEN messages on each socket
simultaneously, the BGP Identifier is used to resolve which socket should be closed.
If BGP GR is enabled the old tcp session is dumped and the new session is retained.
So while this transfer of connection is happening, if all the bgp gr config
is not migrated to the new connection, the new bgp gr mode will never get applied.
Fix Summary:
1.  Replicate GR configuration from the old session to the new session in bgp_accept().
2.  Replicate GR configuration from stub to full-fledged peer in bgp_establish().
3.  Disable all NSF flags, clear stale routes (if present), stop  restart & stale timers
    (if they are running) when the bgp GR mode is changed to “Disabled”.
4.  Disable R-bit in cap, if it is not set the received open message.

Signed-off-by: Biswajit Sadhu <[email protected]>
… reload.

BGP Helper node doesn't set R-bit in OPEN message after the
restart or reload of the BGP router.

Signed-off-by: Biswajit Sadhu <[email protected]>
When the peer router's gr mode had changed from helper/restart
to disable. The local bgp gr router should reset the peer
router's restart-time stored.

Signed-off-by: Biswajit Sadhu <[email protected]>
BGP disable EOR sending is a useful command for testing various
scenarios of BGP graceful restart.
* Added the hidden CLI command :  bgp graceful-restart disable-eor
* The CLI will not be displayed in "show running-config" and will not
  be stored in configuration file.
* When enabled, EOR will not be sent to peer

Signed-off-by: Biswajit Sadhu <[email protected]>
Signed-off-by: Soman K S <[email protected]>
*After a restarting router comes up and the bgp session is
successfully established with the peer. If the restarting
router doesn’t have any route to send, it send EOR to
the peer immediately before receiving updates from its peers.
*Instead the restarting router should send EOR, if the
selection deferral timer is not running OR count of eor received
and eor required are matches then send EOR.

Signed-off-by: Biswajit Sadhu <[email protected]>
Data Structures, function declaration and Macros forSignalling
from BGPD to ZEBRA to enable or disable GR feature in ZEBRA
depending on bgp per peer gr configuration.

Signed-off-by: Biswajit Sadhu <[email protected]>
These changes are for Zebra lib in order to supportGraceful Restart
feature. These changes are addedtemporarily, until Zebra Graceful
Restart lib Pr is merged.

Signed-off-by: Biswajit Sadhu <[email protected]>
Signed-off-by: Soman K S <[email protected]>
*Adding helper function for signalling from BGPD to ZEBRA to
enable or disable GR feature in ZEBRA depending on bgp per
peer gr configuration.

Signed-off-by: Biswajit Sadhu <[email protected]>
*Adding helper caller hooks function for signalling from BGPD
to ZEBRA to enable or disable GR feature in ZEBRA depending
on bgp per peer gr configuration.

Signed-off-by: Biswajit Sadhu <[email protected]>
* Added CLI commands to update rib-stale-time, running in
Cmd : "bgp gaceful-restart rib-stale-time (1-3000)".
Cmd : "no bgp gaceful-restart rib-stale-time".
* Integrating the hooks function for signalling from BGPD
to ZEBRA to ZEBRA to enable or disable GR feature in ZEBRA
depending on bgp per peer gr configuration.

Signed-off-by: Biswajit Sadhu <[email protected]>
…BGPD to Zebra.

* While the Deferral timer is running, signal route update pending
(ZEBRA_CLIENT_ROUTE_UPDATE_PENDING) from BGPD to Zebra.
* After expiry of the Deferral timer, the deferred routes are processed.
When the deferred route_list becomes empty, End-of-Rib is send to the
peer and route processing complete message (ZEBRA_CLIENT_ROUTE_UPDATE_COMPLETE)
is sent to Zebra. So that Zebra would delete any stale routes still
present in the rib.

Signed-off-by: Biswajit Sadhu <[email protected]>
This change list contains the documentation of BGP Greacful Restart
feature and all the commnads to enable/disable the feature

Signed-off-by: Biswajit Sadhu <[email protected]>
Reorganizing bgp gr debug logs and code review comments.

Signed-off-by: Biswajit Sadhu <[email protected]>
bgp graceful restart additional debug logs, resolved
merge conflicts.

Signed-off-by: Biswajit Sadhu <[email protected]>
Copy link

@polychaeta polychaeta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution to FRR!

  • One of your commits does not have a blank line between the summary and body; this will break git log --oneline
Click for style suggestions

To apply these suggestions:

curl -s https://gist.githubusercontent.com/polychaeta/4bd5fbb652d995437b0a33c057ec6298/raw/462573b6f478261ac78e6df7684356b8529ca261/cr_5210_1579753124.diff | git apply

diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index 498a871ce..39f852bb4 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -1646,12 +1646,8 @@ DEFUN (debug_bgp_zebra,
 	return CMD_SUCCESS;
 }
 
-DEFUN (debug_bgp_graceful_restart,
-       debug_bgp_graceful_restart_cmd,
-       "debug bgp graceful-restart",
-       DEBUG_STR
-       BGP_STR
-       GR_DEBUG)
+DEFUN(debug_bgp_graceful_restart, debug_bgp_graceful_restart_cmd,
+      "debug bgp graceful-restart", DEBUG_STR BGP_STR GR_DEBUG)
 {
 	if (vty->node == CONFIG_NODE) {
 		DEBUG_ON(graceful_restart, GRACEFUL_RESTART);
@@ -1721,13 +1717,8 @@ DEFUN (no_debug_bgp_zebra,
 	return CMD_SUCCESS;
 }
 
-DEFUN (no_debug_bgp_graceful_restart,
-	no_debug_bgp_graceful_restart_cmd,
-	"no debug bgp graceful-restart",
-	DEBUG_STR
-	BGP_STR
-	GR_DEBUG
-	NO_STR)
+DEFUN(no_debug_bgp_graceful_restart, no_debug_bgp_graceful_restart_cmd,
+      "no debug bgp graceful-restart", DEBUG_STR BGP_STR GR_DEBUG NO_STR)
 {
 	if (vty->node == CONFIG_NODE) {
 		DEBUG_OFF(graceful_restart, GRACEFUL_RESTART);
@@ -2132,11 +2123,10 @@ DEFUN_NOSH (show_debugging_bgp,
 
 	if (BGP_DEBUG(zebra, ZEBRA))
 		bgp_debug_list_print(vty, "  BGP zebra debugging is on",
-					bgp_debug_zebra_prefixes);
+				     bgp_debug_zebra_prefixes);
 
 	if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
-		vty_out(vty,
-			"  BGP graceful-restart debugging is on");
+		vty_out(vty, "  BGP graceful-restart debugging is on");
 
 	if (BGP_DEBUG(allow_martians, ALLOW_MARTIANS))
 		vty_out(vty, "  BGP allow martian next hop debugging is on\n");
diff --git a/bgpd/bgp_debug.h b/bgpd/bgp_debug.h
index 1e6482e96..dc3e8a1ce 100644
--- a/bgpd/bgp_debug.h
+++ b/bgpd/bgp_debug.h
@@ -133,7 +133,7 @@ struct bgp_debug_filter {
 #define BGP_DEBUG_PACKET_SEND         0x01
 #define BGP_DEBUG_PACKET_SEND_DETAIL  0x02
 
-#define BGP_DEBUG_GRACEFUL_RESTART     0x01
+#define BGP_DEBUG_GRACEFUL_RESTART 0x01
 
 #define CONF_DEBUG_ON(a, b)	(conf_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
 #define CONF_DEBUG_OFF(a, b)	(conf_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index c5b46487a..e7a6c9e5b 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -58,8 +58,7 @@
 
 DEFINE_HOOK(peer_backward_transition, (struct peer * peer), (peer))
 DEFINE_HOOK(peer_status_changed, (struct peer * peer), (peer))
-extern const char *get_afi_safi_str(afi_t afi,
-			safi_t safi, bool for_json);
+extern const char *get_afi_safi_str(afi_t afi, safi_t safi, bool for_json);
 /* Definition of display strings corresponding to FSM events. This should be
  * kept consistent with the events defined in bgpd.h
  */
@@ -255,16 +254,14 @@ static struct peer *peer_xfer_conn(struct peer *from_peer)
 	peer->peer_gr_new_status_flag = from_peer->peer_gr_new_status_flag;
 	bgp_peer_gr_flags_update(peer);
 
-	BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(
-			peer->bgp,
-			peer->bgp->peer);
+	BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(peer->bgp,
+							  peer->bgp->peer);
 
 	if (bgp_peer_gr_mode_get(peer) == PEER_DISABLE) {
 
 		UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_MODE);
 
-		if (CHECK_FLAG(peer->sflags,
-					PEER_STATUS_NSF_WAIT)) {
+		if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)) {
 			peer_nsf_stop(peer);
 		}
 	}
@@ -646,8 +643,9 @@ static int bgp_graceful_deferral_timer_expire(struct thread *thread)
 	bgp = info->bgp;
 
 	if (BGP_DEBUG(update, UPDATE_OUT))
-		zlog_debug("afi %d, safi %d : graceful restart deferral timer expired",
-				afi, safi);
+		zlog_debug(
+			"afi %d, safi %d : graceful restart deferral timer expired",
+			afi, safi);
 
 	bgp->gr_info[afi][safi].t_select_deferral = NULL;
 
@@ -1198,26 +1196,26 @@ int bgp_stop(struct peer *peer)
 		 */
 		if (BGP_PEER_GRACEFUL_RESTART_CAPABLE(peer)) {
 			FOREACH_AFI_SAFI (afi, safi) {
-				if (peer->afc_nego[afi][safi] &&
-				    !CHECK_FLAG(peer->af_sflags[afi][safi],
-						PEER_STATUS_EOR_RECEIVED)) {
+				if (peer->afc_nego[afi][safi]
+				    && !CHECK_FLAG(peer->af_sflags[afi][safi],
+						   PEER_STATUS_EOR_RECEIVED)) {
 					gr_info = &bgp->gr_info[afi][safi];
 
 					if (gr_info && (gr_info->eor_required))
 						gr_info->eor_required--;
 
-					if (gr_info && BGP_DEBUG(update,
-						UPDATE_OUT))
+					if (gr_info
+					    && BGP_DEBUG(update, UPDATE_OUT))
 						zlog_debug(
 							"peer %s, EOR_required %d",
 							peer->host,
 							gr_info->eor_required);
 
 					/* There is no pending EOR message */
-					if (gr_info && gr_info->eor_required
-							== 0) {
+					if (gr_info
+					    && gr_info->eor_required == 0) {
 						BGP_TIMER_OFF(
-						gr_info->t_select_deferral);
+							gr_info->t_select_deferral);
 						gr_info->eor_received = 0;
 					}
 				}
@@ -1622,8 +1620,8 @@ static int bgp_reconnect(struct peer *peer)
 		return -1;
 
 	/* Send graceful restart capabilty */
-	BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(
-			peer->bgp, peer->bgp->peer);
+	BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(peer->bgp,
+							  peer->bgp->peer);
 
 	bgp_start(peer);
 	return 0;
@@ -1662,7 +1660,7 @@ static int bgp_fsm_holdtime_expire(struct peer *peer)
 
 /* Start the selection deferral timer thread for the specified AFI, SAFI */
 static int bgp_start_deferral_timer(struct bgp *bgp, afi_t afi, safi_t safi,
-		struct graceful_restart_info *gr_info)
+				    struct graceful_restart_info *gr_info)
 {
 	struct afi_safi_info *thread_info;
 
@@ -1680,7 +1678,7 @@ static int bgp_start_deferral_timer(struct bgp *bgp, afi_t afi, safi_t safi,
 		if (thread_info == NULL) {
 			if (BGP_DEBUG(update, UPDATE_OUT))
 				zlog_debug("%s : Error allocating thread info",
-						__func__);
+					   __func__);
 			return -1;
 		}
 
@@ -1688,13 +1686,13 @@ static int bgp_start_deferral_timer(struct bgp *bgp, afi_t afi, safi_t safi,
 		thread_info->safi = safi;
 		thread_info->bgp = bgp;
 
-		thread_add_timer(bm->master,
-				bgp_graceful_deferral_timer_expire,
-				thread_info, bgp->select_defer_time,
-				&gr_info->t_select_deferral);
+		thread_add_timer(bm->master, bgp_graceful_deferral_timer_expire,
+				 thread_info, bgp->select_defer_time,
+				 &gr_info->t_select_deferral);
 		if (gr_info->t_select_deferral == NULL) {
 			if (BGP_DEBUG(update, UPDATE_OUT))
-				zlog_debug("Error starting deferral timer for %s",
+				zlog_debug(
+					"Error starting deferral timer for %s",
 					get_afi_safi_str(afi, safi, false));
 			return -1;
 		}
@@ -1709,8 +1707,8 @@ static int bgp_start_deferral_timer(struct bgp *bgp, afi_t afi, safi_t safi,
 	}
 	if (BGP_DEBUG(update, UPDATE_OUT))
 		zlog_debug("Started the deferral timer for %s eor_required %d",
-				get_afi_safi_str(afi, safi, false),
-				gr_info->eor_required);
+			   get_afi_safi_str(afi, safi, false),
+			   gr_info->eor_required);
 	return 0;
 }
 
@@ -1734,8 +1732,8 @@ static int bgp_update_gr_info(struct peer *peer, afi_t afi, safi_t safi)
 	}
 
 	/* Restarting router */
-	if (BGP_PEER_GRACEFUL_RESTART_CAPABLE(peer) &&
-	    BGP_PEER_RESTARTING_MODE(peer)) {
+	if (BGP_PEER_GRACEFUL_RESTART_CAPABLE(peer)
+	    && BGP_PEER_RESTARTING_MODE(peer)) {
 		/* Check if the forwarding state is preserved */
 		if (bgp_flag_check(bgp, BGP_FLAG_GR_PRESERVE_FWD)) {
 			gr_info = &(bgp->gr_info[afi][safi]);
@@ -1800,11 +1798,9 @@ static int bgp_establish(struct peer *peer)
 	UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT);
 	if (bgp_debug_neighbor_events(peer)) {
 		if (BGP_PEER_RESTARTING_MODE(peer))
-			zlog_debug("peer %s BGP_RESTARTING_MODE",
-				   peer->host);
+			zlog_debug("peer %s BGP_RESTARTING_MODE", peer->host);
 		else if (BGP_PEER_HELPER_MODE(peer))
-			zlog_debug("peer %s BGP_HELPER_MODE",
-				   peer->host);
+			zlog_debug("peer %s BGP_HELPER_MODE", peer->host);
 	}
 	for (afi = AFI_IP; afi < AFI_MAX; afi++)
 		for (safi = SAFI_UNICAST; safi <= SAFI_MPLS_VPN; safi++) {
@@ -1831,15 +1827,18 @@ static int bgp_establish(struct peer *peer)
 					status = bgp_update_gr_info(peer, afi,
 								    safi);
 					if (status < 0)
-						zlog_err("Error in updating graceful restart for %s",
-							get_afi_safi_str(afi,
-							safi, false));
+						zlog_err(
+							"Error in updating graceful restart for %s",
+							get_afi_safi_str(
+								afi, safi,
+								false));
 				} else {
 					if (BGP_PEER_GRACEFUL_RESTART_CAPABLE(
-						peer) &&
-						BGP_PEER_RESTARTING_MODE(peer)
-						&& bgp_flag_check(peer->bgp,
-						BGP_FLAG_GR_PRESERVE_FWD))
+						    peer)
+					    && BGP_PEER_RESTARTING_MODE(peer)
+					    && bgp_flag_check(
+						    peer->bgp,
+						    BGP_FLAG_GR_PRESERVE_FWD))
 						peer->bgp->gr_info[afi][safi]
 							.eor_required++;
 				}
@@ -2267,31 +2266,30 @@ int bgp_event_update(struct peer *peer, int event)
 /* BGP GR Code */
 
 int bgp_gr_lookup_n_update_all_peer(struct bgp *bgp,
-			enum global_mode global_new_state,
-			enum global_mode global_old_state)
+				    enum global_mode global_new_state,
+				    enum global_mode global_old_state)
 {
 	struct peer *peer = {0};
 	struct listnode *node = {0};
 	struct listnode *nnode = {0};
-	enum peer_mode  peer_old_state = PEER_INVALID;
+	enum peer_mode peer_old_state = PEER_INVALID;
 
 	for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
 
 		if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
-			zlog_debug(
-			"%s [BGP_GR] Peer: (%s) :",
-				__func__, peer->host);
+			zlog_debug("%s [BGP_GR] Peer: (%s) :", __func__,
+				   peer->host);
 
 		peer_old_state = bgp_peer_gr_mode_get(peer);
 
 		if (peer_old_state == PEER_GLOBAL_INHERIT) {
 
-		/*
-		 *Reset only these peers and send a
-		 *new open message with the change capabilities.
-		 *Considering the mode to be "global_new_state" and
-		 *do all operation accordingly
-		 */
+			/*
+			 *Reset only these peers and send a
+			 *new open message with the change capabilities.
+			 *Considering the mode to be "global_new_state" and
+			 *do all operation accordingly
+			 */
 
 			switch (global_new_state) {
 			case GLOBAL_HELPER:
@@ -2304,14 +2302,12 @@ int bgp_gr_lookup_n_update_all_peer(struct bgp *bgp,
 				BGP_PEER_GR_DISABLE(peer);
 				break;
 			case GLOBAL_INVALID:
-				zlog_debug(
-				"%s [BGP_GR] GLOBAL_INVALID",
-				__func__);
+				zlog_debug("%s [BGP_GR] GLOBAL_INVALID",
+					   __func__);
 				return BGP_ERR_GR_OPERATION_FAILED;
 			default:
-				zlog_debug(
-				"%s [BGP_GR] Global unknown ERROR",
-				__func__);
+				zlog_debug("%s [BGP_GR] Global unknown ERROR",
+					   __func__);
 				return BGP_ERR_GR_OPERATION_FAILED;
 			}
 		}
@@ -2328,50 +2324,45 @@ int bgp_gr_update_all(struct bgp *bgp, int global_gr_cmd)
 	enum global_mode global_old_state = GLOBAL_INVALID;
 
 	if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
-		zlog_debug(
-		"%s [BGP_GR]START: global_gr_cmd :%s:",
-			__func__, print_global_gr_cmd(global_gr_cmd));
+		zlog_debug("%s [BGP_GR]START: global_gr_cmd :%s:", __func__,
+			   print_global_gr_cmd(global_gr_cmd));
 
 	global_old_state = bgp_global_gr_mode_get(bgp);
 
 	if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
-		zlog_debug(
-		"[BGP_GR] global_old_gr_state :%s:",
-		print_global_gr_mode(global_old_state));
+		zlog_debug("[BGP_GR] global_old_gr_state :%s:",
+			   print_global_gr_mode(global_old_state));
 
 	if (global_old_state != GLOBAL_INVALID) {
 		global_new_state =
 			bgp->GLOBAL_GR_FSM[global_old_state][global_gr_cmd];
 
 		if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
-			zlog_debug(
-			"[BGP_GR] global_new_gr_state :%s:",
-			print_global_gr_mode(global_new_state));
+			zlog_debug("[BGP_GR] global_new_gr_state :%s:",
+				   print_global_gr_mode(global_new_state));
 	} else {
-		zlog_err(
-			"%s [BGP_GR] global_old_state == GLOBAL_INVALID",
-			__func__);
+		zlog_err("%s [BGP_GR] global_old_state == GLOBAL_INVALID",
+			 __func__);
 		return BGP_ERR_GR_OPERATION_FAILED;
 	}
 
 	if (global_new_state == GLOBAL_INVALID) {
-		zlog_err(
-			"%s [BGP_GR] global_new_state == GLOBAL_INVALID",
-				__func__);
+		zlog_err("%s [BGP_GR] global_new_state == GLOBAL_INVALID",
+			 __func__);
 		return BGP_ERR_GR_INVALID_CMD;
 	}
 	if (global_new_state == global_old_state) {
 		/* Trace msg */
 		if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
 			zlog_debug(
-			"%s [BGP_GR] global_new_state == global_old_state :%s",
-			__func__, print_global_gr_mode(global_new_state));
+				"%s [BGP_GR] global_new_state == global_old_state :%s",
+				__func__,
+				print_global_gr_mode(global_new_state));
 		return BGP_GR_NO_OPERATION;
 	}
 
-	return bgp_gr_lookup_n_update_all_peer(bgp,
-					global_new_state,
-					global_old_state);
+	return bgp_gr_lookup_n_update_all_peer(bgp, global_new_state,
+					       global_old_state);
 }
 
 const char *print_peer_gr_mode(enum peer_mode pr_mode)
@@ -2481,11 +2472,10 @@ enum peer_mode bgp_peer_gr_mode_get(struct peer *peer)
 	return peer->peer_gr_present_state;
 }
 
-int bgp_neighbor_graceful_restart(struct peer *peer,
-						int peer_gr_cmd)
+int bgp_neighbor_graceful_restart(struct peer *peer, int peer_gr_cmd)
 {
-	enum peer_mode  peer_new_state = PEER_INVALID;
-	enum peer_mode  peer_old_state = PEER_INVALID;
+	enum peer_mode peer_new_state = PEER_INVALID;
+	enum peer_mode peer_old_state = PEER_INVALID;
 	struct bgp_peer_gr peer_state;
 	int result = BGP_GR_FAILURE;
 
@@ -2496,15 +2486,14 @@ int bgp_neighbor_graceful_restart(struct peer *peer,
 	 */
 
 	if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
-		zlog_debug(
-		"%s [BGP_GR] START:Peer: (%s) : peer_gr_cmd :%s:",
-		  __func__, peer->host, print_peer_gr_cmd(peer_gr_cmd));
+		zlog_debug("%s [BGP_GR] START:Peer: (%s) : peer_gr_cmd :%s:",
+			   __func__, peer->host,
+			   print_peer_gr_cmd(peer_gr_cmd));
 
 	peer_old_state = bgp_peer_gr_mode_get(peer);
 
 	if (peer_old_state == PEER_INVALID) {
-		zlog_debug(
-			"[BGP_GR] peer_old_state == Invalid state !");
+		zlog_debug("[BGP_GR] peer_old_state == Invalid state !");
 		return BGP_ERR_GR_OPERATION_FAILED;
 	}
 
@@ -2518,13 +2507,12 @@ int bgp_neighbor_graceful_restart(struct peer *peer,
 	}
 
 	if (peer_new_state != peer_old_state) {
-		result = peer_state.action_fun(peer,
-						peer_old_state,
-						peer_new_state);
+		result = peer_state.action_fun(peer, peer_old_state,
+					       peer_new_state);
 	} else {
 		if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
 			zlog_debug(
-			"[BGP_GR] peer_old_state == peer_new_state !");
+				"[BGP_GR] peer_old_state == peer_new_state !");
 		return BGP_GR_NO_OPERATION;
 	}
 
@@ -2533,8 +2521,9 @@ int bgp_neighbor_graceful_restart(struct peer *peer,
 		/* Update the mode i.e peer_new_state into the peer structure */
 		peer->peer_gr_present_state = peer_new_state;
 		if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
-			zlog_debug("[BGP_GR] Succesfully change the state of the peer to : %s : !",
-					print_peer_gr_mode(peer_new_state));
+			zlog_debug(
+				"[BGP_GR] Succesfully change the state of the peer to : %s : !",
+				print_peer_gr_mode(peer_new_state));
 
 		return BGP_GR_SUCCESS;
 	}
@@ -2542,8 +2531,8 @@ int bgp_neighbor_graceful_restart(struct peer *peer,
 	return result;
 }
 
-unsigned int bgp_peer_gr_action(struct peer *peer,
-				int old_peer_state, int new_peer_state)
+unsigned int bgp_peer_gr_action(struct peer *peer, int old_peer_state,
+				int new_peer_state)
 {
 	if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
 		zlog_debug(
@@ -2555,19 +2544,20 @@ unsigned int bgp_peer_gr_action(struct peer *peer,
 	unsigned int ret = BGP_GR_FAILURE;
 
 	if (old_peer_state == new_peer_state) {
-	/* Nothing to do over here as the present and old state is the same */
+		/* Nothing to do over here as the present and old state is the
+		 * same */
 		return BGP_GR_NO_OPERATION;
 	}
-	if ((old_peer_state == PEER_INVALID) ||
-		(new_peer_state == PEER_INVALID)) {
-	/* something bad happend , print error message */
+	if ((old_peer_state == PEER_INVALID)
+	    || (new_peer_state == PEER_INVALID)) {
+		/* something bad happend , print error message */
 		return BGP_ERR_GR_INVALID_CMD;
 	}
 
 	bgp_gr_global_mode = bgp_global_gr_mode_get(peer->bgp);
 
-	if ((old_peer_state == PEER_GLOBAL_INHERIT) &&
-		(new_peer_state != PEER_GLOBAL_INHERIT)) {
+	if ((old_peer_state == PEER_GLOBAL_INHERIT)
+	    && (new_peer_state != PEER_GLOBAL_INHERIT)) {
 
 		/* fetch the Mode running in the Global state machine
 		 *from the bgp structure into a variable called
@@ -2583,10 +2573,10 @@ unsigned int bgp_peer_gr_action(struct peer *peer,
 		BGP_PEER_GR_GLOBAL_INHERIT_UNSET(peer);
 
 		if (new_peer_state == bgp_gr_global_mode) {
-		/*This is incremental updates i.e no tear down
-		 *of the existing session
-		 *as the peer is already working in the same mode.
-		 */
+			/*This is incremental updates i.e no tear down
+			 *of the existing session
+			 *as the peer is already working in the same mode.
+			 */
 			ret = BGP_GR_SUCCESS;
 		} else {
 			if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
@@ -2602,8 +2592,8 @@ unsigned int bgp_peer_gr_action(struct peer *peer,
 	/* In the case below peer is going into Global inherit mode i.e.
 	 * the peer would work as the mode configured at the global level
 	 */
-	else if ((new_peer_state == PEER_GLOBAL_INHERIT) &&
-		(old_peer_state != PEER_GLOBAL_INHERIT)) {
+	else if ((new_peer_state == PEER_GLOBAL_INHERIT)
+		 && (old_peer_state != PEER_GLOBAL_INHERIT)) {
 		/* Here in this case it would be destructive
 		 * in all the cases except one case when,
 		 * Global GR is configured Disabled
@@ -2627,7 +2617,8 @@ unsigned int bgp_peer_gr_action(struct peer *peer,
 			 */
 
 			if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
-				zlog_debug("[BGP_GR] Peer state changed from :%s",
+				zlog_debug(
+					"[BGP_GR] Peer state changed from :%s",
 					print_peer_gr_mode(old_peer_state));
 
 			bgp_peer_move_to_gr_mode(peer, bgp_gr_global_mode);
@@ -2642,7 +2633,7 @@ unsigned int bgp_peer_gr_action(struct peer *peer,
 		 */
 		if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
 			zlog_debug("[BGP_GR] Peer state changed from :%s",
-					print_peer_gr_mode(old_peer_state));
+				   print_peer_gr_mode(old_peer_state));
 
 		bgp_peer_move_to_gr_mode(peer, new_peer_state);
 
@@ -2672,85 +2663,78 @@ inline void bgp_peer_move_to_gr_mode(struct peer *peer, int new_state)
 
 		if (bgp_global_gr_mode == GLOBAL_HELPER) {
 			BGP_PEER_GR_HELPER_ENABLE(peer);
-		} else if (bgp_global_gr_mode  == GLOBAL_GR) {
+		} else if (bgp_global_gr_mode == GLOBAL_GR) {
 			BGP_PEER_GR_ENABLE(peer);
 		} else if (bgp_global_gr_mode == GLOBAL_DISABLE) {
 			BGP_PEER_GR_DISABLE(peer);
 		} else {
 			zlog_err(
-			"[BGP_GR] Default switch inherit mode ::: SOMETHING IS WRONG !!!");
+				"[BGP_GR] Default switch inherit mode ::: SOMETHING IS WRONG !!!");
 		}
 		break;
 	default:
-		zlog_err("[BGP_GR] Default switch mode ::: SOMETHING IS WRONG !!!");
+		zlog_err(
+			"[BGP_GR] Default switch mode ::: SOMETHING IS WRONG !!!");
 		break;
 	}
 	if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
 		zlog_debug("[BGP_GR] Peer state changed  --to-->  : %d : !",
-					 new_state);
+			   new_state);
 }
 
 void bgp_peer_gr_flags_update(struct peer *peer)
 {
 	if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
-		zlog_debug(
-			"%s [BGP_GR] called !",
-				__func__);
+		zlog_debug("%s [BGP_GR] called !", __func__);
 	if (CHECK_FLAG(peer->peer_gr_new_status_flag,
-		PEER_GRACEFUL_RESTART_NEW_STATE_HELPER))
-		SET_FLAG(peer->flags,
-				PEER_FLAG_GRACEFUL_RESTART_HELPER);
+		       PEER_GRACEFUL_RESTART_NEW_STATE_HELPER))
+		SET_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART_HELPER);
 	else
-		UNSET_FLAG(peer->flags,
-				PEER_FLAG_GRACEFUL_RESTART_HELPER);
+		UNSET_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART_HELPER);
 	if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
 		zlog_debug(
 			"[BGP_GR] Peer %s Flag PEER_FLAG_GRACEFUL_RESTART_HELPER : %s : !",
 			peer->host,
 			(CHECK_FLAG(peer->flags,
-				PEER_FLAG_GRACEFUL_RESTART_HELPER) ?
-				"Set" : "UnSet"));
+				    PEER_FLAG_GRACEFUL_RESTART_HELPER)
+				 ? "Set"
+				 : "UnSet"));
 	if (CHECK_FLAG(peer->peer_gr_new_status_flag,
-		PEER_GRACEFUL_RESTART_NEW_STATE_RESTART))
-		SET_FLAG(peer->flags,
-				PEER_FLAG_GRACEFUL_RESTART);
+		       PEER_GRACEFUL_RESTART_NEW_STATE_RESTART))
+		SET_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART);
 	else
-		UNSET_FLAG(peer->flags,
-				PEER_FLAG_GRACEFUL_RESTART);
+		UNSET_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART);
 	if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
 		zlog_debug(
 			"[BGP_GR] Peer %s Flag PEER_FLAG_GRACEFUL_RESTART : %s : !",
 			peer->host,
-			(CHECK_FLAG(peer->flags,
-				PEER_FLAG_GRACEFUL_RESTART) ?
-				"Set" : "UnSet"));
+			(CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART)
+				 ? "Set"
+				 : "UnSet"));
 	if (CHECK_FLAG(peer->peer_gr_new_status_flag,
-		PEER_GRACEFUL_RESTART_NEW_STATE_INHERIT))
+		       PEER_GRACEFUL_RESTART_NEW_STATE_INHERIT))
 		SET_FLAG(peer->flags,
-				PEER_FLAG_GRACEFUL_RESTART_GLOBAL_INHERIT);
+			 PEER_FLAG_GRACEFUL_RESTART_GLOBAL_INHERIT);
 	else
 		UNSET_FLAG(peer->flags,
-				PEER_FLAG_GRACEFUL_RESTART_GLOBAL_INHERIT);
+			   PEER_FLAG_GRACEFUL_RESTART_GLOBAL_INHERIT);
 	if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
 		zlog_debug(
-		"[BGP_GR] Peer %s Flag PEER_FLAG_GRACEFUL_RESTART_GLOBAL_INHERIT : %s : !",
+			"[BGP_GR] Peer %s Flag PEER_FLAG_GRACEFUL_RESTART_GLOBAL_INHERIT : %s : !",
 			peer->host,
 			(CHECK_FLAG(peer->flags,
-				PEER_FLAG_GRACEFUL_RESTART_GLOBAL_INHERIT) ?
-			 "Set" : "UnSet"));
+				    PEER_FLAG_GRACEFUL_RESTART_GLOBAL_INHERIT)
+				 ? "Set"
+				 : "UnSet"));
 
-	if (!CHECK_FLAG(peer->flags,
-		PEER_FLAG_GRACEFUL_RESTART) &&
-		!CHECK_FLAG(peer->flags,
-			PEER_FLAG_GRACEFUL_RESTART_HELPER)){
-		zlog_debug(
-			"[BGP_GR] Peer %s UNSET PEER_STATUS_NSF_MODE!",
-			peer->host);
+	if (!CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART)
+	    && !CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART_HELPER)) {
+		zlog_debug("[BGP_GR] Peer %s UNSET PEER_STATUS_NSF_MODE!",
+			   peer->host);
 
 		UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_MODE);
 
-		if (CHECK_FLAG(peer->sflags,
-				PEER_STATUS_NSF_WAIT)) {
+		if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)) {
 
 			peer_nsf_stop(peer);
 			zlog_debug(
diff --git a/bgpd/bgp_fsm.h b/bgpd/bgp_fsm.h
index b6abaf3e9..aee5fba17 100644
--- a/bgpd/bgp_fsm.h
+++ b/bgpd/bgp_fsm.h
@@ -56,57 +56,51 @@
 #define FSM_PEER_TRANSFERRED    2
 #define FSM_PEER_TRANSITIONED   3
 
-#define BGP_PEER_GR_HELPER_ENABLE(peer)	\
-	do {		\
-		UNSET_FLAG( \
-			peer->peer_gr_new_status_flag,		\
-			PEER_GRACEFUL_RESTART_NEW_STATE_RESTART);	\
-		SET_FLAG( \
-			peer->peer_gr_new_status_flag,	\
-			PEER_GRACEFUL_RESTART_NEW_STATE_HELPER);\
+#define BGP_PEER_GR_HELPER_ENABLE(peer)                                        \
+	do {                                                                   \
+		UNSET_FLAG(peer->peer_gr_new_status_flag,                      \
+			   PEER_GRACEFUL_RESTART_NEW_STATE_RESTART);           \
+		SET_FLAG(peer->peer_gr_new_status_flag,                        \
+			 PEER_GRACEFUL_RESTART_NEW_STATE_HELPER);              \
 	} while (0)
 
-#define BGP_PEER_GR_ENABLE(peer)\
-	do {				\
-		SET_FLAG(   \
-			peer->peer_gr_new_status_flag,	\
-			PEER_GRACEFUL_RESTART_NEW_STATE_RESTART); \
-		UNSET_FLAG( \
-			peer->peer_gr_new_status_flag,	\
-			PEER_GRACEFUL_RESTART_NEW_STATE_HELPER);\
+#define BGP_PEER_GR_ENABLE(peer)                                               \
+	do {                                                                   \
+		SET_FLAG(peer->peer_gr_new_status_flag,                        \
+			 PEER_GRACEFUL_RESTART_NEW_STATE_RESTART);             \
+		UNSET_FLAG(peer->peer_gr_new_status_flag,                      \
+			   PEER_GRACEFUL_RESTART_NEW_STATE_HELPER);            \
 	} while (0)
 
-#define BGP_PEER_GR_DISABLE(peer)\
-	do {				\
-		UNSET_FLAG( \
-			peer->peer_gr_new_status_flag,	\
-			PEER_GRACEFUL_RESTART_NEW_STATE_RESTART);\
-		UNSET_FLAG(\
-			peer->peer_gr_new_status_flag, \
-			PEER_GRACEFUL_RESTART_NEW_STATE_HELPER);\
+#define BGP_PEER_GR_DISABLE(peer)                                              \
+	do {                                                                   \
+		UNSET_FLAG(peer->peer_gr_new_status_flag,                      \
+			   PEER_GRACEFUL_RESTART_NEW_STATE_RESTART);           \
+		UNSET_FLAG(peer->peer_gr_new_status_flag,                      \
+			   PEER_GRACEFUL_RESTART_NEW_STATE_HELPER);            \
 	} while (0)
 
-#define BGP_PEER_GR_GLOBAL_INHERIT_SET(peer) \
-			SET_FLAG(peer->peer_gr_new_status_flag,	\
-				PEER_GRACEFUL_RESTART_NEW_STATE_INHERIT)
+#define BGP_PEER_GR_GLOBAL_INHERIT_SET(peer)                                   \
+	SET_FLAG(peer->peer_gr_new_status_flag,                                \
+		 PEER_GRACEFUL_RESTART_NEW_STATE_INHERIT)
 
-#define BGP_PEER_GR_GLOBAL_INHERIT_UNSET(peer)	\
-			UNSET_FLAG(peer->peer_gr_new_status_flag, \
-				PEER_GRACEFUL_RESTART_NEW_STATE_INHERIT)
+#define BGP_PEER_GR_GLOBAL_INHERIT_UNSET(peer)                                 \
+	UNSET_FLAG(peer->peer_gr_new_status_flag,                              \
+		   PEER_GRACEFUL_RESTART_NEW_STATE_INHERIT)
 
-#define BGP_PEER_GRACEFUL_RESTART_CAPABLE(peer)                         \
-	(CHECK_FLAG(peer->cap, PEER_CAP_RESTART_ADV) &&                 \
-	 CHECK_FLAG(peer->cap, PEER_CAP_RESTART_RCV))
+#define BGP_PEER_GRACEFUL_RESTART_CAPABLE(peer)                                \
+	(CHECK_FLAG(peer->cap, PEER_CAP_RESTART_ADV)                           \
+	 && CHECK_FLAG(peer->cap, PEER_CAP_RESTART_RCV))
 
-#define BGP_PEER_RESTARTING_MODE(peer)\
-	(CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART) && \
-	 CHECK_FLAG(peer->cap, PEER_CAP_RESTART_BIT_ADV) &&     \
-	 !CHECK_FLAG(peer->cap, PEER_CAP_RESTART_BIT_RCV))
+#define BGP_PEER_RESTARTING_MODE(peer)                                         \
+	(CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART)                   \
+	 && CHECK_FLAG(peer->cap, PEER_CAP_RESTART_BIT_ADV)                    \
+	 && !CHECK_FLAG(peer->cap, PEER_CAP_RESTART_BIT_RCV))
 
-#define BGP_PEER_HELPER_MODE(peer)\
-	(CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART_HELPER) && \
-	 CHECK_FLAG(peer->cap, PEER_CAP_RESTART_BIT_RCV) &&           \
-	 !CHECK_FLAG(peer->cap, PEER_CAP_RESTART_BIT_ADV))
+#define BGP_PEER_HELPER_MODE(peer)                                             \
+	(CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART_HELPER)            \
+	 && CHECK_FLAG(peer->cap, PEER_CAP_RESTART_BIT_RCV)                    \
+	 && !CHECK_FLAG(peer->cap, PEER_CAP_RESTART_BIT_ADV))
 
 /* Prototypes. */
 extern void bgp_fsm_event_update(struct peer *peer, int valid);
@@ -139,14 +133,13 @@ extern void bgp_start_routeadv(struct bgp *);
 extern void bgp_adjust_routeadv(struct peer *);
 
 #include "hook.h"
-DECLARE_HOOK(peer_backward_transition, (struct peer *peer), (peer))
-DECLARE_HOOK(peer_established, (struct peer *peer), (peer))
+DECLARE_HOOK(peer_backward_transition, (struct peer * peer), (peer))
+DECLARE_HOOK(peer_established, (struct peer * peer), (peer))
 
 int bgp_gr_update_all(struct bgp *bgp, int global_gr_cmd);
-int bgp_neighbor_graceful_restart(struct peer *peer,
-			int peer_gr_cmd);
-unsigned int bgp_peer_gr_action(struct peer *peer,
-		int old_peer_state, int new_peer_state);
+int bgp_neighbor_graceful_restart(struct peer *peer, int peer_gr_cmd);
+unsigned int bgp_peer_gr_action(struct peer *peer, int old_peer_state,
+				int new_peer_state);
 void bgp_peer_move_to_gr_mode(struct peer *peer, int new_state);
 unsigned int bgp_peer_gr_helper_enable(struct peer *peer);
 unsigned int bgp_peer_gr_enable(struct peer *peer);
@@ -157,8 +150,8 @@ enum global_mode bgp_global_gr_mode_get(struct bgp *bgp);
 enum peer_mode bgp_get_peer_gr_mode_from_flags(struct peer *peer);
 unsigned int bgp_peer_gr_global_inherit_unset(struct peer *peer);
 int bgp_gr_lookup_n_update_all_peer(struct bgp *bgp,
-		enum global_mode global_new_state,
-		enum global_mode global_old_state);
+				    enum global_mode global_new_state,
+				    enum global_mode global_old_state);
 void bgp_peer_gr_flags_update(struct peer *peer);
 const char *print_peer_gr_mode(enum peer_mode pr_mode);
 const char *print_peer_gr_cmd(enum peer_gr_command pr_gr_cmd);
diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c
index 626c36ff0..ab50c545b 100644
--- a/bgpd/bgp_io.c
+++ b/bgpd/bgp_io.c
@@ -462,12 +462,10 @@ static uint16_t bgp_read(struct peer *peer)
 			 safe_strerror(errno));
 
 		if (peer->status == Established) {
-			if ((CHECK_FLAG(peer->flags,
-				PEER_FLAG_GRACEFUL_RESTART) ||
-				CHECK_FLAG(peer->flags,
-				PEER_FLAG_GRACEFUL_RESTART_HELPER)) &&
-				CHECK_FLAG(peer->sflags,
-				PEER_STATUS_NSF_MODE)) {
+			if ((CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART)
+			     || CHECK_FLAG(peer->flags,
+					   PEER_FLAG_GRACEFUL_RESTART_HELPER))
+			    && CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_MODE)) {
 				peer->last_reset = PEER_DOWN_NSF_CLOSE_SESSION;
 				SET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT);
 			} else
@@ -480,15 +478,13 @@ static uint16_t bgp_read(struct peer *peer)
 	} else if (nbytes == 0) {
 		if (bgp_debug_neighbor_events(peer))
 			zlog_debug("%s [Event] BGP connection closed fd %d",
-					peer->host, peer->fd);
+				   peer->host, peer->fd);
 
 		if (peer->status == Established) {
-			if ((CHECK_FLAG(peer->flags,
-				PEER_FLAG_GRACEFUL_RESTART) ||
-				CHECK_FLAG(peer->flags,
-				PEER_FLAG_GRACEFUL_RESTART_HELPER)) &&
-				CHECK_FLAG(peer->sflags,
-				PEER_STATUS_NSF_MODE)) {
+			if ((CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART)
+			     || CHECK_FLAG(peer->flags,
+					   PEER_FLAG_GRACEFUL_RESTART_HELPER))
+			    && CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_MODE)) {
 				peer->last_reset = PEER_DOWN_NSF_CLOSE_SESSION;
 				SET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT);
 			} else
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index d7989af55..8b585704d 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -489,16 +489,14 @@ static int bgp_accept(struct thread *thread)
 	peer_xfer_config(peer, peer1);
 	bgp_peer_gr_flags_update(peer);
 
-	BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(
-			peer->bgp,
-			peer->bgp->peer);
+	BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(peer->bgp,
+							  peer->bgp->peer);
 
 	if (bgp_peer_gr_mode_get(peer) == PEER_DISABLE) {
 
 		UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_MODE);
 
-		if (CHECK_FLAG(peer->sflags,
-				PEER_STATUS_NSF_WAIT)) {
+		if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)) {
 			peer_nsf_stop(peer);
 		}
 	}
@@ -515,7 +513,7 @@ static int bgp_accept(struct thread *thread)
 	SET_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER);
 	/* Make dummy peer until read Open packet. */
 	if (peer1->status == Established
-		&& CHECK_FLAG(peer1->sflags, PEER_STATUS_NSF_MODE)) {
+	    && CHECK_FLAG(peer1->sflags, PEER_STATUS_NSF_MODE)) {
 		/* If we have an existing established connection with graceful
 		 * restart
 		 * capability announced with one or more address families, then
@@ -524,12 +522,10 @@ static int bgp_accept(struct thread *thread)
 		 */
 		peer1->last_reset = PEER_DOWN_NSF_CLOSE_SESSION;
 
-		if (CHECK_FLAG(peer1->flags,
-			PEER_FLAG_GRACEFUL_RESTART) ||
-			CHECK_FLAG(peer1->flags,
-			PEER_FLAG_GRACEFUL_RESTART_HELPER))
-			SET_FLAG(peer1->sflags,
-				PEER_STATUS_NSF_WAIT);
+		if (CHECK_FLAG(peer1->flags, PEER_FLAG_GRACEFUL_RESTART)
+		    || CHECK_FLAG(peer1->flags,
+				  PEER_FLAG_GRACEFUL_RESTART_HELPER))
+			SET_FLAG(peer1->sflags, PEER_STATUS_NSF_WAIT);
 
 		bgp_event_update(peer1, TCP_connection_closed);
 	}
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index e743fdda8..0452b9d14 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -1012,7 +1012,6 @@ static int bgp_capability_parse(struct peer *peer, size_t length,
 			UNSET_FLAG(restart_flag_time, 0xF000);
 			peer->v_gr_restart = restart_flag_time;
 		}
-
 	}
 	return 0;
 }
@@ -1309,7 +1308,7 @@ static void bgp_open_capability_orf(struct stream *s, struct peer *peer,
 }
 
 static void bgp_peer_send_gr_capability(struct stream *s, struct peer *peer,
-				 unsigned long cp)
+					unsigned long cp)
 {
 	int len;
 	iana_afi_t pkt_afi;
@@ -1320,10 +1319,8 @@ static void bgp_peer_send_gr_capability(struct stream *s, struct peer *peer,
 	unsigned long capp = 0;
 	unsigned long rcapp = 0;
 
-	if ((CHECK_FLAG(peer->flags,
-			PEER_FLAG_GRACEFUL_RESTART)) ||
-		(CHECK_FLAG(peer->flags,
-			PEER_FLAG_GRACEFUL_RESTART_HELPER))) {
+	if ((CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART))
+	    || (CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART_HELPER))) {
 
 		if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
 			zlog_debug(
@@ -1356,30 +1353,28 @@ static void bgp_peer_send_gr_capability(struct stream *s, struct peer *peer,
 		 */
 		if (CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART)) {
 
-			if (bgp_flag_check(peer->bgp,
-					BGP_FLAG_GR_PRESERVE_FWD) &&
-					BGP_DEBUG(graceful_restart,
-					GRACEFUL_RESTART))
+			if (bgp_flag_check(peer->bgp, BGP_FLAG_GR_PRESERVE_FWD)
+			    && BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
 				zlog_debug("[BGP_GR] F bit Set");
 
 			FOREACH_AFI_SAFI (afi, safi) {
 				if (peer->afc[afi][safi]) {
 					if (BGP_DEBUG(graceful_restart,
-							GRACEFUL_RESTART))
+						      GRACEFUL_RESTART))
 						zlog_debug(
-						"[BGP_GR] Sending GR Capability for AFI :%d :, SAFI :%d:",
-						afi, safi);
+							"[BGP_GR] Sending GR Capability for AFI :%d :, SAFI :%d:",
+							afi, safi);
 
 					/* Convert AFI, SAFI to values for
 					 * packet.
 					 */
-					bgp_map_afi_safi_int2iana(afi,
-							safi, &pkt_afi,
-							  &pkt_safi);
+					bgp_map_afi_safi_int2iana(
+						afi, safi, &pkt_afi, &pkt_safi);
 					stream_putw(s, pkt_afi);
 					stream_putc(s, pkt_safi);
-					if (bgp_flag_check(peer->bgp,
-					   BGP_FLAG_GR_PRESERVE_FWD)) {
+					if (bgp_flag_check(
+						    peer->bgp,
+						    BGP_FLAG_GR_PRESERVE_FWD)) {
 						stream_putc(s, RESTART_F_BIT);
 
 					} else {
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index e77194a62..b48e1918c 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -439,33 +439,34 @@ int bgp_generate_updgrp_packets(struct thread *thread)
 			 */
 			if (!next_pkt || !next_pkt->buffer) {
 				if (CHECK_FLAG(peer->cap,
-						PEER_CAP_RESTART_RCV)) {
+					       PEER_CAP_RESTART_RCV)) {
 					if (!(PAF_SUBGRP(paf))->t_coalesce
-						&& peer->afc_nego[afi][safi]
-						&& peer->synctime
-						&& !CHECK_FLAG(
-						peer->af_sflags[afi][safi],
-						PEER_STATUS_EOR_SEND)) {
+					    && peer->afc_nego[afi][safi]
+					    && peer->synctime
+					    && !CHECK_FLAG(
+						    peer->af_sflags[afi][safi],
+						    PEER_STATUS_EOR_SEND)) {
 						/* If EOR is disabled,
 						 * the message is  not sent
 						 */
-						if (BGP_SEND_EOR(peer->bgp,
-								afi, safi)) {
+						if (BGP_SEND_EOR(peer->bgp, afi,
+								 safi)) {
 							SET_FLAG(
-							peer->af_sflags
-							[afi][safi],
-							PEER_STATUS_EOR_SEND);
+								peer->af_sflags
+									[afi]
+									[safi],
+								PEER_STATUS_EOR_SEND);
 
 							/* Update EOR
 							 * send time
 							 */
-							peer->eor_stime
-							[afi][safi] =
-							monotime(NULL);
+							peer->eor_stime[afi]
+								       [safi] =
+								monotime(NULL);
 
 							BGP_UPDATE_EOR_PKT(
-								peer, afi,
-								safi, s);
+								peer, afi, safi,
+								s);
 						}
 					}
 				}
@@ -772,9 +773,8 @@ void bgp_notify_send_with_data(struct peer *peer, uint8_t code,
 	stream_fifo_push(peer->obuf, s);
 
 	bgp_peer_gr_flags_update(peer);
-	BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(
-			peer->bgp,
-			peer->bgp->peer);
+	BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(peer->bgp,
+							  peer->bgp->peer);
 
 	bgp_write_notify(peer);
 }
@@ -1651,8 +1651,8 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
 		struct graceful_restart_info *gr_info;
 
 		/* Restarting router */
-		if (BGP_PEER_GRACEFUL_RESTART_CAPABLE(peer) &&
-		    BGP_PEER_RESTARTING_MODE(peer))
+		if (BGP_PEER_GRACEFUL_RESTART_CAPABLE(peer)
+		    && BGP_PEER_RESTARTING_MODE(peer))
 			restart = true;
 
 		/* Non-MP IPv4/Unicast is a completely emtpy UPDATE - already
@@ -1688,11 +1688,11 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
 				 * deferral timer is running, cancel the timer
 				 * and invoke the best path calculation
 				 */
-				if (gr_info->eor_required ==
-						gr_info->eor_received) {
-					if (bgp_debug_neighbor_events(
-								peer))
-						zlog_debug("%s %d, %s %d",
+				if (gr_info->eor_required
+				    == gr_info->eor_received) {
+					if (bgp_debug_neighbor_events(peer))
+						zlog_debug(
+							"%s %d, %s %d",
 							"EOR REQ",
 							gr_info->eor_required,
 							"EOR RCV",
@@ -1703,7 +1703,8 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
 					gr_info->eor_received = 0;
 					/* Best path selection */
 					if (bgp_best_path_select_defer(
-						peer->bgp, afi, safi) < 0)
+						    peer->bgp, afi, safi)
+					    < 0)
 						return BGP_Stop;
 				}
 			}
@@ -1788,7 +1789,6 @@ static int bgp_notify_receive(struct peer *peer, bgp_size_t size)
 
 					strlcpy(bgp_notify.data, c,
 						bgp_notify.length * 3);
-
 				}
 			bgp_notify.raw_data = (uint8_t *)peer->notify.data;
 		}
@@ -1815,9 +1815,8 @@ static int bgp_notify_receive(struct peer *peer, bgp_size_t size)
 		UNSET_FLAG(peer->sflags, PEER_STATUS_CAPABILITY_OPEN);
 
 	bgp_peer_gr_flags_update(peer);
-	BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(
-			peer->bgp,
-			peer->bgp->peer);
+	BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(peer->bgp,
+							  peer->bgp->peer);
 
 	return Receive_NOTIFICATION_message;
 }
diff --git a/bgpd/bgp_packet.h b/bgpd/bgp_packet.h
index 0242abab2..e83f7d950 100644
--- a/bgpd/bgp_packet.h
+++ b/bgpd/bgp_packet.h
@@ -48,13 +48,13 @@ DECLARE_HOOK(bgp_packet_send,
 #define ORF_COMMON_PART_PERMIT     0x00
 #define ORF_COMMON_PART_DENY       0x20
 
-#define BGP_UPDATE_EOR_PKT(_peer, _afi, _safi, _s)       \
-		do { \
-			_s = bgp_update_packet_eor(_peer, _afi, _safi); \
-			if (_s) { \
-				bgp_packet_add(_peer, _s); \
-			} \
-		} while (0)
+#define BGP_UPDATE_EOR_PKT(_peer, _afi, _safi, _s)                             \
+	do {                                                                   \
+		_s = bgp_update_packet_eor(_peer, _afi, _safi);                \
+		if (_s) {                                                      \
+			bgp_packet_add(_peer, _s);                             \
+		}                                                              \
+	} while (0)
 
 /* Packet send and receive function prototypes. */
 extern void bgp_keepalive_send(struct peer *);
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index f7ace6aed..e3826552f 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -89,8 +89,7 @@
 /* Extern from bgp_dump.c */
 extern const char *bgp_origin_str[];
 extern const char *bgp_origin_long_str[];
-const char *get_afi_safi_str(afi_t afi,
-		safi_t safi, bool for_json);
+const char *get_afi_safi_str(afi_t afi, safi_t safi, bool for_json);
 /* PMSI strings. */
 #define PMSI_TNLTYPE_STR_NO_INFO "No info"
 #define PMSI_TNLTYPE_STR_DEFAULT PMSI_TNLTYPE_STR_NO_INFO
@@ -317,7 +316,8 @@ static int bgp_node_set_defer_flag(struct bgp_node *rn, bool delete)
 	if (CHECK_FLAG(rn->flags, BGP_NODE_PROCESS_SCHEDULED)) {
 		if (BGP_DEBUG(update, UPDATE_OUT)) {
 			prefix2str(&rn->p, buf, PREFIX2STR_BUFFER);
-			zlog_debug("Route %s is in workqueue and being processed, not deferred.",
+			zlog_debug(
+				"Route %s is in workqueue and being processed, not deferred.",
 				buf);
 		}
 		return 0;
@@ -338,17 +338,18 @@ static int bgp_node_set_defer_flag(struct bgp_node *rn, bool delete)
 		/* Route selection is deferred if there is a stale path which
 		 * which indicates peer is in restart mode
 		 */
-		if (CHECK_FLAG(old_pi->flags, BGP_PATH_STALE) &&
-				(old_pi->sub_type == BGP_ROUTE_NORMAL)) {
+		if (CHECK_FLAG(old_pi->flags, BGP_PATH_STALE)
+		    && (old_pi->sub_type == BGP_ROUTE_NORMAL)) {
 			set_flag = 1;
 		} else {
 			/* If the peer is graceful restart capable and peer is
 			 * restarting mode, set the flag BGP_NODE_SELECT_DEFER
 			 */
 			peer = old_pi->peer;
-			if (BGP_PEER_GRACEFUL_RESTART_CAPABLE(peer) &&
-			    BGP_PEER_RESTARTING_MODE(peer) &&
-			    (old_pi && old_pi->sub_type == BGP_ROUTE_NORMAL)) {
+			if (BGP_PEER_GRACEFUL_RESTART_CAPABLE(peer)
+			    && BGP_PEER_RESTARTING_MODE(peer)
+			    && (old_pi
+				&& old_pi->sub_type == BGP_ROUTE_NORMAL)) {
 				set_flag = 1;
 			}
 		}
@@ -368,7 +369,7 @@ static int bgp_node_set_defer_flag(struct bgp_node *rn, bool delete)
 					bgp->gr_info[afi][safi].route_list, rn);
 			if (BGP_DEBUG(update, UPDATE_OUT))
 				zlog_debug("DEFER route %s, rn %p, node %p",
-						buf, rn, rn->rt_node);
+					   buf, rn, rn->rt_node);
 			return 0;
 		}
 	}
@@ -2067,8 +2068,8 @@ static int bgp_route_select_timer_expire(struct thread *thread)
 	bgp = info->bgp;
 
 	if (BGP_DEBUG(update, UPDATE_OUT))
-		zlog_debug("afi %d, safi %d : route select timer expired",
-				afi, safi);
+		zlog_debug("afi %d, safi %d : route select timer expired", afi,
+			   safi);
 
 	bgp->gr_info[afi][safi].t_route_select = NULL;
 
@@ -2729,9 +2730,9 @@ int bgp_best_path_select_defer(struct bgp *bgp, afi_t afi, safi_t safi)
 		BGP_TIMER_OFF(bgp->gr_info[afi][safi].t_route_select);
 
 	if (BGP_DEBUG(update, UPDATE_OUT)) {
-		zlog_debug("%s: processing route for %s : cnt %d",
-			   __func__, get_afi_safi_str(afi, safi, false),
-				listcount(bgp->gr_info[afi][safi].route_list));
+		zlog_debug("%s: processing route for %s : cnt %d", __func__,
+			   get_afi_safi_str(afi, safi, false),
+			   listcount(bgp->gr_info[afi][safi].route_list));
 	}
 
 	/* Process the route list */
@@ -2757,7 +2758,7 @@ int bgp_best_path_select_defer(struct bgp *bgp, afi_t afi, safi_t safi)
 		bgp_send_delayed_eor(bgp);
 		/* Send route processing complete message to RIB */
 		bgp_zebra_update(afi, safi, bgp->vrf_id,
-				ZEBRA_CLIENT_ROUTE_UPDATE_COMPLETE);
+				 ZEBRA_CLIENT_ROUTE_UPDATE_COMPLETE);
 		return 0;
 	}
 
@@ -2765,7 +2766,7 @@ int bgp_best_path_select_defer(struct bgp *bgp, afi_t afi, safi_t safi)
 	if (thread_info == NULL) {
 		if (BGP_DEBUG(update, UPDATE_OUT))
 			zlog_debug("%s : error allocating thread info",
-					__func__);
+				   __func__);
 		return -1;
 	}
 
@@ -2777,13 +2778,13 @@ int bgp_best_path_select_defer(struct bgp *bgp, afi_t afi, safi_t safi)
 	 * selection timer
 	 */
 	thread_add_timer(bm->master, bgp_route_select_timer_expire, thread_info,
-			BGP_ROUTE_SELECT_DELAY,
-			&bgp->gr_info[afi][safi].t_route_select);
+			 BGP_ROUTE_SELECT_DELAY,
+			 &bgp->gr_info[afi][safi].t_route_select);
 	if (bgp->gr_info[afi][safi].t_route_select == NULL) {
 		if (BGP_DEBUG(update, UPDATE_OUT))
-			zlog_debug("%s : error starting selection thread for %s",
-					__func__, get_afi_safi_str(afi,
-					safi, false));
+			zlog_debug(
+				"%s : error starting selection thread for %s",
+				__func__, get_afi_safi_str(afi, safi, false));
 		return -1;
 	}
 	return 0;
@@ -2873,7 +2874,7 @@ void bgp_process(struct bgp *bgp, struct bgp_node *rn, afi_t afi, safi_t safi)
 	if (CHECK_FLAG(rn->flags, BGP_NODE_SELECT_DEFER)) {
 		if (BGP_DEBUG(update, UPDATE_OUT))
 			zlog_debug("BGP_NODE_SELECT_DEFER set for route %p",
-				    rn);
+				   rn);
 		return;
 	}
 
@@ -3054,20 +3055,17 @@ void bgp_rib_remove(struct bgp_node *rn, struct bgp_path_info *pi,
 		 */
 		if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED))
 			delete_route = true;
-		else
-			if (bgp_node_set_defer_flag(rn, true) < 0)
-				delete_route = true;
+		else if (bgp_node_set_defer_flag(rn, true) < 0)
+			delete_route = true;
 		if (delete_route) {
 			if (CHECK_FLAG(rn->flags, BGP_NODE_SELECT_DEFER)) {
 				UNSET_FLAG(rn->flags, BGP_NODE_SELECT_DEFER);
 				bgp = pi->peer->bgp;
-				if ((rn->rt_node) &&
-					(bgp->gr_info[afi][safi]
-					.route_list)) {
-					list_delete_node(
-						bgp->gr_info[afi][safi]
-						.route_list,
-						rn->rt_node);
+				if ((rn->rt_node)
+				    && (bgp->gr_info[afi][safi].route_list)) {
+					list_delete_node(bgp->gr_info[afi][safi]
+								 .route_list,
+							 rn->rt_node);
 					rn->rt_node = NULL;
 				}
 			}
diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c
index 486868630..04181d38b 100644
--- a/bgpd/bgp_table.c
+++ b/bgpd/bgp_table.c
@@ -153,11 +153,11 @@ void bgp_delete_listnode(struct bgp_node *node)
 
 		if (bgp && rn && rn->lock == 1) {
 			/* Delete the route from the selection pending list */
-			if ((node->rt_node) &&
-			    (bgp->gr_info[afi][safi].route_list)) {
+			if ((node->rt_node)
+			    && (bgp->gr_info[afi][safi].route_list)) {
 				list_delete_node(
 					bgp->gr_info[afi][safi].route_list,
-						node->rt_node);
+					node->rt_node);
 				node->rt_node = NULL;
 			}
 		}
diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h
index 69cca9eee..cf854b727 100644
--- a/bgpd/bgp_table.h
+++ b/bgpd/bgp_table.h
@@ -97,7 +97,7 @@ struct bgp_node {
 #define BGP_NODE_USER_CLEAR             (1 << 1)
 #define BGP_NODE_LABEL_CHANGED          (1 << 2)
 #define BGP_NODE_REGISTERED_FOR_LABEL   (1 << 3)
-#define BGP_NODE_SELECT_DEFER           (1 << 4)
+#define BGP_NODE_SELECT_DEFER (1 << 4)
 	/* list node pointer */
 	struct listnode *rt_node;
 	struct bgp_addpath_node_data tx_addpath;
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index eff5b3b7b..8d5df953f 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -105,8 +105,10 @@ DEFINE_HOOK(bgp_inst_config_write,
 		(struct bgp *bgp, struct vty *vty),
 		(bgp, vty))
 
-#define GR_NO_OPER "The Graceful Restart No Operation was executed as cmd same as previous one."
-#define GR_INVALID "The Graceful Restart command used is not valid at this moment."
+#define GR_NO_OPER                                                             \
+	"The Graceful Restart No Operation was executed as cmd same as previous one."
+#define GR_INVALID                                                             \
+	"The Graceful Restart command used is not valid at this moment."
 static struct peer_group *listen_range_exists(struct bgp *bgp,
 					      struct prefix *range, int exact);
 
@@ -120,23 +122,18 @@ enum show_type {
 	show_ipv6_peer
 };
 
-static struct peer_group *listen_range_exists(
-						struct bgp *bgp,
-						struct prefix *range,
-						int exact);
+static struct peer_group *listen_range_exists(struct bgp *bgp,
+					      struct prefix *range, int exact);
 
-static void bgp_show_global_graceful_restart_mode_vty(
-					struct vty *vty,
-					struct bgp *bgp,
-					bool use_json,
-					json_object *json);
+static void bgp_show_global_graceful_restart_mode_vty(struct vty *vty,
+						      struct bgp *bgp,
+						      bool use_json,
+						      json_object *json);
 
-static int bgp_show_neighbor_graceful_restart_afi_all(
-				struct vty *vty,
-				enum show_type type,
-				const char *ip_str,
-				afi_t afi,
-				bool use_json);
+static int bgp_show_neighbor_graceful_restart_afi_all(struct vty *vty,
+						      enum show_type type,
+						      const char *ip_str,
+						      afi_t afi, bool use_json);
 
 static enum node_type bgp_node_type(afi_t afi, safi_t safi)
 {
@@ -838,8 +835,7 @@ static int bgp_clear(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
 
 			bgp_peer_gr_flags_update(peer);
 
-			if (CHECK_FLAG(peer->flags,
-					PEER_FLAG_GRACEFUL_RESTART))
+			if (CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART))
 				gr_router_detected = true;
 
 			ret = bgp_peer_clear(peer, afi, safi, nnode,
@@ -847,14 +843,13 @@ static int bgp_clear(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
 
 			if (ret < 0)
 				bgp_clear_vty_error(vty, peer, afi, safi, ret);
-
 		}
 
-		if (gr_router_detected &&
-			bgp->present_zebra_gr_state == ZEBRA_GR_DISABLE) {
+		if (gr_router_detected
+		    && bgp->present_zebra_gr_state == ZEBRA_GR_DISABLE) {
 			bgp_zebra_send_capabilities(bgp, false);
-		} else if (!gr_router_detected &&
-			bgp->present_zebra_gr_state == ZEBRA_GR_ENABLE) {
+		} else if (!gr_router_detected
+			   && bgp->present_zebra_gr_state == ZEBRA_GR_ENABLE) {
 			bgp_zebra_send_capabilities(bgp, true);
 		}
 
@@ -942,8 +937,7 @@ static int bgp_clear(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
 
 			bgp_peer_gr_flags_update(peer);
 
-			if (CHECK_FLAG(peer->flags,
-				PEER_FLAG_GRACEFUL_RESTART))
+			if (CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART))
 				gr_router_detected = true;
 
 			ret = bgp_peer_clear(peer, afi, safi, nnode, stype);
@@ -954,11 +948,11 @@ static int bgp_clear(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
 				found = true;
 		}
 
-		if (gr_router_detected &&
-			bgp->present_zebra_gr_state == ZEBRA_GR_DISABLE) {
+		if (gr_router_detected
+		    && bgp->present_zebra_gr_state == ZEBRA_GR_DISABLE) {
 			bgp_zebra_send_capabilities(bgp, false);
-		} else if (!gr_router_detected &&
-			bgp->present_zebra_gr_state == ZEBRA_GR_ENABLE) {
+		} else if (!gr_router_detected
+			   && bgp->present_zebra_gr_state == ZEBRA_GR_ENABLE) {
 			bgp_zebra_send_capabilities(bgp, true);
 		}
 
@@ -980,8 +974,7 @@ static int bgp_clear(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
 
 			bgp_peer_gr_flags_update(peer);
 
-			if (CHECK_FLAG(peer->flags,
-				PEER_FLAG_GRACEFUL_RESTART))
+			if (CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART))
 				gr_router_detected = true;
 
 			ret = bgp_peer_clear(peer, afi, safi, nnode, stype);
@@ -992,11 +985,11 @@ static int bgp_clear(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
 				found = true;
 		}
 
-		if (gr_router_detected &&
-			bgp->present_zebra_gr_state == ZEBRA_GR_DISABLE) {
+		if (gr_router_detected
+		    && bgp->present_zebra_gr_state == ZEBRA_GR_DISABLE) {
 			bgp_zebra_send_capabilities(bgp, false);
-		} else if (!gr_router_detected &&
-			bgp->present_zebra_gr_state == ZEBRA_GR_ENABLE) {
+		} else if (!gr_router_detected
+			   && bgp->present_zebra_gr_state == ZEBRA_GR_ENABLE) {
 			bgp_zebra_send_capabilities(bgp, true);
 		}
 
@@ -2181,12 +2174,8 @@ DEFUN (no_bgp_deterministic_med,
 }
 
 /* "bgp graceful-restart mode" configuration. */
-DEFUN (bgp_graceful_restart,
-	bgp_graceful_restart_cmd,
-	"bgp graceful-restart",
-	"BGP specific commands\n"
-	GR_CMD
-      )
+DEFUN(bgp_graceful_restart, bgp_graceful_restart_cmd, "bgp graceful-restart",
+      "BGP specific commands\n" GR_CMD)
 {
 	int ret = BGP_GR_FAILURE;
 
@@ -2197,8 +2186,8 @@ DEFUN (bgp_graceful_restart,
 
 	ret = bgp_gr_update_all(bgp, GLOBAL_GR_CMD);
 
-	VTY_BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(bgp,
-				bgp->peer, ret);
+	VTY_BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(bgp, bgp->peer,
+							      ret);
 
 	if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
 		zlog_debug("[BGP_GR] bgp_graceful_restart_cmd : END ");
@@ -2207,13 +2196,8 @@ DEFUN (bgp_graceful_restart,
 	return bgp_vty_return(vty, ret);
 }
 
-DEFUN (no_bgp_graceful_restart,
-	no_bgp_graceful_restart_cmd,
-	"no bgp graceful-restart",
-	NO_STR
-	"BGP specific commands\n"
-	NO_GR_CMD
-      )
+DEFUN(no_bgp_graceful_restart, no_bgp_graceful_restart_cmd,
+      "no bgp graceful-restart", NO_STR "BGP specific commands\n" NO_GR_CMD)
 {
 	VTY_DECLVAR_CONTEXT(bgp, bgp);
 
@@ -2224,8 +2208,8 @@ DEFUN (no_bgp_graceful_restart,
 
 	ret = bgp_gr_update_all(bgp, NO_GLOBAL_GR_CMD);
 
-	VTY_BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(bgp,
-			bgp->peer, ret);
+	VTY_BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(bgp, bgp->peer,
+							      ret);
 
 	if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
 		zlog_debug("[BGP_GR] no_bgp_graceful_restart_cmd : END ");
@@ -2235,13 +2219,13 @@ DEFUN (no_bgp_graceful_restart,
 	return bgp_vty_return(vty, ret);
 }
 
-DEFUN (bgp_graceful_restart_stalepath_time,
-	bgp_graceful_restart_stalepath_time_cmd,
-	"bgp graceful-restart stalepath-time (1-4095)",
-	"BGP specific commands\n"
-	"Graceful restart capability parameters\n"
-	"Set the max time to hold onto restarting peer's stale paths\n"
-	"Delay value (seconds)\n")
+DEFUN(bgp_graceful_restart_stalepath_time,
+      bgp_graceful_restart_stalepath_time_cmd,
+      "bgp graceful-restart stalepath-time (1-4095)",
+      "BGP specific commands\n"
+      "Graceful restart capability parameters\n"
+      "Set the max time to hold onto restarting peer's stale paths\n"
+      "Delay value (seconds)\n")
 {
 	VTY_DECLVAR_CONTEXT(bgp, bgp);
 	int idx_number = 3;
@@ -2252,13 +2236,12 @@ DEFUN (bgp_graceful_restart_stalepath_time,
 	return CMD_SUCCESS;
 }
 
-DEFUN (bgp_graceful_restart_restart_time,
-	bgp_graceful_restart_restart_time_cmd,
-	"bgp graceful-restart restart-time (1-4095)",
-	"BGP specific commands\n"
-	"Graceful restart capability parameters\n"
-	"Set the time to wait to delete stale routes before a BGP open message is received\n"
-	"Delay value (seconds)\n")
+DEFUN(bgp_graceful_restart_restart_time, bgp_graceful_restart_restart_time_cmd,
+      "bgp graceful-restart restart-time (1-4095)",
+      "BGP specific commands\n"
+      "Graceful restart capability parameters\n"
+      "Set the time to wait to delete stale routes before a BGP open message is received\n"
+      "Delay value (seconds)\n")
 {
 	VTY_DECLVAR_CONTEXT(bgp, bgp);
 	int idx_number = 3;
@@ -2269,13 +2252,13 @@ DEFUN (bgp_graceful_restart_restart_time,
 	return CMD_SUCCESS;
 }
 
-DEFUN (bgp_graceful_restart_select_defer_time,
-       bgp_graceful_restart_select_defer_time_cmd,
-       "bgp graceful-restart select-defer-time (0-3600)",
-       "BGP specific commands\n"
-       "Graceful restart capability parameters\n"
-       "Set the time to defer the BGP route selection after restart\n"
-       "Delay value (seconds, 0 - disable)\n")
+DEFUN(bgp_graceful_restart_select_defer_time,
+      bgp_graceful_restart_select_defer_time_cmd,
+      "bgp graceful-restart select-defer-time (0-3600)",
+      "BGP specific commands\n"
+      "Graceful restart capability parameters\n"
+      "Set the time to defer the BGP route selection after restart\n"
+      "Delay value (seconds, 0 - disable)\n")
 {
 	VTY_DECLVAR_CONTEXT(bgp, bgp);
 	int idx_number = 3;
@@ -2291,14 +2274,14 @@ DEFUN (bgp_graceful_restart_select_defer_time,
 	return CMD_SUCCESS;
 }
 
-DEFUN (no_bgp_graceful_restart_stalepath_time,
-	no_bgp_graceful_restart_stalepath_time_cmd,
-	"no bgp graceful-restart stalepath-time [(1-4095)]",
-	NO_STR
-	"BGP specific commands\n"
-	"Graceful restart capability parameters\n"
-	"Set the max time to hold onto restarting peer's stale paths\n"
-	"Delay value (seconds)\n")
+DEFUN(no_bgp_graceful_restart_stalepath_time,
+      no_bgp_graceful_restart_stalepath_time_cmd,
+      "no bgp graceful-restart stalepath-time [(1-4095)]",
+      NO_STR
+      "BGP specific commands\n"
+      "Graceful restart capability parameters\n"
+      "Set the max time to hold onto restarting peer's stale paths\n"
+      "Delay value (seconds)\n")
 {
 	VTY_DECLVAR_CONTEXT(bgp, bgp);
 
@@ -2306,14 +2289,14 @@ DEFUN (no_bgp_graceful_restart_stalepath_time,
 	return CMD_SUCCESS;
 }
 
-DEFUN (no_bgp_graceful_restart_restart_time,
-	no_bgp_graceful_restart_restart_time_cmd,
-	"no bgp graceful-restart restart-time [(1-4095)]",
-	NO_STR
-	"BGP specific commands\n"
-	"Graceful restart capability parameters\n"
-	"Set the time to wait to delete stale routes before a BGP open message is received\n"
-	"Delay value (seconds)\n")
+DEFUN(no_bgp_graceful_restart_restart_time,
+      no_bgp_graceful_restart_restart_time_cmd,
+      "no bgp graceful-restart restart-time [(1-4095)]",
+      NO_STR
+      "BGP specific commands\n"
+      "Graceful restart capability parameters\n"
+      "Set the time to wait to delete stale routes before a BGP open message is received\n"
+      "Delay value (seconds)\n")
 {
 	VTY_DECLVAR_CONTEXT(bgp, bgp);
 
@@ -2321,14 +2304,14 @@ DEFUN (no_bgp_graceful_restart_restart_time,
 	return CMD_SUCCESS;
 }
 
-DEFUN (no_bgp_graceful_restart_select_defer_time,
-       no_bgp_graceful_restart_select_defer_time_cmd,
-       "no bgp graceful-restart select-defer-time [(0-3600)]",
-       NO_STR
-       "BGP specific commands\n"
-       "Graceful restart capability parameters\n"
-       "Set the time to defer the BGP route selection after restart\n"
-       "Delay value (seconds)\n")
+DEFUN(no_bgp_graceful_restart_select_defer_time,
+      no_bgp_graceful_restart_select_defer_time_cmd,
+      "no bgp graceful-restart select-defer-time [(0-3600)]",
+      NO_STR
+      "BGP specific commands\n"
+      "Graceful restart capability parameters\n"
+      "Set the time to defer the BGP route selection after restart\n"
+      "Delay value (seconds)\n")
 {
 	VTY_DECLVAR_CONTEXT(bgp, bgp);
 
@@ -2338,36 +2321,32 @@ DEFUN (no_bgp_graceful_restart_select_defer_time,
 	return CMD_SUCCESS;
 }
 
-DEFUN (bgp_graceful_restart_preserve_fw,
-	bgp_graceful_restart_preserve_fw_cmd,
-	"bgp graceful-restart preserve-fw-state",
-	"BGP specific commands\n"
-	"Graceful restart capability parameters\n"
-	"Sets F-bit indication that fib is preserved while doing Graceful Restart\n")
+DEFUN(bgp_graceful_restart_preserve_fw, bgp_graceful_restart_preserve_fw_cmd,
+      "bgp graceful-restart preserve-fw-state",
+      "BGP specific commands\n"
+      "Graceful restart capability parameters\n"
+      "Sets F-bit indication that fib is preserved while doing Graceful Restart\n")
 {
 	VTY_DECLVAR_CONTEXT(bgp, bgp);
 	bgp_flag_set(bgp, BGP_FLAG_GR_PRESERVE_FWD);
 	return CMD_SUCCESS;
 }
 
-DEFUN (no_bgp_graceful_restart_preserve_fw,
-	no_bgp_graceful_restart_preserve_fw_cmd,
-	"no bgp graceful-restart preserve-fw-state",
-	NO_STR
-	"BGP specific commands\n"
-	"Graceful restart capability parameters\n"
-	"Unsets F-bit indication that fib is preserved while doing Graceful Restart\n")
+DEFUN(no_bgp_graceful_restart_preserve_fw,
+      no_bgp_graceful_restart_preserve_fw_cmd,
+      "no bgp graceful-restart preserve-fw-state",
+      NO_STR
+      "BGP specific commands\n"
+      "Graceful restart capability parameters\n"
+      "Unsets F-bit indication that fib is preserved while doing Graceful Restart\n")
 {
 	VTY_DECLVAR_CONTEXT(bgp, bgp);
 	bgp_flag_unset(bgp, BGP_FLAG_GR_PRESERVE_FWD);
 	return CMD_SUCCESS;
 }
 
-DEFUN (bgp_graceful_restart_disable,
-	bgp_graceful_restart_disable_cmd,
-	"bgp graceful-restart-disable",
-	"BGP specific commands\n"
-	GR_DISABLE)
+DEFUN(bgp_graceful_restart_disable, bgp_graceful_restart_disable_cmd,
+      "bgp graceful-restart-disable", "BGP specific commands\n" GR_DISABLE)
 {
 	int ret = BGP_GR_FAILURE;
 
@@ -2379,25 +2358,20 @@ DEFUN (bgp_graceful_restart_disable,
 
 	ret = bgp_gr_update_all(bgp, GLOBAL_DISABLE_CMD);
 
-	VTY_BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(bgp,
-				bgp->peer, ret);
+	VTY_BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(bgp, bgp->peer,
+							      ret);
 
 	if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
-		zlog_debug(
-			"[BGP_GR] bgp_graceful_restart_disable_cmd : END ");
+		zlog_debug("[BGP_GR] bgp_graceful_restart_disable_cmd : END ");
 	vty_out(vty,
 		"Graceful restart configuration changed, reset all peers to take effect\n");
 
 	return bgp_vty_return(vty, ret);
 }
 
-DEFUN (no_bgp_graceful_restart_disable,
-	no_bgp_graceful_restart_disable_cmd,
-	"no bgp graceful-restart-disable",
-	NO_STR
-	"BGP specific commands\n"
-	NO_GR_DISABLE
-      )
+DEFUN(no_bgp_graceful_restart_disable, no_bgp_graceful_restart_disable_cmd,
+      "no bgp graceful-restart-disable",
+      NO_STR "BGP specific commands\n" NO_GR_DISABLE)
 {
 	VTY_DECLVAR_CONTEXT(bgp, bgp);
 
@@ -2409,8 +2383,8 @@ DEFUN (no_bgp_graceful_restart_disable,
 
 	ret = bgp_gr_update_all(bgp, NO_GLOBAL_DISABLE_CMD);
 
-	VTY_BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(bgp,
-				bgp->peer, ret);
+	VTY_BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(bgp, bgp->peer,
+							      ret);
 
 	if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
 		zlog_debug(
@@ -2421,13 +2395,9 @@ DEFUN (no_bgp_graceful_restart_disable,
 	return bgp_vty_return(vty, ret);
 }
 
-DEFUN (bgp_neighbor_graceful_restart_set,
-	bgp_neighbor_graceful_restart_set_cmd,
-	"neighbor <A.B.C.D|X:X::X:X|WORD> graceful-restart",
-	NEIGHBOR_STR
-	NEIGHBOR_ADDR_STR2
-	GR_NEIGHBOR_CMD
-      )
+DEFUN(bgp_neighbor_graceful_restart_set, bgp_neighbor_graceful_restart_set_cmd,
+      "neighbor <A.B.C.D|X:X::X:X|WORD> graceful-restart",
+      NEIGHBOR_STR NEIGHBOR_ADDR_STR2 GR_NEIGHBOR_CMD)
 {
 	int idx_peer = 1;
 	struct peer *peer;
@@ -2457,14 +2427,10 @@ DEFUN (bgp_neighbor_graceful_restart_set,
 	return bgp_vty_return(vty, ret);
 }
 
-DEFUN (no_bgp_neighbor_graceful_restart,
-	no_bgp_neighbor_graceful_restart_set_cmd,
-	"no neighbor <A.B.C.D|X:X::X:X|WORD> graceful-restart",
-	NO_STR
-	NEIGHBOR_STR
-	NEIGHBOR_ADDR_STR2
-	NO_GR_NEIGHBOR_CMD
-      )
+DEFUN(no_bgp_neighbor_graceful_restart,
+      no_bgp_neighbor_graceful_restart_set_cmd,
+      "no neighbor <A.B.C.D|X:X::X:X|WORD> graceful-restart",
+      NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 NO_GR_NEIGHBOR_CMD)
 {
 	int idx_peer = 2;
 	int ret = BGP_GR_FAILURE;
@@ -2494,13 +2460,10 @@ DEFUN (no_bgp_neighbor_graceful_restart,
 	return bgp_vty_return(vty, ret);
 }
 
-DEFUN (bgp_neighbor_graceful_restart_helper_set,
-	bgp_neighbor_graceful_restart_helper_set_cmd,
-	"neighbor <A.B.C.D|X:X::X:X|WORD> graceful-restart-helper",
-	NEIGHBOR_STR
-	NEIGHBOR_ADDR_STR2
-	GR_NEIGHBOR_HELPER_CMD
-      )
+DEFUN(bgp_neighbor_graceful_restart_helper_set,
+      bgp_neighbor_graceful_restart_helper_set_cmd,
+      "neighbor <A.B.C.D|X:X::X:X|WORD> graceful-restart-helper",
+      NEIGHBOR_STR NEIGHBOR_ADDR_STR2 GR_NEIGHBOR_HELPER_CMD)
 {
 	int idx_peer = 1;
 	struct peer *peer;
@@ -2532,14 +2495,10 @@ DEFUN (bgp_neighbor_graceful_restart_helper_set,
 	return bgp_vty_return(vty, ret);
 }
 
-DEFUN (no_bgp_neighbor_graceful_restart_helper,
-	no_bgp_neighbor_graceful_restart_helper_set_cmd,
-	"no neighbor <A.B.C.D|X:X::X:X|WORD> graceful-restart-helper",
-	NO_STR
-	NEIGHBOR_STR
-	NEIGHBOR_ADDR_STR2
-	NO_GR_NEIGHBOR_HELPER_CMD
-      )
+DEFUN(no_bgp_neighbor_graceful_restart_helper,
+      no_bgp_neighbor_graceful_restart_helper_set_cmd,
+      "no neighbor <A.B.C.D|X:X::X:X|WORD> graceful-restart-helper",
+      NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 NO_GR_NEIGHBOR_HELPER_CMD)
 {
 	int idx_peer = 2;
 	int ret = BGP_GR_FAILURE;
@@ -2555,8 +2514,7 @@ DEFUN (no_bgp_neighbor_graceful_restart_helper,
 		zlog_debug(
 			"[BGP_GR] no_bgp_neighbor_graceful_restart_helper_set_cmd : START ");
 
-	ret = bgp_neighbor_graceful_restart(peer,
-			NO_PEER_HELPER_CMD);
+	ret = bgp_neighbor_graceful_restart(peer, NO_PEER_HELPER_CMD);
 
 	VTY_BGP_GR_ROUTER_DETECT(bgp, peer, peer->bgp->peer);
 	VTY_SEND_BGP_GR_CAPABILITY_TO_ZEBRA(peer->bgp, ret);
@@ -2570,13 +2528,10 @@ DEFUN (no_bgp_neighbor_graceful_restart_helper,
 	return bgp_vty_return(vty, ret);
 }
 
-DEFUN (bgp_neighbor_graceful_restart_disable_set,
-	bgp_neighbor_graceful_restart_disable_set_cmd,
-	"neighbor <A.B.C.D|X:X::X:X|WORD> graceful-restart-disable",
-	NEIGHBOR_STR
-	NEIGHBOR_ADDR_STR2
-	GR_NEIGHBOR_DISABLE_CMD
-      )
+DEFUN(bgp_neighbor_graceful_restart_disable_set,
+      bgp_neighbor_graceful_restart_disable_set_cmd,
+      "neighbor <A.B.C.D|X:X::X:X|WORD> graceful-restart-disable",
+      NEIGHBOR_STR NEIGHBOR_ADDR_STR2 GR_NEIGHBOR_DISABLE_CMD)
 {
 	int idx_peer = 1;
 	struct peer *peer;
@@ -2592,8 +2547,7 @@ DEFUN (bgp_neighbor_graceful_restart_disable_set,
 	if (!peer)
 		return CMD_WARNING_CONFIG_FAILED;
 
-	ret = bgp_neighbor_graceful_restart(peer,
-				PEER_DISABLE_CMD);
+	ret = bgp_neighbor_graceful_restart(peer, PEER_DISABLE_CMD);
 
 	if (peer->bgp->t_startup)
 		bgp_peer_gr_flags_update(peer);
@@ -2610,14 +2564,10 @@ DEFUN (bgp_neighbor_graceful_restart_disable_set,
 	return bgp_vty_return(vty, ret);
 }
 
-DEFUN (no_bgp_neighbor_graceful_restart_disable,
-	no_bgp_neighbor_graceful_restart_disable_set_cmd,
-	"no neighbor <A.B.C.D|X:X::X:X|WORD> graceful-restart-disable",
-	NO_STR
-	NEIGHBOR_STR
-	NEIGHBOR_ADDR_STR2
-	NO_GR_NEIGHBOR_DISABLE_CMD
-      )
+DEFUN(no_bgp_neighbor_graceful_restart_disable,
+      no_bgp_neighbor_graceful_restart_disable_set_cmd,
+      "no neighbor <A.B.C.D|X:X::X:X|WORD> graceful-restart-disable",
+      NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 NO_GR_NEIGHBOR_DISABLE_CMD)
 {
 	int idx_peer = 2;
 	int ret = BGP_GR_FAILURE;
@@ -2647,12 +2597,12 @@ DEFUN (no_bgp_neighbor_graceful_restart_disable,
 	return bgp_vty_return(vty, ret);
 }
 
-DEFUN_HIDDEN (bgp_graceful_restart_disable_eor,
-              bgp_graceful_restart_disable_eor_cmd,
-              "bgp graceful-restart disable-eor",
-              "BGP specific commands\n"
-              "Graceful restart configuration parameters\n"
-              "Disable EOR Check\n")
+DEFUN_HIDDEN(bgp_graceful_restart_disable_eor,
+	     bgp_graceful_restart_disable_eor_cmd,
+	     "bgp graceful-restart disable-eor",
+	     "BGP specific commands\n"
+	     "Graceful restart configuration parameters\n"
+	     "Disable EOR Check\n")
 {
 	VTY_DECLVAR_CONTEXT(bgp, bgp);
 	bgp_flag_set(bgp, BGP_FLAG_GR_DISABLE_EOR);
@@ -2660,13 +2610,13 @@ DEFUN_HIDDEN (bgp_graceful_restart_disable_eor,
 	return CMD_SUCCESS;
 }
 
-DEFUN_HIDDEN (no_bgp_graceful_restart_disable_eor,
-              no_bgp_graceful_restart_disable_eor_cmd,
-              "no bgp graceful-restart disable-eor",
-              NO_STR
-              "BGP specific commands\n"
-              "Graceful restart configuration parameters\n"
-              "Disable EOR Check\n")
+DEFUN_HIDDEN(no_bgp_graceful_restart_disable_eor,
+	     no_bgp_graceful_restart_disable_eor_cmd,
+	     "no bgp graceful-restart disable-eor",
+	     NO_STR
+	     "BGP specific commands\n"
+	     "Graceful restart configuration parameters\n"
+	     "Disable EOR Check\n")
 {
 	VTY_DECLVAR_CONTEXT(bgp, bgp);
 	bgp_flag_unset(bgp, BGP_FLAG_GR_DISABLE_EOR);
@@ -2674,13 +2624,13 @@ DEFUN_HIDDEN (no_bgp_graceful_restart_disable_eor,
 	return CMD_SUCCESS;
 }
 
-DEFUN (bgp_graceful_restart_rib_stale_time,
-       bgp_graceful_restart_rib_stale_time_cmd,
-       "bgp graceful-restart rib-stale-time (1-3600)",
-       "BGP specific commands\n"
-       "Graceful restart configuration parameters\n"
-       "Specify the stale route removal timer in rib\n"
-       "Delay value (seconds)\n")
+DEFUN(bgp_graceful_restart_rib_stale_time,
+      bgp_graceful_restart_rib_stale_time_cmd,
+      "bgp graceful-restart rib-stale-time (1-3600)",
+      "BGP specific commands\n"
+      "Graceful restart configuration parameters\n"
+      "Specify the stale route removal timer in rib\n"
+      "Delay value (seconds)\n")
 {
 	VTY_DECLVAR_CONTEXT(bgp, bgp);
 	int idx_number = 3;
@@ -2695,14 +2645,14 @@ DEFUN (bgp_graceful_restart_rib_stale_time,
 	return CMD_SUCCESS;
 }
 
-DEFUN (no_bgp_graceful_restart_rib_stale_time,
-       no_bgp_graceful_restart_rib_stale_time_cmd,
-       "no bgp graceful-restart rib-stale-time [(1-3600)]",
-       NO_STR
-       "BGP specific commands\n"
-       "Graceful restart configuration parameters\n"
-       "Specify the stale route removal timer in rib\n"
-       "Delay value (seconds)\n")
+DEFUN(no_bgp_graceful_restart_rib_stale_time,
+      no_bgp_graceful_restart_rib_stale_time_cmd,
+      "no bgp graceful-restart rib-stale-time [(1-3600)]",
+      NO_STR
+      "BGP specific commands\n"
+      "Graceful restart configuration parameters\n"
+      "Specify the stale route removal timer in rib\n"
+      "Delay value (seconds)\n")
 {
 	VTY_DECLVAR_CONTEXT(bgp, bgp);
 
@@ -9454,20 +9404,19 @@ static void bgp_show_peer_afi_orf_cap(struct vty *vty, struct peer *p,
 	}
 }
 
-static void bgp_show_neighnor_graceful_restart_rbit(
-						struct vty *vty,
-						struct peer *p,
-						bool use_json,
-						json_object *json)
+static void bgp_show_neighnor_graceful_restart_rbit(struct vty *vty,
+						    struct peer *p,
+						    bool use_json,
+						    json_object *json)
 {
 	bool rbit_status = 0;
 
 	if (!use_json)
 		vty_out(vty, "\n    R bit          : ");
 
-	if (CHECK_FLAG(p->cap, PEER_CAP_RESTART_ADV) &&
-		(CHECK_FLAG(p->cap, PEER_CAP_RESTART_RCV)) &&
-		(p->status == Established)) {
+	if (CHECK_FLAG(p->cap, PEER_CAP_RESTART_ADV)
+	    && (CHECK_FLAG(p->cap, PEER_CAP_RESTART_RCV))
+	    && (p->status == Established)) {
 
 		if (CHECK_FLAG(p->cap, PEER_CAP_RESTART_BIT_RCV))
 			rbit_status = 1;
@@ -9477,62 +9426,57 @@ static void bgp_show_neighnor_graceful_restart_rbit(
 
 	if (rbit_status) {
 		if (use_json)
-			json_object_boolean_true_add(
-					json, "rBit");
+			json_object_boolean_true_add(json, "rBit");
 		else
 			vty_out(vty, "True\n");
 	} else {
 		if (use_json)
-			json_object_boolean_false_add(
-					json, "rBit");
+			json_object_boolean_false_add(json, "rBit");
 		else
 			vty_out(vty, "False\n");
 	}
 }
 
-static void bgp_show_neighbor_graceful_restart_remote_mode(
-						struct vty *vty,
-						struct peer *peer,
-						bool use_json,
-						json_object *json)
+static void bgp_show_neighbor_graceful_restart_remote_mode(struct vty *vty,
+							   struct peer *peer,
+							   bool use_json,
+							   json_object *json)
 {
 	const char *mode = "NotApplicable";
 
 	if (!use_json)
 		vty_out(vty, "\n    Remote GR Mode : ");
 
-	if (CHECK_FLAG(peer->cap, PEER_CAP_RESTART_ADV) &&
-		(peer->status == Established)) {
+	if (CHECK_FLAG(peer->cap, PEER_CAP_RESTART_ADV)
+	    && (peer->status == Established)) {
 
-		if ((peer->nsf_af_count == 0) &&
-			!CHECK_FLAG(peer->cap, PEER_CAP_RESTART_RCV)) {
+		if ((peer->nsf_af_count == 0)
+		    && !CHECK_FLAG(peer->cap, PEER_CAP_RESTART_RCV)) {
 
 			mode = "Disable";
 
-		} else if (peer->nsf_af_count == 0 &&
-			CHECK_FLAG(peer->cap, PEER_CAP_RESTART_RCV)) {
+		} else if (peer->nsf_af_count == 0
+			   && CHECK_FLAG(peer->cap, PEER_CAP_RESTART_RCV)) {
 
 			mode = "Helper";
 
-		} else if (peer->nsf_af_count != 0 &&
-			CHECK_FLAG(peer->cap, PEER_CAP_RESTART_RCV)) {
+		} else if (peer->nsf_af_count != 0
+			   && CHECK_FLAG(peer->cap, PEER_CAP_RESTART_RCV)) {
 
 			mode = "Restart";
-
 		}
 	}
 
 	if (use_json) {
-		json_object_string_add(json,
-				"remoteGrMode", mode);
+		json_object_string_add(json, "remoteGrMode", mode);
 	} else
 		vty_out(vty, mode, "\n");
 }
 
-static void  bgp_show_neighbor_graceful_restart_local_mode(struct vty *vty,
-						struct peer *p,
-						bool use_json,
-						json_object *json)
+static void bgp_show_neighbor_graceful_restart_local_mode(struct vty *vty,
+							  struct peer *p,
+							  bool use_json,
+							  json_object *json)
 {
 	const char *mode = "Invalid";
 
@@ -9557,16 +9501,14 @@ static void  bgp_show_neighbor_graceful_restart_local_mode(struct vty *vty,
 	}
 
 	if (use_json) {
-		json_object_string_add(json,
-				"localGrMode", mode);
+		json_object_string_add(json, "localGrMode", mode);
 	} else {
 		vty_out(vty, mode, "\n");
 	}
 }
 
-static void  bgp_show_neighbor_graceful_restart_capability_per_afi_safi(
-					struct vty *vty, struct peer *peer,
-					bool use_json, json_object *json)
+static void bgp_show_neighbor_graceful_restart_capability_per_afi_safi(
+	struct vty *vty, struct peer *peer, bool use_json, json_object *json)
 {
 	afi_t afi;
 	safi_t safi;
@@ -9578,68 +9520,64 @@ static void  bgp_show_neighbor_graceful_restart_capability_per_afi_safi(
 	for (afi = AFI_IP; afi < AFI_MAX; afi++) {
 		for (safi = SAFI_UNICAST; safi <= SAFI_MPLS_VPN; safi++) {
 			if (peer->afc[afi][safi]
-				&& CHECK_FLAG(peer->cap, PEER_CAP_RESTART_ADV)
-				&& CHECK_FLAG(peer->cap, PEER_CAP_RESTART_RCV)
-				) {
+			    && CHECK_FLAG(peer->cap, PEER_CAP_RESTART_ADV)
+			    && CHECK_FLAG(peer->cap, PEER_CAP_RESTART_RCV)) {
 				if (use_json) {
 					json_afi_safi =
 						json_object_new_object();
 					json_endofrib_status =
 						json_object_new_object();
-					json_timer =
-						json_object_new_object();
+					json_timer = json_object_new_object();
 				}
 
-				if (peer->eor_stime[afi][safi] >=
-				    peer->pkt_stime[afi][safi])
+				if (peer->eor_stime[afi][safi]
+				    >= peer->pkt_stime[afi][safi])
 					eor_flag = true;
 				else
 					eor_flag = false;
 
 				if (!use_json) {
 					vty_out(vty, "    %s :\n",
-					get_afi_safi_str(afi, safi, false));
+						get_afi_safi_str(afi, safi,
+								 false));
 
 					vty_out(vty,
-					"     F bit                 : ");
+						"     F bit                 : ");
 				} else
 					get_afi_safi_str(afi, safi, true);
 
 				if (peer->nsf[afi][safi]
-					&& CHECK_FLAG(
-					peer->af_cap[afi][safi],
-					PEER_CAP_RESTART_AF_PRESERVE_RCV)) {
+				    && CHECK_FLAG(
+					    peer->af_cap[afi][safi],
+					    PEER_CAP_RESTART_AF_PRESERVE_RCV)) {
 
 					if (use_json) {
 						json_object_boolean_true_add(
-						json_afi_safi, "fBit");
+							json_afi_safi, "fBit");
 					} else {
-						vty_out(vty,
-							"True\n");
+						vty_out(vty, "True\n");
 					}
 
 				} else {
 
 					if (use_json) {
 						json_object_boolean_false_add(
-						json_afi_safi, "fBit");
+							json_afi_safi, "fBit");
 					} else {
-						vty_out(vty,
-							"False\n");
+						vty_out(vty, "False\n");
 					}
-
 				}
 
 				if (!use_json)
 					vty_out(vty,
-					"     End-of-RIB Received   : ");
+						"     End-of-RIB Received   : ");
 
 				if (CHECK_FLAG(peer->af_sflags[afi][safi],
-						PEER_STATUS_EOR_RECEIVED)) {
+					       PEER_STATUS_EOR_RECEIVED)) {
 
 					if (use_json) {
 						json_object_boolean_true_add(
-						json_endofrib_status,
+							json_endofrib_status,
 							"endOfRibRecv");
 					} else {
 						vty_out(vty, "Yes\n");
@@ -9648,7 +9586,7 @@ static void  bgp_show_neighbor_graceful_restart_capability_per_afi_safi(
 				} else {
 					if (use_json) {
 						json_object_boolean_false_add(
-						json_endofrib_status,
+							json_endofrib_status,
 							"endOfRibRecv");
 					} else {
 						vty_out(vty, "No\n");
@@ -9657,77 +9595,82 @@ static void  bgp_show_neighbor_graceful_restart_capability_per_afi_safi(
 
 				if (!use_json)
 					vty_out(vty,
-					"     End-of-RIB Send       : ");
+						"     End-of-RIB Send       : ");
 
 				if (CHECK_FLAG(peer->af_sflags[afi][safi],
-						PEER_STATUS_EOR_SEND)) {
+					       PEER_STATUS_EOR_SEND)) {
 					if (use_json) {
 						json_object_boolean_true_add(
-						json_endofrib_status,
-							 "endOfRibSend");
+							json_endofrib_status,
+							"endOfRibSend");
 
 						PRINT_EOR_JSON(eor_flag);
 					} else {
 						vty_out(vty, "Yes\n");
 						vty_out(vty,
-						"     EoRSentAfterUpdate   : ");
+							"     EoRSentAfterUpdate   : ");
 
 						PRINT_EOR(eor_flag);
 					}
 				} else {
 					if (use_json) {
 						json_object_boolean_false_add(
-						json_endofrib_status,
+							json_endofrib_status,
 							"endOfRibSend");
 						json_object_boolean_false_add(
-						json_endofrib_status,
-						 "endOfRibSentAfterUpdate");
+							json_endofrib_status,
+							"endOfRibSentAfterUpdate");
 					} else {
 						vty_out(vty, "No\n");
 						vty_out(vty,
-						"     EoRSentAfterUpdate   : ");
+							"     EoRSentAfterUpdate   : ");
 						vty_out(vty, "No\n");
 					}
 				}
 
 				if (use_json) {
 
-					json_object_int_add(json_timer,
-						"stalePathTimer",
+					json_object_int_add(
+						json_timer, "stalePathTimer",
 						peer->bgp->stalepath_time);
 
 					if (peer->t_gr_stale != NULL) {
 
 						json_object_int_add(
-						json_timer,
-						"stalePathTimerRemaining",
-						thread_timer_remain_second(
-						peer->t_gr_stale));
+							json_timer,
+							"stalePathTimerRemaining",
+							thread_timer_remain_second(
+								peer->t_gr_stale));
 					}
 
 					/* Display Configured Selection
 					 * Deferral only when when
 					 * Gr mode is enabled.
 					 */
-					if (CHECK_FLAG(peer->flags,
-						PEER_FLAG_GRACEFUL_RESTART)) {
+					if (CHECK_FLAG(
+						    peer->flags,
+						    PEER_FLAG_GRACEFUL_RESTART)) {
 
 						json_object_int_add(
-						json_timer,
-						"selectionDeferralTimer",
-						peer->bgp->stalepath_time);
+							json_timer,
+							"selectionDeferralTimer",
+							peer->bgp
+								->stalepath_time);
 					}
 
 					if (peer->bgp->gr_info[afi][safi]
-						.t_select_deferral != NULL) {
+						    .t_select_deferral
+					    != NULL) {
 
 						json_object_int_add(
-						json_timer,
-						"selectionDeferralTimerRemaining",
-						thread_timer_remain_second(
-						peer->bgp
-						->gr_info[afi][safi]
-						.t_select_deferral));
+							json_timer,
+							"selectionDeferralTimerRemaining",
+							thread_timer_remain_second(
+								peer->bgp
+									->gr_info
+										[afi]
+										[safi]
+									.t_select_deferral));
 					}
 
 				} else {
@@ -9736,109 +9679,106 @@ static void  bgp_show_neighbor_graceful_restart_capability_per_afi_safi(
 
 					vty_out(vty, "%*s", 6, "");
 					vty_out(vty,
-					"Configured Stale Path Time(sec)%*s: %u\n",
+						"Configured Stale Path Time(sec)%*s: %u\n",
 						8, "",
-					peer->bgp->stalepath_time);
+						peer->bgp->stalepath_time);
 
 					if (peer->t_gr_stale != NULL) {
 						vty_out(vty, "%*s", 6, "");
 						vty_out(vty,
-						"Stale Path Remaining(sec)%*s: %ld\n",
-						14, "",
-						thread_timer_remain_second(
-						peer->t_gr_stale));
+							"Stale Path Remaining(sec)%*s: %ld\n",
+							14, "",
+							thread_timer_remain_second(
+								peer->t_gr_stale));
 					}
 					/* Display Configured Selection
 					 * Deferral only when when
 					 * Gr mode is enabled.
 					 */
-					if (CHECK_FLAG(peer->flags,
-						PEER_FLAG_GRACEFUL_RESTART)) {
+					if (CHECK_FLAG(
+						    peer->flags,
+						    PEER_FLAG_GRACEFUL_RESTART)) {
 						vty_out(vty, "%*s", 6, "");
 						vty_out(vty,
-						"Configured Selection Deferral Time(sec): %u\n",
-						peer->bgp->select_defer_time);
+							"Configured Selection Deferral Time(sec): %u\n",
+							peer->bgp
+								->select_defer_time);
 					}
 
-					if (peer->bgp
-						->gr_info[afi][safi]
-						.t_select_deferral != NULL) {
+					if (peer->bgp->gr_info[afi][safi]
+						    .t_select_deferral
+					    != NULL) {
 
 						vty_out(vty, "%*s", 6, "");
 						vty_out(vty,
-						"Selection Deferral Time Remaining(sec) : %ld\n",
-						thread_timer_remain_second(
-						peer->bgp
-						->gr_info[afi][safi]
-						.t_select_deferral));
+							"Selection Deferral Time Remaining(sec) : %ld\n",
+							thread_timer_remain_second(
+								peer->bgp
+									->gr_info
+										[afi]
+										[safi]
+									.t_select_deferral));
 					}
-
 				}
 				if (use_json) {
+					json_object_object_add(
+						json_afi_safi, "endOfRibStatus",
+						json_endofrib_status);
 					json_object_object_add(json_afi_safi,
-							"endOfRibStatus",
-							 json_endofrib_status);
-					json_object_object_add(json_afi_safi,
-							"timers",
-							 json_timer);
-					json_object_object_add(json,
-						get_afi_safi_str(afi, safi, true),
-							 json_afi_safi);
+							       "timers",
+							       json_timer);
+					json_object_object_add(
+						json,
+						get_afi_safi_str(afi, safi,
+								 true),
+						json_afi_safi);
 				}
 			}
 		}
 	}
 }
 
-static void  bgp_show_neighbor_graceful_restart_time(struct vty *vty,
-							struct peer *p,
-							bool use_json,
-							json_object *json)
+static void bgp_show_neighbor_graceful_restart_time(struct vty *vty,
+						    struct peer *p,
+						    bool use_json,
+						    json_object *json)
 {
 	if (use_json) {
 		json_object *json_timer = NULL;
 
 		json_timer = json_object_new_object();
 
-		json_object_int_add(json_timer,
-					"configuredRestartTimer",
-					p->bgp->restart_time);
+		json_object_int_add(json_timer, "configuredRestartTimer",
+				    p->bgp->restart_time);
 
-		json_object_int_add(json_timer,
-					"receivedRestartTimer",
-					p->v_gr_restart);
+		json_object_int_add(json_timer, "receivedRestartTimer",
+				    p->v_gr_restart);
 
 		if (p->t_gr_restart != NULL) {
-			json_object_int_add(json_timer,
-					"restartTimerRemaining",
-					thread_timer_remain_second(
-					p->t_gr_restart)
-					);
+			json_object_int_add(
+				json_timer, "restartTimerRemaining",
+				thread_timer_remain_second(p->t_gr_restart));
 		}
 
 		json_object_object_add(json, "timers", json_timer);
 	} else {
 
 		vty_out(vty, "    Timers :\n");
-		vty_out(vty,
-			"     Configured Restart Time(sec)  : %u\n",
-				p->bgp->restart_time);
+		vty_out(vty, "     Configured Restart Time(sec)  : %u\n",
+			p->bgp->restart_time);
 
-		vty_out(vty,
-			"     Received Restart Time(sec)    : %u\n",
-					p->v_gr_restart);
+		vty_out(vty, "     Received Restart Time(sec)    : %u\n",
+			p->v_gr_restart);
 		if (p->t_gr_restart != NULL) {
 			vty_out(vty,
-			"     Restart Time Remaining(sec)   : %ld\n",
-				thread_timer_remain_second(
-					p->t_gr_restart));
+				"     Restart Time Remaining(sec)   : %ld\n",
+				thread_timer_remain_second(p->t_gr_restart));
 		}
 	}
 }
 
 static void bgp_show_peer_gr_status(struct vty *vty, struct peer *p,
-					bool use_json,
-					json_object *json)
+				    bool use_json, json_object *json)
 {
 	char buf[SU_ADDRSTRLEN] = {0};
 	char dn_flag[2] = {0};
@@ -9849,14 +9789,14 @@ static void bgp_show_peer_gr_status(struct vty *vty, struct peer *p,
 
 	if (p->conf_if) {
 		if (use_json)
-			json_object_string_add(json, "neighborAddr",
+			json_object_string_add(
+				json, "neighborAddr",
 				BGP_PEER_SU_UNSPEC(p)
-				? "none"
-				: sockunion2str(&p->su, buf,
-					SU_ADDRSTRLEN));
+					? "none"
+					: sockunion2str(&p->su, buf,
+							SU_ADDRSTRLEN));
 		else
-			vty_out(vty, "BGP neighbor on %s: %s\n",
-				p->conf_if,
+			vty_out(vty, "BGP neighbor on %s: %s\n", p->conf_if,
 				BGP_PEER_SU_UNSPEC(p)
 					? "none"
 					: sockunion2str(&p->su, buf,
@@ -9865,12 +9805,10 @@ static void bgp_show_peer_gr_status(struct vty *vty, struct peer *p,
 		sprintf(neighborAddr, "%s%s", dn_flag, p->host);
 
 		if (use_json)
-			json_object_string_add(
-				json, "neighborAddr",
-				neighborAddr);
+			json_object_string_add(json, "neighborAddr",
+					       neighborAddr);
 		else
-			vty_out(vty, "BGP neighbor is %s\n",
-				neighborAddr);
+			vty_out(vty, "BGP neighbor is %s\n", neighborAddr);
 	}
 
 	/* more gr info in new format */
@@ -10192,8 +10130,7 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
 					p->pmax_restart[afi][safi] * 60000);
 		}
 		json_object_object_add(json_neigh,
-					get_afi_safi_str(afi,
-						safi, true),
+				       get_afi_safi_str(afi, safi, true),
 				       json_addr);
 
 	} else {
@@ -11649,11 +11586,11 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
 			json_grace_send = json_object_new_object();
 			json_grace_recv = json_object_new_object();
 
-			if ((p->status == Established) &&
-					CHECK_FLAG(p->cap, PEER_CAP_RESTART_RCV)) {
+			if ((p->status == Established)
+			    && CHECK_FLAG(p->cap, PEER_CAP_RESTART_RCV)) {
 				FOREACH_AFI_SAFI (afi, safi) {
 					if (CHECK_FLAG(p->af_sflags[afi][safi],
-						PEER_STATUS_EOR_SEND)) {
+						       PEER_STATUS_EOR_SEND)) {
 						json_object_boolean_true_add(
 							json_grace_send,
 							get_afi_safi_str(afi,
@@ -11664,8 +11601,8 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
 				}
 				FOREACH_AFI_SAFI (afi, safi) {
 					if (CHECK_FLAG(
-						p->af_sflags[afi][safi],
-						PEER_STATUS_EOR_RECEIVED)) {
+						    p->af_sflags[afi][safi],
+						    PEER_STATUS_EOR_RECEIVED)) {
 						json_object_boolean_true_add(
 							json_grace_recv,
 							get_afi_safi_str(afi,
@@ -11675,12 +11612,10 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
 					}
 				}
 			}
-			json_object_object_add(json_grace,
-						"endOfRibSend",
-							json_grace_send);
-			json_object_object_add(json_grace,
-						"endOfRibRecv",
-						json_grace_recv);
+			json_object_object_add(json_grace, "endOfRibSend",
+					       json_grace_send);
+			json_object_object_add(json_grace, "endOfRibRecv",
+					       json_grace_recv);
 
 
 			if (p->t_gr_restart)
@@ -11699,13 +11634,13 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
 						* 1000);
 			/* more gr info in new format */
 			BGP_SHOW_PEER_GR_CAPABILITY(vty, p, use_json,
-							json_grace);
+						    json_grace);
 			json_object_object_add(
 				json_neigh, "gracefulRestartInfo", json_grace);
 		} else {
 			vty_out(vty, "  Graceful restart informations:\n");
-			if ((p->status == Established) &&
-				CHECK_FLAG(p->cap, PEER_CAP_RESTART_RCV)) {
+			if ((p->status == Established)
+			    && CHECK_FLAG(p->cap, PEER_CAP_RESTART_RCV)) {
 
 				vty_out(vty, "    End-of-RIB send: ");
 				FOREACH_AFI_SAFI (afi, safi) {
@@ -11714,9 +11649,9 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
 						vty_out(vty, "%s%s",
 							eor_send_af_count ? ", "
 									  : "",
-							get_afi_safi_str(afi,
-									safi,
-									false));
+							get_afi_safi_str(
+								afi, safi,
+								false));
 						eor_send_af_count++;
 					}
 				}
@@ -12168,12 +12103,11 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
 	}
 }
 
-static int bgp_show_neighbor_graceful_restart(struct vty *vty,
-					struct bgp *bgp,
-					enum show_type type,
-					union sockunion *su,
-					const char *conf_if, afi_t afi,
-					bool use_json, json_object *json)
+static int bgp_show_neighbor_graceful_restart(struct vty *vty, struct bgp *bgp,
+					      enum show_type type,
+					      union sockunion *su,
+					      const char *conf_if, afi_t afi,
+					      bool use_json, json_object *json)
 {
 	struct listnode *node, *nnode;
 	struct peer *peer;
@@ -12194,34 +12128,34 @@ static int bgp_show_neighbor_graceful_restart(struct vty *vty,
 
 		if (type == show_all) {
 			bgp_show_peer_gr_status(vty, peer, use_json,
-							json_neighbor);
+						json_neighbor);
 
 			if (use_json)
-				json_object_object_add(json,
-						peer->host, json_neighbor);
+				json_object_object_add(json, peer->host,
+						       json_neighbor);
 
 		} else if (type == show_peer) {
 			if (conf_if) {
 				if ((peer->conf_if
-					&& !strcmp(peer->conf_if, conf_if))
-					|| (peer->hostname
+				     && !strcmp(peer->conf_if, conf_if))
+				    || (peer->hostname
 					&& !strcmp(peer->hostname, conf_if))) {
 					find = 1;
-					bgp_show_peer_gr_status(vty,
-						peer, use_json,
-						json_neighbor);
+					bgp_show_peer_gr_status(vty, peer,
+								use_json,
+								json_neighbor);
 				}
 			} else {
 				if (sockunion_same(&peer->su, su)) {
 					find = 1;
-					bgp_show_peer_gr_status(vty,
-						peer, use_json,
-						json_neighbor);
+					bgp_show_peer_gr_status(vty, peer,
+								use_json,
+								json_neighbor);
 				}
 			}
 			if (use_json && find) {
-				json_object_object_add(json,
-						peer->host, json_neighbor);
+				json_object_object_add(json, peer->host,
+						       json_neighbor);
 			}
 		}
 
@@ -12231,14 +12165,14 @@ static int bgp_show_neighbor_graceful_restart(struct vty *vty,
 
 	if (type == show_peer && !find) {
 		if (use_json)
-			json_object_boolean_true_add(json,
-							"bgpNoSuchNeighbor");
+			json_object_boolean_true_add(json, "bgpNoSuchNeighbor");
 		else
 			vty_out(vty, "%% No such neighbor\n");
 	}
 	if (use_json) {
-		vty_out(vty, "%s\n", json_object_to_json_string_ext(
-					     json, JSON_C_TO_STRING_PRETTY));
+		vty_out(vty, "%s\n",
+			json_object_to_json_string_ext(
+				json, JSON_C_TO_STRING_PRETTY));
 	} else {
 		vty_out(vty, "\n");
 	}
@@ -12351,9 +12285,10 @@ static int bgp_show_neighbor(struct vty *vty, struct bgp *bgp,
 	return CMD_SUCCESS;
 }
 
-static void  bgp_show_neighbor_graceful_restart_vty(struct vty *vty,
-				 enum show_type type, const char *ip_str,
-				 afi_t afi, bool use_json)
+static void bgp_show_neighbor_graceful_restart_vty(struct vty *vty,
+						   enum show_type type,
+						   const char *ip_str,
+						   afi_t afi, bool use_json)
 {
 
 	int ret;
@@ -12366,29 +12301,28 @@ static void  bgp_show_neighbor_graceful_restart_vty(struct vty *vty,
 	if (bgp) {
 
 		if (!use_json) {
-			bgp_show_global_graceful_restart_mode_vty(vty, bgp,
-						use_json, NULL);
+			bgp_show_global_graceful_restart_mode_vty(
+				vty, bgp, use_json, NULL);
 		}
 
 		json = json_object_new_object();
 		if (ip_str) {
 			ret = str2sockunion(ip_str, &su);
 			if (ret < 0)
-				bgp_show_neighbor_graceful_restart(vty,
-					bgp, type, NULL, ip_str,
-					afi, use_json, json);
+				bgp_show_neighbor_graceful_restart(
+					vty, bgp, type, NULL, ip_str, afi,
+					use_json, json);
 			else
-				bgp_show_neighbor_graceful_restart(vty,
-					bgp, type, &su, NULL,
-					afi, use_json, json);
-		} else {
-			bgp_show_neighbor_graceful_restart(vty, bgp,
-					type, NULL, NULL, afi,
+				bgp_show_neighbor_graceful_restart(
+					vty, bgp, type, &su, NULL, afi,
 					use_json, json);
+		} else {
+			bgp_show_neighbor_graceful_restart(vty, bgp, type, NULL,
+							   NULL, afi, use_json,
+							   json);
 		}
 		json_object_free(json);
 	}
-
 }
 
 static void bgp_show_all_instances_neighbors_vty(struct vty *vty,
@@ -12529,21 +12463,14 @@ static int bgp_show_neighbor_vty(struct vty *vty, const char *name,
 }
 
 
-
 /* "show [ip] bgp neighbors graceful-restart" commands.  */
-DEFUN (show_ip_bgp_neighbors_gracrful_restart,
-	show_ip_bgp_neighbors_graceful_restart_cmd,
-	"show bgp [<ipv4|ipv6>] neighbors [<A.B.C.D|X:X::X:X|WORD>] graceful-restart [json]",
-	SHOW_STR
-	BGP_STR
-	IP_STR
-	IPV6_STR
-	NEIGHBOR_STR
-	"Neighbor to display information about\n"
-	"Neighbor to display information about\n"
-	"Neighbor on BGP configured interface\n"
-	GR_SHOW
-       JSON_STR)
+DEFUN(show_ip_bgp_neighbors_gracrful_restart,
+      show_ip_bgp_neighbors_graceful_restart_cmd,
+      "show bgp [<ipv4|ipv6>] neighbors [<A.B.C.D|X:X::X:X|WORD>] graceful-restart [json]",
+      SHOW_STR BGP_STR IP_STR IPV6_STR NEIGHBOR_STR
+      "Neighbor to display information about\n"
+      "Neighbor to display information about\n"
+      "Neighbor on BGP configured interface\n" GR_SHOW JSON_STR)
 {
 	char *sh_arg = NULL;
 	enum show_type sh_type;
@@ -12551,7 +12478,7 @@ DEFUN (show_ip_bgp_neighbors_gracrful_restart,
 	afi_t afi = AFI_MAX;
 	bool uj = use_json(argc, argv);
 
-	if	(!argv_find_and_parse_afi(argv, argc, &idx, &afi))
+	if (!argv_find_and_parse_afi(argv, argc, &idx, &afi))
 		afi = AFI_MAX;
 
 	idx++;
@@ -12568,9 +12495,8 @@ DEFUN (show_ip_bgp_neighbors_gracrful_restart,
 		return CMD_SUCCESS;
 
 
-	return bgp_show_neighbor_graceful_restart_afi_all(vty,
-						sh_type, sh_arg,
-						afi, uj);
+	return bgp_show_neighbor_graceful_restart_afi_all(vty, sh_type, sh_arg,
+							  afi, uj);
 }
 
 /* "show [ip] bgp neighbors" commands.  */
@@ -12714,9 +12640,9 @@ DEFUN (show_ip_bgp_lcommunity_info,
 /* Graceful Restart */
 
 static void bgp_show_global_graceful_restart_mode_vty(struct vty *vty,
-					struct bgp *bgp,
-					bool use_json,
-					json_object *json)
+						      struct bgp *bgp,
+						      bool use_json,
+						      json_object *json)
 {
 
 
@@ -12727,49 +12653,42 @@ static void bgp_show_global_graceful_restart_mode_vty(struct vty *vty,
 	switch (bgp_global_gr_mode) {
 
 	case GLOBAL_HELPER:
-		vty_out(vty,
-				"Global BGP GR Mode :  Helper\n");
+		vty_out(vty, "Global BGP GR Mode :  Helper\n");
 		break;
 
 	case GLOBAL_GR:
-		vty_out(vty,
-			"Global BGP GR Mode :  Restart\n");
+		vty_out(vty, "Global BGP GR Mode :  Restart\n");
 		break;
 
 	case GLOBAL_DISABLE:
-		vty_out(vty,
-				"Global BGP GR Mode :  Disable\n");
+		vty_out(vty, "Global BGP GR Mode :  Disable\n");
 		break;
 
 	case GLOBAL_INVALID:
 	default:
-		vty_out(vty,
-			"Global BGP GR Mode  Invalid\n");
+		vty_out(vty, "Global BGP GR Mode  Invalid\n");
 		break;
 	}
 	vty_out(vty, "\n");
 }
 
-static int  bgp_show_neighbor_graceful_restart_afi_all(struct vty *vty,
-						enum show_type type,
-						const char *ip_str,
-						afi_t afi,
-						bool use_json)
+static int bgp_show_neighbor_graceful_restart_afi_all(struct vty *vty,
+						      enum show_type type,
+						      const char *ip_str,
+						      afi_t afi, bool use_json)
 {
 	if ((afi == AFI_MAX) && (ip_str == NULL)) {
 		afi = AFI_IP;
 
 		while ((afi != AFI_L2VPN) && (afi < AFI_MAX)) {
 
-			bgp_show_neighbor_graceful_restart_vty(vty,
-							type, ip_str,
-							afi, use_json);
+			bgp_show_neighbor_graceful_restart_vty(
+				vty, type, ip_str, afi, use_json);
 			afi++;
 		}
 	} else if (afi != AFI_MAX) {
-		bgp_show_neighbor_graceful_restart_vty(vty,
-							type, ip_str,
-							afi, use_json);
+		bgp_show_neighbor_graceful_restart_vty(vty, type, ip_str, afi,
+						       use_json);
 	} else {
 		return CMD_ERR_INCOMPLETE;
 	}
@@ -14606,23 +14525,24 @@ static void bgp_config_write_peer_global(struct vty *vty, struct bgp *bgp,
 			addr);
 
 	if (!CHECK_FLAG(peer->peer_gr_new_status_flag,
-		PEER_GRACEFUL_RESTART_NEW_STATE_INHERIT)) {
+			PEER_GRACEFUL_RESTART_NEW_STATE_INHERIT)) {
 
 		if (CHECK_FLAG(peer->peer_gr_new_status_flag,
-				PEER_GRACEFUL_RESTART_NEW_STATE_HELPER)) {
-			vty_out(vty,
-				" neighbor %s graceful-restart-helper\n", addr);
-		} else if (CHECK_FLAG(peer->peer_gr_new_status_flag,
-				PEER_GRACEFUL_RESTART_NEW_STATE_RESTART)) {
-			vty_out(vty,
-				" neighbor %s graceful-restart\n", addr);
-		} else if ((!(CHECK_FLAG(peer->peer_gr_new_status_flag,
-				PEER_GRACEFUL_RESTART_NEW_STATE_HELPER))
-				&& !(CHECK_FLAG(peer->peer_gr_new_status_flag,
-				PEER_GRACEFUL_RESTART_NEW_STATE_RESTART)))) {
-			vty_out(vty,
-				" neighbor %s graceful-restart-disable\n",
-					addr);
+			       PEER_GRACEFUL_RESTART_NEW_STATE_HELPER)) {
+			vty_out(vty, " neighbor %s graceful-restart-helper\n",
+				addr);
+		} else if (CHECK_FLAG(
+				   peer->peer_gr_new_status_flag,
+				   PEER_GRACEFUL_RESTART_NEW_STATE_RESTART)) {
+			vty_out(vty, " neighbor %s graceful-restart\n", addr);
+		} else if (
+			(!(CHECK_FLAG(peer->peer_gr_new_status_flag,
+				      PEER_GRACEFUL_RESTART_NEW_STATE_HELPER))
+			 && !(CHECK_FLAG(
+				 peer->peer_gr_new_status_flag,
+				 PEER_GRACEFUL_RESTART_NEW_STATE_RESTART)))) {
+			vty_out(vty, " neighbor %s graceful-restart-disable\n",
+				addr);
 		}
 	}
 }
@@ -15551,22 +15471,16 @@ void bgp_vty_init(void)
 	install_element(BGP_NODE, &no_bgp_deterministic_med_cmd);
 
 	/* "bgp graceful-restart" command */
-	install_element(BGP_NODE,
-			&bgp_graceful_restart_cmd);
-	install_element(BGP_NODE,
-			&no_bgp_graceful_restart_cmd);
+	install_element(BGP_NODE, &bgp_graceful_restart_cmd);
+	install_element(BGP_NODE, &no_bgp_graceful_restart_cmd);
 
 	/* "bgp graceful-restart-disable" command */
-	install_element(BGP_NODE,
-			&bgp_graceful_restart_disable_cmd);
-	install_element(BGP_NODE,
-			&no_bgp_graceful_restart_disable_cmd);
+	install_element(BGP_NODE, &bgp_graceful_restart_disable_cmd);
+	install_element(BGP_NODE, &no_bgp_graceful_restart_disable_cmd);
 
 	/* "neighbor a:b:c:d graceful-restart" command */
-	install_element(BGP_NODE,
-			&bgp_neighbor_graceful_restart_set_cmd);
-	install_element(BGP_NODE,
-			&no_bgp_neighbor_graceful_restart_set_cmd);
+	install_element(BGP_NODE, &bgp_neighbor_graceful_restart_set_cmd);
+	install_element(BGP_NODE, &no_bgp_neighbor_graceful_restart_set_cmd);
 
 	/* "neighbor a:b:c:d graceful-restart-disable" command */
 	install_element(BGP_NODE,
@@ -16589,8 +16503,7 @@ void bgp_vty_init(void)
 	/* "show [ip] bgp neighbors" commands. */
 	install_element(VIEW_NODE, &show_ip_bgp_neighbors_cmd);
 
-	install_element(VIEW_NODE,
-			&show_ip_bgp_neighbors_graceful_restart_cmd);
+	install_element(VIEW_NODE, &show_ip_bgp_neighbors_graceful_restart_cmd);
 
 	/* "show [ip] bgp peer-group" commands. */
 	install_element(VIEW_NODE, &show_ip_bgp_peer_groups_cmd);
diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h
index 2e33ed59b..e8f812e43 100644
--- a/bgpd/bgp_vty.h
+++ b/bgpd/bgp_vty.h
@@ -46,108 +46,104 @@ struct bgp;
 	"Address Family modifier\n"                                            \
 	"Address Family modifier\n"
 
-#define SHOW_GR_HEADER \
-	"Codes: GR - Graceful Restart," \
-	" * -  Inheriting Global GR Config,\n" \
-	"       Restart - GR Mode-Restarting," \
-	" Helper - GR Mode-Helper,\n" \
+#define SHOW_GR_HEADER                                                         \
+	"Codes: GR - Graceful Restart,"                                        \
+	" * -  Inheriting Global GR Config,\n"                                 \
+	"       Restart - GR Mode-Restarting,"                                 \
+	" Helper - GR Mode-Helper,\n"                                          \
 	"       Disable - GR Mode-Disable.\n\n"
 
-#define BGP_SHOW_PEER_GR_CAPABILITY( \
-			vty, p, use_json, json) \
-	do {			\
-		bgp_show_neighbor_graceful_restart_local_mode( \
-				vty, p, use_json, json);		\
-		bgp_show_neighbor_graceful_restart_remote_mode( \
-				vty, p, use_json, json); \
-		bgp_show_neighnor_graceful_restart_rbit( \
-				vty, p, use_json, json);	\
-		bgp_show_neighbor_graceful_restart_time( \
-				vty, p, use_json, json);	\
-		bgp_show_neighbor_graceful_restart_capability_per_afi_safi(\
-						vty, p, use_json, json); \
+#define BGP_SHOW_PEER_GR_CAPABILITY(vty, p, use_json, json)                    \
+	do {                                                                   \
+		bgp_show_neighbor_graceful_restart_local_mode(vty, p,          \
+							      use_json, json); \
+		bgp_show_neighbor_graceful_restart_remote_mode(                \
+			vty, p, use_json, json);                               \
+		bgp_show_neighnor_graceful_restart_rbit(vty, p, use_json,      \
+							json);                 \
+		bgp_show_neighbor_graceful_restart_time(vty, p, use_json,      \
+							json);                 \
+		bgp_show_neighbor_graceful_restart_capability_per_afi_safi(    \
+			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);
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 03d5cd984..ebad1e225 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -3050,8 +3050,8 @@ int bgp_zebra_send_capabilities(struct bgp *bgp, bool disable)
 		api.vrf_id = bgp->vrf_id;
 	}
 
-	if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES,
-				      zclient, &api) < 0) {
+	if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient, &api)
+	    < 0) {
 		zlog_err("error sending capability");
 		ret = BGP_GR_FAILURE;
 	} else {
@@ -3092,8 +3092,8 @@ int bgp_zebra_update(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type)
 	api.vrf_id = vrf_id;
 	api.cap = type;
 
-	if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES,
-				      zclient, &api) < 0) {
+	if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient, &api)
+	    < 0) {
 		if (BGP_DEBUG(zebra, ZEBRA))
 			zlog_debug("error sending capability");
 		return BGP_GR_FAILURE;
@@ -3103,7 +3103,7 @@ int bgp_zebra_update(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type)
 
 
 int zclient_capabilities_send(uint32_t cmd, struct zclient *zclient,
-		struct zapi_cap *api)
+			      struct zapi_cap *api)
 {
 	struct stream *s;
 
@@ -3117,20 +3117,20 @@ int zclient_capabilities_send(uint32_t cmd, struct zclient *zclient,
 	switch (api->cap) {
 	case ZEBRA_CLIENT_GR_CAPABILITIES:
 	case ZEBRA_CLIENT_RIB_STALE_TIME:
-			stream_putl(s, api->stale_removal_time);
-			stream_putl(s, api->vrf_id);
-			break;
+		stream_putl(s, api->stale_removal_time);
+		stream_putl(s, api->vrf_id);
+		break;
 	case ZEBRA_CLIENT_ROUTE_UPDATE_COMPLETE:
 	case ZEBRA_CLIENT_ROUTE_UPDATE_PENDING:
-			stream_putl(s, api->afi);
-			stream_putl(s, api->safi);
-			stream_putl(s, api->vrf_id);
-			break;
+		stream_putl(s, api->afi);
+		stream_putl(s, api->safi);
+		stream_putl(s, api->vrf_id);
+		break;
 	case ZEBRA_CLIENT_GR_DISABLE:
-			stream_putl(s, api->vrf_id);
-			break;
+		stream_putl(s, api->vrf_id);
+		break;
 	default:
-			break;
+		break;
 	}
 
 	/* Put length at the first point of the stream */
@@ -3161,8 +3161,8 @@ int bgp_zebra_stale_timer_update(struct bgp *bgp)
 	api.cap = ZEBRA_CLIENT_RIB_STALE_TIME;
 	api.stale_removal_time = bgp->rib_stale_time;
 	api.vrf_id = bgp->vrf_id;
-	if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES,
-				zclient, &api) < 0) {
+	if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient, &api)
+	    < 0) {
 		if (BGP_DEBUG(zebra, ZEBRA))
 			zlog_debug("error sending capability");
 		return BGP_GR_FAILURE;
diff --git a/bgpd/bgp_zebra.h b/bgpd/bgp_zebra.h
index c0e305286..5a02e2fbf 100644
--- a/bgpd/bgp_zebra.h
+++ b/bgpd/bgp_zebra.h
@@ -99,7 +99,6 @@ extern void bgp_send_pbr_iptable(struct bgp_pbr_action *pba,
 extern void bgp_zebra_announce_default(struct bgp *bgp, struct nexthop *nh,
 				afi_t afi, uint32_t table_id, bool announce);
 extern int bgp_zebra_send_capabilities(struct bgp *bgp, bool disable);
-extern int bgp_zebra_update(afi_t afi, safi_t safi, vrf_id_t vrf_id,
-			    int type);
+extern int bgp_zebra_update(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type);
 extern int bgp_zebra_stale_timer_update(struct bgp *bgp);
 #endif /* _QUAGGA_BGP_ZEBRA_H */
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index d866ba7f5..a2097e182 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -1111,40 +1111,31 @@ int bgp_global_gr_init(struct bgp *bgp)
 
 	int local_GLOBAL_GR_FSM[BGP_GLOBAL_GR_MODE][BGP_GLOBAL_GR_EVENT_CMD] = {
 		/* GLOBAL_HELPER Mode  */
-		{
-		/*Event -> */
-		/*GLOBAL_GR_cmd*/  /*no_Global_GR_cmd*/
-			GLOBAL_GR,      GLOBAL_INVALID,
-		/*GLOBAL_DISABLE_cmd*/ /*no_Global_Disable_cmd*/
-			GLOBAL_DISABLE, GLOBAL_INVALID
-		},
+		{		   /*Event -> */
+		 /*GLOBAL_GR_cmd*/ /*no_Global_GR_cmd*/
+		 GLOBAL_GR, GLOBAL_INVALID,
+		 /*GLOBAL_DISABLE_cmd*/ /*no_Global_Disable_cmd*/
+		 GLOBAL_DISABLE, GLOBAL_INVALID},
 		/* GLOBAL_GR Mode */
-		{
-		/*Event -> */
-		/*GLOBAL_GR_cmd*/ /*no_Global_GR_cmd*/
-			GLOBAL_INVALID,  GLOBAL_HELPER,
-		/*GLOBAL_DISABLE_cmd*/ /*no_Global_Disable_cmd*/
-			GLOBAL_DISABLE,  GLOBAL_INVALID
-		},
+		{		   /*Event -> */
+		 /*GLOBAL_GR_cmd*/ /*no_Global_GR_cmd*/
+		 GLOBAL_INVALID, GLOBAL_HELPER,
+		 /*GLOBAL_DISABLE_cmd*/ /*no_Global_Disable_cmd*/
+		 GLOBAL_DISABLE, GLOBAL_INVALID},
 		/* GLOBAL_DISABLE Mode  */
-		{
-		/*Event -> */
-		/*GLOBAL_GR_cmd */	/*no_Global_GR_cmd*/
-			GLOBAL_GR,      GLOBAL_INVALID,
-		/*GLOBAL_DISABLE_cmd*//*no_Global_Disable_cmd*/
-			GLOBAL_INVALID,	GLOBAL_HELPER
-		},
+		{		    /*Event -> */
+		 /*GLOBAL_GR_cmd */ /*no_Global_GR_cmd*/
+		 GLOBAL_GR, GLOBAL_INVALID,
+		 /*GLOBAL_DISABLE_cmd*/ /*no_Global_Disable_cmd*/
+		 GLOBAL_INVALID, GLOBAL_HELPER},
 		/* GLOBAL_INVALID Mode  */
-		{
-		/*Event -> */
-		/*GLOBAL_GR_cmd*/	/*no_Global_GR_cmd*/
-			GLOBAL_INVALID, GLOBAL_INVALID,
-		/*GLOBAL_DISABLE_cmd*/ /*no_Global_Disable_cmd*/
-			GLOBAL_INVALID, GLOBAL_INVALID
-		}
-	};
+		{		   /*Event -> */
+		 /*GLOBAL_GR_cmd*/ /*no_Global_GR_cmd*/
+		 GLOBAL_INVALID, GLOBAL_INVALID,
+		 /*GLOBAL_DISABLE_cmd*/ /*no_Global_Disable_cmd*/
+		 GLOBAL_INVALID, GLOBAL_INVALID}};
 	memcpy(bgp->GLOBAL_GR_FSM, local_GLOBAL_GR_FSM,
-					sizeof(local_GLOBAL_GR_FSM));
+	       sizeof(local_GLOBAL_GR_FSM));
 
 	bgp->global_gr_present_state = GLOBAL_HELPER;
 	bgp->present_zebra_gr_state = ZEBRA_GR_DISABLE;
@@ -1157,59 +1148,73 @@ int bgp_peer_gr_init(struct peer *peer)
 	if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
 		zlog_debug("%s called ..", __func__);
 
-	struct bgp_peer_gr local_Peer_GR_FSM[BGP_PEER_GR_MODE]
-					[BGP_PEER_GR_EVENT_CMD] = {
-	{
-	/*	PEER_HELPER Mode	*/
-	/* Event-> */ /* PEER_GR_CMD */ /* NO_PEER_GR_CMD */
-		{ PEER_GR, bgp_peer_gr_action }, {PEER_INVALID, NULL },
-	/* Event-> */ /* PEER_DISABLE_CMD */ /* NO_PEER_DISABLE_CMD */
-		{PEER_DISABLE, bgp_peer_gr_action }, {PEER_INVALID, NULL },
-	/* Event-> */ /* PEER_HELPER_cmd */ /* NO_PEER_HELPER_CMD */
-		{ PEER_INVALID, NULL }, {PEER_GLOBAL_INHERIT,
-						bgp_peer_gr_action }
-	},
-	{
-	/*	PEER_GR Mode	*/
-	/* Event-> */ /* PEER_GR_CMD */ /* NO_PEER_GR_CMD */
-		{ PEER_INVALID, NULL }, { PEER_GLOBAL_INHERIT,
-						bgp_peer_gr_action },
-	/* Event-> */ /* PEER_DISABLE_CMD */ /* NO_PEER_DISABLE_CMD */
-		{PEER_DISABLE, bgp_peer_gr_action }, { PEER_INVALID, NULL },
-	/* Event-> */ /* PEER_HELPER_cmd */ /* NO_PEER_HELPER_CMD */
-		{ PEER_HELPER, bgp_peer_gr_action }, { PEER_INVALID, NULL }
-	},
-	{
-	/*	PEER_DISABLE Mode	*/
-	/* Event-> */ /* PEER_GR_CMD */ /* NO_PEER_GR_CMD */
-		{ PEER_GR, bgp_peer_gr_action }, { PEER_INVALID, NULL },
-	/* Event-> */ /* PEER_DISABLE_CMD */ /* NO_PEER_DISABLE_CMD */
-		{ PEER_INVALID, NULL }, { PEER_GLOBAL_INHERIT,
-						bgp_peer_gr_action },
-	/* Event-> */ /* PEER_HELPER_cmd */  /* NO_PEER_HELPER_CMD */
-		{ PEER_HELPER, bgp_peer_gr_action }, { PEER_INVALID, NULL }
-	},
-	{
-	/*	PEER_INVALID Mode	*/
-	/* Event-> */ /* PEER_GR_CMD */  /* NO_PEER_GR_CMD */
-		{ PEER_INVALID, NULL }, { PEER_INVALID, NULL },
-	/* Event-> */ /* PEER_DISABLE_CMD */  /* NO_PEER_DISABLE_CMD */
-		{ PEER_INVALID, NULL }, { PEER_INVALID, NULL },
-	/* Event-> */ /* PEER_HELPER_cmd */  /* NO_PEER_HELPER_CMD */
-		{ PEER_INVALID, NULL }, { PEER_INVALID, NULL },
-	},
-	{
-	/*	PEER_GLOBAL_INHERIT Mode	*/
-	/* Event-> */ /* PEER_GR_CMD */		/* NO_PEER_GR_CMD */
-		{ PEER_GR, bgp_peer_gr_action }, { PEER_INVALID, NULL },
-	/* Event-> */ /* PEER_DISABLE_CMD */     /* NO_PEER_DISABLE_CMD */
-		{ PEER_DISABLE, bgp_peer_gr_action}, { PEER_INVALID, NULL },
-	/* Event-> */ /* PEER_HELPER_cmd */     /* NO_PEER_HELPER_CMD */
-		{ PEER_HELPER, bgp_peer_gr_action }, { PEER_INVALID, NULL }
-	}
-	};
+	struct bgp_peer_gr
+		local_Peer_GR_FSM[BGP_PEER_GR_MODE][BGP_PEER_GR_EVENT_CMD] = {
+			{				 /*	PEER_HELPER Mode	*/
+			 /* Event-> */ /* PEER_GR_CMD */ /* NO_PEER_GR_CMD */
+			 {PEER_GR, bgp_peer_gr_action},
+			 {PEER_INVALID, NULL},
+			 /* Event-> */ /* PEER_DISABLE_CMD */ /* NO_PEER_DISABLE_CMD
+							       */
+			 {PEER_DISABLE, bgp_peer_gr_action},
+			 {PEER_INVALID, NULL},
+			 /* Event-> */ /* PEER_HELPER_cmd */ /* NO_PEER_HELPER_CMD
+							      */
+			 {PEER_INVALID, NULL},
+			 {PEER_GLOBAL_INHERIT, bgp_peer_gr_action}},
+			{				 /*	PEER_GR Mode	*/
+			 /* Event-> */ /* PEER_GR_CMD */ /* NO_PEER_GR_CMD */
+			 {PEER_INVALID, NULL},
+			 {PEER_GLOBAL_INHERIT, bgp_peer_gr_action},
+			 /* Event-> */ /* PEER_DISABLE_CMD */ /* NO_PEER_DISABLE_CMD
+							       */
+			 {PEER_DISABLE, bgp_peer_gr_action},
+			 {PEER_INVALID, NULL},
+			 /* Event-> */ /* PEER_HELPER_cmd */ /* NO_PEER_HELPER_CMD
+							      */
+			 {PEER_HELPER, bgp_peer_gr_action},
+			 {PEER_INVALID, NULL}},
+			{				 /*	PEER_DISABLE Mode	*/
+			 /* Event-> */ /* PEER_GR_CMD */ /* NO_PEER_GR_CMD */
+			 {PEER_GR, bgp_peer_gr_action},
+			 {PEER_INVALID, NULL},
+			 /* Event-> */ /* PEER_DISABLE_CMD */ /* NO_PEER_DISABLE_CMD
+							       */
+			 {PEER_INVALID, NULL},
+			 {PEER_GLOBAL_INHERIT, bgp_peer_gr_action},
+			 /* Event-> */ /* PEER_HELPER_cmd */ /* NO_PEER_HELPER_CMD
+							      */
+			 {PEER_HELPER, bgp_peer_gr_action},
+			 {PEER_INVALID, NULL}},
+			{
+				/*	PEER_INVALID Mode	*/
+				/* Event-> */ /* PEER_GR_CMD */ /* NO_PEER_GR_CMD
+								 */
+				{PEER_INVALID, NULL},
+				{PEER_INVALID, NULL},
+				/* Event-> */ /* PEER_DISABLE_CMD */ /* NO_PEER_DISABLE_CMD
+								      */
+				{PEER_INVALID, NULL},
+				{PEER_INVALID, NULL},
+				/* Event-> */ /* PEER_HELPER_cmd */ /* NO_PEER_HELPER_CMD
+								     */
+				{PEER_INVALID, NULL},
+				{PEER_INVALID, NULL},
+			},
+			{/*	PEER_GLOBAL_INHERIT Mode	*/
+			 /* Event-> */ /* PEER_GR_CMD */ /* NO_PEER_GR_CMD */
+			 {PEER_GR, bgp_peer_gr_action},
+			 {PEER_INVALID, NULL},
+			 /* Event-> */ /* PEER_DISABLE_CMD */ /* NO_PEER_DISABLE_CMD
+							       */
+			 {PEER_DISABLE, bgp_peer_gr_action},
+			 {PEER_INVALID, NULL},
+			 /* Event-> */ /* PEER_HELPER_cmd */ /* NO_PEER_HELPER_CMD
+							      */
+			 {PEER_HELPER, bgp_peer_gr_action},
+			 {PEER_INVALID, NULL}}};
 	memcpy(&peer->PEER_GR_FSM, local_Peer_GR_FSM,
-					sizeof(local_Peer_GR_FSM));
+	       sizeof(local_Peer_GR_FSM));
 	peer->peer_gr_present_state = PEER_GLOBAL_INHERIT;
 	bgp_peer_move_to_gr_mode(peer, PEER_GLOBAL_INHERIT);
 
@@ -1654,9 +1659,7 @@ struct peer *peer_create(union sockunion *su, const char *conf_if,
 		bgp_timer_set(peer);
 
 	bgp_peer_gr_flags_update(peer);
-	BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(
-		bgp,
-		bgp->peer);
+	BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(bgp, bgp->peer);
 
 	return peer;
 }
@@ -3077,7 +3080,7 @@ static struct bgp *bgp_create(as_t *as, const char *name,
 		bgp->name = XSTRDUP(MTYPE_BGP, name);
 
 	thread_add_timer(bm->master, bgp_startup_timer_expire, bgp,
-				bgp->restart_time, &bgp->t_startup);
+			 bgp->restart_time, &bgp->t_startup);
 
 	/* printable name we can use in debug messages */
 	if (inst_type == BGP_INSTANCE_TYPE_DEFAULT) {
@@ -7254,22 +7257,20 @@ void bgp_gr_apply_running_config(void)
 	bool gr_router_detected = false;
 
 	if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
-		zlog_debug("[BGP_GR] %s called !",
-				__func__);
+		zlog_debug("[BGP_GR] %s called !", __func__);
 
 	for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp)) {
 		for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
 			bgp_peer_gr_flags_update(peer);
-			if (CHECK_FLAG(peer->flags,
-						PEER_FLAG_GRACEFUL_RESTART))
+			if (CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_RESTART))
 				gr_router_detected = true;
 		}
 
-		if (gr_router_detected &&
-			bgp->present_zebra_gr_state == ZEBRA_GR_DISABLE) {
+		if (gr_router_detected
+		    && bgp->present_zebra_gr_state == ZEBRA_GR_DISABLE) {
 			bgp_zebra_send_capabilities(bgp, true);
-		} else if (!gr_router_detected &&
-			bgp->present_zebra_gr_state == ZEBRA_GR_ENABLE) {
+		} else if (!gr_router_detected
+			   && bgp->present_zebra_gr_state == ZEBRA_GR_ENABLE) {
 			bgp_zebra_send_capabilities(bgp, false);
 		}
 
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 3f33139ef..8b2ea1af2 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -66,10 +66,7 @@ enum { AS_UNSPECIFIED = 0,
 };
 
 /* Zebra Gracaful Restart states */
-enum zebra_gr_mode {
-	ZEBRA_GR_DISABLE = 0,
-	ZEBRA_GR_ENABLE
-};
+enum zebra_gr_mode { ZEBRA_GR_DISABLE = 0, ZEBRA_GR_ENABLE };
 
 /* Typedef BGP specific types.  */
 typedef uint32_t as_t;
@@ -238,11 +235,11 @@ enum bgp_instance_type {
 	BGP_INSTANCE_TYPE_VIEW
 };
 
-#define BGP_SEND_EOR(bgp, afi, safi)				\
-	(!bgp_flag_check(bgp, BGP_FLAG_GR_DISABLE_EOR) &&	\
-	((bgp->gr_info[afi][safi].t_select_deferral == NULL) || \
-	 (bgp->gr_info[afi][safi].eor_required ==		\
-	  bgp->gr_info[afi][safi].eor_received)))
+#define BGP_SEND_EOR(bgp, afi, safi)                                           \
+	(!bgp_flag_check(bgp, BGP_FLAG_GR_DISABLE_EOR)                         \
+	 && ((bgp->gr_info[afi][safi].t_select_deferral == NULL)               \
+	     || (bgp->gr_info[afi][safi].eor_required                          \
+		 == bgp->gr_info[afi][safi].eor_received)))
 
 /* BGP GR Global ds */
 
@@ -422,11 +419,11 @@ struct bgp {
 #define BGP_FLAG_GR_PRESERVE_FWD          (1 << 20)
 #define BGP_FLAG_GRACEFUL_SHUTDOWN        (1 << 21)
 #define BGP_FLAG_DELETE_IN_PROGRESS       (1 << 22)
-#define BGP_FLAG_SELECT_DEFER_DISABLE     (1 << 23)
-#define BGP_FLAG_GR_DISABLE_EOR           (1 << 24)
+#define BGP_FLAG_SELECT_DEFER_DISABLE (1 << 23)
+#define BGP_FLAG_GR_DISABLE_EOR (1 << 24)
 
 	enum global_mode GLOBAL_GR_FSM[BGP_GLOBAL_GR_MODE]
-				[BGP_GLOBAL_GR_EVENT_CMD];
+				      [BGP_GLOBAL_GR_EVENT_CMD];
 	enum global_mode global_gr_present_state;
 
 	/* This variable stores the current Graceful Restart state of Zebra
@@ -659,12 +656,12 @@ DECLARE_HOOK(bgp_inst_config_write,
 		(struct bgp *bgp, struct vty *vty),
 		(bgp, vty))
 
-	/* Thread callback information */
-	struct afi_safi_info {
-		afi_t afi;
-		safi_t safi;
-		struct bgp *bgp;
-	};
+/* Thread callback information */
+struct afi_safi_info {
+	afi_t afi;
+	safi_t safi;
+	struct bgp *bgp;
+};
 
 #define BGP_ROUTE_ADV_HOLD(bgp) (bgp->main_peers_update_hold)
 
@@ -673,7 +670,7 @@ DECLARE_HOOK(bgp_inst_config_write,
 	 || (bgp->inst_type == BGP_INSTANCE_TYPE_VRF                           \
 	     && bgp->vrf_id != VRF_UNKNOWN))
 
-#define BGP_SELECT_DEFER_DISABLE(bgp)                 \
+#define BGP_SELECT_DEFER_DISABLE(bgp)                                          \
 	(bgp_flag_check(bgp, BGP_FLAG_SELECT_DEFER_DISABLE))
 
 /* BGP peer-group support. */
@@ -829,7 +826,7 @@ enum peer_gr_command {
 	NO_PEER_HELPER_CMD
 };
 
-typedef unsigned int  (*bgp_peer_gr_action_ptr)(struct peer *, int, int);
+typedef unsigned int (*bgp_peer_gr_action_ptr)(struct peer *, int, int);
 
 struct bgp_peer_gr {
 	enum peer_mode next_state;
@@ -1058,9 +1055,10 @@ struct peer {
 #define PEER_FLAG_UPDATE_SOURCE             (1 << 22) /* update-source */
 
 	/* BGP-GR Peer related  flags */
-#define PEER_FLAG_GRACEFUL_RESTART_HELPER   (1 << 23) /* Helper */
-#define PEER_FLAG_GRACEFUL_RESTART          (1 << 24) /* Graceful Restart */
-#define PEER_FLAG_GRACEFUL_RESTART_GLOBAL_INHERIT (1 << 25) /* Global-Inherit */
+#define PEER_FLAG_GRACEFUL_RESTART_HELPER (1 << 23) /* Helper */
+#define PEER_FLAG_GRACEFUL_RESTART (1 << 24)	/* Graceful Restart */
+#define PEER_FLAG_GRACEFUL_RESTART_GLOBAL_INHERIT (1 << 25) /* Global-Inherit  \
+							     */
 
 	/*
 	 *GR-Disabled mode means unset PEER_FLAG_GRACEFUL_RESTART
@@ -1074,9 +1072,9 @@ struct peer {
 	uint8_t nsf_af_count;
 
 	uint8_t peer_gr_new_status_flag;
-#define PEER_GRACEFUL_RESTART_NEW_STATE_HELPER   (1 << 0)
-#define PEER_GRACEFUL_RESTART_NEW_STATE_RESTART  (1 << 1)
-#define PEER_GRACEFUL_RESTART_NEW_STATE_INHERIT  (1 << 2)
+#define PEER_GRACEFUL_RESTART_NEW_STATE_HELPER (1 << 0)
+#define PEER_GRACEFUL_RESTART_NEW_STATE_RESTART (1 << 1)
+#define PEER_GRACEFUL_RESTART_NEW_STATE_INHERIT (1 << 2)
 
 	/* outgoing message sent in CEASE_ADMIN_SHUTDOWN notify */
 	char *tx_shutdown_message;
@@ -1591,8 +1589,8 @@ struct bgp_nlri {
 /* BGP graceful restart  */
 #define BGP_DEFAULT_RESTART_TIME               120
 #define BGP_DEFAULT_STALEPATH_TIME             360
-#define BGP_DEFAULT_SELECT_DEFERRAL_TIME       360
-#define BGP_DEFAULT_RIB_STALE_TIME             500
+#define BGP_DEFAULT_SELECT_DEFERRAL_TIME 360
+#define BGP_DEFAULT_RIB_STALE_TIME 500
 
 /* BGP uptime string length.  */
 #define BGP_UPTIME_LEN 25
@@ -1659,9 +1657,9 @@ enum bgp_clear_type {
 #define BGP_ERR_PEER_SAFI_CONFLICT              -35
 
 /* BGP GR ERRORS */
-#define BGP_ERR_GR_INVALID_CMD                  -36
-#define BGP_ERR_GR_OPERATION_FAILED             -37
-#define BGP_GR_NO_OPERATION                     -38
+#define BGP_ERR_GR_INVALID_CMD -36
+#define BGP_ERR_GR_OPERATION_FAILED -37
+#define BGP_GR_NO_OPERATION -38
 
 /*
  * Enumeration of different policy kinds a peer can be configured with.
@@ -1922,29 +1920,26 @@ int bgp_global_gr_init(struct bgp *bgp);
 int bgp_peer_gr_init(struct peer *peer);
 
 
-#define BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA( \
-		_bgp, _peer_list) \
-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 (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) { \
-		bgp_zebra_send_capabilities(_bgp, false); \
-	} else if (!gr_router_detected && \
-			_bgp->present_zebra_gr_state == ZEBRA_GR_ENABLE) { \
-		bgp_zebra_send_capabilities(_bgp, true); \
-	} \
-} while (0)
+#define BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(_bgp, _peer_list)    \
+	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 (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) {     \
+			bgp_zebra_send_capabilities(_bgp, false);              \
+		} else if (!gr_router_detected                                 \
+			   && _bgp->present_zebra_gr_state                     \
+				      == ZEBRA_GR_ENABLE) {                    \
+			bgp_zebra_send_capabilities(_bgp, true);               \
+		}                                                              \
+	} while (0)
 
 static inline struct bgp *bgp_lock(struct bgp *bgp)
 {
diff --git a/lib/command.h b/lib/command.h
index ea8a76a96..710d060cf 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -425,13 +425,18 @@ struct cmd_node {
 #define GR_DISABLE "Global Graceful Restart - Disable Mode\n"
 #define NO_GR_DISABLE "Undo Global Graceful Restart - Disable Mode\n"
 #define GR_DEBUG "Graceful Restart - Enable Debug Logs\n"
-#define GR_SHOW "Graceful Restart - Show command for Global and all neighbor mode\n"
+#define GR_SHOW                                                                \
+	"Graceful Restart - Show command for Global and all neighbor mode\n"
 #define GR_NEIGHBOR_CMD "Graceful Restart command for a neighbor\n"
 #define NO_GR_NEIGHBOR_CMD "Undo Graceful Restart command for a neighbor\n"
-#define GR_NEIGHBOR_DISABLE_CMD "Graceful Restart Disable command for a neighbor\n"
-#define NO_GR_NEIGHBOR_DISABLE_CMD "Undo Graceful Restart Disable command for a neighbor\n"
-#define GR_NEIGHBOR_HELPER_CMD "Graceful Restart Helper command for a neighbor\n"
-#define NO_GR_NEIGHBOR_HELPER_CMD "Undo Graceful Restart Helper command for a neighbor\n"
+#define GR_NEIGHBOR_DISABLE_CMD                                                \
+	"Graceful Restart Disable command for a neighbor\n"
+#define NO_GR_NEIGHBOR_DISABLE_CMD                                             \
+	"Undo Graceful Restart Disable command for a neighbor\n"
+#define GR_NEIGHBOR_HELPER_CMD                                                 \
+	"Graceful Restart Helper command for a neighbor\n"
+#define NO_GR_NEIGHBOR_HELPER_CMD                                              \
+	"Undo Graceful Restart Helper command for a neighbor\n"
 
 /* Prototypes. */
 extern void install_node(struct cmd_node *node, int (*)(struct vty *));
diff --git a/lib/zclient.c b/lib/zclient.c
index 7ddf0085d..0497d8560 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -3309,20 +3309,20 @@ int zapi_capabilities_decode(struct stream *s, struct zapi_cap *api)
 	switch (api->cap) {
 	case ZEBRA_CLIENT_GR_CAPABILITIES:
 	case ZEBRA_CLIENT_RIB_STALE_TIME:
-			STREAM_GETL(s, api->stale_removal_time);
-			STREAM_GETL(s, api->vrf_id);
-			break;
+		STREAM_GETL(s, api->stale_removal_time);
+		STREAM_GETL(s, api->vrf_id);
+		break;
 	case ZEBRA_CLIENT_ROUTE_UPDATE_COMPLETE:
 	case ZEBRA_CLIENT_ROUTE_UPDATE_PENDING:
-			STREAM_GETL(s, api->afi);
-			STREAM_GETL(s, api->safi);
-			STREAM_GETL(s, api->vrf_id);
-			break;
+		STREAM_GETL(s, api->afi);
+		STREAM_GETL(s, api->safi);
+		STREAM_GETL(s, api->vrf_id);
+		break;
 	case ZEBRA_CLIENT_GR_DISABLE:
-			STREAM_GETL(s, api->vrf_id);
-			break;
+		STREAM_GETL(s, api->vrf_id);
+		break;
 	default:
-			break;
+		break;
 	}
 
 stream_failure:
diff --git a/lib/zclient.h b/lib/zclient.h
index bbc70c383..7998f138e 100644
--- a/lib/zclient.h
+++ b/lib/zclient.h
@@ -74,11 +74,11 @@ typedef uint16_t zebra_size_t;
 #define ZEBRA_FEC_REGISTER_LABEL_INDEX    0x2
 
 /* Client Graceful Restart */
-#define ZEBRA_CLIENT_GR_CAPABILITIES       0x1
+#define ZEBRA_CLIENT_GR_CAPABILITIES 0x1
 #define ZEBRA_CLIENT_ROUTE_UPDATE_COMPLETE 0x2
-#define ZEBRA_CLIENT_ROUTE_UPDATE_PENDING  0x3
-#define ZEBRA_CLIENT_GR_DISABLE            0x4
-#define ZEBRA_CLIENT_RIB_STALE_TIME        0x5
+#define ZEBRA_CLIENT_ROUTE_UPDATE_PENDING 0x3
+#define ZEBRA_CLIENT_GR_DISABLE 0x4
+#define ZEBRA_CLIENT_RIB_STALE_TIME 0x5
 #define ZEBRA_CLIENT_GR_ENABLED(X) (X & ZEBRA_CLIENT_GR_CAPABILITIES)
 
 extern struct sockaddr_storage zclient_addr;
@@ -233,11 +233,11 @@ struct zclient_capabilities {
 
 /* Graceful Restart Capabilities message */
 struct zapi_cap {
-	uint32_t  cap;
-	uint32_t  stale_removal_time;
-	afi_t     afi;
-	safi_t    safi;
-	vrf_id_t  vrf_id;
+	uint32_t cap;
+	uint32_t stale_removal_time;
+	afi_t afi;
+	safi_t safi;
+	vrf_id_t vrf_id;
 };
 
 /* Structure for the zebra client. */
@@ -795,6 +795,6 @@ extern void zclient_send_mlag_data(struct zclient *client,
 				   struct stream *client_s);
 
 extern int zclient_capabilities_send(uint32_t cmd, struct zclient *zclient,
-		struct zapi_cap *api);
+				     struct zapi_cap *api);
 extern int zapi_capabilities_decode(struct stream *s, struct zapi_cap *api);
 #endif /* _ZEBRA_ZCLIENT_H */
diff --git a/tests/bgpd/test_mpath.c b/tests/bgpd/test_mpath.c
index a51ce4c6b..3f63c0499 100644
--- a/tests/bgpd/test_mpath.c
+++ b/tests/bgpd/test_mpath.c
@@ -315,7 +315,7 @@ static int setup_bgp_path_info_mpath_update(testcase_t *t)
 	str2prefix("42.1.1.0/24", &test_rn.p);
 	rt_node = bgp_node_to_rnode(&test_rn);
 	memcpy((struct route_table *)&rt_node->table, &rt->route_table,
-		sizeof(struct route_table));
+	       sizeof(struct route_table));
 	setup_bgp_mp_list(t);
 	for (i = 0; i < test_mp_list_info_count; i++)
 		bgp_path_info_add(&test_rn, &test_mp_list_info[i]);

If you are a new contributor to FRR, please see our contributing guidelines.

@LabN-CI
Copy link
Collaborator

LabN-CI commented Jan 23, 2020

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result 0
Date 0
Start 0
Finish vncregress-2020-01-22-23:46:29.txt
Run-Time autoscript-2020-01-22-23:47:30.log.bz2
Total 417 429 363
Pass Complete
Fail 09/09/2019
Valgrind-Errors 23:46:22
Valgrind-Loss 00:06:31
Details 20:09
Log 1815
Memory 1815
SUCCESS git merge/5210 4a6e80f 0
01/22/2020 0
23:46:29 0
00:12:23 autoscript-2019-09-09-23:46:22.txt
25:54 autoscript-2019-09-09-23:46:22.log.bz2
1815 420 422 360
1815

For details, please contact louberger

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-10521/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

<TITLE>clang_check</TITLE>

clang_check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants