]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bpgd: adjust return value for the same command
authoranlan_cs <anlan_cs@tom.com>
Fri, 12 Apr 2024 13:57:30 +0000 (21:57 +0800)
committeranlan_cs <anlan_cs@tom.com>
Sat, 13 Apr 2024 01:28:55 +0000 (09:28 +0800)
The same command should be accepted, it is an empty operation.  Take
`neighbor <X> graceful-restart-helper` as an example:

Before:
```
anlan(config-router)# neighbor 3.3.3.3 graceful-restart-helper
Graceful restart configuration changed, reset this peer to take effect
anlan(config-router)# neighbor 3.3.3.3 graceful-restart-helper
Graceful restart configuration changed, reset this peer to take effect
% The Graceful Restart command used is not valid at this moment.
anlan(config-router)#
```

After:
```
anlan(config-router)# neighbor 3.3.3.3 graceful-restart-helper
Graceful restart configuration changed, reset this peer to take effect
anlan(config-router)# neighbor 3.3.3.3 graceful-restart-helper
Graceful restart configuration changed, reset this peer to take effect
anlan(config-router)#
```

Signed-off-by: anlan_cs <anlan_cs@tom.com>
bgpd/bgpd.c

index d98df754ef81187eb953f9cdb7f8c9a16c06b9b9..33da70fb9bbcd659214d548183670ceb3b428e21 100644 (file)
@@ -1377,7 +1377,7 @@ int bgp_global_gr_init(struct bgp *bgp)
                /*GLOBAL_GR_cmd */      /*no_Global_GR_cmd*/
                        GLOBAL_GR,      GLOBAL_INVALID,
                /*GLOBAL_DISABLE_cmd*//*no_Global_Disable_cmd*/
-                       GLOBAL_INVALID, GLOBAL_HELPER
+                       GLOBAL_DISABLE, GLOBAL_HELPER
                },
                /* GLOBAL_INVALID Mode  */
                {
@@ -1411,13 +1411,13 @@ int bgp_peer_gr_init(struct peer *peer)
        /* 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,
+               { PEER_HELPER, 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,
+               { PEER_GR, 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 },
@@ -1429,7 +1429,7 @@ int bgp_peer_gr_init(struct peer *peer)
        /* 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,
+               { PEER_DISABLE, 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 }