[cooja] plugins/analyzers/IPHCPacketAnalyzer: Hack for basic Hop-by-hop extension header handling
This commit is contained in:
parent
3b60d96f39
commit
5ee8c7e178
|
@ -12,8 +12,10 @@ public class IPHCPacketAnalyzer extends PacketAnalyzer {
|
|||
public final static int SICSLOWPAN_DISPATCH_IPV6 = 0x41; /* 01000001 = 65 */
|
||||
public final static int SICSLOWPAN_DISPATCH_HC1 = 0x42; /* 01000010 = 66 */
|
||||
public final static int SICSLOWPAN_DISPATCH_IPHC = 0x60; /* 011xxxxx = ... */
|
||||
public final static int SICSLOWPAN_DISPATCH_FRAG1 = 0xc0; /* 1100= 0xxx */
|
||||
public final static int SICSLOWPAN_DISPATCH_FRAGN = 0xe0; /* 1110= 0xxx */
|
||||
|
||||
public final static int EXT_HDR_HOP_BY_HOP = 0;
|
||||
public final static int EXT_HDR_ROUTING = 43;
|
||||
public final static int EXT_HDR_FRAGMENT = 44;
|
||||
|
||||
/*
|
||||
* Values of fields within the IPHC encoding first byte
|
||||
|
@ -404,6 +406,23 @@ public class IPHCPacketAnalyzer extends PacketAnalyzer {
|
|||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Skip extension header
|
||||
// XXX TODO: Handle others, too?
|
||||
if (proto == EXT_HDR_HOP_BY_HOP) {
|
||||
proto = packet.get(hc06_ptr) & 0xFF;
|
||||
|
||||
// header length is length specified in field, rounded up to 64 bit
|
||||
int hdr_len = ((packet.get(hc06_ptr + 1) / 8) + 1) * 8;
|
||||
hc06_ptr += hdr_len;
|
||||
|
||||
// UDP hadling
|
||||
if (proto == PROTO_UDP) {
|
||||
srcPort = packet.getInt(hc06_ptr, 2) & 0xFFFF;
|
||||
destPort = packet.getInt(hc06_ptr + 2, 2) & 0xFFFF;
|
||||
hc06_ptr += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// /* IP length field. */
|
||||
|
|
Loading…
Reference in a new issue