]> git.puffer.fish Git - mirror/frr.git/commitdiff
vtysh: fix false lib path matching in extract.pl.in
authorJoakim Tjernlund <Joakim.Tjernlund@transmode.se>
Sat, 23 Feb 2013 18:38:37 +0000 (19:38 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Sat, 23 Feb 2013 18:38:37 +0000 (19:38 +0100)
The if ($file =~ /lib/) path matching logic is supposed to
match Quagga's lib directory only but will match all path
having lib in it such as /var/lib/jenkins/quagga/...

Fix by matching both lib and file: lib/keychain.c etc.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
vtysh/extract.pl.in

index 37763043a058e2d87f9310f14fd6ec2dcbe9582d..d323cdb05ab87c582ececf0db0df72c30e0cf8dd 100755 (executable)
@@ -90,41 +90,40 @@ foreach (@ARGV) {
        $cmd =~ s/\s+$//g;
 
         # $protocol is VTYSH_PROTO format for redirection of user input
-       if ($file =~ /lib/) {
-           if ($file =~ /keychain.c/) {
-              $protocol = "VTYSH_RIPD";
-           }
-           if ($file =~ /routemap.c/) {
-              $protocol = "VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA";
-           }
-           if ($file =~ /filter.c/) {
-              $protocol = "VTYSH_ALL";
-           }
-           if ($file =~ /plist.c/) {
-             if ($defun_array[1] =~ m/ipv6/) {
-                 $protocol = "VTYSH_RIPNGD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA";
-              } else {
-                 $protocol = "VTYSH_RIPD|VTYSH_OSPFD|VTYSH_BGPD|VTYSH_ZEBRA";
-              }
-           }
-           if ($file =~ /distribute.c/) {
-              if ($defun_array[1] =~ m/ipv6/) {
-                 $protocol = "VTYSH_RIPNGD";
-              } else {
-                 $protocol = "VTYSH_RIPD";
-              }
-           }
-           if ($file =~ /if_rmap.c/) {
-              if ($defun_array[1] =~ m/ipv6/) {
-                 $protocol = "VTYSH_RIPNGD";
-              } else {
-                 $protocol = "VTYSH_RIPD";
-              }
-           }
-          if ($file =~ /vty.c/) {
-             $protocol = "VTYSH_ALL";
-          }
-        } else {
+        if ($file =~ /lib\/keychain\.c$/) {
+            $protocol = "VTYSH_RIPD";
+        }
+        elsif ($file =~ /lib\/routemap\.c$/) {
+            $protocol = "VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA";
+        }
+        elsif ($file =~ /lib\/filter\.c$/) {
+            $protocol = "VTYSH_ALL";
+        }
+        elsif ($file =~ /lib\/plist\.c$/) {
+            if ($defun_array[1] =~ m/ipv6/) {
+                $protocol = "VTYSH_RIPNGD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA";
+            } else {
+                $protocol = "VTYSH_RIPD|VTYSH_OSPFD|VTYSH_BGPD|VTYSH_ZEBRA";
+            }
+        }
+        elsif ($file =~ /lib\/distribute\.c$/) {
+            if ($defun_array[1] =~ m/ipv6/) {
+                $protocol = "VTYSH_RIPNGD";
+            } else {
+                $protocol = "VTYSH_RIPD";
+            }
+        }
+        elsif ($file =~ /lib\/if_rmap\.c$/) {
+            if ($defun_array[1] =~ m/ipv6/) {
+                $protocol = "VTYSH_RIPNGD";
+            } else {
+                $protocol = "VTYSH_RIPD";
+            }
+        }
+        elsif ($file =~ /lib\/vty\.c$/) {
+           $protocol = "VTYSH_ALL";
+        }
+       else {
            ($protocol) = ($file =~ /^.*\/([a-z0-9]+)\/[a-zA-Z0-9_\-]+\.c$/);
            $protocol = "VTYSH_" . uc $protocol;
         }