diff options
Diffstat (limited to 'net/batman-adv/distributed-arp-table.c')
-rw-r--r-- | net/batman-adv/distributed-arp-table.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index d54188a112ea..8e15d966d9b0 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c | |||
@@ -816,7 +816,6 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv, | |||
816 | bool ret = false; | 816 | bool ret = false; |
817 | struct batadv_dat_entry *dat_entry = NULL; | 817 | struct batadv_dat_entry *dat_entry = NULL; |
818 | struct sk_buff *skb_new; | 818 | struct sk_buff *skb_new; |
819 | struct batadv_hard_iface *primary_if = NULL; | ||
820 | 819 | ||
821 | if (!atomic_read(&bat_priv->distributed_arp_table)) | 820 | if (!atomic_read(&bat_priv->distributed_arp_table)) |
822 | goto out; | 821 | goto out; |
@@ -838,22 +837,18 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv, | |||
838 | 837 | ||
839 | dat_entry = batadv_dat_entry_hash_find(bat_priv, ip_dst); | 838 | dat_entry = batadv_dat_entry_hash_find(bat_priv, ip_dst); |
840 | if (dat_entry) { | 839 | if (dat_entry) { |
841 | primary_if = batadv_primary_if_get_selected(bat_priv); | ||
842 | if (!primary_if) | ||
843 | goto out; | ||
844 | |||
845 | skb_new = arp_create(ARPOP_REPLY, ETH_P_ARP, ip_src, | 840 | skb_new = arp_create(ARPOP_REPLY, ETH_P_ARP, ip_src, |
846 | primary_if->soft_iface, ip_dst, hw_src, | 841 | bat_priv->soft_iface, ip_dst, hw_src, |
847 | dat_entry->mac_addr, hw_src); | 842 | dat_entry->mac_addr, hw_src); |
848 | if (!skb_new) | 843 | if (!skb_new) |
849 | goto out; | 844 | goto out; |
850 | 845 | ||
851 | skb_reset_mac_header(skb_new); | 846 | skb_reset_mac_header(skb_new); |
852 | skb_new->protocol = eth_type_trans(skb_new, | 847 | skb_new->protocol = eth_type_trans(skb_new, |
853 | primary_if->soft_iface); | 848 | bat_priv->soft_iface); |
854 | bat_priv->stats.rx_packets++; | 849 | bat_priv->stats.rx_packets++; |
855 | bat_priv->stats.rx_bytes += skb->len + ETH_HLEN; | 850 | bat_priv->stats.rx_bytes += skb->len + ETH_HLEN; |
856 | primary_if->soft_iface->last_rx = jiffies; | 851 | bat_priv->soft_iface->last_rx = jiffies; |
857 | 852 | ||
858 | netif_rx(skb_new); | 853 | netif_rx(skb_new); |
859 | batadv_dbg(BATADV_DBG_DAT, bat_priv, "ARP request replied locally\n"); | 854 | batadv_dbg(BATADV_DBG_DAT, bat_priv, "ARP request replied locally\n"); |
@@ -866,8 +861,6 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv, | |||
866 | out: | 861 | out: |
867 | if (dat_entry) | 862 | if (dat_entry) |
868 | batadv_dat_entry_free_ref(dat_entry); | 863 | batadv_dat_entry_free_ref(dat_entry); |
869 | if (primary_if) | ||
870 | batadv_hardif_free_ref(primary_if); | ||
871 | return ret; | 864 | return ret; |
872 | } | 865 | } |
873 | 866 | ||
@@ -887,7 +880,6 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv, | |||
887 | __be32 ip_src, ip_dst; | 880 | __be32 ip_src, ip_dst; |
888 | uint8_t *hw_src; | 881 | uint8_t *hw_src; |
889 | struct sk_buff *skb_new; | 882 | struct sk_buff *skb_new; |
890 | struct batadv_hard_iface *primary_if = NULL; | ||
891 | struct batadv_dat_entry *dat_entry = NULL; | 883 | struct batadv_dat_entry *dat_entry = NULL; |
892 | bool ret = false; | 884 | bool ret = false; |
893 | int err; | 885 | int err; |
@@ -912,12 +904,8 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv, | |||
912 | if (!dat_entry) | 904 | if (!dat_entry) |
913 | goto out; | 905 | goto out; |
914 | 906 | ||
915 | primary_if = batadv_primary_if_get_selected(bat_priv); | ||
916 | if (!primary_if) | ||
917 | goto out; | ||
918 | |||
919 | skb_new = arp_create(ARPOP_REPLY, ETH_P_ARP, ip_src, | 907 | skb_new = arp_create(ARPOP_REPLY, ETH_P_ARP, ip_src, |
920 | primary_if->soft_iface, ip_dst, hw_src, | 908 | bat_priv->soft_iface, ip_dst, hw_src, |
921 | dat_entry->mac_addr, hw_src); | 909 | dat_entry->mac_addr, hw_src); |
922 | 910 | ||
923 | if (!skb_new) | 911 | if (!skb_new) |
@@ -941,8 +929,6 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv, | |||
941 | out: | 929 | out: |
942 | if (dat_entry) | 930 | if (dat_entry) |
943 | batadv_dat_entry_free_ref(dat_entry); | 931 | batadv_dat_entry_free_ref(dat_entry); |
944 | if (primary_if) | ||
945 | batadv_hardif_free_ref(primary_if); | ||
946 | if (ret) | 932 | if (ret) |
947 | kfree_skb(skb); | 933 | kfree_skb(skb); |
948 | return ret; | 934 | return ret; |