puffy 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/ci.yml +36 -0
- data/.gitignore +5 -0
- data/.rspec +2 -0
- data/.rubocop.yml +39 -0
- data/.simplecov +8 -0
- data/Gemfile +6 -0
- data/README.md +51 -0
- data/Rakefile +20 -0
- data/bin/puffy +17 -0
- data/lib/core_ext.rb +76 -0
- data/lib/puffy/cli.rb +132 -0
- data/lib/puffy/formatters/base.rb +95 -0
- data/lib/puffy/formatters/netfilter.rb +263 -0
- data/lib/puffy/formatters/netfilter4.rb +23 -0
- data/lib/puffy/formatters/netfilter6.rb +23 -0
- data/lib/puffy/formatters/pf.rb +132 -0
- data/lib/puffy/parser.tab.rb +1217 -0
- data/lib/puffy/puppet.rb +73 -0
- data/lib/puffy/resolver.rb +76 -0
- data/lib/puffy/rule.rb +220 -0
- data/lib/puffy/rule_factory.rb +117 -0
- data/lib/puffy/version.rb +5 -0
- data/lib/puffy.rb +62 -0
- data/puffy.gemspec +47 -0
- metadata +254 -0
@@ -0,0 +1,1217 @@
|
|
1
|
+
#
|
2
|
+
# DO NOT MODIFY!!!!
|
3
|
+
# This file is automatically generated by Racc 1.5.2
|
4
|
+
# from Racc grammar file "".
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'racc/parser.rb'
|
8
|
+
|
9
|
+
|
10
|
+
require 'deep_merge'
|
11
|
+
require 'strscan'
|
12
|
+
|
13
|
+
module Puffy
|
14
|
+
class Parser < Racc::Parser
|
15
|
+
|
16
|
+
module_eval(<<'...end parser.y/module_eval...', 'parser.y', 191)
|
17
|
+
|
18
|
+
attr_accessor :yydebug
|
19
|
+
attr_reader :policy, :filename
|
20
|
+
#attr_accessor :variables, :nodes, :services
|
21
|
+
|
22
|
+
def ipaddress?(s)
|
23
|
+
IPAddr.new(s.matched)
|
24
|
+
rescue IPAddr::InvalidAddressError
|
25
|
+
s.unscan
|
26
|
+
nil
|
27
|
+
end
|
28
|
+
|
29
|
+
def parse_file(filename)
|
30
|
+
@filename = filename
|
31
|
+
parse(File.read(filename))
|
32
|
+
@filename = nil
|
33
|
+
end
|
34
|
+
|
35
|
+
def parse(text)
|
36
|
+
@lineno = 1
|
37
|
+
s = StringScanner.new(text)
|
38
|
+
|
39
|
+
@tokens = []
|
40
|
+
@position = 0
|
41
|
+
@line = (s.check_until(/\n/) || '').chomp
|
42
|
+
until s.eos? do
|
43
|
+
case
|
44
|
+
when s.scan(/\n/)
|
45
|
+
@lineno += 1
|
46
|
+
@position = -1 # Current match "\n" length will be added before we read the first token
|
47
|
+
@line = (s.check_until(/\n/) || '').chomp
|
48
|
+
when s.scan(/#.*/) then # ignore comments
|
49
|
+
when s.scan(/\s+/) then # ignore blanks
|
50
|
+
|
51
|
+
when s.scan(/\//)
|
52
|
+
n = 0
|
53
|
+
while char = s.post_match[n]
|
54
|
+
case char
|
55
|
+
when /\\/
|
56
|
+
n += 1
|
57
|
+
when /\//
|
58
|
+
emit(:REGEX, Regexp.new(s.post_match[0...n]), s.matched_size)
|
59
|
+
s.pos += n + 1
|
60
|
+
break
|
61
|
+
end
|
62
|
+
n += 1
|
63
|
+
end
|
64
|
+
when s.scan(/=/) then emit('=', s.matched)
|
65
|
+
when s.scan(/:/) then emit(':', s.matched)
|
66
|
+
when s.scan(/,/) then emit(',', s.matched)
|
67
|
+
when s.scan(/{/) then emit('{', s.matched)
|
68
|
+
when s.scan(/}/) then emit('}', s.matched)
|
69
|
+
when s.scan(/service\b/) then emit(:SERVICE, s.matched)
|
70
|
+
when s.scan(/client\b/) then emit(:CLIENT, s.matched)
|
71
|
+
when s.scan(/server\b/) then emit(:SERVER, s.matched)
|
72
|
+
when s.scan(/node\b/) then emit(:NODE, s.matched)
|
73
|
+
when s.scan(/'[^'\n]*'/) then emit(:STRING, s.matched[1...-1], s.matched_size)
|
74
|
+
when s.scan(/"[^"\n]*"/) then emit(:STRING, s.matched[1...-1], s.matched_size)
|
75
|
+
|
76
|
+
when s.scan(/ipv4\b/) then emit(:IPV4, s.matched)
|
77
|
+
when s.scan(/ipv6\b/) then emit(:IPV6, s.matched)
|
78
|
+
when s.scan(/policy\b/) then emit(:POLICY, s.matched)
|
79
|
+
|
80
|
+
when s.scan(/do\b/) then emit(:DO, s.matched)
|
81
|
+
when s.scan(/end\b/) then emit(:END, s.matched)
|
82
|
+
|
83
|
+
when s.scan(/\$\S+/) then emit(:VARIABLE, s.matched[1..-1], s.matched_size)
|
84
|
+
|
85
|
+
when s.scan(/pass\b/) then emit(:PASS, s.matched)
|
86
|
+
when s.scan(/block\b/) then emit(:BLOCK, s.matched)
|
87
|
+
when s.scan(/in\b/) then emit(:IN, s.matched)
|
88
|
+
when s.scan(/out\b/) then emit(:OUT, s.matched)
|
89
|
+
when s.scan(/log\b/) then emit(:LOG, s.matched)
|
90
|
+
when s.scan(/inet\b/) then emit(:INET, s.matched)
|
91
|
+
when s.scan(/inet6\b/) then emit(:INET6, s.matched)
|
92
|
+
when s.scan(/on\b/) then emit(:ON, s.matched)
|
93
|
+
when s.scan(/proto\b/) then emit(:PROTO, s.matched)
|
94
|
+
when s.scan(/from\b/) then emit(:FROM, s.matched)
|
95
|
+
when s.scan(/to\b/) then emit(:TO, s.matched)
|
96
|
+
when s.scan(/all\b/) then emit(:ALL, s.matched)
|
97
|
+
when s.scan(/any\b/) then emit(:ANY, s.matched)
|
98
|
+
when s.scan(/self\b/) then emit(:SELF, s.matched)
|
99
|
+
when s.scan(/port\b/) then emit(:PORT, s.matched)
|
100
|
+
when s.scan(/nat-to\b/) then emit(:NAT_TO, s.matched)
|
101
|
+
when s.scan(/rdr-to\b/) then emit(:RDR_TO, s.matched)
|
102
|
+
|
103
|
+
when s.scan(/\d+\.\d+\.\d+\.\d+(\/\d+)?/) && ip = ipaddress?(s) then emit(:ADDRESS, ip, s.matched_size)
|
104
|
+
when s.scan(/[[:xdigit:]]*:[:[:xdigit:]]+(\/\d+)?/) && ip = ipaddress?(s) then emit(:ADDRESS, ip, s.matched_size)
|
105
|
+
|
106
|
+
when s.scan(/\d+/) then emit(:INTEGER, s.matched.to_i, s.matched_size)
|
107
|
+
when s.scan(/\w[\w-]+/) then emit(:IDENTIFIER, s.matched)
|
108
|
+
else
|
109
|
+
raise SyntaxError.new('Syntax error', { filename: @filename, lineno: @lineno, position: @position, line: @line })
|
110
|
+
end
|
111
|
+
@position += s.matched_size if s.matched_size
|
112
|
+
end
|
113
|
+
|
114
|
+
begin
|
115
|
+
do_parse
|
116
|
+
rescue Racc::ParseError => e
|
117
|
+
raise ParseError.new("Parse error: unexpected token: #{@current_token[0]}", @current_token[1].merge(filename: @filename))
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def emit(token, value, length = nil)
|
122
|
+
if token && length.nil?
|
123
|
+
raise "length must be explicitly passed when value is not a String (#{value.class.name})" unless value.is_a?(String)
|
124
|
+
|
125
|
+
length = value.length
|
126
|
+
end
|
127
|
+
|
128
|
+
exvalue = {
|
129
|
+
value: value,
|
130
|
+
line: @line,
|
131
|
+
lineno: @lineno,
|
132
|
+
position: @position,
|
133
|
+
length: length,
|
134
|
+
}
|
135
|
+
@tokens << [token, exvalue]
|
136
|
+
end
|
137
|
+
|
138
|
+
def next_token
|
139
|
+
@current_token = @tokens.shift
|
140
|
+
end
|
141
|
+
|
142
|
+
def initialize
|
143
|
+
super
|
144
|
+
@variables = {}
|
145
|
+
@nodes = {}
|
146
|
+
@saved_policies = {}
|
147
|
+
@services = {}
|
148
|
+
@rule_factory = Puffy::RuleFactory.new
|
149
|
+
end
|
150
|
+
|
151
|
+
def nodes
|
152
|
+
@nodes.keys
|
153
|
+
end
|
154
|
+
|
155
|
+
def prefered_key_for_hostname(keys, hostname)
|
156
|
+
direct_mapping = []
|
157
|
+
regexp_mapping = []
|
158
|
+
|
159
|
+
keys.each do |key|
|
160
|
+
case key
|
161
|
+
when String
|
162
|
+
direct_mapping << key if key == hostname
|
163
|
+
when Regexp
|
164
|
+
regexp_mapping << key if key.match?(hostname)
|
165
|
+
when Array
|
166
|
+
key.each do |value|
|
167
|
+
case value
|
168
|
+
when String
|
169
|
+
direct_mapping << key if value == hostname
|
170
|
+
when Regexp
|
171
|
+
regexp_mapping << key if value.match?(hostname)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
raise "Multiple definitions for #{hostname}" if direct_mapping.count > 1
|
178
|
+
raise "Multiple definitions match #{hostname}: #{regexp_mapping.join(', ')}" if regexp_mapping.count > 1
|
179
|
+
|
180
|
+
direct_mapping.first || regexp_mapping.first
|
181
|
+
end
|
182
|
+
|
183
|
+
def prefered_value_for_hostname(hash, hostname)
|
184
|
+
hash[(prefered_key_for_hostname(hash.keys, hostname))]
|
185
|
+
end
|
186
|
+
|
187
|
+
def ruleset_for(hostname)
|
188
|
+
rules = prefered_value_for_hostname(@nodes, hostname)
|
189
|
+
rule_factory = RuleFactory.new
|
190
|
+
rules.map do |r|
|
191
|
+
rule_factory.build(r)
|
192
|
+
end.flatten
|
193
|
+
end
|
194
|
+
|
195
|
+
def policy_for(hostname)
|
196
|
+
prefered_value_for_hostname(@saved_policies, hostname) || @default_policy || :block
|
197
|
+
end
|
198
|
+
...end parser.y/module_eval...
|
199
|
+
##### State transition tables begin ###
|
200
|
+
|
201
|
+
racc_action_table = [
|
202
|
+
132, 132, 129, 132, 132, 24, 153, 154, 162, 74,
|
203
|
+
10, 25, 26, 107, 33, 107, 110, 111, 110, 111,
|
204
|
+
140, 15, 34, 110, 111, 17, 115, 116, 76, 77,
|
205
|
+
19, 18, 131, 131, 21, 131, 131, 22, 164, 165,
|
206
|
+
106, 109, 106, 109, 76, 77, 49, 139, 142, 89,
|
207
|
+
90, 91, 38, 47, 48, 50, 51, 49, 25, 26,
|
208
|
+
39, 30, 31, 67, 47, 48, 50, 51, 49, 25,
|
209
|
+
26, 66, 27, 9, 69, 47, 48, 50, 51, 49,
|
210
|
+
25, 26, 68, 62, 9, 38, 47, 48, 50, 51,
|
211
|
+
49, 25, 26, 39, 89, 90, 91, 47, 48, 50,
|
212
|
+
51, 49, 25, 26, 21, 30, 31, 22, 47, 48,
|
213
|
+
50, 51, 49, 25, 26, 59, 60, 30, 31, 47,
|
214
|
+
48, 50, 51, 49, 25, 26, 21, 76, 77, 22,
|
215
|
+
47, 48, 50, 51, 49, 25, 26, 133, 134, 110,
|
216
|
+
111, 47, 48, 50, 51, 49, 25, 26, 160, 134,
|
217
|
+
110, 111, 47, 48, 50, 51, 49, 25, 26, 89,
|
218
|
+
90, 91, 78, 47, 48, 50, 51, 49, 25, 26,
|
219
|
+
89, 90, 91, 96, 47, 48, 50, 51, 49, 25,
|
220
|
+
26, 150, 99, 148, 100, 47, 48, 50, 51, 6,
|
221
|
+
25, 26, 6, 110, 111, 6, 7, 8, 6, 7,
|
222
|
+
8, 9, 7, 8, 9, 7, 8, 9, 6, 101,
|
223
|
+
9, 54, 55, 17, 21, 7, 8, 22, 17, 18,
|
224
|
+
9, 17, 28, 102, 18, 30, 31, 18, 150, 124,
|
225
|
+
125, 166, 167, 76, 77, 110, 111, 110, 111, 164,
|
226
|
+
165, 103, 104, 114, 119, 119, 126, 128, 137, 145,
|
227
|
+
119, 156, 150, 170, 171, 150, 173, 174 ]
|
228
|
+
|
229
|
+
racc_action_check = [
|
230
|
+
119, 129, 119, 143, 154, 9, 143, 143, 157, 52,
|
231
|
+
1, 9, 9, 89, 16, 90, 89, 89, 90, 90,
|
232
|
+
128, 6, 16, 128, 128, 7, 97, 97, 52, 52,
|
233
|
+
8, 7, 119, 129, 8, 143, 154, 8, 157, 157,
|
234
|
+
89, 89, 90, 90, 97, 97, 33, 128, 128, 70,
|
235
|
+
70, 70, 20, 33, 33, 33, 33, 34, 33, 33,
|
236
|
+
20, 28, 28, 47, 34, 34, 34, 34, 38, 34,
|
237
|
+
34, 47, 10, 38, 48, 38, 38, 38, 38, 39,
|
238
|
+
38, 38, 48, 43, 39, 54, 39, 39, 39, 39,
|
239
|
+
44, 39, 39, 54, 71, 71, 71, 44, 44, 44,
|
240
|
+
44, 45, 44, 44, 19, 60, 60, 19, 45, 45,
|
241
|
+
45, 45, 46, 45, 45, 41, 41, 41, 41, 46,
|
242
|
+
46, 46, 46, 57, 46, 46, 55, 74, 74, 55,
|
243
|
+
57, 57, 57, 57, 58, 57, 57, 120, 120, 120,
|
244
|
+
120, 58, 58, 58, 58, 66, 58, 58, 152, 152,
|
245
|
+
152, 152, 66, 66, 66, 66, 67, 66, 66, 72,
|
246
|
+
72, 72, 53, 67, 67, 67, 67, 68, 67, 67,
|
247
|
+
136, 136, 136, 73, 68, 68, 68, 68, 69, 68,
|
248
|
+
68, 137, 81, 137, 82, 69, 69, 69, 69, 0,
|
249
|
+
69, 69, 2, 107, 107, 3, 0, 0, 4, 2,
|
250
|
+
2, 0, 3, 3, 2, 4, 4, 3, 5, 84,
|
251
|
+
4, 35, 35, 49, 35, 5, 5, 35, 50, 49,
|
252
|
+
5, 51, 15, 85, 50, 15, 15, 51, 158, 113,
|
253
|
+
113, 158, 158, 116, 116, 134, 134, 140, 140, 162,
|
254
|
+
162, 86, 87, 95, 105, 112, 114, 118, 123, 131,
|
255
|
+
138, 145, 148, 164, 165, 167, 170, 173 ]
|
256
|
+
|
257
|
+
racc_action_pointer = [
|
258
|
+
187, 10, 190, 193, 196, 206, 18, 23, 26, -10,
|
259
|
+
72, nil, nil, nil, nil, 218, 10, nil, nil, 96,
|
260
|
+
48, nil, nil, nil, nil, nil, nil, nil, 54, nil,
|
261
|
+
nil, nil, nil, 37, 48, 206, nil, nil, 59, 70,
|
262
|
+
nil, 110, nil, 78, 81, 92, 103, 59, 70, 211,
|
263
|
+
216, 219, 5, 149, 81, 118, nil, 114, 125, nil,
|
264
|
+
98, nil, nil, nil, nil, nil, 136, 147, 158, 169,
|
265
|
+
21, 66, 131, 158, 104, nil, nil, nil, nil, nil,
|
266
|
+
nil, 177, 171, nil, 196, 218, 228, 237, nil, 9,
|
267
|
+
11, nil, nil, nil, nil, 223, nil, 21, nil, nil,
|
268
|
+
nil, nil, nil, nil, nil, 211, nil, 186, nil, nil,
|
269
|
+
nil, nil, 212, 204, 238, nil, 210, nil, 218, -2,
|
270
|
+
132, nil, nil, 221, nil, nil, nil, nil, 16, -1,
|
271
|
+
nil, 214, nil, nil, 228, nil, 142, 179, 217, nil,
|
272
|
+
230, nil, nil, 1, nil, 217, nil, nil, 250, nil,
|
273
|
+
nil, nil, 143, nil, 2, nil, nil, 2, 226, nil,
|
274
|
+
nil, nil, 203, nil, 246, 247, nil, 253, nil, nil,
|
275
|
+
223, nil, nil, 223, nil ]
|
276
|
+
|
277
|
+
racc_action_default = [
|
278
|
+
-5, -102, -5, -5, -5, -5, -102, -102, -102, -102,
|
279
|
+
-102, -1, -2, -3, -4, -102, -102, -14, -15, -102,
|
280
|
+
-102, -21, -22, -32, -33, -46, -47, 175, -102, -7,
|
281
|
+
-11, -12, -13, -31, -31, -102, -20, -17, -31, -31,
|
282
|
+
-25, -102, -10, -102, -31, -31, -31, -102, -102, -102,
|
283
|
+
-102, -102, -48, -102, -102, -102, -19, -31, -31, -6,
|
284
|
+
-102, -9, -26, -28, -29, -30, -31, -31, -31, -31,
|
285
|
+
-71, -71, -71, -43, -102, -50, -54, -55, -27, -16,
|
286
|
+
-18, -102, -102, -8, -102, -102, -102, -102, -38, -76,
|
287
|
+
-76, -69, -70, -39, -40, -44, -42, -102, -53, -23,
|
288
|
+
-24, -34, -35, -36, -37, -84, -72, -102, -74, -75,
|
289
|
+
-91, -92, -84, -56, -102, -49, -102, -52, -67, -102,
|
290
|
+
-102, -95, -68, -59, -57, -58, -45, -51, -81, -102,
|
291
|
+
-83, -88, -89, -73, -102, -94, -102, -102, -84, -77,
|
292
|
+
-102, -79, -80, -102, -87, -102, -93, -98, -102, -61,
|
293
|
+
-65, -66, -102, -82, -102, -86, -90, -41, -102, -64,
|
294
|
+
-78, -85, -102, -97, -102, -102, -60, -102, -63, -96,
|
295
|
+
-100, -101, -62, -102, -99 ]
|
296
|
+
|
297
|
+
racc_goto_table = [
|
298
|
+
75, 20, 121, 130, 29, 37, 163, 120, 16, 53,
|
299
|
+
41, 169, 36, 144, 53, 135, 32, 42, 35, 63,
|
300
|
+
64, 65, 98, 141, 118, 149, 23, 155, 56, 146,
|
301
|
+
61, 122, 81, 82, 73, 121, 159, 95, 161, 79,
|
302
|
+
152, 84, 85, 86, 87, 117, 168, 135, 80, 83,
|
303
|
+
70, 71, 72, 57, 58, 172, 1, 151, 11, 12,
|
304
|
+
13, 14, 105, 112, 127, 88, 93, 94, 113, 123,
|
305
|
+
136, 147, 157, 97, 158, 138, 143 ]
|
306
|
+
|
307
|
+
racc_goto_check = [
|
308
|
+
27, 12, 34, 36, 7, 11, 37, 33, 8, 13,
|
309
|
+
6, 37, 12, 36, 13, 34, 9, 7, 10, 13,
|
310
|
+
13, 13, 27, 34, 31, 29, 17, 36, 12, 34,
|
311
|
+
7, 31, 13, 13, 19, 34, 29, 20, 36, 11,
|
312
|
+
33, 13, 13, 13, 13, 27, 29, 34, 12, 7,
|
313
|
+
8, 8, 8, 4, 4, 29, 1, 31, 1, 1,
|
314
|
+
1, 1, 30, 30, 27, 18, 18, 18, 21, 22,
|
315
|
+
23, 24, 25, 26, 28, 32, 35 ]
|
316
|
+
|
317
|
+
racc_goto_pointer = [
|
318
|
+
nil, 56, nil, nil, 15, nil, -18, -11, 1, 0,
|
319
|
+
-1, -15, -7, -25, nil, nil, nil, 17, -5, -18,
|
320
|
+
-36, -27, -44, -53, -65, -75, -1, -52, -74, -112,
|
321
|
+
-27, -81, -53, -100, -105, -53, -116, -151 ]
|
322
|
+
|
323
|
+
racc_goto_default = [
|
324
|
+
nil, nil, 2, 3, 4, 5, nil, nil, nil, 40,
|
325
|
+
nil, nil, nil, 43, 44, 45, 46, 52, nil, nil,
|
326
|
+
nil, nil, nil, nil, 92, nil, nil, nil, nil, nil,
|
327
|
+
nil, nil, nil, nil, 108, nil, nil, nil ]
|
328
|
+
|
329
|
+
racc_reduce_table = [
|
330
|
+
0, 0, :racc_error,
|
331
|
+
2, 39, :_reduce_none,
|
332
|
+
2, 39, :_reduce_none,
|
333
|
+
2, 39, :_reduce_3,
|
334
|
+
2, 39, :_reduce_none,
|
335
|
+
0, 39, :_reduce_none,
|
336
|
+
5, 40, :_reduce_6,
|
337
|
+
3, 40, :_reduce_7,
|
338
|
+
3, 44, :_reduce_8,
|
339
|
+
2, 44, :_reduce_9,
|
340
|
+
1, 44, :_reduce_10,
|
341
|
+
1, 45, :_reduce_11,
|
342
|
+
1, 45, :_reduce_12,
|
343
|
+
3, 43, :_reduce_13,
|
344
|
+
1, 46, :_reduce_14,
|
345
|
+
1, 46, :_reduce_15,
|
346
|
+
5, 41, :_reduce_16,
|
347
|
+
3, 41, :_reduce_17,
|
348
|
+
3, 48, :_reduce_18,
|
349
|
+
2, 48, :_reduce_19,
|
350
|
+
1, 48, :_reduce_20,
|
351
|
+
1, 50, :_reduce_21,
|
352
|
+
1, 50, :_reduce_22,
|
353
|
+
4, 49, :_reduce_23,
|
354
|
+
4, 49, :_reduce_24,
|
355
|
+
1, 49, :_reduce_25,
|
356
|
+
3, 47, :_reduce_26,
|
357
|
+
3, 47, :_reduce_27,
|
358
|
+
2, 51, :_reduce_28,
|
359
|
+
2, 51, :_reduce_29,
|
360
|
+
2, 51, :_reduce_30,
|
361
|
+
0, 51, :_reduce_31,
|
362
|
+
2, 42, :_reduce_32,
|
363
|
+
2, 42, :_reduce_33,
|
364
|
+
4, 53, :_reduce_34,
|
365
|
+
4, 53, :_reduce_35,
|
366
|
+
4, 54, :_reduce_36,
|
367
|
+
4, 54, :_reduce_37,
|
368
|
+
3, 52, :_reduce_38,
|
369
|
+
3, 52, :_reduce_39,
|
370
|
+
3, 52, :_reduce_40,
|
371
|
+
8, 52, :_reduce_41,
|
372
|
+
1, 58, :_reduce_none,
|
373
|
+
0, 58, :_reduce_none,
|
374
|
+
0, 59, :_reduce_none,
|
375
|
+
2, 59, :_reduce_45,
|
376
|
+
1, 55, :_reduce_46,
|
377
|
+
1, 55, :_reduce_47,
|
378
|
+
0, 57, :_reduce_none,
|
379
|
+
3, 57, :_reduce_49,
|
380
|
+
1, 57, :_reduce_50,
|
381
|
+
3, 64, :_reduce_51,
|
382
|
+
2, 64, :_reduce_52,
|
383
|
+
1, 64, :_reduce_53,
|
384
|
+
1, 65, :_reduce_54,
|
385
|
+
1, 65, :_reduce_55,
|
386
|
+
0, 60, :_reduce_none,
|
387
|
+
1, 60, :_reduce_57,
|
388
|
+
1, 60, :_reduce_58,
|
389
|
+
0, 61, :_reduce_none,
|
390
|
+
4, 61, :_reduce_60,
|
391
|
+
2, 61, :_reduce_61,
|
392
|
+
3, 66, :_reduce_62,
|
393
|
+
2, 66, :_reduce_63,
|
394
|
+
1, 66, :_reduce_64,
|
395
|
+
1, 67, :_reduce_65,
|
396
|
+
6, 62, :_reduce_66,
|
397
|
+
3, 62, :_reduce_67,
|
398
|
+
3, 62, :_reduce_68,
|
399
|
+
1, 62, :_reduce_69,
|
400
|
+
1, 56, :_reduce_none,
|
401
|
+
0, 56, :_reduce_71,
|
402
|
+
1, 68, :_reduce_72,
|
403
|
+
3, 68, :_reduce_73,
|
404
|
+
1, 68, :_reduce_none,
|
405
|
+
1, 68, :_reduce_75,
|
406
|
+
0, 68, :_reduce_none,
|
407
|
+
1, 70, :_reduce_77,
|
408
|
+
3, 70, :_reduce_78,
|
409
|
+
1, 70, :_reduce_none,
|
410
|
+
1, 70, :_reduce_80,
|
411
|
+
0, 70, :_reduce_none,
|
412
|
+
4, 69, :_reduce_82,
|
413
|
+
2, 69, :_reduce_83,
|
414
|
+
0, 69, :_reduce_none,
|
415
|
+
3, 73, :_reduce_85,
|
416
|
+
2, 73, :_reduce_86,
|
417
|
+
1, 73, :_reduce_87,
|
418
|
+
1, 74, :_reduce_88,
|
419
|
+
1, 74, :_reduce_89,
|
420
|
+
3, 74, :_reduce_90,
|
421
|
+
1, 72, :_reduce_91,
|
422
|
+
1, 72, :_reduce_92,
|
423
|
+
3, 71, :_reduce_93,
|
424
|
+
2, 71, :_reduce_94,
|
425
|
+
1, 71, :_reduce_95,
|
426
|
+
3, 63, :_reduce_96,
|
427
|
+
2, 63, :_reduce_97,
|
428
|
+
0, 63, :_reduce_98,
|
429
|
+
4, 75, :_reduce_99,
|
430
|
+
2, 75, :_reduce_100,
|
431
|
+
2, 75, :_reduce_101 ]
|
432
|
+
|
433
|
+
racc_reduce_n = 102
|
434
|
+
|
435
|
+
racc_shift_n = 175
|
436
|
+
|
437
|
+
racc_token_table = {
|
438
|
+
false => 0,
|
439
|
+
:error => 1,
|
440
|
+
:IDENTIFIER => 2,
|
441
|
+
"=" => 3,
|
442
|
+
"{" => 4,
|
443
|
+
"}" => 5,
|
444
|
+
"," => 6,
|
445
|
+
:ADDRESS => 7,
|
446
|
+
:STRING => 8,
|
447
|
+
:SERVICE => 9,
|
448
|
+
:NODE => 10,
|
449
|
+
:REGEX => 11,
|
450
|
+
:DO => 12,
|
451
|
+
:END => 13,
|
452
|
+
:POLICY => 14,
|
453
|
+
:LOG => 15,
|
454
|
+
:IPV4 => 16,
|
455
|
+
:IPV6 => 17,
|
456
|
+
:CLIENT => 18,
|
457
|
+
:SERVER => 19,
|
458
|
+
:ON => 20,
|
459
|
+
:BLOCK => 21,
|
460
|
+
:PASS => 22,
|
461
|
+
:IN => 23,
|
462
|
+
:OUT => 24,
|
463
|
+
:INET => 25,
|
464
|
+
:INET6 => 26,
|
465
|
+
:PROTO => 27,
|
466
|
+
:FROM => 28,
|
467
|
+
:TO => 29,
|
468
|
+
:ALL => 30,
|
469
|
+
:ANY => 31,
|
470
|
+
:VARIABLE => 32,
|
471
|
+
:PORT => 33,
|
472
|
+
:INTEGER => 34,
|
473
|
+
":" => 35,
|
474
|
+
:RDR_TO => 36,
|
475
|
+
:NAT_TO => 37 }
|
476
|
+
|
477
|
+
racc_nt_base = 38
|
478
|
+
|
479
|
+
racc_use_result_var = true
|
480
|
+
|
481
|
+
Racc_arg = [
|
482
|
+
racc_action_table,
|
483
|
+
racc_action_check,
|
484
|
+
racc_action_default,
|
485
|
+
racc_action_pointer,
|
486
|
+
racc_goto_table,
|
487
|
+
racc_goto_check,
|
488
|
+
racc_goto_default,
|
489
|
+
racc_goto_pointer,
|
490
|
+
racc_nt_base,
|
491
|
+
racc_reduce_table,
|
492
|
+
racc_token_table,
|
493
|
+
racc_shift_n,
|
494
|
+
racc_reduce_n,
|
495
|
+
racc_use_result_var ]
|
496
|
+
|
497
|
+
Racc_token_to_s_table = [
|
498
|
+
"$end",
|
499
|
+
"error",
|
500
|
+
"IDENTIFIER",
|
501
|
+
"\"=\"",
|
502
|
+
"\"{\"",
|
503
|
+
"\"}\"",
|
504
|
+
"\",\"",
|
505
|
+
"ADDRESS",
|
506
|
+
"STRING",
|
507
|
+
"SERVICE",
|
508
|
+
"NODE",
|
509
|
+
"REGEX",
|
510
|
+
"DO",
|
511
|
+
"END",
|
512
|
+
"POLICY",
|
513
|
+
"LOG",
|
514
|
+
"IPV4",
|
515
|
+
"IPV6",
|
516
|
+
"CLIENT",
|
517
|
+
"SERVER",
|
518
|
+
"ON",
|
519
|
+
"BLOCK",
|
520
|
+
"PASS",
|
521
|
+
"IN",
|
522
|
+
"OUT",
|
523
|
+
"INET",
|
524
|
+
"INET6",
|
525
|
+
"PROTO",
|
526
|
+
"FROM",
|
527
|
+
"TO",
|
528
|
+
"ALL",
|
529
|
+
"ANY",
|
530
|
+
"VARIABLE",
|
531
|
+
"PORT",
|
532
|
+
"INTEGER",
|
533
|
+
"\":\"",
|
534
|
+
"RDR_TO",
|
535
|
+
"NAT_TO",
|
536
|
+
"$start",
|
537
|
+
"target",
|
538
|
+
"assignation",
|
539
|
+
"node",
|
540
|
+
"policy",
|
541
|
+
"service",
|
542
|
+
"variable_value_list",
|
543
|
+
"variable_value",
|
544
|
+
"service_name",
|
545
|
+
"block",
|
546
|
+
"node_name_list",
|
547
|
+
"block_with_policy",
|
548
|
+
"node_name",
|
549
|
+
"rules",
|
550
|
+
"pf_rule",
|
551
|
+
"ipv4_block",
|
552
|
+
"ipv6_block",
|
553
|
+
"action",
|
554
|
+
"optional_hosts",
|
555
|
+
"rule_direction",
|
556
|
+
"log",
|
557
|
+
"on_interface",
|
558
|
+
"rule_af",
|
559
|
+
"protospec",
|
560
|
+
"hosts",
|
561
|
+
"filteropts",
|
562
|
+
"direction_list",
|
563
|
+
"direction",
|
564
|
+
"protocol_list",
|
565
|
+
"protocol",
|
566
|
+
"hosts_from",
|
567
|
+
"hosts_port",
|
568
|
+
"hosts_to",
|
569
|
+
"host_list",
|
570
|
+
"host",
|
571
|
+
"port_list",
|
572
|
+
"port",
|
573
|
+
"filteropt" ]
|
574
|
+
|
575
|
+
Racc_debug_parser = false
|
576
|
+
|
577
|
+
##### State transition tables end #####
|
578
|
+
|
579
|
+
# reduce 0 omitted
|
580
|
+
|
581
|
+
# reduce 1 omitted
|
582
|
+
|
583
|
+
# reduce 2 omitted
|
584
|
+
|
585
|
+
module_eval(<<'.,.,', 'parser.y', 4)
|
586
|
+
def _reduce_3(val, _values, result)
|
587
|
+
@default_policy = val[0]
|
588
|
+
result
|
589
|
+
end
|
590
|
+
.,.,
|
591
|
+
|
592
|
+
# reduce 4 omitted
|
593
|
+
|
594
|
+
# reduce 5 omitted
|
595
|
+
|
596
|
+
module_eval(<<'.,.,', 'parser.y', 9)
|
597
|
+
def _reduce_6(val, _values, result)
|
598
|
+
@variables[val[0][:value]] = val[3].freeze
|
599
|
+
result
|
600
|
+
end
|
601
|
+
.,.,
|
602
|
+
|
603
|
+
module_eval(<<'.,.,', 'parser.y', 10)
|
604
|
+
def _reduce_7(val, _values, result)
|
605
|
+
@variables[val[0][:value]] = val[2].freeze
|
606
|
+
result
|
607
|
+
end
|
608
|
+
.,.,
|
609
|
+
|
610
|
+
module_eval(<<'.,.,', 'parser.y', 13)
|
611
|
+
def _reduce_8(val, _values, result)
|
612
|
+
result = val[0] + [val[2]]
|
613
|
+
result
|
614
|
+
end
|
615
|
+
.,.,
|
616
|
+
|
617
|
+
module_eval(<<'.,.,', 'parser.y', 14)
|
618
|
+
def _reduce_9(val, _values, result)
|
619
|
+
result = val[0] + [val[1]]
|
620
|
+
result
|
621
|
+
end
|
622
|
+
.,.,
|
623
|
+
|
624
|
+
module_eval(<<'.,.,', 'parser.y', 15)
|
625
|
+
def _reduce_10(val, _values, result)
|
626
|
+
result = [val[0]]
|
627
|
+
result
|
628
|
+
end
|
629
|
+
.,.,
|
630
|
+
|
631
|
+
module_eval(<<'.,.,', 'parser.y', 18)
|
632
|
+
def _reduce_11(val, _values, result)
|
633
|
+
result = val[0][:value]
|
634
|
+
result
|
635
|
+
end
|
636
|
+
.,.,
|
637
|
+
|
638
|
+
module_eval(<<'.,.,', 'parser.y', 19)
|
639
|
+
def _reduce_12(val, _values, result)
|
640
|
+
result = val[0][:value]
|
641
|
+
result
|
642
|
+
end
|
643
|
+
.,.,
|
644
|
+
|
645
|
+
module_eval(<<'.,.,', 'parser.y', 22)
|
646
|
+
def _reduce_13(val, _values, result)
|
647
|
+
@services[val[1]] = val[2]
|
648
|
+
result
|
649
|
+
end
|
650
|
+
.,.,
|
651
|
+
|
652
|
+
module_eval(<<'.,.,', 'parser.y', 25)
|
653
|
+
def _reduce_14(val, _values, result)
|
654
|
+
result = val[0][:value]
|
655
|
+
result
|
656
|
+
end
|
657
|
+
.,.,
|
658
|
+
|
659
|
+
module_eval(<<'.,.,', 'parser.y', 26)
|
660
|
+
def _reduce_15(val, _values, result)
|
661
|
+
result = val[0][:value]
|
662
|
+
result
|
663
|
+
end
|
664
|
+
.,.,
|
665
|
+
|
666
|
+
module_eval(<<'.,.,', 'parser.y', 29)
|
667
|
+
def _reduce_16(val, _values, result)
|
668
|
+
@nodes[val[2]] = val[4]; @saved_policies[val[2]] = @policy
|
669
|
+
result
|
670
|
+
end
|
671
|
+
.,.,
|
672
|
+
|
673
|
+
module_eval(<<'.,.,', 'parser.y', 30)
|
674
|
+
def _reduce_17(val, _values, result)
|
675
|
+
@nodes[val[1]] = val[2]; @saved_policies[val[1]] = @policy
|
676
|
+
result
|
677
|
+
end
|
678
|
+
.,.,
|
679
|
+
|
680
|
+
module_eval(<<'.,.,', 'parser.y', 33)
|
681
|
+
def _reduce_18(val, _values, result)
|
682
|
+
result = val[0] + [val[2]]
|
683
|
+
result
|
684
|
+
end
|
685
|
+
.,.,
|
686
|
+
|
687
|
+
module_eval(<<'.,.,', 'parser.y', 34)
|
688
|
+
def _reduce_19(val, _values, result)
|
689
|
+
result = val[0] + [val[1]]
|
690
|
+
result
|
691
|
+
end
|
692
|
+
.,.,
|
693
|
+
|
694
|
+
module_eval(<<'.,.,', 'parser.y', 35)
|
695
|
+
def _reduce_20(val, _values, result)
|
696
|
+
result = [val[0]]
|
697
|
+
result
|
698
|
+
end
|
699
|
+
.,.,
|
700
|
+
|
701
|
+
module_eval(<<'.,.,', 'parser.y', 38)
|
702
|
+
def _reduce_21(val, _values, result)
|
703
|
+
result = val[0][:value]
|
704
|
+
result
|
705
|
+
end
|
706
|
+
.,.,
|
707
|
+
|
708
|
+
module_eval(<<'.,.,', 'parser.y', 39)
|
709
|
+
def _reduce_22(val, _values, result)
|
710
|
+
result = val[0][:value]
|
711
|
+
result
|
712
|
+
end
|
713
|
+
.,.,
|
714
|
+
|
715
|
+
module_eval(<<'.,.,', 'parser.y', 42)
|
716
|
+
def _reduce_23(val, _values, result)
|
717
|
+
@policy = val[1]; result = val[2]
|
718
|
+
result
|
719
|
+
end
|
720
|
+
.,.,
|
721
|
+
|
722
|
+
module_eval(<<'.,.,', 'parser.y', 43)
|
723
|
+
def _reduce_24(val, _values, result)
|
724
|
+
@policy = val[1]; result = val[2]
|
725
|
+
result
|
726
|
+
end
|
727
|
+
.,.,
|
728
|
+
|
729
|
+
module_eval(<<'.,.,', 'parser.y', 44)
|
730
|
+
def _reduce_25(val, _values, result)
|
731
|
+
@policy = nil; result = val[0]
|
732
|
+
result
|
733
|
+
end
|
734
|
+
.,.,
|
735
|
+
|
736
|
+
module_eval(<<'.,.,', 'parser.y', 47)
|
737
|
+
def _reduce_26(val, _values, result)
|
738
|
+
result = val[1].freeze
|
739
|
+
result
|
740
|
+
end
|
741
|
+
.,.,
|
742
|
+
|
743
|
+
module_eval(<<'.,.,', 'parser.y', 48)
|
744
|
+
def _reduce_27(val, _values, result)
|
745
|
+
result = val[1].freeze
|
746
|
+
result
|
747
|
+
end
|
748
|
+
.,.,
|
749
|
+
|
750
|
+
module_eval(<<'.,.,', 'parser.y', 51)
|
751
|
+
def _reduce_28(val, _values, result)
|
752
|
+
result = val[0] + val[1]
|
753
|
+
result
|
754
|
+
end
|
755
|
+
.,.,
|
756
|
+
|
757
|
+
module_eval(<<'.,.,', 'parser.y', 52)
|
758
|
+
def _reduce_29(val, _values, result)
|
759
|
+
result = val[0] + val[1]
|
760
|
+
result
|
761
|
+
end
|
762
|
+
.,.,
|
763
|
+
|
764
|
+
module_eval(<<'.,.,', 'parser.y', 53)
|
765
|
+
def _reduce_30(val, _values, result)
|
766
|
+
result = val[0] + val[1]
|
767
|
+
result
|
768
|
+
end
|
769
|
+
.,.,
|
770
|
+
|
771
|
+
module_eval(<<'.,.,', 'parser.y', 54)
|
772
|
+
def _reduce_31(val, _values, result)
|
773
|
+
result = []
|
774
|
+
result
|
775
|
+
end
|
776
|
+
.,.,
|
777
|
+
|
778
|
+
module_eval(<<'.,.,', 'parser.y', 57)
|
779
|
+
def _reduce_32(val, _values, result)
|
780
|
+
result = val[1][:action]
|
781
|
+
result
|
782
|
+
end
|
783
|
+
.,.,
|
784
|
+
|
785
|
+
module_eval(<<'.,.,', 'parser.y', 58)
|
786
|
+
def _reduce_33(val, _values, result)
|
787
|
+
result = 'log'
|
788
|
+
result
|
789
|
+
end
|
790
|
+
.,.,
|
791
|
+
|
792
|
+
module_eval(<<'.,.,', 'parser.y', 61)
|
793
|
+
def _reduce_34(val, _values, result)
|
794
|
+
result = val[2].reject { |x| x[:af] == :inet6 }.map { |x| x[:af] = :inet ; x }
|
795
|
+
result
|
796
|
+
end
|
797
|
+
.,.,
|
798
|
+
|
799
|
+
module_eval(<<'.,.,', 'parser.y', 62)
|
800
|
+
def _reduce_35(val, _values, result)
|
801
|
+
result = val[2].reject { |x| x[:af] == :inet6 }.map { |x| x[:af] = :inet ; x }
|
802
|
+
result
|
803
|
+
end
|
804
|
+
.,.,
|
805
|
+
|
806
|
+
module_eval(<<'.,.,', 'parser.y', 65)
|
807
|
+
def _reduce_36(val, _values, result)
|
808
|
+
result = val[2].reject { |x| x[:af] == :inet }.map { |x| x[:af] = :inet6 ; x }
|
809
|
+
result
|
810
|
+
end
|
811
|
+
.,.,
|
812
|
+
|
813
|
+
module_eval(<<'.,.,', 'parser.y', 66)
|
814
|
+
def _reduce_37(val, _values, result)
|
815
|
+
result = val[2].reject { |x| x[:af] == :inet }.map { |x| x[:af] = :inet6 ; x }
|
816
|
+
result
|
817
|
+
end
|
818
|
+
.,.,
|
819
|
+
|
820
|
+
module_eval(<<'.,.,', 'parser.y', 69)
|
821
|
+
def _reduce_38(val, _values, result)
|
822
|
+
result = @services.fetch(val[1]).deep_dup.map { |x| x.merge(val[2]) }
|
823
|
+
result
|
824
|
+
end
|
825
|
+
.,.,
|
826
|
+
|
827
|
+
module_eval(<<'.,.,', 'parser.y', 71)
|
828
|
+
def _reduce_39(val, _values, result)
|
829
|
+
raise "service #{val[1]} cannot be used as client" if @services.fetch(val[1]).map { |x| x[:dir] }.compact.any?
|
830
|
+
result = @services.fetch(val[1]).deep_dup.map { |x| x.merge(dir: :out).deep_merge(val[2]) }
|
831
|
+
|
832
|
+
result
|
833
|
+
end
|
834
|
+
.,.,
|
835
|
+
|
836
|
+
module_eval(<<'.,.,', 'parser.y', 75)
|
837
|
+
def _reduce_40(val, _values, result)
|
838
|
+
raise "service #{val[1]} cannot be used as server" if @services.fetch(val[1]).map { |x| x[:dir] }.compact.any?
|
839
|
+
result = @services.fetch(val[1]).deep_dup.map { |x| x.merge(dir: :in).deep_merge(val[2]) }
|
840
|
+
|
841
|
+
result
|
842
|
+
end
|
843
|
+
.,.,
|
844
|
+
|
845
|
+
module_eval(<<'.,.,', 'parser.y', 78)
|
846
|
+
def _reduce_41(val, _values, result)
|
847
|
+
result = [val.compact.inject(:merge)]
|
848
|
+
result
|
849
|
+
end
|
850
|
+
.,.,
|
851
|
+
|
852
|
+
# reduce 42 omitted
|
853
|
+
|
854
|
+
# reduce 43 omitted
|
855
|
+
|
856
|
+
# reduce 44 omitted
|
857
|
+
|
858
|
+
module_eval(<<'.,.,', 'parser.y', 86)
|
859
|
+
def _reduce_45(val, _values, result)
|
860
|
+
result = { on: val[1][:value] }
|
861
|
+
result
|
862
|
+
end
|
863
|
+
.,.,
|
864
|
+
|
865
|
+
module_eval(<<'.,.,', 'parser.y', 89)
|
866
|
+
def _reduce_46(val, _values, result)
|
867
|
+
result = { action: :block }
|
868
|
+
result
|
869
|
+
end
|
870
|
+
.,.,
|
871
|
+
|
872
|
+
module_eval(<<'.,.,', 'parser.y', 90)
|
873
|
+
def _reduce_47(val, _values, result)
|
874
|
+
result = { action: :pass }
|
875
|
+
result
|
876
|
+
end
|
877
|
+
.,.,
|
878
|
+
|
879
|
+
# reduce 48 omitted
|
880
|
+
|
881
|
+
module_eval(<<'.,.,', 'parser.y', 94)
|
882
|
+
def _reduce_49(val, _values, result)
|
883
|
+
result = { dir: val[1] }
|
884
|
+
result
|
885
|
+
end
|
886
|
+
.,.,
|
887
|
+
|
888
|
+
module_eval(<<'.,.,', 'parser.y', 95)
|
889
|
+
def _reduce_50(val, _values, result)
|
890
|
+
result = { dir: val[0] }
|
891
|
+
result
|
892
|
+
end
|
893
|
+
.,.,
|
894
|
+
|
895
|
+
module_eval(<<'.,.,', 'parser.y', 98)
|
896
|
+
def _reduce_51(val, _values, result)
|
897
|
+
result = val[0] + [val[2]]
|
898
|
+
result
|
899
|
+
end
|
900
|
+
.,.,
|
901
|
+
|
902
|
+
module_eval(<<'.,.,', 'parser.y', 99)
|
903
|
+
def _reduce_52(val, _values, result)
|
904
|
+
result = val[0] + [val[1]]
|
905
|
+
result
|
906
|
+
end
|
907
|
+
.,.,
|
908
|
+
|
909
|
+
module_eval(<<'.,.,', 'parser.y', 100)
|
910
|
+
def _reduce_53(val, _values, result)
|
911
|
+
result = [val[0]]
|
912
|
+
result
|
913
|
+
end
|
914
|
+
.,.,
|
915
|
+
|
916
|
+
module_eval(<<'.,.,', 'parser.y', 103)
|
917
|
+
def _reduce_54(val, _values, result)
|
918
|
+
result = :in
|
919
|
+
result
|
920
|
+
end
|
921
|
+
.,.,
|
922
|
+
|
923
|
+
module_eval(<<'.,.,', 'parser.y', 104)
|
924
|
+
def _reduce_55(val, _values, result)
|
925
|
+
result = :out
|
926
|
+
result
|
927
|
+
end
|
928
|
+
.,.,
|
929
|
+
|
930
|
+
# reduce 56 omitted
|
931
|
+
|
932
|
+
module_eval(<<'.,.,', 'parser.y', 108)
|
933
|
+
def _reduce_57(val, _values, result)
|
934
|
+
result = { af: :inet }
|
935
|
+
result
|
936
|
+
end
|
937
|
+
.,.,
|
938
|
+
|
939
|
+
module_eval(<<'.,.,', 'parser.y', 109)
|
940
|
+
def _reduce_58(val, _values, result)
|
941
|
+
result = { af: :inet6 }
|
942
|
+
result
|
943
|
+
end
|
944
|
+
.,.,
|
945
|
+
|
946
|
+
# reduce 59 omitted
|
947
|
+
|
948
|
+
module_eval(<<'.,.,', 'parser.y', 113)
|
949
|
+
def _reduce_60(val, _values, result)
|
950
|
+
result = { proto: val[2] }
|
951
|
+
result
|
952
|
+
end
|
953
|
+
.,.,
|
954
|
+
|
955
|
+
module_eval(<<'.,.,', 'parser.y', 114)
|
956
|
+
def _reduce_61(val, _values, result)
|
957
|
+
result = { proto: val[1] }
|
958
|
+
result
|
959
|
+
end
|
960
|
+
.,.,
|
961
|
+
|
962
|
+
module_eval(<<'.,.,', 'parser.y', 117)
|
963
|
+
def _reduce_62(val, _values, result)
|
964
|
+
result = val[0] + [val[2]]
|
965
|
+
result
|
966
|
+
end
|
967
|
+
.,.,
|
968
|
+
|
969
|
+
module_eval(<<'.,.,', 'parser.y', 118)
|
970
|
+
def _reduce_63(val, _values, result)
|
971
|
+
result = val[0] + [val[1]]
|
972
|
+
result
|
973
|
+
end
|
974
|
+
.,.,
|
975
|
+
|
976
|
+
module_eval(<<'.,.,', 'parser.y', 119)
|
977
|
+
def _reduce_64(val, _values, result)
|
978
|
+
result = [val[0]]
|
979
|
+
result
|
980
|
+
end
|
981
|
+
.,.,
|
982
|
+
|
983
|
+
module_eval(<<'.,.,', 'parser.y', 122)
|
984
|
+
def _reduce_65(val, _values, result)
|
985
|
+
result = val[0][:value].to_sym
|
986
|
+
result
|
987
|
+
end
|
988
|
+
.,.,
|
989
|
+
|
990
|
+
module_eval(<<'.,.,', 'parser.y', 125)
|
991
|
+
def _reduce_66(val, _values, result)
|
992
|
+
result = { from: { host: val[1], port: val[2] }, to: { host: val[4], port: val[5] } }
|
993
|
+
result
|
994
|
+
end
|
995
|
+
.,.,
|
996
|
+
|
997
|
+
module_eval(<<'.,.,', 'parser.y', 126)
|
998
|
+
def _reduce_67(val, _values, result)
|
999
|
+
result = { from: { host: val[1], port: val[2] } }
|
1000
|
+
result
|
1001
|
+
end
|
1002
|
+
.,.,
|
1003
|
+
|
1004
|
+
module_eval(<<'.,.,', 'parser.y', 127)
|
1005
|
+
def _reduce_68(val, _values, result)
|
1006
|
+
result = { to: { host: val[1], port: val[2] } }
|
1007
|
+
result
|
1008
|
+
end
|
1009
|
+
.,.,
|
1010
|
+
|
1011
|
+
module_eval(<<'.,.,', 'parser.y', 128)
|
1012
|
+
def _reduce_69(val, _values, result)
|
1013
|
+
result = {}
|
1014
|
+
result
|
1015
|
+
end
|
1016
|
+
.,.,
|
1017
|
+
|
1018
|
+
# reduce 70 omitted
|
1019
|
+
|
1020
|
+
module_eval(<<'.,.,', 'parser.y', 132)
|
1021
|
+
def _reduce_71(val, _values, result)
|
1022
|
+
result = {}
|
1023
|
+
result
|
1024
|
+
end
|
1025
|
+
.,.,
|
1026
|
+
|
1027
|
+
module_eval(<<'.,.,', 'parser.y', 135)
|
1028
|
+
def _reduce_72(val, _values, result)
|
1029
|
+
result = nil
|
1030
|
+
result
|
1031
|
+
end
|
1032
|
+
.,.,
|
1033
|
+
|
1034
|
+
module_eval(<<'.,.,', 'parser.y', 136)
|
1035
|
+
def _reduce_73(val, _values, result)
|
1036
|
+
result = val[1]
|
1037
|
+
result
|
1038
|
+
end
|
1039
|
+
.,.,
|
1040
|
+
|
1041
|
+
# reduce 74 omitted
|
1042
|
+
|
1043
|
+
module_eval(<<'.,.,', 'parser.y', 138)
|
1044
|
+
def _reduce_75(val, _values, result)
|
1045
|
+
result = @variables.fetch(val[0][:value])
|
1046
|
+
result
|
1047
|
+
end
|
1048
|
+
.,.,
|
1049
|
+
|
1050
|
+
# reduce 76 omitted
|
1051
|
+
|
1052
|
+
module_eval(<<'.,.,', 'parser.y', 142)
|
1053
|
+
def _reduce_77(val, _values, result)
|
1054
|
+
result = nil
|
1055
|
+
result
|
1056
|
+
end
|
1057
|
+
.,.,
|
1058
|
+
|
1059
|
+
module_eval(<<'.,.,', 'parser.y', 143)
|
1060
|
+
def _reduce_78(val, _values, result)
|
1061
|
+
result = val[1]
|
1062
|
+
result
|
1063
|
+
end
|
1064
|
+
.,.,
|
1065
|
+
|
1066
|
+
# reduce 79 omitted
|
1067
|
+
|
1068
|
+
module_eval(<<'.,.,', 'parser.y', 145)
|
1069
|
+
def _reduce_80(val, _values, result)
|
1070
|
+
result = @variables.fetch(val[0][:value])
|
1071
|
+
result
|
1072
|
+
end
|
1073
|
+
.,.,
|
1074
|
+
|
1075
|
+
# reduce 81 omitted
|
1076
|
+
|
1077
|
+
module_eval(<<'.,.,', 'parser.y', 149)
|
1078
|
+
def _reduce_82(val, _values, result)
|
1079
|
+
result = val[2]
|
1080
|
+
result
|
1081
|
+
end
|
1082
|
+
.,.,
|
1083
|
+
|
1084
|
+
module_eval(<<'.,.,', 'parser.y', 150)
|
1085
|
+
def _reduce_83(val, _values, result)
|
1086
|
+
result = val[1]
|
1087
|
+
result
|
1088
|
+
end
|
1089
|
+
.,.,
|
1090
|
+
|
1091
|
+
# reduce 84 omitted
|
1092
|
+
|
1093
|
+
module_eval(<<'.,.,', 'parser.y', 154)
|
1094
|
+
def _reduce_85(val, _values, result)
|
1095
|
+
result = val[0] + [val[2]]
|
1096
|
+
result
|
1097
|
+
end
|
1098
|
+
.,.,
|
1099
|
+
|
1100
|
+
module_eval(<<'.,.,', 'parser.y', 155)
|
1101
|
+
def _reduce_86(val, _values, result)
|
1102
|
+
result = val[0] + [val[1]]
|
1103
|
+
result
|
1104
|
+
end
|
1105
|
+
.,.,
|
1106
|
+
|
1107
|
+
module_eval(<<'.,.,', 'parser.y', 156)
|
1108
|
+
def _reduce_87(val, _values, result)
|
1109
|
+
result = [val[0]]
|
1110
|
+
result
|
1111
|
+
end
|
1112
|
+
.,.,
|
1113
|
+
|
1114
|
+
module_eval(<<'.,.,', 'parser.y', 159)
|
1115
|
+
def _reduce_88(val, _values, result)
|
1116
|
+
result = val[0][:value]
|
1117
|
+
result
|
1118
|
+
end
|
1119
|
+
.,.,
|
1120
|
+
|
1121
|
+
module_eval(<<'.,.,', 'parser.y', 160)
|
1122
|
+
def _reduce_89(val, _values, result)
|
1123
|
+
result = val[0][:value]
|
1124
|
+
result
|
1125
|
+
end
|
1126
|
+
.,.,
|
1127
|
+
|
1128
|
+
module_eval(<<'.,.,', 'parser.y', 161)
|
1129
|
+
def _reduce_90(val, _values, result)
|
1130
|
+
result = Range.new(val[0][:value], val[2][:value])
|
1131
|
+
result
|
1132
|
+
end
|
1133
|
+
.,.,
|
1134
|
+
|
1135
|
+
module_eval(<<'.,.,', 'parser.y', 164)
|
1136
|
+
def _reduce_91(val, _values, result)
|
1137
|
+
result = val[0][:value]
|
1138
|
+
result
|
1139
|
+
end
|
1140
|
+
.,.,
|
1141
|
+
|
1142
|
+
module_eval(<<'.,.,', 'parser.y', 165)
|
1143
|
+
def _reduce_92(val, _values, result)
|
1144
|
+
result = val[0][:value]
|
1145
|
+
result
|
1146
|
+
end
|
1147
|
+
.,.,
|
1148
|
+
|
1149
|
+
module_eval(<<'.,.,', 'parser.y', 168)
|
1150
|
+
def _reduce_93(val, _values, result)
|
1151
|
+
result = val[0] + [val[2]]
|
1152
|
+
result
|
1153
|
+
end
|
1154
|
+
.,.,
|
1155
|
+
|
1156
|
+
module_eval(<<'.,.,', 'parser.y', 169)
|
1157
|
+
def _reduce_94(val, _values, result)
|
1158
|
+
result = val[0] + [val[1]]
|
1159
|
+
result
|
1160
|
+
end
|
1161
|
+
.,.,
|
1162
|
+
|
1163
|
+
module_eval(<<'.,.,', 'parser.y', 170)
|
1164
|
+
def _reduce_95(val, _values, result)
|
1165
|
+
result = [val[0]]
|
1166
|
+
result
|
1167
|
+
end
|
1168
|
+
.,.,
|
1169
|
+
|
1170
|
+
module_eval(<<'.,.,', 'parser.y', 173)
|
1171
|
+
def _reduce_96(val, _values, result)
|
1172
|
+
result = val[0].merge(val[2])
|
1173
|
+
result
|
1174
|
+
end
|
1175
|
+
.,.,
|
1176
|
+
|
1177
|
+
module_eval(<<'.,.,', 'parser.y', 174)
|
1178
|
+
def _reduce_97(val, _values, result)
|
1179
|
+
result = val[0].merge(val[1])
|
1180
|
+
result
|
1181
|
+
end
|
1182
|
+
.,.,
|
1183
|
+
|
1184
|
+
module_eval(<<'.,.,', 'parser.y', 175)
|
1185
|
+
def _reduce_98(val, _values, result)
|
1186
|
+
result = {}
|
1187
|
+
result
|
1188
|
+
end
|
1189
|
+
.,.,
|
1190
|
+
|
1191
|
+
module_eval(<<'.,.,', 'parser.y', 178)
|
1192
|
+
def _reduce_99(val, _values, result)
|
1193
|
+
result = { rdr_to: { host: val[1][:value], port: val[3][:value] } }
|
1194
|
+
result
|
1195
|
+
end
|
1196
|
+
.,.,
|
1197
|
+
|
1198
|
+
module_eval(<<'.,.,', 'parser.y', 179)
|
1199
|
+
def _reduce_100(val, _values, result)
|
1200
|
+
result = { rdr_to: { host: val[1][:value] } }
|
1201
|
+
result
|
1202
|
+
end
|
1203
|
+
.,.,
|
1204
|
+
|
1205
|
+
module_eval(<<'.,.,', 'parser.y', 180)
|
1206
|
+
def _reduce_101(val, _values, result)
|
1207
|
+
result = { nat_to: val[1][:value] }
|
1208
|
+
result
|
1209
|
+
end
|
1210
|
+
.,.,
|
1211
|
+
|
1212
|
+
def _reduce_none(val, _values, result)
|
1213
|
+
val[0]
|
1214
|
+
end
|
1215
|
+
|
1216
|
+
end # class Parser
|
1217
|
+
end # module Puffy
|