Sha256: a7db1627cd34d7d5c2d888f1913ccba8c71ce1f40643bf8d4faa1631d3df901f
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
class PacketViaDMEM class Received < Packet def initialize packet @type = :received @original = packet @header, @packet = parse_packet packet end private def parse_packet pkt pop, push = 6, [] offset = 0 case pkt.first.to_i(16) when 0x00 then offset = 0 #1,2,3,4,5,6 when 0x10 then offset = 2 #1,2,3,4,7,8,5,6 end pop += offset case pkt[4+offset..5+offset].join.to_i(16) when 0x8000 then pop+=14 # ae/802.1AX is special, I seem to have 2 bytes I don't know # and ethertype missing, and MAC is weird, mpls labels are present # i'd need example carrying IPv4/IPv6 instead of MPLS to decide those two bytes when 0x4220 pop+=14 #pop macs and weird two bytes (return macs in push) push = pkt[8+offset..19+offset] + FAKE[:etype_mpls] when 0x2000 # these were BFD packets from control-plane pop+=5 push = FAKE[:dmac] + FAKE[:smac] + FAKE[:etype_ipv4] # some BGP packets like this # also SMB2 TCP Seq1 (maybe post ARP from control-plane?) # they are misssing all of ipv4 headers before TTL when 0x1f00 pop+=7 push = FAKE[:dmac] + FAKE[:smac] + FAKE[:etype_ipv4] + FAKE[:ipv4] end header_and_packet pkt, pop, push end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
packet_via_dmem-0.0.6 | lib/packet_via_dmem/received.rb |