Skip to content

Commit

Permalink
batman-adv: linearise the tt_response skb only if needed
Browse files Browse the repository at this point in the history
The TT_RESPONSE skb has to be linearised only if the node plans to access the
packet payload (so only if the message is directed to that node). In all the
other cases the node can avoid this memory operation

Signed-off-by: Antonio Quartulli <[email protected]>
Signed-off-by: Sven Eckelmann <[email protected]>
  • Loading branch information
Antonio Quartulli authored and ecsv committed Nov 20, 2011
1 parent d099c2c commit dc58fe3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions net/batman-adv/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,13 +616,14 @@ int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
}
break;
case TT_RESPONSE:
/* packet needs to be linearized to access the TT changes */
if (skb_linearize(skb) < 0)
goto out;
if (is_my_mac(tt_query->dst)) {
/* packet needs to be linearized to access the TT
* changes */
if (skb_linearize(skb) < 0)
goto out;

if (is_my_mac(tt_query->dst))
handle_tt_response(bat_priv, tt_query);
else {
} else {
bat_dbg(DBG_TT, bat_priv,
"Routing TT_RESPONSE to %pM [%c]\n",
tt_query->dst,
Expand Down

0 comments on commit dc58fe3

Please sign in to comment.