lemontree55 / packetgen

Ruby library to easily generate and capture network packets
MIT License
98 stars 13 forks source link

Packet#dup and Packet#clone do not set magic methods on headers #90

Closed sdaubert closed 6 years ago

sdaubert commented 6 years ago
pg> pkt1 = Packet.gen('Eth')
=> -- PacketGen::Packet -------------------------------------------------
---- PacketGen::Header::Eth ------------------------------------------
           MacAddr          dst: 00:00:00:00:00:00
           MacAddr          src: 00:00:00:00:00:00
             Int16    ethertype: 0          (0x0000)

pg> pkt1.eth
=> ---- PacketGen::Header::Eth ------------------------------------------
           MacAddr          dst: 00:00:00:00:00:00
           MacAddr          src: 00:00:00:00:00:00
             Int16    ethertype: 0          (0x0000)
pg> pkt2 = pkt1.dup
=> -- PacketGen::Packet -------------------------------------------------
---- PacketGen::Header::Eth ------------------------------------------
           MacAddr          dst: 00:00:00:00:00:00
           MacAddr          src: 00:00:00:00:00:00
             Int16    ethertype: 0          (0x0000)

pg> pkt2.eth
Traceback (most recent call last):
        4: from bin/pgconsole:69:in `<top (required)>'
        3: from bin/pgconsole:69:in `catch'
        2: from bin/pgconsole:70:in `block in <top (required)>'
        1: from (irb):6:in `get_binding'
NoMethodError (undefined method `eth' for #<PacketGen::Packet:0x000055e79da52028>)