Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cisco IOS: do not crash on malformed pool #6568

Merged
merged 2 commits into from Jan 15, 2021

Conversation

progwriter
Copy link
Contributor

In some cases (like anonymized configs) we were crashing the whole node conversion on malformed NAT pools. This change simply skips pool creation, and warns that the pool is malformed. The transformation referencing the pool will not match.

@batfish-bot
Copy link

This change is Reviewable

@codecov
Copy link

codecov bot commented Jan 15, 2021

Codecov Report

Merging #6568 (cfb9e78) into master (18f3a8e) will decrease coverage by 0.00%.
The diff coverage is 50.00%.

@@             Coverage Diff              @@
##             master    #6568      +/-   ##
============================================
- Coverage     73.40%   73.39%   -0.01%     
- Complexity    35715    35719       +4     
============================================
  Files          2837     2837              
  Lines        144146   144177      +31     
  Branches      17427    17431       +4     
============================================
+ Hits         105806   105824      +18     
- Misses        29958    29969      +11     
- Partials       8382     8384       +2     
Impacted Files Coverage Δ Complexity Δ
...fish/grammar/cisco/CiscoControlPlaneExtractor.java 66.81% <50.00%> (+0.07%) 1286.00 <0.00> (+3.00)
...rg/batfish/identifiers/StorageBasedIdResolver.java 85.29% <0.00%> (-5.89%) 22.00% <0.00%> (ø%)
.../org/batfish/dataplane/rib/RouteAdvertisement.java 83.67% <0.00%> (-4.09%) 18.00% <0.00%> (-1.00%)
...col/src/main/java/org/batfish/role/InferRoles.java 89.54% <0.00%> (-1.37%) 50.00% <0.00%> (-1.00%)
...src/main/java/org/batfish/coordinator/PoolMgr.java 59.52% <0.00%> (-1.20%) 15.00% <0.00%> (-1.00%)
.../org/batfish/representation/cisco/CiscoIosNat.java 88.00% <0.00%> (-0.89%) 8.00% <0.00%> (-1.00%)
...ain/java/org/batfish/storage/FileBasedStorage.java 86.19% <0.00%> (-0.55%) 249.00% <0.00%> (ø%)
...java/org/batfish/dataplane/ibdp/VirtualRouter.java 90.58% <0.00%> (-0.32%) 206.00% <0.00%> (-1.00%)
...a/org/batfish/representation/aws/LoadBalancer.java 82.18% <0.00%> (-0.32%) 70.00% <0.00%> (-1.00%)
...src/main/java/org/batfish/coordinator/WorkMgr.java 75.81% <0.00%> (-0.31%) 247.00% <0.00%> (-1.00%)
... and 4 more

Copy link
Contributor

@corinaminer corinaminer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 4 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @progwriter)


projects/batfish/src/main/java/org/batfish/representation/cisco/CiscoIosDynamicNat.java, line 245 at r1 (raw file):

      if (pool == null) {
        return when(FALSE);
      }

This addition isn't necessary; isMalformed already checked whether the specified pool is defined, so if it reaches this point then it must be.


projects/batfish/src/test/resources/org/batfish/grammar/cisco/testconfigs/ios-nat-malformed-pool, line 10 at r1 (raw file):

 permit 1.1.1.1 0.0.0.255
! Note the pool is not a valid range
ip nat pool SNOOKER 10.161.151.222 10.161.151.30 netmask 255.255.255.0

could choose some less obscure IPs lol

Copy link
Contributor Author

@progwriter progwriter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved


projects/batfish/src/main/java/org/batfish/representation/cisco/CiscoIosDynamicNat.java, line 245 at r1 (raw file):

Previously, corinaminer (Corina Miner) wrote…

This addition isn't necessary; isMalformed already checked whether the specified pool is defined, so if it reaches this point then it must be.

ah, cool, thanks.


projects/batfish/src/test/resources/org/batfish/grammar/cisco/testconfigs/ios-nat-malformed-pool, line 10 at r1 (raw file):

Previously, corinaminer (Corina Miner) wrote…

could choose some less obscure IPs lol

done

Copy link
Contributor

@corinaminer corinaminer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@progwriter progwriter merged commit f31dab4 into batfish:master Jan 15, 2021
@progwriter progwriter deleted the ios-malformed-pool branch January 15, 2021 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants