]> git.puffer.fish Git - mirror/frr.git/commitdiff
pbrd: fix crash with match command 13881/head
authoranlan_cs <vic.lan@pica8.com>
Wed, 28 Jun 2023 04:31:52 +0000 (12:31 +0800)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Thu, 29 Jun 2023 19:22:46 +0000 (19:22 +0000)
Crash with empty `ip-protocol`:
```
anlan(config-pbr-map)# match ip-protocol
vtysh: error reading from pbrd: Resource temporarily unavailable (11)Warning: closing connection to pbrd because of an I/O error!
```

So, give warning for empty `ip-protocol`.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
(cherry picked from commit 4e313ee450cb95cbc49cfe0b5bb9eb2e31549554)

pbrd/pbr_vty.c

index a2dfd80fdd90889d26d1cad03d317a01087ea4de..abd997e9c08b083359e6996ebe6e67e710708fb3 100644 (file)
@@ -212,6 +212,11 @@ DEFPY(pbr_map_match_ip_proto, pbr_map_match_ip_proto_cmd,
                return CMD_WARNING_CONFIG_FAILED;
 
        if (!no) {
+               if (!ip_proto) {
+                       vty_out(vty, "Unable to convert (null) to proto id\n");
+                       return CMD_WARNING;
+               }
+
                p = getprotobyname(ip_proto);
                if (!p) {
                        vty_out(vty, "Unable to convert %s to proto id\n",