mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-08-09 06:14:34 +02:00
Before batman-adv is allowed to write to an skb, it either has to have its
own copy of the skb or use skb_cow() to ensure that the data part is not
shared. But batadv_frag_skb_fwd() modifies the TTL even when it is shared.
Adding a skb_cow() right before this operation avoids this and can at the
same time prepare it for the modifications required to forward the
fragment.
Cc: stable@kernel.org
Fixes: 610bfc6bc9 ("batman-adv: Receive fragmented packets and merge")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
46 lines
1.3 KiB
C
46 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Copyright (C) B.A.T.M.A.N. contributors:
|
|
*
|
|
* Martin Hundebøll <martin@hundeboll.net>
|
|
*/
|
|
|
|
#ifndef _NET_BATMAN_ADV_FRAGMENTATION_H_
|
|
#define _NET_BATMAN_ADV_FRAGMENTATION_H_
|
|
|
|
#include "main.h"
|
|
|
|
#include <linux/compiler.h>
|
|
#include <linux/list.h>
|
|
#include <linux/skbuff.h>
|
|
#include <linux/stddef.h>
|
|
#include <linux/types.h>
|
|
|
|
void batadv_frag_purge_orig(struct batadv_orig_node *orig,
|
|
bool (*check_cb)(struct batadv_frag_table_entry *));
|
|
bool batadv_frag_skb_fwd(struct sk_buff *skb,
|
|
struct batadv_hard_iface *recv_if,
|
|
struct batadv_orig_node *orig_node_src,
|
|
int *rx_result);
|
|
bool batadv_frag_skb_buffer(struct sk_buff **skb,
|
|
struct batadv_orig_node *orig_node);
|
|
int batadv_frag_send_packet(struct sk_buff *skb,
|
|
struct batadv_orig_node *orig_node,
|
|
struct batadv_neigh_node *neigh_node);
|
|
|
|
/**
|
|
* batadv_frag_check_entry() - check if a list of fragments has timed out
|
|
* @frags_entry: table entry to check
|
|
*
|
|
* Return: true if the frags entry has timed out, false otherwise.
|
|
*/
|
|
static inline bool
|
|
batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry)
|
|
{
|
|
if (!hlist_empty(&frags_entry->fragment_list) &&
|
|
batadv_has_timed_out(frags_entry->timestamp, BATADV_FRAG_TIMEOUT))
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
#endif /* _NET_BATMAN_ADV_FRAGMENTATION_H_ */
|