packetgen 3.1.1 → 3.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/bin/pgconsole +1 -0
  3. data/lib/packetgen.rb +33 -4
  4. data/lib/packetgen/capture.rb +51 -28
  5. data/lib/packetgen/config.rb +17 -11
  6. data/lib/packetgen/deprecation.rb +34 -8
  7. data/lib/packetgen/header.rb +2 -9
  8. data/lib/packetgen/header/arp.rb +2 -2
  9. data/lib/packetgen/header/asn1_base.rb +2 -2
  10. data/lib/packetgen/header/base.rb +70 -74
  11. data/lib/packetgen/header/bootp.rb +3 -3
  12. data/lib/packetgen/header/dhcp.rb +2 -2
  13. data/lib/packetgen/header/dhcp/option.rb +2 -2
  14. data/lib/packetgen/header/dhcp/options.rb +2 -2
  15. data/lib/packetgen/header/dhcpv6.rb +12 -12
  16. data/lib/packetgen/header/dhcpv6/duid.rb +11 -5
  17. data/lib/packetgen/header/dhcpv6/option.rb +8 -16
  18. data/lib/packetgen/header/dhcpv6/options.rb +2 -2
  19. data/lib/packetgen/header/dhcpv6/relay.rb +2 -2
  20. data/lib/packetgen/header/dns.rb +9 -9
  21. data/lib/packetgen/header/dns/name.rb +20 -9
  22. data/lib/packetgen/header/dns/opt.rb +2 -2
  23. data/lib/packetgen/header/dns/option.rb +2 -2
  24. data/lib/packetgen/header/dns/qdsection.rb +3 -3
  25. data/lib/packetgen/header/dns/question.rb +37 -35
  26. data/lib/packetgen/header/dns/rr.rb +3 -3
  27. data/lib/packetgen/header/dns/rrsection.rb +2 -2
  28. data/lib/packetgen/header/dot11.rb +30 -51
  29. data/lib/packetgen/header/dot11/control.rb +5 -5
  30. data/lib/packetgen/header/dot11/data.rb +11 -7
  31. data/lib/packetgen/header/dot11/element.rb +16 -16
  32. data/lib/packetgen/header/dot11/management.rb +2 -2
  33. data/lib/packetgen/header/dot11/sub_mngt.rb +2 -12
  34. data/lib/packetgen/header/dot1q.rb +2 -2
  35. data/lib/packetgen/header/dot1x.rb +7 -20
  36. data/lib/packetgen/header/eap.rb +30 -33
  37. data/lib/packetgen/header/eap/fast.rb +2 -2
  38. data/lib/packetgen/header/eap/md5.rb +2 -2
  39. data/lib/packetgen/header/eap/tls.rb +2 -2
  40. data/lib/packetgen/header/eap/ttls.rb +2 -2
  41. data/lib/packetgen/header/eth.rb +13 -11
  42. data/lib/packetgen/header/gre.rb +2 -2
  43. data/lib/packetgen/header/http.rb +2 -0
  44. data/lib/packetgen/header/http/headers.rb +6 -4
  45. data/lib/packetgen/header/http/request.rb +36 -21
  46. data/lib/packetgen/header/http/response.rb +7 -7
  47. data/lib/packetgen/header/http/verbs.rb +3 -3
  48. data/lib/packetgen/header/icmp.rb +2 -2
  49. data/lib/packetgen/header/icmpv6.rb +2 -2
  50. data/lib/packetgen/header/igmp.rb +4 -4
  51. data/lib/packetgen/header/igmpv3.rb +3 -3
  52. data/lib/packetgen/header/igmpv3/group_record.rb +8 -6
  53. data/lib/packetgen/header/igmpv3/mq.rb +2 -2
  54. data/lib/packetgen/header/igmpv3/mr.rb +2 -2
  55. data/lib/packetgen/header/ip.rb +30 -31
  56. data/lib/packetgen/header/ip/addr.rb +10 -3
  57. data/lib/packetgen/header/ip/option.rb +8 -10
  58. data/lib/packetgen/header/ip/options.rb +3 -5
  59. data/lib/packetgen/header/ipv6.rb +2 -2
  60. data/lib/packetgen/header/ipv6/addr.rb +9 -2
  61. data/lib/packetgen/header/ipv6/extension.rb +2 -2
  62. data/lib/packetgen/header/ipv6/hop_by_hop.rb +3 -3
  63. data/lib/packetgen/header/llc.rb +2 -2
  64. data/lib/packetgen/header/mdns.rb +2 -2
  65. data/lib/packetgen/header/mld.rb +2 -2
  66. data/lib/packetgen/header/mldv2.rb +2 -2
  67. data/lib/packetgen/header/mldv2/mcast_address_record.rb +4 -2
  68. data/lib/packetgen/header/mldv2/mlq.rb +2 -2
  69. data/lib/packetgen/header/mldv2/mlr.rb +2 -2
  70. data/lib/packetgen/header/ospfv2.rb +9 -9
  71. data/lib/packetgen/header/ospfv2/db_description.rb +2 -2
  72. data/lib/packetgen/header/ospfv2/hello.rb +2 -2
  73. data/lib/packetgen/header/ospfv2/ls_ack.rb +2 -2
  74. data/lib/packetgen/header/ospfv2/ls_request.rb +4 -2
  75. data/lib/packetgen/header/ospfv2/ls_update.rb +2 -2
  76. data/lib/packetgen/header/ospfv2/lsa.rb +9 -5
  77. data/lib/packetgen/header/ospfv2/lsa_header.rb +8 -7
  78. data/lib/packetgen/header/ospfv3.rb +2 -2
  79. data/lib/packetgen/header/ospfv3/db_description.rb +2 -2
  80. data/lib/packetgen/header/ospfv3/hello.rb +2 -2
  81. data/lib/packetgen/header/ospfv3/ipv6_prefix.rb +4 -2
  82. data/lib/packetgen/header/ospfv3/ls_ack.rb +2 -2
  83. data/lib/packetgen/header/ospfv3/ls_request.rb +4 -2
  84. data/lib/packetgen/header/ospfv3/ls_update.rb +2 -2
  85. data/lib/packetgen/header/ospfv3/lsa.rb +5 -5
  86. data/lib/packetgen/header/ospfv3/lsa_header.rb +9 -8
  87. data/lib/packetgen/header/snmp.rb +33 -29
  88. data/lib/packetgen/header/tcp.rb +4 -23
  89. data/lib/packetgen/header/tcp/option.rb +11 -11
  90. data/lib/packetgen/header/tcp/options.rb +2 -2
  91. data/lib/packetgen/header/tftp.rb +6 -6
  92. data/lib/packetgen/header/udp.rb +3 -3
  93. data/lib/packetgen/headerable.rb +5 -4
  94. data/lib/packetgen/inject.rb +23 -0
  95. data/lib/packetgen/inspect.rb +23 -20
  96. data/lib/packetgen/packet.rb +96 -53
  97. data/lib/packetgen/pcap.rb +29 -0
  98. data/lib/packetgen/pcapng.rb +13 -13
  99. data/lib/packetgen/pcapng/block.rb +26 -13
  100. data/lib/packetgen/pcapng/epb.rb +25 -22
  101. data/lib/packetgen/pcapng/file.rb +260 -138
  102. data/lib/packetgen/pcapng/idb.rb +36 -38
  103. data/lib/packetgen/pcapng/shb.rb +51 -53
  104. data/lib/packetgen/pcapng/spb.rb +19 -19
  105. data/lib/packetgen/pcapng/unknown_block.rb +5 -13
  106. data/lib/packetgen/pcaprub_wrapper.rb +81 -0
  107. data/lib/packetgen/proto.rb +2 -2
  108. data/lib/packetgen/types.rb +3 -0
  109. data/lib/packetgen/types/abstract_tlv.rb +28 -8
  110. data/lib/packetgen/types/array.rb +22 -15
  111. data/lib/packetgen/types/cstring.rb +40 -16
  112. data/lib/packetgen/types/enum.rb +8 -3
  113. data/lib/packetgen/types/fieldable.rb +65 -0
  114. data/lib/packetgen/types/fields.rb +182 -117
  115. data/lib/packetgen/types/int.rb +18 -6
  116. data/lib/packetgen/types/int_string.rb +10 -2
  117. data/lib/packetgen/types/length_from.rb +20 -12
  118. data/lib/packetgen/types/oui.rb +4 -2
  119. data/lib/packetgen/types/string.rb +46 -8
  120. data/lib/packetgen/types/tlv.rb +4 -2
  121. data/lib/packetgen/utils.rb +4 -4
  122. data/lib/packetgen/utils/arp_spoofer.rb +2 -2
  123. data/lib/packetgen/version.rb +3 -3
  124. metadata +35 -50
  125. data/.gitignore +0 -13
  126. data/.rubocop.yml +0 -28
  127. data/.travis.yml +0 -17
  128. data/Gemfile +0 -4
  129. data/Rakefile +0 -21
  130. data/packetgen.gemspec +0 -36
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  require_relative 'group_record'
9
9
 
