diff options
author | Marek Lindner <lindner_marek@yahoo.de> | 2013-04-23 09:40:02 -0400 |
---|---|---|
committer | Antonio Quartulli <antonio@meshcoding.com> | 2013-10-09 15:22:30 -0400 |
commit | 335fbe0f5d2501b7dd815806aef6fd9bad784eb1 (patch) | |
tree | 6a456167f38f521a58d7fac2fc8a87aec338f0a7 /net/batman-adv/routing.c | |
parent | e1bf0c14096f9dc09c7695f42051d178b23d0670 (diff) |
batman-adv: tvlv - convert tt query packet to use tvlv unicast packets
Instead of generating TT specific packets the TVLV unicast API is used
to send translation table data.
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r-- | net/batman-adv/routing.c | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 9640656d4e51..d12858110f91 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -557,84 +557,6 @@ static int batadv_check_unicast_packet(struct batadv_priv *bat_priv, | |||
557 | return 0; | 557 | return 0; |
558 | } | 558 | } |
559 | 559 | ||
560 | int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if) | ||
561 | { | ||
562 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); | ||
563 | struct batadv_tt_query_packet *tt_query; | ||
564 | uint16_t tt_size; | ||
565 | int hdr_size = sizeof(*tt_query); | ||
566 | char tt_flag; | ||
567 | size_t packet_size; | ||
568 | |||
569 | if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0) | ||
570 | return NET_RX_DROP; | ||
571 | |||
572 | /* I could need to modify it */ | ||
573 | if (skb_cow(skb, sizeof(struct batadv_tt_query_packet)) < 0) | ||
574 | goto out; | ||
575 | |||
576 | tt_query = (struct batadv_tt_query_packet *)skb->data; | ||
577 | |||
578 | switch (tt_query->flags & BATADV_TT_QUERY_TYPE_MASK) { | ||
579 | case BATADV_TT_REQUEST: | ||
580 | batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_RX); | ||
581 | |||
582 | /* If we cannot provide an answer the tt_request is | ||
583 | * forwarded | ||
584 | */ | ||
585 | if (!batadv_send_tt_response(bat_priv, tt_query)) { | ||
586 | if (tt_query->flags & BATADV_TT_FULL_TABLE) | ||
587 | tt_flag = 'F'; | ||
588 | else | ||
589 | tt_flag = '.'; | ||
590 | |||
591 | batadv_dbg(BATADV_DBG_TT, bat_priv, | ||
592 | "Routing TT_REQUEST to %pM [%c]\n", | ||
593 | tt_query->dst, | ||
594 | tt_flag); | ||
595 | return batadv_route_unicast_packet(skb, recv_if); | ||
596 | } | ||
597 | break; | ||
598 | case BATADV_TT_RESPONSE: | ||
599 | batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX); | ||
600 | |||
601 | if (batadv_is_my_mac(bat_priv, tt_query->dst)) { | ||
602 | /* packet needs to be linearized to access the TT | ||
603 | * changes | ||
604 | */ | ||
605 | if (skb_linearize(skb) < 0) | ||
606 | goto out; | ||
607 | /* skb_linearize() possibly changed skb->data */ | ||
608 | tt_query = (struct batadv_tt_query_packet *)skb->data; | ||
609 | |||
610 | tt_size = batadv_tt_len(ntohs(tt_query->tt_data)); | ||
611 | |||
612 | /* Ensure we have all the claimed data */ | ||
613 | packet_size = sizeof(struct batadv_tt_query_packet); | ||
614 | packet_size += tt_size; | ||
615 | if (unlikely(skb_headlen(skb) < packet_size)) | ||
616 | goto out; | ||
617 | |||
618 | batadv_handle_tt_response(bat_priv, tt_query); | ||
619 | } else { | ||
620 | if (tt_query->flags & BATADV_TT_FULL_TABLE) | ||
621 | tt_flag = 'F'; | ||
622 | else | ||
623 | tt_flag = '.'; | ||
624 | batadv_dbg(BATADV_DBG_TT, bat_priv, | ||
625 | "Routing TT_RESPONSE to %pM [%c]\n", | ||
626 | tt_query->dst, | ||
627 | tt_flag); | ||
628 | return batadv_route_unicast_packet(skb, recv_if); | ||
629 | } | ||
630 | break; | ||
631 | } | ||
632 | |||
633 | out: | ||
634 | /* returning NET_RX_DROP will make the caller function kfree the skb */ | ||
635 | return NET_RX_DROP; | ||
636 | } | ||
637 | |||
638 | int batadv_recv_roam_adv(struct sk_buff *skb, struct batadv_hard_iface *recv_if) | 560 | int batadv_recv_roam_adv(struct sk_buff *skb, struct batadv_hard_iface *recv_if) |
639 | { | 561 | { |
640 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); | 562 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); |