puffy 1.0.0 → 1.1.0.pre.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
3
  # DO NOT MODIFY!!!!
4
- # This file is automatically generated by Racc 1.7.3
4
+ # This file is automatically generated by Racc 1.8.1
5
5
  # from Racc grammar file "parser.y".
6
6
  #
7
7
 
@@ -24,7 +24,7 @@ unless $".find {|p| p.end_with?('/racc/info.rb')}
24
24
  $".push "#{__dir__}/racc/info.rb"
25
25
 
26
26
  module Racc
27
- VERSION = '1.7.3'
27
+ VERSION = '1.8.1'
28
28
  Version = VERSION
29
29
  Copyright = 'Copyright (c) 1999-2006 Minero Aoki'
30
30
  end
@@ -32,10 +32,6 @@ end
32
32
  end
33
33
 
34
34
 
35
- unless defined?(NotImplementedError)
36
- NotImplementedError = NotImplementError # :nodoc:
37
- end
38
-
39
35
  module Racc
40
36
  class ParseError < StandardError; end
41
37
  end
@@ -43,7 +39,7 @@ unless defined?(::ParseError)
43
39
  ParseError = Racc::ParseError # :nodoc:
44
40
  end
45
41
 
46
- # Racc is a LALR(1) parser generator.
42
+ # Racc is an LALR(1) parser generator.
47
43
  # It is written in Ruby itself, and generates Ruby programs.
48
44
  #
49
45
  # == Command-line Reference
@@ -660,15 +656,16 @@ end
660
656
 
661
657
  require 'deep_merge'
662
658
  require 'ipaddr'
659
+ require 'json'
663
660
  require 'strscan'
664
661
 
665
662
  module Puffy
666
663
  class Parser < Racc::Parser
667
664
 
668
- module_eval(<<'...end parser.y/module_eval...', 'parser.y', 166)
665
+ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 176)
669
666
 
670
667
  attr_accessor :yydebug
671
- attr_reader :policy, :filename
668
+ attr_reader :current_policies, :filename
672
669
  #attr_accessor :variables, :nodes, :services
673
670
 
674
671
  def ipaddress?(s)
@@ -749,6 +746,7 @@ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 166)
749
746
  when s.scan(/rdr-to\b/) then emit(:RDR_TO, s.matched)
750
747
  when s.scan(/srv\b/) then emit(:SRV, s.matched)
751
748
  when s.scan(/apt-mirror\b/) then emit(:APT_MIRROR, s.matched)
749
+ when s.scan(/azure-ip-range\b/) then emit(:AZURE_IP_RANGE, s.matched)
752
750
 
753
751
  when s.scan(/\d+\.\d+\.\d+\.\d+(\/\d+)?/) && ip = ipaddress?(s) then emit(:ADDRESS, ip, s.matched_size)
754
752
  when s.scan(/[[:xdigit:]]*:[:[:xdigit:]]+(\/\d+)?/) && ip = ipaddress?(s) then emit(:ADDRESS, ip, s.matched_size)
@@ -771,7 +769,7 @@ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 166)
771
769
 
772
770
  begin
773
771
  do_parse
774
- rescue Racc::ParseError => e
772
+ rescue Racc::ParseError
775
773
  raise ParseError.new("Parse error: unexpected token: #{@current_token[0]}", @current_token[1])
776
774
  end
777
775
  end
@@ -805,6 +803,10 @@ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 166)
805
803
  @saved_policies = {}
806
804
  @services = {}
807
805
  @rule_factory = Puffy::RuleFactory.new
806
+ @default_policies = {
807
+ in: { action: :block, log: false },
808
+ out: { action: :block, log: false },
809
+ }
808
810
  end
809
811
 
810
812
  def nodes
@@ -851,8 +853,8 @@ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 166)
851
853
  end.flatten
852
854
  end
853
855
 
854
- def policy_for(hostname)
855
- prefered_value_for_hostname(@saved_policies, hostname) || @default_policy || :block
856
+ def policies_for(hostname)
857
+ return @default_policies.merge(prefered_value_for_hostname(@saved_policies, hostname))
856
858
  end
857
859
 
858
860
  def constraint_service_to_hosts(service, hosts)
@@ -878,244 +880,259 @@ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 166)
878
880
  ##### State transition tables begin ###
879
881
 
880
882
  racc_action_table = [
881
- 134, 134, 131, 134, 134, 6, 155, 156, 167, 75,
882
- 162, 17, 160, 7, 8, 34, 110, 18, 9, 115,
883
- 116, 111, 110, 10, 35, 115, 116, 111, 110, 77,
884
- 78, 115, 116, 111, 21, 17, 133, 133, 22, 133,
885
- 133, 18, 169, 170, 107, 112, 120, 121, 113, 114,
886
- 107, 112, 17, 15, 113, 114, 107, 112, 18, 6,
887
- 113, 114, 6, 27, 39, 77, 78, 7, 8, 6,
888
- 7, 8, 9, 40, 24, 9, 6, 7, 8, 68,
889
- 25, 26, 9, 50, 7, 8, 77, 78, 67, 9,
890
- 48, 49, 51, 52, 50, 25, 26, 115, 116, 70,
891
- 39, 48, 49, 51, 52, 50, 25, 26, 69, 40,
892
- 9, 63, 48, 49, 51, 52, 50, 25, 26, 136,
893
- 137, 9, 79, 48, 49, 51, 52, 50, 25, 26,
894
- 141, 142, 115, 116, 48, 49, 51, 52, 50, 25,
895
- 26, 30, 31, 32, 97, 48, 49, 51, 52, 50,
896
- 25, 26, 30, 31, 32, 100, 48, 49, 51, 52,
897
- 50, 25, 26, 90, 91, 92, 101, 48, 49, 51,
898
- 52, 50, 25, 26, 90, 91, 92, 102, 48, 49,
899
- 51, 52, 50, 25, 26, 90, 91, 92, 103, 48,
900
- 49, 51, 52, 50, 25, 26, 90, 91, 92, 104,
901
- 48, 49, 51, 52, 50, 25, 26, 77, 78, 115,
902
- 116, 48, 49, 51, 52, 50, 25, 26, 169, 170,
903
- 105, 119, 48, 49, 51, 52, 19, 25, 26, 123,
904
- 21, 17, 55, 56, 22, 21, 21, 18, 28, 22,
905
- 22, 30, 31, 32, 60, 61, 30, 31, 32, 162,
906
- 114, 114, 171, 172, 114, 129, 130, 138, 144, 145,
907
- 148, 150, 114, 153, 154, 158, 162, 175, 176, 162,
908
- 178, 179 ]
883
+ 36, 36, 31, 144, 93, 36, 38, 134, 135, 12,
884
+ 36, 38, 43, 76, 77, 36, 38, 17, 23, 44,
885
+ 24, 38, 6, 51, 52, 51, 52, 7, 127, 8,
886
+ 178, 29, 38, 10, 40, 35, 35, 37, 41, 40,
887
+ 35, 30, 37, 41, 40, 35, 36, 37, 41, 40,
888
+ 35, 36, 37, 41, 124, 128, 56, 127, 129, 130,
889
+ 40, 38, 48, 37, 41, 180, 181, 36, 127, 49,
890
+ 167, 168, 38, 57, 152, 153, 23, 38, 24, 38,
891
+ 160, 35, 110, 124, 128, 160, 35, 129, 130, 40,
892
+ 38, 10, 37, 41, 124, 128, 108, 109, 129, 130,
893
+ 40, 160, 35, 37, 41, 40, 86, 40, 37, 41,
894
+ 37, 41, 10, 85, 19, 64, 75, 110, 40, 110,
895
+ 20, 37, 41, 62, 63, 65, 66, 64, 79, 26,
896
+ 27, 108, 109, 108, 109, 62, 63, 65, 66, 64,
897
+ 21, 26, 27, 110, 23, 88, 24, 62, 63, 65,
898
+ 66, 64, 87, 26, 27, 26, 27, 108, 109, 62,
899
+ 63, 65, 66, 64, 19, 26, 27, 51, 52, 48,
900
+ 20, 62, 63, 65, 66, 64, 49, 26, 27, 173,
901
+ 80, 171, 19, 62, 63, 65, 66, 64, 20, 26,
902
+ 27, 26, 27, 81, 19, 62, 63, 65, 66, 64,
903
+ 20, 26, 27, 51, 52, 51, 52, 62, 63, 65,
904
+ 66, 64, 173, 26, 27, 182, 183, 147, 148, 62,
905
+ 63, 65, 66, 64, 95, 26, 27, 51, 52, 180,
906
+ 181, 62, 63, 65, 66, 64, 100, 26, 27, 102,
907
+ 75, 117, 118, 62, 63, 65, 66, 6, 6, 26,
908
+ 27, 119, 7, 7, 8, 8, 6, 6, 10, 10,
909
+ 120, 7, 7, 8, 8, 121, 122, 10, 10, 69,
910
+ 70, 133, 23, 137, 24, 130, 130, 142, 143, 149,
911
+ 155, 156, 162, 130, 165, 166, 173, 186, 187, 173,
912
+ 189, 190 ]
909
913
 
910
914
  racc_action_check = [
911
- 114, 131, 114, 146, 156, 0, 146, 146, 164, 53,
912
- 150, 7, 150, 0, 0, 16, 90, 7, 0, 90,
913
- 90, 90, 91, 1, 16, 91, 91, 91, 123, 53,
914
- 53, 123, 123, 123, 19, 50, 114, 131, 19, 146,
915
- 156, 50, 164, 164, 90, 90, 98, 98, 90, 90,
916
- 91, 91, 51, 6, 91, 91, 123, 123, 51, 2,
917
- 123, 123, 3, 10, 20, 98, 98, 2, 2, 4,
918
- 3, 3, 2, 20, 9, 3, 5, 4, 4, 48,
919
- 9, 9, 4, 34, 5, 5, 75, 75, 48, 5,
920
- 34, 34, 34, 34, 35, 34, 34, 110, 110, 49,
921
- 55, 35, 35, 35, 35, 39, 35, 35, 49, 55,
922
- 39, 44, 39, 39, 39, 39, 40, 39, 39, 118,
923
- 118, 40, 54, 40, 40, 40, 40, 45, 40, 40,
924
- 126, 126, 126, 126, 45, 45, 45, 45, 46, 45,
925
- 45, 28, 28, 28, 74, 46, 46, 46, 46, 47,
926
- 46, 46, 61, 61, 61, 82, 47, 47, 47, 47,
927
- 58, 47, 47, 71, 71, 71, 83, 58, 58, 58,
928
- 58, 59, 58, 58, 72, 72, 72, 85, 59, 59,
929
- 59, 59, 67, 59, 59, 73, 73, 73, 86, 67,
930
- 67, 67, 67, 68, 67, 67, 149, 149, 149, 87,
931
- 68, 68, 68, 68, 69, 68, 68, 121, 121, 142,
932
- 142, 69, 69, 69, 69, 70, 69, 69, 167, 167,
933
- 88, 96, 70, 70, 70, 70, 8, 70, 70, 106,
934
- 8, 52, 36, 36, 8, 36, 56, 52, 15, 36,
935
- 56, 15, 15, 15, 42, 42, 42, 42, 42, 165,
936
- 107, 108, 165, 165, 111, 112, 113, 119, 129, 130,
937
- 133, 135, 141, 144, 145, 148, 160, 169, 170, 172,
938
- 175, 178 ]
915
+ 17, 130, 17, 130, 67, 31, 17, 115, 115, 1,
916
+ 54, 31, 18, 54, 54, 77, 54, 6, 21, 18,
917
+ 21, 77, 0, 67, 67, 115, 115, 0, 108, 0,
918
+ 175, 11, 108, 0, 17, 17, 130, 17, 17, 31,
919
+ 31, 12, 31, 31, 54, 54, 144, 54, 54, 77,
920
+ 77, 168, 77, 77, 108, 108, 35, 109, 108, 108,
921
+ 108, 109, 22, 108, 108, 175, 175, 157, 137, 22,
922
+ 157, 157, 137, 41, 140, 140, 70, 140, 70, 127,
923
+ 144, 144, 89, 109, 109, 168, 168, 109, 109, 109,
924
+ 153, 48, 109, 109, 137, 137, 89, 89, 137, 137,
925
+ 137, 157, 157, 137, 137, 140, 62, 127, 140, 140,
926
+ 127, 127, 49, 62, 7, 43, 50, 90, 153, 91,
927
+ 7, 153, 153, 43, 43, 43, 43, 44, 56, 43,
928
+ 43, 90, 90, 91, 91, 44, 44, 44, 44, 59,
929
+ 8, 44, 44, 161, 8, 63, 8, 59, 59, 59,
930
+ 59, 60, 63, 59, 59, 10, 10, 161, 161, 60,
931
+ 60, 60, 60, 61, 64, 60, 60, 25, 25, 69,
932
+ 64, 61, 61, 61, 61, 72, 69, 61, 61, 162,
933
+ 57, 162, 65, 72, 72, 72, 72, 73, 65, 72,
934
+ 72, 29, 29, 58, 66, 73, 73, 73, 73, 85,
935
+ 66, 73, 73, 53, 53, 93, 93, 85, 85, 85,
936
+ 85, 86, 176, 85, 85, 176, 176, 132, 132, 86,
937
+ 86, 86, 86, 87, 68, 86, 86, 135, 135, 178,
938
+ 178, 87, 87, 87, 87, 88, 74, 87, 87, 80,
939
+ 92, 98, 99, 88, 88, 88, 88, 2, 3, 88,
940
+ 88, 103, 2, 3, 2, 3, 4, 5, 2, 3,
941
+ 104, 4, 5, 4, 5, 105, 106, 4, 5, 45,
942
+ 45, 114, 45, 123, 45, 124, 126, 128, 129, 133,
943
+ 142, 143, 146, 152, 155, 156, 171, 180, 181, 183,
944
+ 186, 189 ]
939
945
 
940
946
  racc_action_pointer = [
941
- 3, 23, 57, 60, 67, 74, 50, 9, 222, 58,
942
- 63, nil, nil, nil, nil, 234, 11, nil, nil, 26,
943
- 60, nil, nil, nil, nil, nil, nil, nil, 134, nil,
944
- nil, nil, nil, nil, 73, 84, 227, nil, nil, 95,
945
- 106, nil, 239, nil, 106, 117, 128, 139, 75, 95,
946
- 33, 50, 229, 5, 108, 96, 228, nil, 150, 161,
947
- nil, 145, nil, nil, nil, nil, nil, 172, 183, 194,
948
- 205, 134, 145, 156, 128, 62, nil, nil, nil, nil,
949
- nil, nil, 150, 152, nil, 163, 183, 185, 215, nil,
950
- 12, 18, nil, nil, nil, nil, 200, nil, 41, nil,
951
- nil, nil, nil, nil, nil, nil, 199, 213, 214, nil,
952
- 90, 217, 221, 222, -2, nil, nil, nil, 93, 249,
953
- nil, 183, nil, 24, nil, nil, 125, nil, nil, 250,
954
- 251, -1, nil, 221, nil, 233, nil, nil, nil, nil,
955
- nil, 225, 202, nil, 228, 229, 1, nil, 227, 167,
956
- 8, nil, nil, nil, nil, nil, 2, nil, nil, nil,
957
- 264, nil, nil, nil, 2, 247, nil, 178, nil, 260,
958
- 261, nil, 267, nil, nil, 233, nil, nil, 233, nil ]
947
+ 20, 9, 245, 246, 254, 255, 14, 112, 136, nil,
948
+ 134, 18, 41, nil, nil, nil, nil, -2, 8, nil,
949
+ nil, 10, 58, nil, nil, 144, nil, nil, nil, 170,
950
+ nil, 3, nil, nil, nil, 18, nil, nil, nil, nil,
951
+ nil, 41, nil, 108, 120, 264, nil, nil, 78, 99,
952
+ 97, nil, nil, 180, 8, nil, 91, 172, 188, 132,
953
+ 144, 156, 102, 141, 162, 180, 192, 0, 212, 165,
954
+ 68, nil, 168, 180, 222, nil, nil, 13, nil, nil,
955
+ 206, nil, nil, nil, nil, 192, 204, 216, 228, 68,
956
+ 103, 105, 221, 182, nil, nil, nil, nil, 236, 230,
957
+ nil, nil, nil, 239, 255, 253, 261, nil, 24, 53,
958
+ nil, nil, nil, nil, 251, 2, nil, nil, nil, nil,
959
+ nil, nil, nil, 244, 240, nil, 241, 71, 245, 246,
960
+ -1, nil, 192, 271, nil, 204, nil, 64, nil, nil,
961
+ 69, nil, 272, 273, 44, nil, 255, nil, nil, nil,
962
+ nil, nil, 248, 82, nil, 251, 252, 65, nil, nil,
963
+ nil, 129, 177, nil, nil, nil, nil, nil, 49, nil,
964
+ nil, 284, nil, nil, nil, 24, 210, nil, 188, nil,
965
+ 248, 249, nil, 287, nil, nil, 255, nil, nil, 254,
966
+ nil ]
959
967
 
