batfish / batfish

Batfish is a network configuration analysis tool that can find bugs and guarantee the correctness of (planned or current) network configurations. It enables network engineers to rapidly and safely evolve their network, without fear of outages or security breaches.
http://www.batfish.org
Apache License 2.0
1.17k stars 233 forks source link

Cisco static route next-hop interface name is not canonicalized #95

Closed arifogel closed 7 years ago

arifogel commented 7 years ago

The stored value of the name of the next-hop interface of a static route is not canonicalized. This causes a crash in data plane computation when the actual interface cannot be found due to the name mismatch.

arifogel commented 7 years ago

Should be fixable with below patch. Commit will follow later.

diff --git a/projects/batfish/src/org/batfish/grammar/cisco/CiscoControlPlaneExtractor.java b/projects/batfish/src/org/batfish/grammar/cisco/CiscoControlPlaneExtractor.java
index 514f6a0..7c2895a 100644
--- a/projects/batfish/src/org/batfish/grammar/cisco/CiscoControlPlaneExtractor.java
+++ b/projects/batfish/src/org/batfish/grammar/cisco/CiscoControlPlaneExtractor.java
@@ -2690,7 +2690,7 @@ public class CiscoControlPlaneExtractor extends CiscoParserBaseListener
          nextHopIp = nextHopPrefix.getAddress();
       }
       if (ctx.nexthopint != null) {
-         nextHopInterface = ctx.nexthopint.getText();
+         nextHopInterface = getCanonicalInterfaceName(ctx.nexthopint.getText());
       }
       if (ctx.distance != null) {
          distance = toInteger(ctx.distance);
@@ -4073,7 +4073,7 @@ public class CiscoControlPlaneExtractor extends CiscoParserBaseListener
             nextHopIp = new Ip(ctx.nhip.getText());
          }
          if (ctx.nhint != null) {
-            nextHopInterface = ctx.nhint.getText();
+            nextHopInterface = getCanonicalInterfaceName(ctx.nhint.getText());
          }
          int distance = DEFAULT_STATIC_ROUTE_DISTANCE;
          if (ctx.distance != null) {
arifogel commented 7 years ago

fixed by b11ddea6d53e40c9e221a49e6bc7265df2823a37