Skip to content

Commit

Permalink
ip/ipreassembler: fix positive header_delta push path
Browse files Browse the repository at this point in the history
Like the put earlier in this method, the push here can fail or reallocate
the SKB.  In the former case, we need to clean up (as above) and in both
cases, we need to update the linkage into q from it's predecessor.

Thanks: --enable-force-expensive + Valgrind

Signed-off-by: Derrick Pallas <[email protected]>
  • Loading branch information
Derrick Pallas authored and tbarbette committed Nov 26, 2018
1 parent 550c2d6 commit cdb13b6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion elements/ip/ipreassembler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,16 @@ IPReassembler::simple_action(Packet *p)
uint16_t old_ip_off = q->ip_header()->ip_off;
int header_delta = p->ip_header_offset() - q->ip_header_offset() + p->ip_header_length() - q->ip_header_length();
if (header_delta > 0)
int old_transport_length = q->transport_length();
q = q->push(header_delta);
else if (header_delta < 0)
if (!q) {
p->kill();
*q_pprev = q_bucket_next;
_mem_used -= IPH_MEM_USED + old_transport_length;
return 0;
}
*q_pprev = q;
} else if (header_delta < 0)
q->pull(-header_delta);
q->set_ip_header((click_ip *)(q->data() + p->ip_header_offset()), p->ip_header_length());
if (p->has_mac_header())
Expand Down

0 comments on commit cdb13b6

Please sign in to comment.