net: ipv6: Handle large IPv6 packets properly
Current implementation does not handle large extension headers (e.g HBHO). Which resulted network stack crashes or due to misinterpretation of lengths network packets are dropped. Also caused issues while preparing IPv6 packet (e.g. large HBHO header with IPv6 fragmentation support). Issues fixed and provided more unit tests. Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
This commit is contained in:
parent
e9e5115116
commit
3fafe4f9ad
7 changed files with 1854 additions and 479 deletions
|
@ -784,29 +784,27 @@ ws_only:
|
|||
struct net_buf *hdr, *payload;
|
||||
struct net_pkt *cloned;
|
||||
|
||||
ret = net_pkt_split(pkt, pkt->frags,
|
||||
ctx->websocket.data_waiting,
|
||||
&payload, &hdr,
|
||||
ctx->timeout);
|
||||
if (ret < 0) {
|
||||
net_pkt_unref(pkt);
|
||||
return;
|
||||
}
|
||||
|
||||
net_pkt_frag_unref(pkt->frags);
|
||||
payload = pkt->frags;
|
||||
pkt->frags = NULL;
|
||||
|
||||
cloned = net_pkt_clone(pkt, ctx->timeout);
|
||||
if (!cloned) {
|
||||
net_pkt_unref(pkt);
|
||||
net_pkt_frag_unref(payload);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = net_pkt_split(pkt, payload,
|
||||
ctx->websocket.data_waiting,
|
||||
&hdr, ctx->timeout);
|
||||
if (ret < 0) {
|
||||
net_pkt_unref(pkt);
|
||||
net_pkt_frag_unref(payload);
|
||||
net_pkt_unref(cloned);
|
||||
return;
|
||||
}
|
||||
|
||||
pkt->frags = payload;
|
||||
payload->frags = NULL;
|
||||
|
||||
net_pkt_compact(pkt);
|
||||
|
||||
cloned->frags = hdr;
|
||||
|
||||
ctx->websocket.pending = cloned;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue