diff options
author | Martin Hundebøll <martin@hundeboll.net> | 2012-10-16 10:13:48 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-11-21 06:34:50 -0500 |
commit | bb351ba0bba23f01af00e36bfe20897201f404fa (patch) | |
tree | 7ac84275cfb3f32d0cae0ba854a90298f56e9561 /net/batman-adv/unicast.c | |
parent | 637fbd12947b5645d8c16c982aa15c17ab695b0a (diff) |
batman-adv: Add wrapper to look up neighbor and send skb
By adding batadv_send_skb_to_orig() in send.c, we can remove duplicate
code that looks up the next hop and then calls batadv_send_skb_packet().
Furthermore, this prepares the upcoming new implementation of
fragmentation, which requires the next hop to route packets.
Please note that this doesn't entirely remove the next-hop lookup in
routing.c and unicast.c, since it is used by the current fragmentation
code.
Also note that the next-hop info is removed from debug messages in
translation-table.c, since it is looked up elsewhere.
Signed-off-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/unicast.c')
-rw-r--r-- | net/batman-adv/unicast.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c index c9a1f6523c36..10aff49fcf25 100644 --- a/net/batman-adv/unicast.c +++ b/net/batman-adv/unicast.c | |||
@@ -402,7 +402,7 @@ int batadv_unicast_generic_send_skb(struct batadv_priv *bat_priv, | |||
402 | struct batadv_orig_node *orig_node; | 402 | struct batadv_orig_node *orig_node; |
403 | struct batadv_neigh_node *neigh_node; | 403 | struct batadv_neigh_node *neigh_node; |
404 | int data_len = skb->len; | 404 | int data_len = skb->len; |
405 | int ret = 1; | 405 | int ret = NET_RX_DROP; |
406 | unsigned int dev_mtu; | 406 | unsigned int dev_mtu; |
407 | 407 | ||
408 | /* get routing information */ | 408 | /* get routing information */ |
@@ -466,15 +466,15 @@ find_router: | |||
466 | goto out; | 466 | goto out; |
467 | } | 467 | } |
468 | 468 | ||
469 | batadv_send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr); | 469 | if (batadv_send_skb_to_orig(skb, orig_node, NULL)) |
470 | ret = 0; | 470 | ret = 0; |
471 | 471 | ||
472 | out: | 472 | out: |
473 | if (neigh_node) | 473 | if (neigh_node) |
474 | batadv_neigh_node_free_ref(neigh_node); | 474 | batadv_neigh_node_free_ref(neigh_node); |
475 | if (orig_node) | 475 | if (orig_node) |
476 | batadv_orig_node_free_ref(orig_node); | 476 | batadv_orig_node_free_ref(orig_node); |
477 | if (ret == 1) | 477 | if (ret == NET_RX_DROP) |
478 | kfree_skb(skb); | 478 | kfree_skb(skb); |
479 | return ret; | 479 | return ret; |
480 | } | 480 | } |