10
10
  module PacketGen
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  require 'socket'
9
9
 
10
10
  module PacketGen
@@ -131,7 +131,7 @@ module PacketGen
131
131
  # @since 2.2.0
132
132
  # @return [Types::String]
133
133
  define_field :options, Options, optional: ->(h) { h.ihl > 5 },
134
- builder: ->(h, t) { t.new(length_from: -> { (h.ihl - 5) * 4 }) }
134
+ builder: ->(h, t) { t.new(length_from: -> { (h.ihl - 5) * 4 }) }
135
135
  # @!attribute body
136
136
  # @return [Types::String,Header::Base]
137
137
  define_field :body, Types::String
@@ -166,7 +166,7 @@ module PacketGen
166
166
 
167
167
  data = hdr.to_s
168
168
  data << "\x00" if data.size.odd?
169
- sum = data.unpack('n*').reduce(:+)
169
+ sum = data.unpack('n*').sum
170
170
 
171
171
  hdr.checksum = old_checksum if old_checksum
172
172
 
@@ -182,9 +182,7 @@ module PacketGen
182
182
  # @param [Integer] checksum checksum to reduce
183
183
  # @return [Integer] reduced checksum
184
184
  def self.reduce_checksum(checksum)
185
- while checksum > 0xffff
186
- checksum = (checksum & 0xffff) + (checksum >> 16)
187
- end
185
+ checksum = (checksum & 0xffff) + (checksum >> 16) while checksum > 0xffff
188
186
  checksum = ~checksum & 0xffff
