diff options
author | Martin Hundebøll <martin@hundeboll.net> | 2013-04-20 07:54:39 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2013-05-28 20:44:55 -0400 |
commit | e91ecfc64ad691176be119e627e36cec8564f44b (patch) | |
tree | d709428d92da6a522edca57fbec960d7c582c93f /net/batman-adv/routing.c | |
parent | 5f80df6705fcd8153f93bd0e82109dbeb7ff535b (diff) |
batman-adv: Move call to batadv_nc_skb_forward() from routing.c to send.c
The call to batadv_nc_skb_forward() fits better in
batadv_send_skb_to_orig(), as this is where the actual next hop is
looked up.
To let the caller of batadv_send_skb_to_orig() know wether the skb is
transmitted, buffered or failed, the return value is changed from
boolean to int.
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/routing.c')
-rw-r--r-- | net/batman-adv/routing.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index fad08469767d..2f0bd3ffe6e8 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -285,7 +285,7 @@ static int batadv_recv_my_icmp_packet(struct batadv_priv *bat_priv, | |||
285 | icmp_packet->msg_type = BATADV_ECHO_REPLY; | 285 | icmp_packet->msg_type = BATADV_ECHO_REPLY; |
286 | icmp_packet->header.ttl = BATADV_TTL; | 286 | icmp_packet->header.ttl = BATADV_TTL; |
287 | 287 | ||
288 | if (batadv_send_skb_to_orig(skb, orig_node, NULL)) | 288 | if (batadv_send_skb_to_orig(skb, orig_node, NULL) != NET_XMIT_DROP) |
289 | ret = NET_RX_SUCCESS; | 289 | ret = NET_RX_SUCCESS; |
290 | 290 | ||
291 | out: | 291 | out: |
@@ -333,7 +333,7 @@ static int batadv_recv_icmp_ttl_exceeded(struct batadv_priv *bat_priv, | |||
333 | icmp_packet->msg_type = BATADV_TTL_EXCEEDED; | 333 | icmp_packet->msg_type = BATADV_TTL_EXCEEDED; |
334 | icmp_packet->header.ttl = BATADV_TTL; | 334 | icmp_packet->header.ttl = BATADV_TTL; |
335 | 335 | ||
336 | if (batadv_send_skb_to_orig(skb, orig_node, NULL)) | 336 | if (batadv_send_skb_to_orig(skb, orig_node, NULL) != NET_XMIT_DROP) |
337 | ret = NET_RX_SUCCESS; | 337 | ret = NET_RX_SUCCESS; |
338 | 338 | ||
339 | out: | 339 | out: |
@@ -410,7 +410,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, | |||
410 | icmp_packet->header.ttl--; | 410 | icmp_packet->header.ttl--; |
411 | 411 | ||
412 | /* route it */ | 412 | /* route it */ |
413 | if (batadv_send_skb_to_orig(skb, orig_node, recv_if)) | 413 | if (batadv_send_skb_to_orig(skb, orig_node, recv_if) != NET_XMIT_DROP) |
414 | ret = NET_RX_SUCCESS; | 414 | ret = NET_RX_SUCCESS; |
415 | 415 | ||
416 | out: | 416 | out: |
@@ -775,7 +775,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, | |||
775 | struct batadv_neigh_node *neigh_node = NULL; | 775 | struct batadv_neigh_node *neigh_node = NULL; |
776 | struct batadv_unicast_packet *unicast_packet; | 776 | struct batadv_unicast_packet *unicast_packet; |
777 | struct ethhdr *ethhdr = eth_hdr(skb); | 777 | struct ethhdr *ethhdr = eth_hdr(skb); |
778 | int ret = NET_RX_DROP; | 778 | int res, ret = NET_RX_DROP; |
779 | struct sk_buff *new_skb; | 779 | struct sk_buff *new_skb; |
780 | 780 | ||
781 | unicast_packet = (struct batadv_unicast_packet *)skb->data; | 781 | unicast_packet = (struct batadv_unicast_packet *)skb->data; |
@@ -835,16 +835,19 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, | |||
835 | /* decrement ttl */ | 835 | /* decrement ttl */ |
836 | unicast_packet->header.ttl--; | 836 | unicast_packet->header.ttl--; |
837 | 837 | ||
838 | /* network code packet if possible */ | 838 | res = batadv_send_skb_to_orig(skb, orig_node, recv_if); |
839 | if (batadv_nc_skb_forward(skb, neigh_node, ethhdr)) { | ||
840 | ret = NET_RX_SUCCESS; | ||
841 | } else if (batadv_send_skb_to_orig(skb, orig_node, recv_if)) { | ||
842 | ret = NET_RX_SUCCESS; | ||
843 | 839 | ||
844 | /* Update stats counter */ | 840 | /* translate transmit result into receive result */ |
841 | if (res == NET_XMIT_SUCCESS) { | ||
842 | /* skb was transmitted and consumed */ | ||
845 | batadv_inc_counter(bat_priv, BATADV_CNT_FORWARD); | 843 | batadv_inc_counter(bat_priv, BATADV_CNT_FORWARD); |
846 | batadv_add_counter(bat_priv, BATADV_CNT_FORWARD_BYTES, | 844 | batadv_add_counter(bat_priv, BATADV_CNT_FORWARD_BYTES, |
847 | skb->len + ETH_HLEN); | 845 | skb->len + ETH_HLEN); |
846 | |||
847 | ret = NET_RX_SUCCESS; | ||
848 | } else if (res == NET_XMIT_POLICED) { | ||
849 | /* skb was buffered and consumed */ | ||
850 | ret = NET_RX_SUCCESS; | ||
848 | } | 851 | } |
849 | 852 | ||
850 | out: | 853 | out: |