960
968
  racc_action_default = [
961
- -5, -100, -5, -5, -5, -5, -100, -100, -100, -100,
962
- -100, -1, -2, -3, -4, -100, -100, -15, -16, -100,
963
- -100, -22, -23, -33, -34, -47, -48, 180, -100, -7,
964
- -11, -12, -13, -14, -32, -32, -100, -21, -18, -32,
965
- -32, -26, -100, -10, -100, -32, -32, -32, -100, -100,
966
- -100, -100, -100, -49, -100, -100, -100, -20, -32, -32,
967
- -6, -100, -9, -27, -29, -30, -31, -32, -32, -32,
968
- -32, -72, -72, -72, -44, -100, -51, -55, -56, -28,
969
- -17, -19, -100, -100, -8, -100, -100, -100, -100, -39,
970
- -82, -82, -70, -71, -40, -41, -45, -43, -100, -54,
971
- -24, -25, -35, -36, -37, -38, -68, -82, -82, -75,
972
- -100, -82, -100, -100, -100, -89, -90, -69, -57, -100,
973
- -50, -100, -53, -82, -73, -74, -100, -93, -77, -100,
974
- -100, -100, -81, -86, -87, -60, -58, -59, -46, -52,
975
- -67, -82, -100, -92, -100, -100, -100, -85, -100, -100,
976
- -100, -76, -91, -78, -79, -80, -100, -84, -88, -96,
977
- -100, -62, -66, -83, -42, -100, -65, -100, -95, -100,
978
- -100, -61, -100, -64, -94, -98, -99, -63, -100, -97 ]
969
+ -5, -105, -5, -5, -5, -5, -105, -105, -105, -31,
970
+ -105, -34, -105, -1, -2, -3, -4, -105, -105, -14,
971
+ -15, -105, -105, -21, -22, -32, -48, -49, -33, -105,
972
+ 191, -105, -7, -11, -12, -88, -89, -91, -92, -96,
973
+ -97, -105, -13, -30, -30, -105, -20, -17, -34, -34,
974
+ -45, -56, -57, -105, -105, -10, -105, -105, -105, -30,
975
+ -30, -30, -105, -105, -105, -105, -105, -50, -105, -105,
976
+ -105, -19, -30, -30, -105, -44, -6, -105, -9, -90,
977
+ -105, -25, -27, -28, -29, -30, -30, -30, -30, -73,
978
+ -73, -73, -45, -105, -52, -26, -16, -18, -105, -105,
979
+ -35, -8, -98, -105, -105, -105, -105, -40, -82, -82,
980
+ -71, -72, -41, -42, -46, -105, -55, -23, -24, -36,
981
+ -37, -38, -39, -69, -82, -75, -82, -105, -105, -105,
982
+ -105, -70, -58, -105, -51, -105, -54, -82, -74, -76,
983
+ -105, -95, -105, -105, -105, -81, -61, -59, -60, -47,
984
+ -53, -68, -82, -105, -94, -105, -105, -105, -85, -86,
985
+ -87, -105, -105, -77, -93, -78, -79, -80, -105, -84,
986
+ -101, -105, -63, -67, -83, -43, -105, -66, -105, -100,
987
+ -105, -105, -62, -105, -65, -99, -103, -104, -64, -105,
988
+ -102 ]
979
989
 
980
990
  racc_goto_table = [
981
- 76, 20, 132, 16, 29, 38, 161, 124, 125, 106,
982
- 117, 128, 37, 58, 59, 168, 166, 43, 174, 147,
983
- 127, 173, 99, 89, 94, 95, 42, 33, 177, 57,
984
- 36, 62, 23, 74, 157, 96, 143, 118, 135, 149,
985
- 80, 151, 140, 159, 163, 122, 71, 72, 73, 81,
986
- 84, 54, 152, 164, 98, 1, 54, 11, 12, 13,
987
- 14, 64, 65, 66, 165, 126, 146, nil, 139, nil,
988
- nil, nil, nil, nil, 82, 83, nil, nil, nil, nil,
989
- nil, nil, nil, 85, 86, 87, 88 ]
991
+ 94, 22, 32, 47, 126, 126, 25, 18, 145, 74,
992
+ 179, 58, 68, 185, 46, 138, 55, 139, 123, 131,
993
+ 54, 158, 159, 141, 42, 53, 116, 82, 83, 84,
994
+ 107, 112, 113, 126, 169, 159, 154, 45, 71, 78,
995
+ 98, 99, 28, 163, 92, 174, 159, 151, 136, 164,
996
+ 96, 114, 132, 103, 104, 105, 106, 146, 172, 72,
997
+ 73, 161, 101, 97, 89, 90, 91, 177, 150, 170,
998
+ 175, 1, 184, 13, 14, 15, 16, 115, 176, 188,
999
+ 140, 157 ]
990
1000
 
991
1001
  racc_goto_check = [
992
- 27, 12, 35, 8, 7, 11, 29, 31, 31, 30,
993
- 30, 31, 12, 4, 4, 36, 29, 7, 36, 35,
994
- 32, 29, 27, 18, 18, 18, 6, 9, 29, 12,
995
- 10, 7, 17, 19, 35, 20, 32, 21, 22, 23,
996
- 11, 31, 30, 24, 35, 27, 8, 8, 8, 12,
997
- 7, 13, 32, 25, 26, 1, 13, 1, 1, 1,
998
- 1, 13, 13, 13, 28, 33, 34, nil, 27, nil,
999
- nil, nil, nil, nil, 13, 13, nil, nil, nil, nil,
1000
- nil, nil, nil, 13, 13, 13, 13 ]
1002
+ 22, 14, 7, 13, 8, 8, 20, 10, 9, 23,
1003
+ 40, 15, 15, 40, 14, 35, 7, 35, 34, 34,
1004
+ 6, 38, 9, 8, 11, 20, 22, 15, 15, 15,
1005
+ 24, 24, 24, 8, 38, 9, 8, 12, 14, 7,
1006
+ 15, 15, 19, 35, 25, 38, 9, 34, 22, 8,
1007
+ 13, 23, 26, 15, 15, 15, 15, 27, 33, 4,
1008
+ 4, 28, 7, 14, 10, 10, 10, 33, 22, 29,
1009
+ 30, 1, 33, 1, 1, 1, 1, 31, 32, 33,
1010
+ 36, 37 ]
1001
1011
 
1002
1012
  racc_goto_pointer = [
1003
- nil, 55, nil, nil, -26, nil, -2, -11, -4, 11,
1004
- 11, -15, -7, 16, nil, nil, nil, 23, -48, -20,
1005
- -39, -59, -80, -96, -106, -106, -21, -53, -96, -144,
1006
- -81, -100, -90, -45, -65, -112, -149 ]
1013
+ nil, 71, nil, nil, 11, nil, -11, -15, -104, -122,
1014
+ 0, 6, 16, -19, -7, -32, nil, nil, nil, 31,
1015
+ -4, nil, -67, -41, -59, -23, -62, -75, -85, -92,
1016
+ -100, -16, -93, -104, -90, -109, -47, -63, -123, nil,
1017
+ -165 ]
1007
1018
 
1008
1019
  racc_goto_default = [
1009
- nil, nil, 2, 3, 4, 5, nil, nil, nil, 41,
1010
- nil, nil, nil, 44, 45, 46, 47, 53, nil, nil,
1011
- nil, nil, nil, nil, 93, nil, nil, nil, nil, nil,
1012
- nil, 109, 108, nil, nil, nil, nil ]
1020
+ nil, nil, 2, 3, 4, 5, nil, nil, 33, 34,
1021
+ nil, nil, nil, nil, nil, nil, 59, 60, 61, 9,
1022
+ 67, 11, 50, nil, nil, nil, nil, nil, nil, 111,
1023
+ nil, nil, nil, nil, nil, 125, nil, nil, nil, 39,
1024
+ nil ]
1013
1025
 