189
187
  checksum.zero? ? 0xffff : checksum
190
188
  end
@@ -193,17 +191,10 @@ module PacketGen
193
191
  # @return [Integer]
194
192
  def calc_checksum
195
193
  # Checksum is only on header, so cannot use IP.sum16,
196
- # which also calcultes checksum on #body.
197
- checksum = (self[:u8].to_i << 8) | self.tos
198
- checksum += self.length
199
- checksum += self.id
200
- checksum += self.frag
201
- checksum += (self.ttl << 8) | self.protocol
202
- checksum += (self[:src].to_i >> 16)
203
- checksum += (self[:src].to_i & 0xffff)
204
- checksum += self[:dst].to_i >> 16
205
- checksum += self[:dst].to_i & 0xffff
206
- options.to_s.unpack('n*').each { |x| checksum += x }
194
+ # which also calculates checksum on #body.
195
+ nb_words = ihl * 2
196
+ self.checksum = 0
197
+ checksum = to_s.unpack("n#{nb_words}").sum
207
198
  self[:checksum].value = IP.reduce_checksum(checksum)
208
199
  end
209
200
 
@@ -240,20 +231,9 @@ module PacketGen
240
231
  super do |attr|
241
232
  case attr
242
233
  when :u8
243
- shift = Inspect.shift_level
244
- str = Inspect.inspect_attribute(attr, self[attr])
245
- str << shift << Inspect::FMT_ATTR % ['', 'version', version]
246
- str << shift << Inspect::FMT_ATTR % ['', 'ihl', ihl]
234
+ inspect_u8
247
235
  when :frag
248
- shift = Inspect.shift_level
249
- str = Inspect.inspect_attribute(attr, self[attr])
250
- flags = flag_rsv? ? %w[RSV] : []
251
- flags << 'DF' if flag_df?
252
- flags << 'MF' if flag_mf?
253
- flags_str = flags.empty? ? 'none' : flags.join(',')
254
- str << shift << Inspect::FMT_ATTR % ['', 'flags', flags_str]
255
- foff = Inspect.int_dec_hex(fragment_offset, 4)
256
- str << shift << Inspect::FMT_ATTR % ['', 'frag_offset', foff]
236
+ inspect_frag
257
237
  end
258
238
  end
259
239
  end
@@ -278,6 +258,25 @@ module PacketGen
278
258
  self[:src], self[:dst] = self[:dst], self[:src]
279
259
  self
280
260
  end
