Skip to content

Commit

Permalink
net: pkt: Clone all needed attributes
Browse files Browse the repository at this point in the history
The net_pkt_clone() did not cloned all needed fields.
Added what was missing from the clone.

Fixes #83157

Signed-off-by: Jukka Rissanen <[email protected]>
  • Loading branch information
jukkar committed Jan 9, 2025
1 parent bdb04db commit 2ca2ab2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion subsys/net/ip/net_pkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2068,16 +2068,24 @@ static void clone_pkt_attributes(struct net_pkt *pkt, struct net_pkt *clone_pkt)
net_pkt_set_captured(clone_pkt, net_pkt_is_captured(pkt));
net_pkt_set_eof(clone_pkt, net_pkt_eof(pkt));
net_pkt_set_ptp(clone_pkt, net_pkt_is_ptp(pkt));
net_pkt_set_ppp(clone_pkt, net_pkt_is_ppp(pkt));
net_pkt_set_lldp(clone_pkt, net_pkt_is_lldp(pkt));
net_pkt_set_ipv4_acd(clone_pkt, net_pkt_ipv4_acd(pkt));
net_pkt_set_tx_timestamping(clone_pkt, net_pkt_is_tx_timestamping(pkt));
net_pkt_set_rx_timestamping(clone_pkt, net_pkt_is_rx_timestamping(pkt));
net_pkt_set_forwarding(clone_pkt, net_pkt_forwarding(pkt));
net_pkt_set_chksum_done(clone_pkt, net_pkt_is_chksum_done(pkt));
net_pkt_set_ip_reassembled(pkt, net_pkt_is_ip_reassembled(pkt));

net_pkt_set_cooked_mode(clone_pkt, net_pkt_is_cooked_mode(pkt));
net_pkt_set_ipv4_pmtu(clone_pkt, net_pkt_ipv4_pmtu(pkt));
net_pkt_set_l2_bridged(clone_pkt, net_pkt_is_l2_bridged(pkt));
net_pkt_set_l2_processed(clone_pkt, net_pkt_is_l2_processed(pkt));
net_pkt_set_ll_proto_type(clone_pkt, net_pkt_ll_proto_type(pkt));

#if defined(CONFIG_NET_OFFLOAD) || defined(CONFIG_NET_L2_IPIP)
net_pkt_set_remote_address(clone_pkt, net_pkt_remote_address(pkt));
#endif

if (pkt->buffer && clone_pkt->buffer) {
memcpy(net_pkt_lladdr_src(clone_pkt), net_pkt_lladdr_src(pkt),
sizeof(struct net_linkaddr));
Expand Down

0 comments on commit 2ca2ab2

Please sign in to comment.