batman-adv: Introduce forward packet creation helper
This patch abstracts the forward packet creation into the new function batadv_forw_packet_alloc(). The queue counting and interface reference counters are now handled internally within batadv_forw_packet_alloc() and its batadv_forw_packet_free() counterpart. This should reduce the risk of having reference/queue counting bugs again and should increase code readibility. Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
This commit is contained in:

committed by
Simon Wunderlich

parent
4fd261bf58
commit
a65e548131
@@ -28,6 +28,12 @@
|
||||
struct sk_buff;
|
||||
|
||||
void batadv_forw_packet_free(struct batadv_forw_packet *forw_packet);
|
||||
struct batadv_forw_packet *
|
||||
batadv_forw_packet_alloc(struct batadv_hard_iface *if_incoming,
|
||||
struct batadv_hard_iface *if_outgoing,
|
||||
atomic_t *queue_left,
|
||||
struct batadv_priv *bat_priv);
|
||||
|
||||
int batadv_send_skb_to_orig(struct sk_buff *skb,
|
||||
struct batadv_orig_node *orig_node,
|
||||
struct batadv_hard_iface *recv_if);
|
||||
|
Reference in New Issue
Block a user