261
+
262
+ private
263
+
264
+ def inspect_u8
265
+ shift = Inspect.shift_level
266
+ str = Inspect.inspect_attribute(:u8, self[:u8])
267
+ str << shift << Inspect::FMT_ATTR % ['', 'version', version]
268
+ str << shift << Inspect::FMT_ATTR % ['', 'ihl', ihl]
269
+ end
270
+
271
+ def inspect_frag
272
+ shift = Inspect.shift_level
273
+ str = Inspect.inspect_attribute(:frag, self[:frag])
274
+ flags = %i[rsv df mf].select { |flag| send("flag_#{flag}?") }.map(&:upcase)
275
+ flags_str = flags.empty? ? 'none' : flags.join(',')
276
+ str << shift << Inspect::FMT_ATTR % ['', 'flags', flags_str]
277
+ foff = Inspect.int_dec_hex(fragment_offset, 4)
278
+ str << shift << Inspect::FMT_ATTR % ['', 'frag_offset', foff]
279
+ end
281
280
  end
282
281
 
283
282
  self.add_class IP
@@ -1,16 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  class IP
11
11
  # IP address, as a group of 4 bytes
12
12
  # @author Sylvain Daubert
13
13
  class Addr < Types::Fields
14
+ include Types::Fieldable
15
+
14
16
  # @!attribute a1
15
17
  # @return [Integer] IP address first byte
16
18
  define_field :a1, Types::Int8
@@ -24,7 +26,7 @@ module PacketGen
24
26
  # @return [Integer] IP address fourth byte
25
27
  define_field :a4, Types::Int8
26
28
 
27
- IPV4_ADDR_REGEX = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
29
+ IPV4_ADDR_REGEX = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.freeze
28
30
 
29
31
  # Read a dotted address
30
32
  # @param [String] str
@@ -60,6 +62,11 @@ module PacketGen
60
62
  def mcast?
61
63
  self.a1 >= 224 && self.a1 <= 239
62
64
  end
65
+
66
+ def ==(other)
67
+ other.is_a?(self.class) &&
68
+ fields.all? { |attr| self[attr].value == other[attr].value }
69
+ end
63
70
  end
64
71
  end
65
72
  end
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  class IP
@@ -26,6 +26,8 @@ module PacketGen
26
26
  # Base class for IP options
27
27
  # @author Sylvain Daubert
28
28
  class Option < Types::Fields
29
+ include Types::Fieldable
30
+
29
31
  # EOL option type
30
32
  EOL_TYPE = 0x00
31
33
  # NOP option type
@@ -83,7 +85,7 @@ module PacketGen
83
85
 
84
86
  # Factory to build an option from its type
85
87
  # @return [Option]
86
- def Option.build(options={})
88
+ def self.build(options={})
87
89
  type = options.delete(:type)
88
90
  klass = case type
89
91
  when String
@@ -99,9 +101,7 @@ module PacketGen
99
101
  def initialize(options={})
100
102
  unless options[:type]
101
103
  opt_name = self.class.to_s.gsub(/.*::/, '')
102
- if Option.const_defined? "#{opt_name}_TYPE"
103
- options[:type] = Option.const_get("#{opt_name}_TYPE")
104
- end
104
+ options[:type] = Option.const_get("#{opt_name}_TYPE") if Option.const_defined? "#{opt_name}_TYPE"
105
105
  end
106
106
  super
107
107
  self.length = sz if respond_to?(:length) && options[:length].nil?
@@ -117,10 +117,8 @@ module PacketGen
117
117
  # Get a human readable string
118
118
  # @return [String]
119
119
  def to_human
120
- str = self.class == Option ? +"unk-#{type}" : self.class.to_s.sub(/.*::/, '')
121
- if respond_to?(:length) && (length > 2) && !self[:data].to_s.empty?
122
- str << ":#{self[:data].to_s.inspect}"
123
- end
120
+ str = self.instance_of?(Option) ? +"unk-#{type}" : self.class.to_s.sub(/.*::/, '')
121
+ str << ":#{self[:data].to_s.inspect}" if respond_to?(:length) && (length > 2) && !self[:data].to_s.empty?
124
122
  str
125
123
  end
126
124
  end
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  class IP
@@ -19,9 +19,7 @@ module PacketGen
19
19
  # @return [String]
20
20
  def to_s
21
21
  str = super
22
- if str.length % 4 != 0
23
- str += ([0] * (4 - (str.length % 4))).pack('C*')
24
- end
22
+ str += ([0] * (4 - (str.length % 4))).pack('C*') if str.length % 4 != 0
25
23
  str
