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 028747d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion elements/ip/ipreassembler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,22 @@ IPReassembler::simple_action(Packet *p)
if (p_off == 0) {
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();
<<<<<<< HEAD
if (header_delta > 0)
int old_transport_length = q->transport_length();
=======
if (header_delta > 0) {
int old_transport_length = q->transport_length();
>>>>>>> Update ipreassembler.cc
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 028747d

Please sign in to comment.