diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-11-26 21:19:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-26 21:19:06 +0200 |
| commit | 29a911093b96ea0aa330367a486d331e2a8fcc9c (patch) | |
| tree | 585f2a9a6457ee9e8aea1f54734134e2993f27d5 | |
| parent | 85db584ff85c46cc3c5a33fdf548e7667f915c96 (diff) | |
| parent | b635d08603230d57caf746c5b3440c95cd439efa (diff) | |
Merge pull request #12400 from FRRouting/mergify/bp/stable/8.4/pr-12370
bgpd: Fix crash for `set ipv4/ipv6 vpn next-hop` command (backport #12370)
| -rw-r--r-- | bgpd/bgp_routemap.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index ded47028a6..143df083e1 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -6750,9 +6750,9 @@ DEFUN_YANG (no_set_vpn_nexthop, } #endif /* KEEP_OLD_VPN_COMMANDS */ -DEFUN_YANG (set_ipx_vpn_nexthop, +DEFPY_YANG (set_ipx_vpn_nexthop, set_ipx_vpn_nexthop_cmd, - "set <ipv4|ipv6> vpn next-hop <A.B.C.D|X:X::X:X>", + "set <ipv4|ipv6> vpn next-hop <A.B.C.D$addrv4|X:X::X:X$addrv6>", SET_STR "IPv4 information\n" "IPv6 information\n" @@ -6768,6 +6768,11 @@ DEFUN_YANG (set_ipx_vpn_nexthop, if (argv_find_and_parse_afi(argv, argc, &idx, &afi)) { if (afi == AFI_IP) { + if (addrv6_str) { + vty_out(vty, "%% IPv4 next-hop expected\n"); + return CMD_WARNING_CONFIG_FAILED; + } + const char *xpath = "./set-action[action='frr-bgp-route-map:ipv4-vpn-address']"; @@ -6777,6 +6782,11 @@ DEFUN_YANG (set_ipx_vpn_nexthop, "%s/rmap-set-action/frr-bgp-route-map:ipv4-address", xpath); } else { + if (addrv4_str) { + vty_out(vty, "%% IPv6 next-hop expected\n"); + return CMD_WARNING_CONFIG_FAILED; + } + const char *xpath = "./set-action[action='frr-bgp-route-map:ipv6-vpn-address']"; |