1014
1026
  racc_reduce_table = [
1015
1027
  0, 0, :racc_error,
1016
- 2, 43, :_reduce_none,
1017
- 2, 43, :_reduce_none,
1018
- 2, 43, :_reduce_3,
1019
- 2, 43, :_reduce_none,
1020
- 0, 43, :_reduce_none,
1021
- 5, 44, :_reduce_6,
1022
- 3, 44, :_reduce_7,
1023
- 3, 48, :_reduce_8,
1024
- 2, 48, :_reduce_9,
1025
- 1, 48, :_reduce_10,
1026
- 1, 49, :_reduce_11,
1027
- 1, 49, :_reduce_12,
1028
- 1, 49, :_reduce_13,
1029
- 3, 47, :_reduce_14,
1030
- 1, 50, :_reduce_15,
1031
- 1, 50, :_reduce_16,
1032
- 5, 45, :_reduce_17,
1033
- 3, 45, :_reduce_18,
1034
- 3, 52, :_reduce_19,
1035
- 2, 52, :_reduce_20,
1036
- 1, 52, :_reduce_21,
1037
- 1, 54, :_reduce_22,
1038
- 1, 54, :_reduce_23,
1039
- 4, 53, :_reduce_24,
1040
- 4, 53, :_reduce_25,
1041
- 1, 53, :_reduce_26,
1042
- 3, 51, :_reduce_27,
1043
- 3, 51, :_reduce_28,
1044
- 2, 55, :_reduce_29,
1045
- 2, 55, :_reduce_30,
1046
- 2, 55, :_reduce_31,
1047
- 0, 55, :_reduce_32,
1048
- 2, 46, :_reduce_33,
1049
- 2, 46, :_reduce_34,
1050
- 4, 57, :_reduce_35,
1051
- 4, 57, :_reduce_36,
1052
- 4, 58, :_reduce_37,
1053
- 4, 58, :_reduce_38,
1054
- 3, 56, :_reduce_39,
1055
- 3, 56, :_reduce_40,
1056
- 3, 56, :_reduce_41,
1057
- 8, 56, :_reduce_42,
1058
- 1, 62, :_reduce_none,
1059
- 0, 62, :_reduce_none,
1060
- 0, 63, :_reduce_none,
1061
- 2, 63, :_reduce_46,
1062
- 1, 59, :_reduce_47,
1063
- 1, 59, :_reduce_48,
1064
- 0, 61, :_reduce_none,
1065
- 3, 61, :_reduce_50,
1066
- 1, 61, :_reduce_51,
1067
- 3, 68, :_reduce_52,
1068
- 2, 68, :_reduce_53,
1069
- 1, 68, :_reduce_54,
1070
- 1, 69, :_reduce_55,
1071
- 1, 69, :_reduce_56,
1072
- 0, 64, :_reduce_none,
1073
- 1, 64, :_reduce_58,
1074
- 1, 64, :_reduce_59,
1075
- 0, 65, :_reduce_none,
1076
- 4, 65, :_reduce_61,
1077
- 2, 65, :_reduce_62,
1078
- 3, 70, :_reduce_63,
1079
- 2, 70, :_reduce_64,
1080
- 1, 70, :_reduce_65,
1081
- 1, 71, :_reduce_66,
1082
- 4, 66, :_reduce_67,
1083
- 2, 66, :_reduce_68,
1084
- 2, 66, :_reduce_69,
1085
- 1, 66, :_reduce_70,
1086
- 1, 60, :_reduce_none,
1087
- 0, 60, :_reduce_72,
1088
- 2, 72, :_reduce_73,
1089
- 2, 72, :_reduce_74,
1090
- 1, 72, :_reduce_75,
1091
- 4, 72, :_reduce_76,
1092
- 2, 72, :_reduce_77,
1093
- 4, 72, :_reduce_78,
1094
- 4, 72, :_reduce_79,
1095
- 4, 73, :_reduce_80,
1096
- 2, 73, :_reduce_81,
1097
- 0, 73, :_reduce_none,
1098
- 3, 76, :_reduce_83,
1099
- 2, 76, :_reduce_84,
1100
- 1, 76, :_reduce_85,
1101
- 1, 77, :_reduce_86,
1102
- 1, 77, :_reduce_87,
1103
- 3, 77, :_reduce_88,
1104
- 1, 74, :_reduce_89,
1105
- 1, 74, :_reduce_90,
1106
- 3, 75, :_reduce_91,
1107
- 2, 75, :_reduce_92,
1108
- 1, 75, :_reduce_93,
1109
- 3, 67, :_reduce_94,
1110
- 2, 67, :_reduce_95,
1111
- 0, 67, :_reduce_96,
1112
- 4, 78, :_reduce_97,
1113
- 2, 78, :_reduce_98,
1114
- 2, 78, :_reduce_99 ]
1115
-
1116
- racc_reduce_n = 100
1117
-
1118
- racc_shift_n = 180
1028
+ 2, 44, :_reduce_none,
1029
+ 2, 44, :_reduce_none,
1030
+ 2, 44, :_reduce_3,
1031
+ 2, 44, :_reduce_none,
1032
+ 0, 44, :_reduce_none,
1033
+ 5, 45, :_reduce_6,
1034
+ 3, 45, :_reduce_7,
1035
+ 3, 49, :_reduce_8,
1036
+ 2, 49, :_reduce_9,
1037
+ 1, 49, :_reduce_10,
1038
+ 1, 50, :_reduce_11,
1039
+ 1, 50, :_reduce_12,
1040
+ 3, 48, :_reduce_13,
1041
+ 1, 53, :_reduce_14,
1042
+ 1, 53, :_reduce_15,
1043
+ 5, 46, :_reduce_16,
1044
+ 3, 46, :_reduce_17,
1045
+ 3, 55, :_reduce_18,
1046
+ 2, 55, :_reduce_19,
1047
+ 1, 55, :_reduce_20,
1048
+ 1, 57, :_reduce_21,
1049
+ 1, 57, :_reduce_22,
1050
+ 4, 56, :_reduce_23,
1051
+ 4, 56, :_reduce_24,
1052
+ 3, 54, :_reduce_25,
1053
+ 3, 54, :_reduce_26,
1054
+ 2, 58, :_reduce_27,
1055
+ 2, 58, :_reduce_28,
1056
+ 2, 58, :_reduce_29,
1057
+ 0, 58, :_reduce_30,
1058
+ 1, 47, :_reduce_31,
1059
+ 2, 47, :_reduce_32,
1060
+ 2, 62, :_reduce_33,
1061
+ 0, 62, :_reduce_34,
1062
+ 5, 64, :_reduce_35,
1063
+ 4, 60, :_reduce_36,
1064
+ 4, 60, :_reduce_37,
1065
+ 4, 61, :_reduce_38,
1066
+ 4, 61, :_reduce_39,
1067
+ 3, 59, :_reduce_40,
1068
+ 3, 59, :_reduce_41,
1069
+ 3, 59, :_reduce_42,
1070
+ 8, 59, :_reduce_43,
1071
+ 1, 66, :_reduce_44,
1072
+ 0, 66, :_reduce_45,
1073
+ 0, 69, :_reduce_none,
1074
+ 2, 69, :_reduce_47,
1075
+ 1, 63, :_reduce_48,
1076
+ 1, 63, :_reduce_49,
1077
+ 0, 68, :_reduce_none,
1078
+ 3, 68, :_reduce_51,
1079
+ 1, 68, :_reduce_52,
1080
+ 3, 74, :_reduce_53,
1081
+ 2, 74, :_reduce_54,
1082
+ 1, 74, :_reduce_55,
1083
+ 1, 65, :_reduce_56,
1084
+ 1, 65, :_reduce_57,
1085
+ 0, 70, :_reduce_none,
1086
+ 1, 70, :_reduce_59,
1087
+ 1, 70, :_reduce_60,
1088
+ 0, 71, :_reduce_none,
1089
+ 4, 71, :_reduce_62,
1090
+ 2, 71, :_reduce_63,
1091
+ 3, 75, :_reduce_64,
1092
+ 2, 75, :_reduce_65,
1093
+ 1, 75, :_reduce_66,
1094
+ 1, 76, :_reduce_67,
1095
+ 4, 72, :_reduce_68,
1096
+ 2, 72, :_reduce_69,
1097
+ 2, 72, :_reduce_70,
1098
+ 1, 72, :_reduce_71,
1099
+ 1, 67, :_reduce_none,
1100
+ 0, 67, :_reduce_73,
1101
+ 2, 77, :_reduce_74,
1102
+ 1, 77, :_reduce_75,
1103
+ 2, 77, :_reduce_76,
1104
+ 4, 77, :_reduce_77,
1105
+ 4, 77, :_reduce_78,
1106
+ 4, 77, :_reduce_79,
1107
+ 4, 78, :_reduce_80,
1108
+ 2, 78, :_reduce_81,
1109
+ 0, 78, :_reduce_none,
1110
+ 3, 80, :_reduce_83,
1111
+ 2, 80, :_reduce_84,
1112
+ 1, 80, :_reduce_85,
1113
+ 1, 81, :_reduce_86,
1114
+ 1, 81, :_reduce_87,
1115
+ 1, 52, :_reduce_88,
1116
+ 1, 52, :_reduce_89,
1117
+ 3, 52, :_reduce_90,
1118
+ 1, 82, :_reduce_91,
1119
+ 1, 82, :_reduce_92,
1120
+ 3, 79, :_reduce_93,
1121
+ 2, 79, :_reduce_94,
1122
+ 1, 79, :_reduce_95,
1123
+ 1, 51, :_reduce_96,
1124
+ 1, 51, :_reduce_97,
1125
+ 4, 51, :_reduce_98,
1126
+ 3, 73, :_reduce_99,
1127
+ 2, 73, :_reduce_100,
1128
+ 0, 73, :_reduce_101,
1129
+ 4, 83, :_reduce_102,
1130
+ 2, 83, :_reduce_103,
1131
+ 2, 83, :_reduce_104 ]
1132
+
1133
+ racc_reduce_n = 105
1134
+
1135
+ racc_shift_n = 191
1119
1136
 
1120
1137
  racc_token_table = {
1121
1138
  false => 0,
@@ -1125,43 +1142,44 @@ racc_token_table = {
1125
1142
  "{" => 4,
1126
1143
  "}" => 5,
1127
1144
  "," => 6,
1128
- :ADDRESS => 7,
1145
+ :SERVICE => 7,
1129
1146
  :STRING => 8,
1130
- :VARIABLE => 9,
1131
- :SERVICE => 10,
1132
- :NODE => 11,
1133
- :REGEX => 12,
1134
- :DO => 13,
1135
- :END => 14,
1136
- :POLICY => 15,
1137
- :LOG => 16,
1138
- :IPV4 => 17,
1139
- :IPV6 => 18,
1140
- :CLIENT => 19,
1141
- :SERVER => 20,
1142
- :ON => 21,
1143
- :BLOCK => 22,
1144
- :PASS => 23,
1145
- :IN => 24,
1146
- :OUT => 25,
1147
- :INET => 26,
1148
- :INET6 => 27,
1149
- :PROTO => 28,
1150
- :FROM => 29,
1151
- :TO => 30,
1152
- :ALL => 31,
1153
- :ANY => 32,
1154
- :SRV => 33,
1155
- "(" => 34,
1156
- ")" => 35,
1157
- :APT_MIRROR => 36,
1158
- :PORT => 37,
1159
- :INTEGER => 38,
1160
- ":" => 39,
1161
- :RDR_TO => 40,
1162
- :NAT_TO => 41 }
1163
-
1164
- racc_nt_base = 42
1147
+ :NODE => 9,
1148
+ :REGEX => 10,
1149
+ :DO => 11,
1150
+ :END => 12,
1151
+ :POLICY => 13,
1152
+ :ALL => 14,
1153
+ :IPV4 => 15,
1154
+ :IPV6 => 16,
1155
+ :CLIENT => 17,
1156
+ :SERVER => 18,
1157
+ :LOG => 19,
1158
+ :ON => 20,
1159
+ :BLOCK => 21,
1160
+ :PASS => 22,
1161
+ :IN => 23,
1162
+ :OUT => 24,
1163
+ :INET => 25,
1164
+ :INET6 => 26,
1165
+ :PROTO => 27,
1166
+ :FROM => 28,
1167
+ :TO => 29,
1168
+ :ANY => 30,
1169
+ :SRV => 31,
1170
+ "(" => 32,
1171
+ ")" => 33,
1172
+ :APT_MIRROR => 34,
1173
+ :PORT => 35,
1174
+ :VARIABLE => 36,
1175
+ :INTEGER => 37,
1176
+ ":" => 38,
1177
+ :ADDRESS => 39,
1178
+ :AZURE_IP_RANGE => 40,
1179
+ :RDR_TO => 41,
1180
+ :NAT_TO => 42 }
1181
+
1182
+ racc_nt_base = 43
1165
1183
 
