Issue 108 in dpkt: Setting TCP offset truncates TCP data field

13 views
Skip to first unread message

dp...@googlecode.com

unread,
May 22, 2013, 9:04:57 AM5/22/13
to dp...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 108 by sm...@depht.com: Setting TCP offset truncates TCP data
field
http://code.google.com/p/dpkt/issues/detail?id=108

-What steps will reproduce the problem?
import sys
import pcap
import ethernet
import tcp

if(len(sys.argv) > 2):
pcIn = pcap.Reader(open(sys.argv[1]))
pcOut = pcap.Writer(open(sys.argv[2], 'wb'))
for ts, pkt in pcIn:
eth = ethernet.Ethernet(pkt)
ip = eth.data
otcp = ip.data

newTCP = tcp.TCP()
newTCP.dport = otcp.dport
newTCP.sport = otcp.sport
newTCP.win = otcp.win
newTCP.off = otcp.off
# newTCP.off_x2 = otcp.off_x2
newTCP.sum = otcp.sum
newTCP.flags = otcp.flags
newTCP.seq = otcp.seq
newTCP.ack = otcp.ack
newTCP.data = otcp.data

ip.data = newTCP
pcOut.writepkt(ethernet.Ethernet.pack(eth), ts)

-What is the expected output? What do you see instead?
I expect the above script will copy the TCP packets exactly.

-What version of the product are you using? On what operating system?
dpkt-1.7r88
Debian Linux Wheezy(7.0)
Python 2.7.3

-Please provide any additional information below.
Example source and corupted destination pcap files are attached.

It's quite possible I am simply not doing this correctly. If so please
tell me the correct way to calculate the TCP data offset.

Thanks,
Smutt

Attachments:
source.pcap 722 bytes
corrupt.pcap 674 bytes

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

dp...@googlecode.com

unread,
Jun 3, 2013, 12:27:51 PM6/3/13
to dp...@googlegroups.com

Comment #1 on issue 108 by sm...@depht.com: Setting TCP offset truncates
Ignore this. I just didn't understand I should be using TCP.off instead of
TCP.off_x2.

dp...@googlecode.com

unread,
Dec 29, 2014, 12:06:40 PM12/29/14
to dp...@googlegroups.com
Updates:
Status: WontFix
Owner: kba...@in2void.com

Comment #2 on issue 108 by kba...@in2void.com: Setting TCP offset
truncates TCP data field
https://code.google.com/p/dpkt/issues/detail?id=108

Closing this issue
Reply all
Reply to author
Forward
0 new messages