net: Set the protocol type of fragmented packet

The fragmented packet should inherit the protocol type of the
original packet.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
Jukka Rissanen 2025-01-21 10:50:40 +02:00 committed by Benjamin Cabé
parent 3e680551b6
commit 04205ae24f
2 changed files with 4 additions and 0 deletions

View file

@ -441,6 +441,8 @@ static int send_ipv4_fragment(struct net_pkt *pkt, uint16_t rand_id, uint16_t fi
net_pkt_cursor_backup(pkt, &cur_pkt);
net_pkt_cursor_backup(frag_pkt, &cur);
net_pkt_set_ll_proto_type(frag_pkt, net_pkt_ll_proto_type(pkt));
/* Copy the original IPv4 headers back to the fragment packet */
if (net_pkt_copy(frag_pkt, pkt, net_pkt_ip_hdr_len(pkt))) {
goto fail;

View file

@ -609,6 +609,8 @@ static int send_ipv6_fragment(struct net_pkt *pkt,
net_pkt_cursor_init(pkt);
net_pkt_set_ll_proto_type(frag_pkt, net_pkt_ll_proto_type(pkt));
/* We copy original headers back to the fragment packet
* Note that we insert the right next header to point to fragment header
*/