Mailing List Archive

[PATCH] Fix wrong command persisted by vtysh
Fixes invalid syntax when applying integrated configuration a file
with vtysh -b.

Commit d8aa4beab72cdd2c2d78f9e624fd4b704eec488f ("vtysh: Fix Quagga.conf file read in.")
replaced NULL cmd argument but only in one instance of the cmd_execute_command_strict
call. This patch fixes the second instance.
---

Without the fix and with a consolidated configuration file (integrated)
CORE daemon (a "router" with 3 interfaces + ospf/6 + rip/ng)

/etc/quagga/Quagga.conf
interface eth0
ip address 10.0.1.2/24
ipv6 address 2001:1::2/64
!
interface eth1
ip address 10.0.2.2/24
ipv6 address 2001:2::2/64
!
interface eth2
ip address 10.0.3.1/24
ipv6 address 2001:3::1/64
!
router ospf
router-id 10.0.1.2
network 10.0.1.0/24 area 0
network 10.0.2.0/24 area 0
network 10.0.3.0/24 area 0
!
router ospf6
router-id 10.0.1.2
interface eth0 area 0.0.0.0
interface eth1 area 0.0.0.0
interface eth2 area 0.0.0.0
!
router rip
redistribute static
redistribute connected
redistribute ospf
network 0.0.0.0/0
!
router ripng
redistribute static
redistribute connected
redistribute ospf6
network ::/0
!

/etc/quagga/vtysh.conf
service integrated-vtysh-config


does error out with (was vanilla debian quagga 1.1.1-3)

vtysh -b
% Unknown command: ip address 10.0.2.2/24
% Unknown command: ipv6 address 2001:2::2/64
% [ZEBRA] Unknown command: router ospf

% Unknown command: network 10.0.1.0/24 area 0
% Unknown command: network 10.0.2.0/24 area 0
% Unknown command: network 10.0.3.0/24 area 0
eth0 already attached to Area 0.0.0.0
eth1 already attached to Area 0.0.0.0
eth2 already attached to Area 0.0.0.0
% [OSPF6] Unknown command: router rip

% Unknown command: redistribute static
% Unknown command: redistribute connected
% Unknown command: redistribute ospf
% Unknown command: network 0.0.0.0/0
There is same network configuration ::/0


lib/command.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/command.c b/lib/command.c
index 662f8a3d..65f9f513 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -2812,7 +2812,7 @@ command_config_read_one_line (struct vty *vty, struct cmd_element **cmd, int use
ret != CMD_SUCCESS && ret != CMD_WARNING &&
ret != CMD_ERR_NOTHING_TODO && vty->node != CONFIG_NODE) {
vty->node = node_parent(vty->node);
- ret = cmd_execute_command_strict (vline, vty, NULL);
+ ret = cmd_execute_command_strict (vline, vty, cmd);
}

// If climbing the tree did not work then ignore the command and
--
2.15.0

_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev
Re: [PATCH] Fix wrong command persisted by vtysh [ In reply to ]
Thanks for the patch. Applied

On Mon, Nov 13, 2017 at 7:02 PM, Alban Browaeys <alban.browaeys@gmail.com>
wrote:

> Fixes invalid syntax when applying integrated configuration a file
> with vtysh -b.
>
> Commit d8aa4beab72cdd2c2d78f9e624fd4b704eec488f ("vtysh: Fix Quagga.conf
> file read in.")
> replaced NULL cmd argument but only in one instance of the
> cmd_execute_command_strict
> call. This patch fixes the second instance.
> ---
>
> Without the fix and with a consolidated configuration file (integrated)
> CORE daemon (a "router" with 3 interfaces + ospf/6 + rip/ng)
>
> /etc/quagga/Quagga.conf
> interface eth0
> ip address 10.0.1.2/24
> ipv6 address 2001:1::2/64
> !
> interface eth1
> ip address 10.0.2.2/24
> ipv6 address 2001:2::2/64
> !
> interface eth2
> ip address 10.0.3.1/24
> ipv6 address 2001:3::1/64
> !
> router ospf
> router-id 10.0.1.2
> network 10.0.1.0/24 area 0
> network 10.0.2.0/24 area 0
> network 10.0.3.0/24 area 0
> !
> router ospf6
> router-id 10.0.1.2
> interface eth0 area 0.0.0.0
> interface eth1 area 0.0.0.0
> interface eth2 area 0.0.0.0
> !
> router rip
> redistribute static
> redistribute connected
> redistribute ospf
> network 0.0.0.0/0
> !
> router ripng
> redistribute static
> redistribute connected
> redistribute ospf6
> network ::/0
> !
>
> /etc/quagga/vtysh.conf
> service integrated-vtysh-config
>
>
> does error out with (was vanilla debian quagga 1.1.1-3)
>
> vtysh -b
> % Unknown command: ip address 10.0.2.2/24
> % Unknown command: ipv6 address 2001:2::2/64
> % [ZEBRA] Unknown command: router ospf
>
> % Unknown command: network 10.0.1.0/24 area 0
> % Unknown command: network 10.0.2.0/24 area 0
> % Unknown command: network 10.0.3.0/24 area 0
> eth0 already attached to Area 0.0.0.0
> eth1 already attached to Area 0.0.0.0
> eth2 already attached to Area 0.0.0.0
> % [OSPF6] Unknown command: router rip
>
> % Unknown command: redistribute static
> % Unknown command: redistribute connected
> % Unknown command: redistribute ospf
> % Unknown command: network 0.0.0.0/0
> There is same network configuration ::/0
>
>
> lib/command.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/command.c b/lib/command.c
> index 662f8a3d..65f9f513 100644
> --- a/lib/command.c
> +++ b/lib/command.c
> @@ -2812,7 +2812,7 @@ command_config_read_one_line (struct vty *vty,
> struct cmd_element **cmd, int use
> ret != CMD_SUCCESS && ret != CMD_WARNING &&
> ret != CMD_ERR_NOTHING_TODO && vty->node != CONFIG_NODE) {
> vty->node = node_parent(vty->node);
> - ret = cmd_execute_command_strict (vline, vty, NULL);
> + ret = cmd_execute_command_strict (vline, vty, cmd);
> }
>
> // If climbing the tree did not work then ignore the command and
> --
> 2.15.0
>
> _______________________________________________
> Quagga-dev mailing list
> Quagga-dev@lists.quagga.net
> https://lists.quagga.net/mailman/listinfo/quagga-dev
>