ga0/netgraph

Incorrect http re-assembly

Closed this issue · 3 comments

kjk commented

trace_indexes_from_client_go.pcap.zip

Attached is pcap file that is incorrectly re-assembled into http stream.

As seen in this screenshot, the body of DELETE request is not correct:

screen shot 2018-08-04 at 1 01 12 am

To make sure it's not a bad pcap file, I looked at packets using http://www.tastycocoabytes.com/cpa/.

This is how body of the request should look like:

screen shot 2018-08-04 at 1 03 45 am

I used netgraph -input-pcap trace_indexes_from_client_go.pcap

kjk commented

I think https://github.com/ga0/netgraph/blob/master/ngnet/httpstream.go#L74 might be an issue.

It merely sends r for processing.

According to https://godoc.org/github.com/google/gopacket/tcpassembly#Stream, []Reassembly slice will be re-used, so probably should make a copy of r before sending.

ga0 commented

Thank you for posting this issue!
I'll try to solve it.

ga0 commented

I missed to copy data from buffer here, if you are interested.