26
24
  end
27
25
 
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  # This file is part of PacketGen
3
5
  # See https://github.com/sdaubert/packetgen for more informations
4
6
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
5
7
  # This program is published under MIT license.
6
8
 
7
- # frozen_string_literal: true
8
-
9
9
  require 'ipaddr'
10
10
 
11
11
  module PacketGen
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  # This file is part of PacketGen
3
5
  # See https://github.com/sdaubert/packetgen for more informations
4
6
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
5
7
  # This program is published under MIT license.
6
8
 
7
- # frozen_string_literal: true
8
-
9
9
  require 'ipaddr'
10
10
 
11
11
  module PacketGen
@@ -14,6 +14,8 @@ module PacketGen
14
14
  # IPv6 address, as a group of 8 2-byte words
15
15
  # @author Sylvain Daubert
16
16
  class Addr < Types::Fields
17
+ include Types::Fieldable
18
+
17
19
  # @!attribute a1
18
20
  # 1st 2-byte word of IPv6 address
19
21
  # @return [Integer]
@@ -85,6 +87,11 @@ module PacketGen
85
87
  def mcast?
86
88
  self.a1 & 0xff00 == 0xff00
87
89
  end
90
+
91
+ def ==(other)
92
+ other.is_a?(self.class) &&
93
+ fields.all? { |attr| self[attr].value == other[attr].value }
94
+ end
88
95
  end
89
96
 
90
97
  # Class to handle series of IPv6 addresses
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  class IPv6
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  class IPv6
@@ -106,7 +106,7 @@ module PacketGen
106
106
  # @!attribute options
107
107
  # Specific options of extension header
108
108
  # @return [Options]
109
- define_field_before :body, :options, Options, builder: ->(h, t) { t.new(length_from: -> { h.real_length - 2} ) }
109
+ define_field_before :body, :options, Options, builder: ->(h, t) { t.new(length_from: -> { h.real_length - 2 }) }
110
110
  end
111
111
  end
112
112
 
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  # This file is part of PacketGen
3
5
  # See https://github.com/sdaubert/packetgen for more informations
4
6
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
5
7
  # This program is published under MIT license.
6
8
 
7
- # frozen_string_literal: true
8
-
9
9
  module PacketGen
10
10
  module Header
11
11
  # Logical-Link Control header
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  # This file is part of PacketGen
3
5
  # See https://github.com/sdaubert/packetgen for more informations
4
6
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
5
7
  # This program is published under MIT license.
6
8
 
7
- # frozen_string_literal: true
8
-
9
9
  module PacketGen
10
10
  module Header
11
11
  # Multicast DNS.
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  # This class supports MLDv1 (RFC 2710).
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  # This module contains all MLDv2 specific classes.
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  module MLDv2
@@ -52,6 +52,8 @@ module PacketGen
52
52
  # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
53
53
  # @author Sylvain Daubert
54
54
  class McastAddressRecord < Types::Fields
55
+ include Types::Fieldable
56
+
55
57
  # Known record types
56
58
  RECORD_TYPES = IGMPv3::GroupRecord::RECORD_TYPES
57
59
 
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  module MLDv2
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  require_relative 'mcast_address_record'
9
9
 
10
10
  module PacketGen
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  # This class supports OSPFv2 (RFC 2328).
@@ -75,18 +75,18 @@ module PacketGen
75
75
 
76
76
  # OSPF packet types
77
77
  TYPES = {
78
- 'HELLO' => 1,
78
+ 'HELLO' => 1,
79
79
  'DB_DESCRIPTION' => 2,
80
- 'LS_REQUEST' => 3,
81
- 'LS_UPDATE' => 4,
82
- 'LS_ACK' => 5
80
+ 'LS_REQUEST' => 3,
81
+ 'LS_UPDATE' => 4,
82
+ 'LS_ACK' => 5
83
83
  }.freeze
84
84
 
85
85
  # Authentication types
86
86
  AU_TYPES = {
87
- 'NO_AUTH' => 0,
88
- 'PASSWORD' => 1,
89
- 'CRYPTO' => 2,
87
+ 'NO_AUTH' => 0,
88
+ 'PASSWORD' => 1,
89
+ 'CRYPTO' => 2,
90
90
  'CRYPTO_WITH_ESN' => 3
91
91
  }.freeze
92
92