The following commit has been merged in the merge/master branch: commit 6c27cef04bc11514b91aa20f199e5bda9abe6207 Merge: 235bd568df5cbfb345b0c802238d9cc354df3a57 f6c80c29ef4e8b45b715976107b7ae06fc0be3a0 Author: Marek Lindner mareklindner@neomailbox.ch Date: Mon Jun 6 23:40:13 2016 +0800
Merge branch 'maint' into next
diff --combined net/batman-adv/routing.c index e3857ed,27e07dd..6c2901a --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c @@@ -100,6 -100,10 +100,6 @@@ static void _batadv_update_route(struc if (curr_router) batadv_neigh_node_put(curr_router);
- /* increase refcount of new best neighbor */ - if (neigh_node && !kref_get_unless_zero(&neigh_node->refcount)) - neigh_node = NULL; - spin_lock_bh(&orig_node->neigh_list_lock); /* curr_router used earlier may not be the current orig_ifinfo->router * anymore because it was dereferenced outside of the neigh_list_lock @@@ -110,10 -114,6 +110,10 @@@ */ curr_router = rcu_dereference_protected(orig_ifinfo->router, true);
+ /* increase refcount of new best neighbor */ + if (neigh_node) + kref_get(&neigh_node->refcount); + rcu_assign_pointer(orig_ifinfo->router, neigh_node); spin_unlock_bh(&orig_node->neigh_list_lock); batadv_orig_ifinfo_put(orig_ifinfo); @@@ -163,18 -163,18 +163,18 @@@ out * doesn't change otherwise. * * Return: - * 0 if the packet is to be accepted. - * 1 if the packet is to be ignored. + * false if the packet is to be accepted. + * true if the packet is to be ignored. */ -int batadv_window_protected(struct batadv_priv *bat_priv, s32 seq_num_diff, - s32 seq_old_max_diff, unsigned long *last_reset, - bool *protection_started) +bool batadv_window_protected(struct batadv_priv *bat_priv, s32 seq_num_diff, + s32 seq_old_max_diff, unsigned long *last_reset, + bool *protection_started) { if (seq_num_diff <= -seq_old_max_diff || seq_num_diff >= BATADV_EXPECTED_SEQNO_RANGE) { if (!batadv_has_timed_out(*last_reset, BATADV_RESET_PROTECTION_MS)) - return 1; + return true;
*last_reset = jiffies; if (protection_started) @@@ -183,7 -183,7 +183,7 @@@ "old packet received, start protection\n"); }
- return 0; + return false; }
bool batadv_check_management_packet(struct sk_buff *skb, @@@ -374,6 -374,7 +374,7 @@@ int batadv_recv_icmp_packet(struct sk_b if (skb_cow(skb, ETH_HLEN) < 0) goto out;
+ ethhdr = eth_hdr(skb); icmph = (struct batadv_icmp_header *)skb->data; icmp_packet_rr = (struct batadv_icmp_packet_rr *)icmph; if (icmp_packet_rr->rr_cur >= BATADV_RR_LEN) @@@ -720,9 -721,8 +721,9 @@@ out return ret; }
-static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, - struct sk_buff *skb, int hdr_len) { +static bool batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, + struct sk_buff *skb, int hdr_len) +{ struct batadv_unicast_packet *unicast_packet; struct batadv_hard_iface *primary_if; struct batadv_orig_node *orig_node; @@@ -733,11 -733,11 +734,11 @@@
/* check if there is enough data before accessing it */ if (!pskb_may_pull(skb, hdr_len + ETH_HLEN)) - return 0; + return false;
/* create a copy of the skb (in case of for re-routing) to modify it. */ if (skb_cow(skb, sizeof(*unicast_packet)) < 0) - return 0; + return false;
unicast_packet = (struct batadv_unicast_packet *)skb->data; vid = batadv_get_vid(skb, hdr_len); @@@ -761,7 -761,7 +762,7 @@@ * table. If not, let the packet go untouched anyway because * there is nothing the node can do */ - return 1; + return true; }
/* retrieve the TTVN known by this node for the packet destination. This @@@ -777,7 -777,7 +778,7 @@@ * not be possible to deliver it */ if (!orig_node) - return 0; + return false;
curr_ttvn = (u8)atomic_read(&orig_node->last_ttvn); batadv_orig_node_put(orig_node); @@@ -788,7 -788,7 +789,7 @@@ */ is_old_ttvn = batadv_seq_before(unicast_packet->ttvn, curr_ttvn); if (!is_old_ttvn) - return 1; + return true;
old_ttvn = unicast_packet->ttvn; /* the packet was forged based on outdated network information. Its @@@ -801,7 -801,7 +802,7 @@@ "Rerouting unicast packet to %pM (dst=%pM): TTVN mismatch old_ttvn=%u new_ttvn=%u\n", unicast_packet->dest, ethhdr->h_dest, old_ttvn, curr_ttvn); - return 1; + return true; }
/* the packet has not been re-routed: either the destination is @@@ -809,14 -809,14 +810,14 @@@ * it is possible to drop the packet */ if (!batadv_is_my_client(bat_priv, ethhdr->h_dest, vid)) - return 0; + return false;
/* update the header in order to let the packet be delivered to this * node's soft interface */ primary_if = batadv_primary_if_get_selected(bat_priv); if (!primary_if) - return 0; + return false;
ether_addr_copy(unicast_packet->dest, primary_if->net_dev->dev_addr);
@@@ -824,7 -824,7 +825,7 @@@
unicast_packet->ttvn = curr_ttvn;
- return 1; + return true; }
/** @@@ -915,7 -915,7 +916,7 @@@ int batadv_recv_unicast_packet(struct s hdr_size)) goto rx_success;
- batadv_interface_rx(recv_if->soft_iface, skb, recv_if, hdr_size, + batadv_interface_rx(recv_if->soft_iface, skb, hdr_size, orig_node);
rx_success: @@@ -1125,7 -1125,8 +1126,7 @@@ int batadv_recv_bcast_packet(struct sk_ goto rx_success;
/* broadcast for me */ - batadv_interface_rx(recv_if->soft_iface, skb, recv_if, hdr_size, - orig_node); + batadv_interface_rx(recv_if->soft_iface, skb, hdr_size, orig_node);
rx_success: ret = NET_RX_SUCCESS;