batman-adv: refine API calls for unicast transmissions of SKBs
PATCH v3 1/1 batman-adv: refine API calls for unicast transmissions of SKBs
With this patch the functions batadv_send_skb_unicast() and batadv_send_skb_unicast_4addr() are further refined into batadv_send_skb_via_tt(), batadv_send_skb_via_tt_4addr() and batadv_send_skb_via_gw(). This way we avoid any "guessing" about where to send a packet in the unicast forwarding methods and let the callers decide.
This is going to be useful for the upcoming multicast related patches in particular.
Further, the return values were polished a little to use the more appropriate NET_XMIT_* defines.
---
v3: changed return values to use the appropriate defines
distributed-arp-table.c | 10 +++--- send.c | 87 ++++++++++++++++++++++++++++++++++++----------- send.h | 51 +++++++++++++++------------ soft-interface.c | 8 +++-- 4 files changed, 108 insertions(+), 48 deletions(-)
distributed-arp-table.c +5 -5
@@ -1026,13 +1026,13 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,* that a node not using the 4addr packet format doesn't support it. */ if (hdr_size ==sizeof (struct batadv_unicast_4addr_packet )) - err =batadv_send_skb_unicast_4addr (bat_priv, skb_new, -BATADV_P_DAT_CACHE_REPLY , - vid); + err =batadv_send_skb_via_tt_4addr (bat_priv, skb_new, +BATADV_P_DAT_CACHE_REPLY , + vid);else - err =batadv_send_skb_unicast (bat_priv, skb_new, vid); + err =batadv_send_skb_via_tt (bat_priv, skb_new, vid); -if (!err) { +if (err !=NET_XMIT_DROP ) {batadv_inc_counter (bat_priv,BATADV_CNT_DAT_CACHED_REPLY_TX ); ret = true; }
send.c +67 -20
118 lines not on this page · raw message
send.h +30 -21
75 lines not on this page · raw message
soft-interface.c +6 -2
@@ -289,8 +289,12 @@ static int batadv_interface_tx(struct sk_buff *skb,batadv_dat_snoop_outgoing_arp_reply (bat_priv, skb); - ret =batadv_send_skb_unicast (bat_priv, skb, vid); -if (ret !=0 ) +if (is_multicast_ether_addr (ethhdr->h_dest)) + ret =batadv_send_skb_via_gw (bat_priv, skb, vid); +else + ret =batadv_send_skb_via_tt (bat_priv, skb, vid); + +if (ret ==NET_XMIT_DROP ) goto dropped_freed; }
Signature · 1 line
1.7.10.4
Quoted 6 lines · Linus Lüssing
With this patch the functions
batadv_send_skb_unicast()andbatadv_send_skb_unicast_4addr()are further refined intobatadv_send_skb_via_tt(),batadv_send_skb_via_tt_4addr()andbatadv_send_skb_via_gw(). This way we avoid any "guessing" about where to send a packet in the unicast forwarding methods and let the callers decide.
Quoted 7 lines
This is going to be useful for the upcoming multicast related patches in particular.
Further, the return values were polished a little to use the more appropriate NET_XMIT_* defines.
Signed-off-by Linus Lüssing <[email protected]>
Thanks a lot Linus!
Signature · 4 lines
Antonio Quartulli ..each of us alone is worth nothing.. Ernesto "Che" Guevara
Marek Lindner
AppliedQuoted 15 lines · On Wednesday, July 03, 2013 18:22:23 Antonio Quartulli wrote:
Quoted 14 lines · Linus Lüssing
With this patch the functions
batadv_send_skb_unicast()andbatadv_send_skb_unicast_4addr()are further refined intobatadv_send_skb_via_tt(),batadv_send_skb_via_tt_4addr()andbatadv_send_skb_via_gw(). This way we avoid any "guessing" about where to send a packet in the unicast forwarding methods and let the callers decide.This is going to be useful for the upcoming multicast related patches in particular.
Quoted 8 lines
Quoted 6 lines
Further, the return values were polished a little to use the more appropriate NET_XMIT_* defines.
Signed-off-by Linus Lüssing <[email protected]>
Applied in revision ab91f68.
Thanks,
Marek