Skip to content

Commit

Permalink
Use a magic regex, force no encoding for LLDP
Browse files Browse the repository at this point in the history
See packetfu#28. This doesn't solve the other problems with string encoding but
at least packetfu will load without errors.
  • Loading branch information
todb committed Jun 9, 2013
1 parent 3c3b565 commit eb88ddd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/packetfu/protos/lldp.rb
Expand Up @@ -7,6 +7,7 @@
module PacketFu

class LLDPPacket < Packet
MAGIC = Regexp.new("^\x01\x80\xc2\x00\x00[\x0e\x03\x00]", nil, "n")
include ::PacketFu::EthHeaderMixin
include ::PacketFu::LLDPHeaderMixin

Expand All @@ -16,7 +17,7 @@ def self.can_parse?(str)
return false unless EthPacket.can_parse? str
return false unless str.size >= 6
return false unless str[12,2] == "\x88\xcc"
return false unless str =~ /^\x01\x80\xc2\x00\x00[\x0e\x03\x00]/
return false unless str =~ MAGIC
true
end

Expand Down

0 comments on commit eb88ddd

Please sign in to comment.