diff options
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r-- | net/batman-adv/routing.c | 86 |
1 files changed, 1 insertions, 85 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 0dc1c0e84451..fd2cdbc3ea85 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include "icmp_socket.h" | 25 | #include "icmp_socket.h" |
26 | #include "translation-table.h" | 26 | #include "translation-table.h" |
27 | #include "originator.h" | 27 | #include "originator.h" |
28 | #include "unicast.h" | ||
29 | #include "bridge_loop_avoidance.h" | 28 | #include "bridge_loop_avoidance.h" |
30 | #include "distributed-arp-table.h" | 29 | #include "distributed-arp-table.h" |
31 | #include "network-coding.h" | 30 | #include "network-coding.h" |
@@ -653,11 +652,9 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, | |||
653 | { | 652 | { |
654 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); | 653 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); |
655 | struct batadv_orig_node *orig_node = NULL; | 654 | struct batadv_orig_node *orig_node = NULL; |
656 | struct batadv_neigh_node *neigh_node = NULL; | ||
657 | struct batadv_unicast_packet *unicast_packet; | 655 | struct batadv_unicast_packet *unicast_packet; |
658 | struct ethhdr *ethhdr = eth_hdr(skb); | 656 | struct ethhdr *ethhdr = eth_hdr(skb); |
659 | int res, hdr_len, ret = NET_RX_DROP; | 657 | int res, hdr_len, ret = NET_RX_DROP; |
660 | struct sk_buff *new_skb; | ||
661 | 658 | ||
662 | unicast_packet = (struct batadv_unicast_packet *)skb->data; | 659 | unicast_packet = (struct batadv_unicast_packet *)skb->data; |
663 | 660 | ||
@@ -674,46 +671,12 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, | |||
674 | if (!orig_node) | 671 | if (!orig_node) |
675 | goto out; | 672 | goto out; |
676 | 673 | ||
677 | /* find_router() increases neigh_nodes refcount if found. */ | ||
678 | neigh_node = batadv_find_router(bat_priv, orig_node, recv_if); | ||
679 | |||
680 | if (!neigh_node) | ||
681 | goto out; | ||
682 | |||
683 | /* create a copy of the skb, if needed, to modify it. */ | 674 | /* create a copy of the skb, if needed, to modify it. */ |
684 | if (skb_cow(skb, ETH_HLEN) < 0) | 675 | if (skb_cow(skb, ETH_HLEN) < 0) |
685 | goto out; | 676 | goto out; |
686 | 677 | ||
687 | unicast_packet = (struct batadv_unicast_packet *)skb->data; | ||
688 | |||
689 | if (unicast_packet->header.packet_type == BATADV_UNICAST && | ||
690 | atomic_read(&bat_priv->fragmentation) && | ||
691 | skb->len > neigh_node->if_incoming->net_dev->mtu) { | ||
692 | ret = batadv_frag_send_skb(skb, bat_priv, | ||
693 | neigh_node->if_incoming, | ||
694 | neigh_node->addr); | ||
695 | goto out; | ||
696 | } | ||
697 | |||
698 | if (unicast_packet->header.packet_type == BATADV_UNICAST_FRAG && | ||
699 | batadv_frag_can_reassemble(skb, | ||
700 | neigh_node->if_incoming->net_dev->mtu)) { | ||
701 | ret = batadv_frag_reassemble_skb(skb, bat_priv, &new_skb); | ||
702 | |||
703 | if (ret == NET_RX_DROP) | ||
704 | goto out; | ||
705 | |||
706 | /* packet was buffered for late merge */ | ||
707 | if (!new_skb) { | ||
708 | ret = NET_RX_SUCCESS; | ||
709 | goto out; | ||
710 | } | ||
711 | |||
712 | skb = new_skb; | ||
713 | unicast_packet = (struct batadv_unicast_packet *)skb->data; | ||
714 | } | ||
715 | |||
716 | /* decrement ttl */ | 678 | /* decrement ttl */ |
679 | unicast_packet = (struct batadv_unicast_packet *)skb->data; | ||
717 | unicast_packet->header.ttl--; | 680 | unicast_packet->header.ttl--; |
718 | 681 | ||
719 | switch (unicast_packet->header.packet_type) { | 682 | switch (unicast_packet->header.packet_type) { |
@@ -748,8 +711,6 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, | |||
748 | } | 711 | } |
749 | 712 | ||
750 | out: | 713 | out: |
751 | if (neigh_node) | ||
752 | batadv_neigh_node_free_ref(neigh_node); | ||
753 | if (orig_node) | 714 | if (orig_node) |
754 | batadv_orig_node_free_ref(orig_node); | 715 | batadv_orig_node_free_ref(orig_node); |
755 | return ret; | 716 | return ret; |
@@ -1003,51 +964,6 @@ rx_success: | |||
1003 | return batadv_route_unicast_packet(skb, recv_if); | 964 | return batadv_route_unicast_packet(skb, recv_if); |
1004 | } | 965 | } |
1005 | 966 | ||
1006 | int batadv_recv_ucast_frag_packet(struct sk_buff *skb, | ||
1007 | struct batadv_hard_iface *recv_if) | ||
1008 | { | ||
1009 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); | ||
1010 | struct batadv_unicast_frag_packet *unicast_packet; | ||
1011 | int hdr_size = sizeof(*unicast_packet); | ||
1012 | struct sk_buff *new_skb = NULL; | ||
1013 | int ret; | ||
1014 | |||
1015 | if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0) | ||
1016 | return NET_RX_DROP; | ||
1017 | |||
1018 | if (!batadv_check_unicast_ttvn(bat_priv, skb, hdr_size)) | ||
1019 | return NET_RX_DROP; | ||
1020 | |||
1021 | unicast_packet = (struct batadv_unicast_frag_packet *)skb->data; | ||
1022 | |||
1023 | /* packet for me */ | ||
1024 | if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) { | ||
1025 | ret = batadv_frag_reassemble_skb(skb, bat_priv, &new_skb); | ||
1026 | |||
1027 | if (ret == NET_RX_DROP) | ||
1028 | return NET_RX_DROP; | ||
1029 | |||
1030 | /* packet was buffered for late merge */ | ||
1031 | if (!new_skb) | ||
1032 | return NET_RX_SUCCESS; | ||
1033 | |||
1034 | if (batadv_dat_snoop_incoming_arp_request(bat_priv, new_skb, | ||
1035 | hdr_size)) | ||
1036 | goto rx_success; | ||
1037 | if (batadv_dat_snoop_incoming_arp_reply(bat_priv, new_skb, | ||
1038 | hdr_size)) | ||
1039 | goto rx_success; | ||
1040 | |||
1041 | batadv_interface_rx(recv_if->soft_iface, new_skb, recv_if, | ||
1042 | sizeof(struct batadv_unicast_packet), NULL); | ||
1043 | |||
1044 | rx_success: | ||
1045 | return NET_RX_SUCCESS; | ||
1046 | } | ||
1047 | |||
1048 | return batadv_route_unicast_packet(skb, recv_if); | ||
1049 | } | ||
1050 | |||
1051 | /** | 967 | /** |
1052 | * batadv_recv_unicast_tvlv - receive and process unicast tvlv packets | 968 | * batadv_recv_unicast_tvlv - receive and process unicast tvlv packets |
1053 | * @skb: unicast tvlv packet to process | 969 | * @skb: unicast tvlv packet to process |