net: ipv6: Remove invalid/unneeded code from fragmentation logic

Skipping both next_hdr_off and last_hdr_off and filling last_hdr
variable doesn't make much sense, as this effectively moves the packet
cursor inside/behind the last (L4) header with no particular meaning.
Plus the last_hdr variable isn't really used anywhere, which kind of
proves the point. Therefore, remove the unused variable and needless
net_pkt operations.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2023-10-20 16:43:35 +02:00 committed by Fabio Baltieri
parent 13a22e6814
commit 0c1c939d9e

View file

@ -687,7 +687,6 @@ int net_ipv6_send_fragmented_pkt(struct net_if *iface, struct net_pkt *pkt,
uint16_t frag_offset;
size_t length;
uint8_t next_hdr;
uint8_t last_hdr;
int fit_len;
int ret;
@ -701,9 +700,7 @@ int net_ipv6_send_fragmented_pkt(struct net_if *iface, struct net_pkt *pkt,
net_pkt_cursor_init(pkt);
if (net_pkt_skip(pkt, next_hdr_off) ||
net_pkt_read_u8(pkt, &next_hdr) ||
net_pkt_skip(pkt, last_hdr_off) ||
net_pkt_read_u8(pkt, &last_hdr)) {
net_pkt_read_u8(pkt, &next_hdr)) {
return -ENOBUFS;
}