node_pcap icon indicating copy to clipboard operation
node_pcap copied to clipboard

IPv6 saddr and daddr always undefined?

Open pehanson opened this issue 11 years ago • 7 comments

Whenever I try to parse pcap files of ethertype ipv6, saddr and daddr are always undefined. Why is this happening? saddr and daddr look like this: { o1: undefined, o2: undefined, o3: undefined, o4: undefined, o5: undefined, o6: undefined, o7: undefined, o8: undefined }

pehanson avatar Jul 23 '15 14:07 pehanson

Are you running of the release branch or master?

jmaxxz avatar Jul 28 '15 16:07 jmaxxz

I'm running the master

pehanson avatar Jul 29 '15 15:07 pehanson

How are you getting that? master no longer use the o1, o2, o3, etc approach for addresses. saddr and daddr should be arrays.

can you share the code you used to generate that?

jmaxxz avatar Jul 31 '15 02:07 jmaxxz

var pcap = require('pcap'), tcp_tracker = new pcap.TCPTracker(), pcap_session = pcap.createOfflineSession(filename);

pcap_session.on('packet', function(raw_packet) { var packet = pcap.decode.packet(raw_packet);

if (packet.payload.ethertype == 34525) {
    console.log(packet.payload.payload.saddr);
}

}

The console always prints: { o1: undefined, o2: undefined, o3: undefined, o4: undefined, o5: undefined, o6: undefined, o7: undefined, o8: undefined }

pehanson avatar Jul 31 '15 18:07 pehanson

Try looking at the addr property on saddr

    it("sets #saddr to the senders address", function(){
      this.instance.decode(this.example, 0);
      this.instance.saddr.should.have.property("addr", [0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8d, 0xfe, 0x83, 0x41, 0x14, 0xa5, 0x12]);
    });

if it is not there you are not on master. (check which version is in your packages.config and report back if this is the case)

jmaxxz avatar Aug 07 '15 16:08 jmaxxz

I checked the config and I am actually running the release branch

pehanson avatar Aug 10 '15 20:08 pehanson

@pehanson major rewrite in progress which 'should' help with ipv6 support. If need something quickly please submit a pull request for the release branch.

jmaxxz avatar Aug 18 '15 18:08 jmaxxz