]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: return failure for wildcard ERT 12166/head
authoranlan_cs <vic.lan@pica8.com>
Fri, 21 Oct 2022 05:17:29 +0000 (01:17 -0400)
committeranlan_cs <vic.lan@pica8.com>
Mon, 24 Oct 2022 12:51:12 +0000 (08:51 -0400)
The "RTLIST..." list should be maintained integrity. If wildcard check
failed, it should immediately return failure. Otherwise user configuration
will be partial.

```
anlan(config-router-af)# route-target export *:55 33:33
% Wildcard '*' only applicable for import
anlan(config-router-af)# route-target both *:55 33:33
% Wildcard '*' only applicable for import
```

With this commit, the RTs without wildcard will not be executed as before. And
the same for `no` form.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
bgpd/bgp_evpn_vty.c

index f920a783b3be16bbfce0a3ff1bd368cb81ecfa5f..997250db102fb9b39261158eed3fe2699a17f68d 100644 (file)
@@ -5866,13 +5866,6 @@ static int parse_rtlist(struct bgp *bgp, struct vty *vty, int argc,
                 * the ecommunity parser.
                 */
                if ((argv[i]->arg)[0] == '*') {
-                       if (!is_import) {
-                               vty_out(vty,
-                                       "%% Wildcard '*' only applicable for import\n");
-                               ret = CMD_WARNING;
-                               continue;
-                       }
-
                        (argv[i]->arg)[0] = '0';
                        is_wildcard = true;
                }
@@ -5950,6 +5943,16 @@ DEFUN (bgp_evpn_vrf_rt,
                return CMD_WARNING_CONFIG_FAILED;
        }
 
+       if (rt_type != RT_TYPE_IMPORT) {
+               for (int i = 2; i < argc; i++) {
+                       if ((argv[i]->arg)[0] == '*') {
+                               vty_out(vty,
+                                       "%% Wildcard '*' only applicable for import\n");
+                               return CMD_WARNING_CONFIG_FAILED;
+                       }
+               }
+       }
+
        /* Add/update the import route-target */
        if (rt_type == RT_TYPE_BOTH || rt_type == RT_TYPE_IMPORT)
                tmp_ret = parse_rtlist(bgp, vty, argc, argv, 2, true, true);
@@ -6056,6 +6059,16 @@ DEFUN (no_bgp_evpn_vrf_rt,
                }
        }
 
+       if (rt_type != RT_TYPE_IMPORT) {
+               for (int i = 3; i < argc; i++) {
+                       if ((argv[i]->arg)[0] == '*') {
+                               vty_out(vty,
+                                       "%% Wildcard '*' only applicable for import\n");
+                               return CMD_WARNING_CONFIG_FAILED;
+                       }
+               }
+       }
+
        if (rt_type == RT_TYPE_BOTH || rt_type == RT_TYPE_IMPORT)
                tmp_ret = parse_rtlist(bgp, vty, argc, argv, 3, false, true);