Bugfix: Fix incorrect IPv4 pseudo-header checksum calculation for a stream with incrementing/decrementing packet length (regression bug caused by variable fields feature introduced in 0.7)
This commit is contained in:
parent
4f6195b8ba
commit
ad866e3025
@ -819,7 +819,8 @@ quint32 Ip4Protocol::protocolFrameCksum(int streamIndex,
|
||||
sum += *((quint16*)(p + 14)); // src-ip lo
|
||||
sum += *((quint16*)(p + 16)); // dst-ip hi
|
||||
sum += *((quint16*)(p + 18)); // dst-ip lo
|
||||
sum += qToBigEndian((quint16) protocolFramePayloadSize()); // len
|
||||
sum += qToBigEndian((quint16)
|
||||
protocolFramePayloadSize(streamIndex)); // len
|
||||
sum += qToBigEndian((quint16) *(p + 9)); // proto
|
||||
|
||||
while(sum>>16)
|
||||
|
@ -105,6 +105,10 @@ def ports(request, drone):
|
||||
ports.rx = ost_pb.PortIdList()
|
||||
ports.rx.port_id.add().id = rx_number;
|
||||
|
||||
# stop transmit/capture on ports, if any
|
||||
drone.stopTransmit(ports.tx)
|
||||
drone.stopCapture(ports.rx)
|
||||
|
||||
# delete existing streams, if any, on tx port
|
||||
sid_list = drone.getStreamIdList(ports.tx.port_id[0])
|
||||
drone.deleteStream(sid_list)
|
||||
@ -181,12 +185,13 @@ def test_packet_length(drone, ports, stream, mode):
|
||||
buff = drone.getCaptureBuffer(ports.rx.port_id[0])
|
||||
drone.saveCaptureBuffer(buff, 'capture.pcap')
|
||||
log.info('dumping Rx capture buffer')
|
||||
cap_pkts = subprocess.check_output([tshark, '-n', '-r', 'capture.pcap',
|
||||
'-R', 'udp'])
|
||||
cap_pkts = subprocess.check_output([tshark, '-n', '-r', 'capture.pcap'])
|
||||
print(cap_pkts)
|
||||
cap_pkts = subprocess.check_output([tshark, '-n', '-r', 'capture.pcap',
|
||||
'-R', 'udp', '-o', fmt])
|
||||
print(cap_pkts)
|
||||
result = extract_column(cap_pkts, fmt_col)
|
||||
print(result)
|
||||
diffSum = 0
|
||||
for i in range(len(result)):
|
||||
l = int(result[i]) + 4 # add FCS to length
|
||||
|
Loading…
Reference in New Issue
Block a user