diff options
author | David S. Miller <davem@davemloft.net> | 2012-05-14 18:15:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-14 18:15:33 -0400 |
commit | 748336087374ca7e5369f310745fa1d3b4a8cbf7 (patch) | |
tree | a13671709fa2cf67d7802526f2ebd4e282aa6010 /net/batman-adv/routing.c | |
parent | c597f6653d5734c11b1e3217c7619a37e96e5a1f (diff) | |
parent | 521251f2f5fa16747cc21e71580e404af855d140 (diff) | |
download | talos-obmc-linux-748336087374ca7e5369f310745fa1d3b4a8cbf7.tar.gz talos-obmc-linux-748336087374ca7e5369f310745fa1d3b4a8cbf7.zip |
Merge tag 'batman-adv-for-davem' of git://git.open-mesh.org/linux-merge
Included changes:
* an improvement to avoid to linearise the whole received packet when not needed
* an improvement for client traffic rerouting after roaming
* a fix for the local translation table state-machine
* minor cleanups and fixes
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r-- | net/batman-adv/routing.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 7ed9d8f92916..840e2c64a301 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c @@ -234,17 +234,14 @@ int window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff, { if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) || (seq_num_diff >= EXPECTED_SEQNO_RANGE)) { - if (has_timed_out(*last_reset, RESET_PROTECTION_MS)) { - - *last_reset = jiffies; - bat_dbg(DBG_BATMAN, bat_priv, - "old packet received, start protection\n"); - - return 0; - } else { + if (!has_timed_out(*last_reset, RESET_PROTECTION_MS)) return 1; - } + + *last_reset = jiffies; + bat_dbg(DBG_BATMAN, bat_priv, + "old packet received, start protection\n"); } + return 0; } @@ -916,12 +913,20 @@ static int check_unicast_ttvn(struct bat_priv *bat_priv, /* Check whether I have to reroute the packet */ if (seq_before(unicast_packet->ttvn, curr_ttvn) || tt_poss_change) { - /* Linearize the skb before accessing it */ - if (skb_linearize(skb) < 0) + /* check if there is enough data before accessing it */ + if (pskb_may_pull(skb, sizeof(struct unicast_packet) + + ETH_HLEN) < 0) return 0; ethhdr = (struct ethhdr *)(skb->data + sizeof(struct unicast_packet)); + + /* we don't have an updated route for this client, so we should + * not try to reroute the packet!! + */ + if (tt_global_client_is_roaming(bat_priv, ethhdr->h_dest)) + return 1; + orig_node = transtable_search(bat_priv, NULL, ethhdr->h_dest); if (!orig_node) { |