Skip to content

Commit

Permalink
IPv6 doesn't have a hdr length...
Browse files Browse the repository at this point in the history
Fix to isssue #234
  • Loading branch information
mirjak committed Aug 17, 2018
1 parent 1c2122f commit e2cb9ea
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pathspider/chains/dscp.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,12 @@ def _dscp_extract(self, rec, ip, rev):
if ip.tcp.flags & TCP_SYN == TCP_SYN:
rec['dscp_mark_syn_rev' if rev else 'dscp_mark_syn_fwd'] = dscp
return True
if ip.pkt_len == (ip.hdr_len + ip.tcp.doff) * 4: # No payload
return True
if ip.version == 4:
ip.pkt_len == ip.hdr_len + (ip.tcp.doff) * 4: # No payload
return True
elif ip.version == 6:
ip.payload_len == (ip.tcp.doff) * 4: # No payload
return True

# If not TCP or TCP non-SYN
data_key = 'dscp_mark_data_rev' if rev else 'dscp_mark_data_fwd'
Expand Down

0 comments on commit e2cb9ea

Please sign in to comment.