1166
1184
  racc_use_result_var = true
1167
1185
 
@@ -1190,20 +1208,19 @@ Racc_token_to_s_table = [
1190
1208
  "\"{\"",
1191
1209
  "\"}\"",
1192
1210
  "\",\"",
1193
- "ADDRESS",
1194
- "STRING",
1195
- "VARIABLE",
1196
1211
  "SERVICE",
1212
+ "STRING",
1197
1213
  "NODE",
1198
1214
  "REGEX",
1199
1215
  "DO",
1200
1216
  "END",
1201
1217
  "POLICY",
1202
- "LOG",
1218
+ "ALL",
1203
1219
  "IPV4",
1204
1220
  "IPV6",
1205
1221
  "CLIENT",
1206
1222
  "SERVER",
1223
+ "LOG",
1207
1224
  "ON",
1208
1225
  "BLOCK",
1209
1226
  "PASS",
@@ -1214,53 +1231,59 @@ Racc_token_to_s_table = [
1214
1231
  "PROTO",
1215
1232
  "FROM",
1216
1233
  "TO",
1217
- "ALL",
1218
1234
  "ANY",
1219
1235
  "SRV",
1220
1236
  "\"(\"",
1221
1237
  "\")\"",
1222
1238
  "APT_MIRROR",
1223
1239
  "PORT",
1240
+ "VARIABLE",
1224
1241
  "INTEGER",
1225
1242
  "\":\"",
1243
+ "ADDRESS",
1244
+ "AZURE_IP_RANGE",
1226
1245
  "RDR_TO",
1227
1246
  "NAT_TO",
1228
1247
  "$start",
1229
1248
  "target",
1230
1249
  "assignation",
1231
1250
  "node",
1232
- "policy",
1251
+ "policies",
1233
1252
  "service",
1234
1253
  "variable_value_list",
1235
1254
  "variable_value",
1255
+ "host_list_item",
1256
+ "port",
1236
1257
  "service_name",
1237
1258
  "block",
1238
1259
  "node_name_list",
1239
- "block_with_policy",
1260
+ "block_with_policies",
1240
1261
  "node_name",
1241
1262
  "rules",
1242
1263
  "pf_rule",
1243
1264
  "ipv4_block",
1244
1265
  "ipv6_block",
1266
+ "policy_list",
1245
1267
  "action",
1268
+ "policy",
1269
+ "direction",
1270
+ "log",
1246
1271
  "optional_hosts",
1247
1272
  "rule_direction",
1248
- "log",
1249
1273
  "on_interface",
1250
1274
  "rule_af",
1251
1275
  "protospec",
1252
1276
  "hosts",
1253
1277
  "filteropts",
1254
1278
  "direction_list",
1255
- "direction",
1256
1279
  "protocol_list",
1257
1280
  "protocol",
1258
1281
  "hosts_host",
1259
1282
  "hosts_port",
1260
- "host",
1261
1283
  "host_list",
1262
1284
  "port_list",
1263
- "port",
1285
+ "port_list_item",
1286
+ "host",
1264
1287
  "filteropt" ]
1265
1288
  Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
1266
1289
 
@@ -1276,7 +1299,7 @@ Racc_debug_parser = false
1276
1299
 
1277
1300
  module_eval(<<'.,.,', 'parser.y', 4)
1278
1301
  def _reduce_3(val, _values, result)
1279
- @default_policy = val[0]
1302
+ @default_policies = val[0]
1280
1303
  result
1281
1304
  end
1282
1305
  .,.,
@@ -1322,28 +1345,28 @@ module_eval(<<'.,.,', 'parser.y', 13)
1322
1345
 
1323
1346
  module_eval(<<'.,.,', 'parser.y', 15)
1324
1347
  def _reduce_11(val, _values, result)
1325
- result = val[0][:value]
1348
+ result = val[0]
1326
1349
  result
1327
1350
  end
1328
1351
  .,.,
1329
1352
 
1330
1353
  module_eval(<<'.,.,', 'parser.y', 16)
1331
1354
  def _reduce_12(val, _values, result)
1332
- result = val[0][:value]
1355
+ result = val[0]
1333
1356
  result
1334
1357
  end
1335
1358
  .,.,
1336
1359
 
1337
- module_eval(<<'.,.,', 'parser.y', 17)
1360
+ module_eval(<<'.,.,', 'parser.y', 18)
1338
1361
  def _reduce_13(val, _values, result)
1339
- result = @variables.fetch(val[0][:value])
1362
+ @services[val[1]] = val[2]
1340
1363
  result
1341
1364
  end
1342
1365
  .,.,
1343
1366
 
1344
- module_eval(<<'.,.,', 'parser.y', 19)
1367
+ module_eval(<<'.,.,', 'parser.y', 20)
1345
1368
  def _reduce_14(val, _values, result)
1346
- @services[val[1]] = val[2]
1369
+ result = val[0][:value]
1347
1370
  result
1348
1371
  end
1349
1372
  .,.,
@@ -1355,44 +1378,44 @@ module_eval(<<'.,.,', 'parser.y', 21)
1355
1378
  end
1356
1379
  .,.,
1357
1380
 
1358
- module_eval(<<'.,.,', 'parser.y', 22)
1381
+ module_eval(<<'.,.,', 'parser.y', 23)
1359
1382
  def _reduce_16(val, _values, result)
1360
- result = val[0][:value]
1383
+ val[2].each { |name| @nodes[name] = val[4]; @saved_policies[name] = @current_policies }
1361
1384
  result
1362
1385
  end
1363
1386
  .,.,
1364
1387
 
1365
1388
  module_eval(<<'.,.,', 'parser.y', 24)
1366
1389
  def _reduce_17(val, _values, result)
1367
- val[2].each { |name| @nodes[name] = val[4]; @saved_policies[name] = @policy }
1390
+ @nodes[val[1]] = val[2]; @saved_policies[val[1]] = @current_policies
1368
1391
  result
1369
1392
  end
1370
1393
  .,.,
1371
1394
 
1372
- module_eval(<<'.,.,', 'parser.y', 25)
1395
+ module_eval(<<'.,.,', 'parser.y', 26)
1373
1396
  def _reduce_18(val, _values, result)
1374
- @nodes[val[1]] = val[2]; @saved_policies[val[1]] = @policy
1397
+ result = val[0] + [val[2]]
1375
1398
  result
1376
1399
  end
1377
1400
  .,.,
1378
1401
 
1379
1402
  module_eval(<<'.,.,', 'parser.y', 27)
1380
1403
  def _reduce_19(val, _values, result)
1381
- result = val[0] + [val[2]]
1404
+ result = val[0] + [val[1]]
1382
1405
  result
1383
1406
  end
1384
1407
  .,.,
1385
1408
 
1386
1409
  module_eval(<<'.,.,', 'parser.y', 28)
1387
1410
  def _reduce_20(val, _values, result)
1388
- result = val[0] + [val[1]]
1411
+ result = [val[0]]
1389
1412
  result
1390
1413
  end
1391
1414
  .,.,
1392
1415
 
1393
- module_eval(<<'.,.,', 'parser.y', 29)
1416
+ module_eval(<<'.,.,', 'parser.y', 30)
1394
1417
  def _reduce_21(val, _values, result)
1395
- result = [val[0]]
1418
+ result = val[0][:value]
1396
1419
  result
1397
1420
  end
1398
1421
  .,.,
@@ -1404,44 +1427,44 @@ module_eval(<<'.,.,', 'parser.y', 31)
1404
1427
  end
1405
1428
  .,.,
1406
1429
 
1407
- module_eval(<<'.,.,', 'parser.y', 32)
1430
+ module_eval(<<'.,.,', 'parser.y', 33)
1408
1431
  def _reduce_23(val, _values, result)
1409
- result = val[0][:value]
1432
+ @current_policies = val[1]; result = val[2]
1410
1433
  result
1411
1434
  end
1412
1435
  .,.,
1413
1436
 
1414
1437
  module_eval(<<'.,.,', 'parser.y', 34)
1415
1438
  def _reduce_24(val, _values, result)
1416
- @policy = val[1]; result = val[2]
1439
+ @current_policies = val[1]; result = val[2]
1417
1440
  result
1418
1441
  end
1419
1442
  .,.,
1420
1443
 
1421
- module_eval(<<'.,.,', 'parser.y', 35)
1444
+ module_eval(<<'.,.,', 'parser.y', 36)
1422
1445
  def _reduce_25(val, _values, result)
1423
- @policy = val[1]; result = val[2]
1446
+ result = val[1].freeze
1424
1447
  result
1425
1448
  end
1426
1449
  .,.,
1427
1450
 
1428
- module_eval(<<'.,.,', 'parser.y', 36)
1451
+ module_eval(<<'.,.,', 'parser.y', 37)
1429
1452
  def _reduce_26(val, _values, result)
1430
- @policy = nil; result = val[0]
1453
+ result = val[1].freeze
1431
1454
  result
1432
1455
  end
1433
1456
  .,.,
1434
1457
 
1435
- module_eval(<<'.,.,', 'parser.y', 38)
1458
+ module_eval(<<'.,.,', 'parser.y', 39)
1436
1459
  def _reduce_27(val, _values, result)
1437
- result = val[1].freeze
1460
+ result = val[0] + val[1]
1438
1461
  result
1439
1462
  end
1440
1463
  .,.,
1441
1464
 
1442
- module_eval(<<'.,.,', 'parser.y', 39)
1465
+ module_eval(<<'.,.,', 'parser.y', 40)
1443
1466
  def _reduce_28(val, _values, result)
1444
- result = val[1].freeze
1467
+ result = val[0] + val[1]
1445
1468
  result
1446
1469
  end
1447
1470
  .,.,
@@ -1455,61 +1478,61 @@ module_eval(<<'.,.,', 'parser.y', 41)
1455
1478
 
1456
1479
  module_eval(<<'.,.,', 'parser.y', 42)
1457
1480
  def _reduce_30(val, _values, result)
1458
- result = val[0] + val[1]
1481
+ result = []
1459
1482
  result
1460
1483
  end
1461
1484
  .,.,
1462
1485
 
1463
- module_eval(<<'.,.,', 'parser.y', 43)
1486
+ module_eval(<<'.,.,', 'parser.y', 44)
1464
1487
  def _reduce_31(val, _values, result)
1465
- result = val[0] + val[1]
1488
+ result = val[0]
1466
1489
  result
1467
1490
  end
1468
1491
  .,.,
1469
1492
 
1470
- module_eval(<<'.,.,', 'parser.y', 44)
1493
+ module_eval(<<'.,.,', 'parser.y', 45)
1471
1494
  def _reduce_32(val, _values, result)
1472
- result = []
1495
+ warn("#{val[0][:filename]}:#{val[0][:lineno]}:#{val[0][:position]}: deprecated policy syntax:\n\t#{val[0][:line]}\n\t#{' ' * val[0][:position]}^#{'~' * (val[0][:line].length - 1 - val[0][:position])}\n\tUse explicit 'in' and 'out' policies, with optional logging:\n\tpolicy #{val[1][:action]} in all\n\tpolicy #{val[1][:action]} out all") ; result = { in: { action: val[1][:action] }, out: { action: val[1][:action] } }
1473
1496
  result
1474
1497
  end
1475
1498
  .,.,
1476
1499
 
1477
- module_eval(<<'.,.,', 'parser.y', 46)
1500
+ module_eval(<<'.,.,', 'parser.y', 47)
1478
1501
  def _reduce_33(val, _values, result)
1479
- result = val[1][:action]
1502
+ result = val[1].merge(val[0][:dir] => val[0])
1480
1503
  result
1481
1504
  end
1482
1505
  .,.,
1483
1506
 
1484
- module_eval(<<'.,.,', 'parser.y', 47)
1507
+ module_eval(<<'.,.,', 'parser.y', 48)
1485
1508
  def _reduce_34(val, _values, result)
1486
- result = 'log'
1509
+ result = {}
1487
1510
  result
1488
1511
  end
1489
1512
  .,.,
1490
1513
 
1491
- module_eval(<<'.,.,', 'parser.y', 49)
1514
+ module_eval(<<'.,.,', 'parser.y', 50)
1492
1515
  def _reduce_35(val, _values, result)
1493
- result = val[2].reject { |x| x[:af] == :inet6 }.map { |x| x[:af] = :inet ; x }
1516
+ result = { action: val[1][:action], dir: val[2], log: val[3].any? }
1494
1517
  result
1495
1518
  end
1496
1519
  .,.,
1497
1520
 
1498
- module_eval(<<'.,.,', 'parser.y', 50)
1521
+ module_eval(<<'.,.,', 'parser.y', 52)
1499
1522
  def _reduce_36(val, _values, result)
1500
1523
  result = val[2].reject { |x| x[:af] == :inet6 }.map { |x| x[:af] = :inet ; x }
1501
1524
  result
1502
1525
  end
1503
1526
  .,.,
1504
1527
 
1505
- module_eval(<<'.,.,', 'parser.y', 52)
1528
+ module_eval(<<'.,.,', 'parser.y', 53)
1506
1529
  def _reduce_37(val, _values, result)
1507
- result = val[2].reject { |x| x[:af] == :inet }.map { |x| x[:af] = :inet6 ; x }
1530
+ result = val[2].reject { |x| x[:af] == :inet6 }.map { |x| x[:af] = :inet ; x }
1508
1531
  result
1509
1532
  end
1510
1533
  .,.,
1511
1534
 
1512
- module_eval(<<'.,.,', 'parser.y', 53)
1535
+ module_eval(<<'.,.,', 'parser.y', 55)
1513
1536
  def _reduce_38(val, _values, result)
1514
1537
  result = val[2].reject { |x| x[:af] == :inet }.map { |x| x[:af] = :inet6 ; x }
1515
1538
  result
@@ -1518,6 +1541,13 @@ module_eval(<<'.,.,', 'parser.y', 53)
1518
1541
 
1519
1542
  module_eval(<<'.,.,', 'parser.y', 56)
1520
1543
  def _reduce_39(val, _values, result)
1544
+ result = val[2].reject { |x| x[:af] == :inet }.map { |x| x[:af] = :inet6 ; x }
1545
+ result
1546
+ end
1547
+ .,.,
1548
+
1549
+ module_eval(<<'.,.,', 'parser.y', 59)
1550
+ def _reduce_40(val, _values, result)
1521
1551
  begin
1522
1552
  result = constraint_service_to_hosts(val[1], val[2])
1523
1553
  rescue KeyError
@@ -1528,8 +1558,8 @@ module_eval(<<'.,.,', 'parser.y', 56)
1528
1558
  end
1529
1559
  .,.,
1530
1560
 
1531
- module_eval(<<'.,.,', 'parser.y', 63)
1532
- def _reduce_40(val, _values, result)
1561
+ module_eval(<<'.,.,', 'parser.y', 66)
1562
+ def _reduce_41(val, _values, result)
1533
1563
  begin
1534
1564
  raise "service #{val[1]} cannot be used as client" if @services.fetch(val[1]).map { |x| x[:dir] }.compact.any?
1535
1565
  result = constraint_service_to_hosts(val[1], val[2]).map { |item| item.merge(dir: :out) }
@@ -1541,8 +1571,8 @@ module_eval(<<'.,.,', 'parser.y', 63)
1541
1571
  end
1542
1572
  .,.,
1543
1573
 
1544
- module_eval(<<'.,.,', 'parser.y', 71)
1545
- def _reduce_41(val, _values, result)
1574
+ module_eval(<<'.,.,', 'parser.y', 74)
1575
+ def _reduce_42(val, _values, result)
1546
1576
  begin
1547
1577
  raise "service #{val[1]} cannot be used as server" if @services.fetch(val[1]).map { |x| x[:dir] }.compact.any?
1548
1578
  result = constraint_service_to_hosts(val[1], val[2]).map { |item| item.merge(dir: :in) }
@@ -1554,245 +1584,248 @@ module_eval(<<'.,.,', 'parser.y', 71)
1554
1584
  end
1555
1585
  .,.,
1556
1586
 
1557
- module_eval(<<'.,.,', 'parser.y', 78)
1558
- def _reduce_42(val, _values, result)
1587
+ module_eval(<<'.,.,', 'parser.y', 81)
1588
+ def _reduce_43(val, _values, result)
1559
1589
  result = [val.compact.inject(:merge)]
1560
1590
  result
1561
1591
  end
1562
1592
  .,.,
1563
1593
 
1564
- # reduce 43 omitted
1565
-
1566
- # reduce 44 omitted
1567
-
1568
- # reduce 45 omitted
1594
+ module_eval(<<'.,.,', 'parser.y', 83)
1595
+ def _reduce_44(val, _values, result)
1596
+ result = { log: true }
1597
+ result
1598
+ end
1599
+ .,.,
1569
1600
 
1570
1601
  module_eval(<<'.,.,', 'parser.y', 84)
1571
- def _reduce_46(val, _values, result)
1572
- result = { on: val[1][:value] }
1602
+ def _reduce_45(val, _values, result)
1603
+ result = {}
1573
1604
  result
1574
1605
  end
1575
1606
  .,.,
1576
1607
 
1577
- module_eval(<<'.,.,', 'parser.y', 86)
1608
+ # reduce 46 omitted
1609
+
1610
+ module_eval(<<'.,.,', 'parser.y', 87)
1578
1611
  def _reduce_47(val, _values, result)
1579
- result = { action: :block }
1612
+ result = { on: val[1][:value] }
1580
1613
  result
1581
1614
  end
1582
1615
  .,.,
1583
1616
 
1584
- module_eval(<<'.,.,', 'parser.y', 87)
1617
+ module_eval(<<'.,.,', 'parser.y', 89)
1585
1618
  def _reduce_48(val, _values, result)
1586
- result = { action: :pass }
1619
+ result = { action: :block }
1587
1620
  result
1588
1621
  end
1589
1622
  .,.,
1590
1623
 
1591
- # reduce 49 omitted
1592
-
1593
1624
  module_eval(<<'.,.,', 'parser.y', 90)
1594
- def _reduce_50(val, _values, result)
1595
- result = { dir: val[1] }
1625
+ def _reduce_49(val, _values, result)
1626
+ result = { action: :pass }
1596
1627
  result
1597
1628
  end
1598
1629
  .,.,
1599
1630
 
1600
- module_eval(<<'.,.,', 'parser.y', 91)
1631
+ # reduce 50 omitted
1632
+
1633
+ module_eval(<<'.,.,', 'parser.y', 93)
1601
1634
  def _reduce_51(val, _values, result)
1602
- result = { dir: val[0] }
1635
+ result = { dir: val[1] }
1603
1636
  result
1604
1637
  end
1605
1638
  .,.,
1606
1639
 
1607
- module_eval(<<'.,.,', 'parser.y', 93)
1640
+ module_eval(<<'.,.,', 'parser.y', 94)
1608
1641
  def _reduce_52(val, _values, result)
1609
- result = val[0] + [val[2]]
1642
+ result = { dir: val[0] }
1610
1643
  result
1611
1644
  end
1612
1645
  .,.,
1613
1646
 
1614
- module_eval(<<'.,.,', 'parser.y', 94)
1647
+ module_eval(<<'.,.,', 'parser.y', 96)
1615
1648
  def _reduce_53(val, _values, result)
1616
- result = val[0] + [val[1]]
1649
+ result = val[0] + [val[2]]
1617
1650
  result
1618
1651
  end
1619
1652
  .,.,
1620
1653
 
1621
- module_eval(<<'.,.,', 'parser.y', 95)
1654
+ module_eval(<<'.,.,', 'parser.y', 97)
1622
1655
  def _reduce_54(val, _values, result)
1623
- result = [val[0]]
1656
+ result = val[0] + [val[1]]
1624
1657
  result
1625
1658
  end
1626
1659
  .,.,
1627
1660
 
1628
- module_eval(<<'.,.,', 'parser.y', 97)
1661
+ module_eval(<<'.,.,', 'parser.y', 98)
1629
1662
  def _reduce_55(val, _values, result)
1630
- result = :in
1663
+ result = [val[0]]
1631
1664
  result
1632
1665
  end
1633
1666
  .,.,
1634
1667
 
1635
- module_eval(<<'.,.,', 'parser.y', 98)
1668
+ module_eval(<<'.,.,', 'parser.y', 100)
1636
1669
  def _reduce_56(val, _values, result)
1637
- result = :out
1670
+ result = :in
1638
1671
  result
1639
1672
  end
1640
1673
  .,.,
1641
1674
 
1642
- # reduce 57 omitted
1643
-
1644
1675
  module_eval(<<'.,.,', 'parser.y', 101)
1645
- def _reduce_58(val, _values, result)
1646
- result = { af: :inet }
1676
+ def _reduce_57(val, _values, result)
1677
+ result = :out
1647
1678
  result
1648
1679
  end
1649
1680
  .,.,
1650
1681
 
1651
- module_eval(<<'.,.,', 'parser.y', 102)
1682
+ # reduce 58 omitted
1683
+
1684
+ module_eval(<<'.,.,', 'parser.y', 104)
1652
1685
  def _reduce_59(val, _values, result)
1653
- result = { af: :inet6 }
1686
+ result = { af: :inet }
1654
1687
  result
1655
1688
  end
1656
1689
  .,.,
1657
1690
 
1658
- # reduce 60 omitted
1659
-
1660
1691
  module_eval(<<'.,.,', 'parser.y', 105)
1661
- def _reduce_61(val, _values, result)
1662
- result = { proto: val[2] }
1692
+ def _reduce_60(val, _values, result)
1693
+ result = { af: :inet6 }
1663
1694
  result
1664
1695
  end
1665
1696
  .,.,
1666
1697
 
1667
- module_eval(<<'.,.,', 'parser.y', 106)
1698
+ # reduce 61 omitted
1699
+
1700
+ module_eval(<<'.,.,', 'parser.y', 108)
1668
1701
  def _reduce_62(val, _values, result)
1669
- result = { proto: val[1] }
1702
+ result = { proto: val[2] }
1670
1703
  result
1671
1704
  end
1672
1705
  .,.,
1673
1706
 
1674
- module_eval(<<'.,.,', 'parser.y', 108)
1707
+ module_eval(<<'.,.,', 'parser.y', 109)
1675
1708
  def _reduce_63(val, _values, result)
1676
- result = val[0] + [val[2]]
1709
+ result = { proto: val[1] }
1677
1710
  result
1678
1711
  end
1679
1712
  .,.,
1680
1713
 
1681
- module_eval(<<'.,.,', 'parser.y', 109)
1714
+ module_eval(<<'.,.,', 'parser.y', 111)
1682
1715
  def _reduce_64(val, _values, result)
1683
- result = val[0] + [val[1]]
1716
+ result = val[0] + [val[2]]
1684
1717
  result
1685
1718
  end
1686
1719
  .,.,
1687
1720
 
1688
- module_eval(<<'.,.,', 'parser.y', 110)
1721
+ module_eval(<<'.,.,', 'parser.y', 112)
1689
1722
  def _reduce_65(val, _values, result)
1690
- result = [val[0]]
1723
+ result = val[0] + [val[1]]
1691
1724
  result
1692
1725
  end
1693
1726
  .,.,
1694
1727
 
1695
- module_eval(<<'.,.,', 'parser.y', 112)
1728
+ module_eval(<<'.,.,', 'parser.y', 113)
1696
1729
  def _reduce_66(val, _values, result)
1697
- result = val[0][:value].to_sym
1730
+ result = [val[0]]
1698
1731
  result
1699
1732
  end
1700
1733
  .,.,
1701
1734
 
1702
- module_eval(<<'.,.,', 'parser.y', 114)
1735
+ module_eval(<<'.,.,', 'parser.y', 115)
1703
1736
  def _reduce_67(val, _values, result)
1704
- result = { from: val[1], to: val[3] }
1737
+ result = val[0][:value].to_sym
1705
1738
  result
1706
1739
  end
1707
1740
  .,.,
1708
1741
 
1709
- module_eval(<<'.,.,', 'parser.y', 115)
1742
+ module_eval(<<'.,.,', 'parser.y', 117)
1710
1743
  def _reduce_68(val, _values, result)
1711
- result = { from: val[1] }
1744
+ result = { from: val[1], to: val[3] }
1712
1745
  result
1713
1746
  end
1714
1747
  .,.,
1715
1748
 
1716
- module_eval(<<'.,.,', 'parser.y', 116)
1749
+ module_eval(<<'.,.,', 'parser.y', 118)
1717
1750
  def _reduce_69(val, _values, result)
1718
- result = { to: val[1] }
1751
+ result = { from: val[1] }
1719
1752
  result
1720
1753
  end
1721
1754
  .,.,
1722
1755
 
1723
- module_eval(<<'.,.,', 'parser.y', 117)
1756
+ module_eval(<<'.,.,', 'parser.y', 119)
1724
1757
  def _reduce_70(val, _values, result)
1725
- result = {}
1758
+ result = { to: val[1] }
1726
1759
  result
1727
1760
  end
1728
1761
  .,.,
1729
1762
 
1730
- # reduce 71 omitted
1731
-
1732
1763
  module_eval(<<'.,.,', 'parser.y', 120)
1733
- def _reduce_72(val, _values, result)
1764
+ def _reduce_71(val, _values, result)
1734
1765
  result = {}
1735
1766
  result
1736
1767
  end
1737
1768
  .,.,
1738
1769
 
1739
- module_eval(<<'.,.,', 'parser.y', 122)
1770
+ # reduce 72 omitted
1771
+
1772
+ module_eval(<<'.,.,', 'parser.y', 123)
1740
1773
  def _reduce_73(val, _values, result)
1741
- result = [{ host: nil, port: val[1] }]
1774
+ result = {}
1742
1775
  result
1743
1776
  end
1744
1777
  .,.,
1745
1778
 
1746
- module_eval(<<'.,.,', 'parser.y', 123)
1779
+ module_eval(<<'.,.,', 'parser.y', 125)
1747
1780
  def _reduce_74(val, _values, result)
1748
- result = [{ host: val[0], port: val[1] }]
1781
+ result = [{ host: nil, port: val[1] }]
1749
1782
  result
1750
1783
  end
1751
1784
  .,.,
1752
1785
 
1753
- module_eval(<<'.,.,', 'parser.y', 124)
1786
+ module_eval(<<'.,.,', 'parser.y', 126)
1754
1787
  def _reduce_75(val, _values, result)
1755
1788
  result = [{ host: nil, port: val[0] }]
1756
1789
  result
1757
1790
  end
1758
1791
  .,.,
1759
1792
 
1760
- module_eval(<<'.,.,', 'parser.y', 125)
1793
+ module_eval(<<'.,.,', 'parser.y', 127)
1761
1794
  def _reduce_76(val, _values, result)
1762
- result = [{ host: val[1], port: val[3] }]
1795
+ result = [{ host: val[0], port: val[1] }]
1763
1796
  result
1764
1797
  end
1765
1798
  .,.,
1766
1799
 
1767
- module_eval(<<'.,.,', 'parser.y', 126)
1800
+ module_eval(<<'.,.,', 'parser.y', 128)
1768
1801
  def _reduce_77(val, _values, result)
1769
- result = [{ host: @variables.fetch(val[0][:value]), port: val[1] }]
1802
+ result = [{ host: val[1], port: val[3] }]
1770
1803
  result
1771
1804
  end
1772
1805
  .,.,
1773
1806
 
1774
- module_eval(<<'.,.,', 'parser.y', 127)
1807
+ module_eval(<<'.,.,', 'parser.y', 129)
1775
1808
  def _reduce_78(val, _values, result)
1776
1809
  result = Resolver.instance.resolv_srv(val[2][:value])
1777
1810
  result
1778
1811
  end
1779
1812
  .,.,
1780
1813
 
1781
- module_eval(<<'.,.,', 'parser.y', 128)
1814
+ module_eval(<<'.,.,', 'parser.y', 130)
1782
1815
  def _reduce_79(val, _values, result)
1783
1816
  result = Resolver.instance.resolv_apt_mirror(val[2][:value])
1784
1817
  result
1785
1818
  end
1786
1819
  .,.,
1787
1820
 
1788
- module_eval(<<'.,.,', 'parser.y', 130)
1821
+ module_eval(<<'.,.,', 'parser.y', 132)
1789
1822
  def _reduce_80(val, _values, result)
1790
1823
  result = val[2]
1791
1824
  result
1792
1825
  end
1793
1826
  .,.,
1794
1827
 
1795
- module_eval(<<'.,.,', 'parser.y', 131)
1828
+ module_eval(<<'.,.,', 'parser.y', 133)
1796
1829
  def _reduce_81(val, _values, result)
1797
1830
  result = val[1]
1798
1831
  result
@@ -1801,120 +1834,155 @@ module_eval(<<'.,.,', 'parser.y', 131)
1801
1834
 
1802
1835
  # reduce 82 omitted
1803
1836
 
1804
- module_eval(<<'.,.,', 'parser.y', 134)
1837
+ module_eval(<<'.,.,', 'parser.y', 136)
1805
1838
  def _reduce_83(val, _values, result)
1806
- result = val[0] + [val[2]]
1839
+ result = val[0] + val[2]
1807
1840
  result
1808
1841
  end
1809
1842
  .,.,
1810
1843
 
1811
- module_eval(<<'.,.,', 'parser.y', 135)
1844
+ module_eval(<<'.,.,', 'parser.y', 137)
1812
1845
  def _reduce_84(val, _values, result)
1813
- result = val[0] + [val[1]]
1846
+ result = val[0] + val[1]
1814
1847
  result
1815
1848
  end
1816
1849
  .,.,
1817
1850
 
1818
- module_eval(<<'.,.,', 'parser.y', 136)
1851
+ module_eval(<<'.,.,', 'parser.y', 138)
1819
1852
  def _reduce_85(val, _values, result)
1820
- result = [val[0]]
1853
+ result = val[0]
1821
1854
  result
1822
1855
  end
1823
1856
  .,.,
1824
1857
 
1825
- module_eval(<<'.,.,', 'parser.y', 138)
1858
+ module_eval(<<'.,.,', 'parser.y', 140)
1826
1859
  def _reduce_86(val, _values, result)
1827
- result = val[0][:value]
1860
+ result = [val[0]]
1828
1861
  result
1829
1862
  end
1830
1863
  .,.,
1831
1864
 
1832
- module_eval(<<'.,.,', 'parser.y', 139)
1865
+ module_eval(<<'.,.,', 'parser.y', 141)
1833
1866
  def _reduce_87(val, _values, result)
1834
- result = val[0][:value]
1867
+ result = @variables.fetch(val[0][:value])
1835
1868
  result
1836
1869
  end
1837
1870
  .,.,
1838
1871
 
1839
- module_eval(<<'.,.,', 'parser.y', 140)
1872
+ module_eval(<<'.,.,', 'parser.y', 143)
1840
1873
  def _reduce_88(val, _values, result)
1841
- result = Range.new(val[0][:value], val[2][:value])
1874
+ result = val[0][:value]
1842
1875
  result
1843
1876
  end
1844
1877
  .,.,
1845
1878
 
1846
- module_eval(<<'.,.,', 'parser.y', 142)
1879
+ module_eval(<<'.,.,', 'parser.y', 144)
1847
1880
  def _reduce_89(val, _values, result)
1848
1881
  result = val[0][:value]
1849
1882
  result
1850
1883
  end
1851
1884
  .,.,
1852
1885
 
1853
- module_eval(<<'.,.,', 'parser.y', 143)
1886
+ module_eval(<<'.,.,', 'parser.y', 145)
1854
1887
  def _reduce_90(val, _values, result)
1855
- result = val[0][:value]
1888
+ result = Range.new(val[0][:value], val[2][:value])
1856
1889
  result
1857
1890
  end
1858
1891
  .,.,
1859
1892
 
1860
- module_eval(<<'.,.,', 'parser.y', 145)
1893
+ module_eval(<<'.,.,', 'parser.y', 147)
1861
1894
  def _reduce_91(val, _values, result)
1862
- result = val[0] + [val[2]]
1895
+ result = val[0][:value]
1863
1896
  result
1864
1897
  end
1865
1898
  .,.,
1866
1899
 
1867
- module_eval(<<'.,.,', 'parser.y', 146)
1900
+ module_eval(<<'.,.,', 'parser.y', 148)
1868
1901
  def _reduce_92(val, _values, result)
1869
- result = val[0] + [val[1]]
1902
+ result = val[0][:value]
1870
1903
  result
1871
1904
  end
1872
1905
  .,.,
1873
1906
 
1874
- module_eval(<<'.,.,', 'parser.y', 147)
1907
+ module_eval(<<'.,.,', 'parser.y', 150)
1875
1908
  def _reduce_93(val, _values, result)
1876
- result = [val[0]]
1909
+ result = val[0] + val[2]
1877
1910
  result
1878
1911
  end
1879
1912
  .,.,
1880
1913
 
1881
- module_eval(<<'.,.,', 'parser.y', 149)
1914
+ module_eval(<<'.,.,', 'parser.y', 151)
1882
1915
  def _reduce_94(val, _values, result)
1883
- result = val[0].merge(val[2])
1916
+ result = val[0] + val[1]
1884
1917
  result
1885
1918
  end
1886
1919
  .,.,
1887
1920
 
1888
- module_eval(<<'.,.,', 'parser.y', 150)
1921
+ module_eval(<<'.,.,', 'parser.y', 152)
1889
1922
  def _reduce_95(val, _values, result)
1890
- result = val[0].merge(val[1])
1923
+ result = val[0]
1891
1924
  result
1892
1925
  end
1893
1926
  .,.,
1894
1927
 
1895
- module_eval(<<'.,.,', 'parser.y', 151)
1928
+ module_eval(<<'.,.,', 'parser.y', 154)
1896
1929
  def _reduce_96(val, _values, result)
1897
- result = {}
1930
+ result = [val[0]]
1898
1931
  result
1899
1932
  end
1900
1933
  .,.,
1901
1934
 
1902
- module_eval(<<'.,.,', 'parser.y', 153)
1935
+ module_eval(<<'.,.,', 'parser.y', 155)
1903
1936
  def _reduce_97(val, _values, result)
1904
- result = { rdr_to: [{ host: val[1][:value], port: val[3][:value] }] }
1937
+ result = @variables.fetch(val[0][:value])
1905
1938
  result
1906
1939
  end
1907
1940
  .,.,
1908
1941
 
1909
- module_eval(<<'.,.,', 'parser.y', 154)
1942
+ module_eval(<<'.,.,', 'parser.y', 156)
1910
1943
  def _reduce_98(val, _values, result)
1911
- result = { rdr_to: [{ host: val[1][:value], port: nil }] }
1944
+ result = Resolver.instance.resolv_azure_ip_range(val[2][:value])
1912
1945
  result
1913
1946
  end
1914
1947
  .,.,
1915
1948
 
1916
- module_eval(<<'.,.,', 'parser.y', 155)
1949
+ module_eval(<<'.,.,', 'parser.y', 158)
1917
1950
  def _reduce_99(val, _values, result)
1951
+ result = val[0].merge(val[2])
1952
+ result
1953
+ end
1954
+ .,.,
1955
+
1956
+ module_eval(<<'.,.,', 'parser.y', 159)
1957
+ def _reduce_100(val, _values, result)
1958
+ result = val[0].merge(val[1])
1959
+ result
1960
+ end
1961
+ .,.,
1962
+
1963
+ module_eval(<<'.,.,', 'parser.y', 160)
1964
+ def _reduce_101(val, _values, result)
1965
+ result = {}
1966
+ result
1967
+ end
1968
+ .,.,
1969
+
1970
+ module_eval(<<'.,.,', 'parser.y', 162)
1971
+ def _reduce_102(val, _values, result)
1972
+ result = { rdr_to: [{ host: val[1][:value], port: val[3][:value] }] }
1973
+ result
1974
+ end
1975
+ .,.,
1976
+
1977
+ module_eval(<<'.,.,', 'parser.y', 163)
1978
+ def _reduce_103(val, _values, result)
1979
+ result = { rdr_to: [{ host: val[1][:value], port: nil }] }
1980
+ result
1981
+ end
1982
+ .,.,
1983
+
1984
+ module_eval(<<'.,.,', 'parser.y', 164)
1985
+ def _reduce_104(val, _values, result)
1918
1986
  result = { nat_to: val[1][:value] }
1919
1987
  result
1920
1988
  end