diff options
author | David S. Miller <davem@davemloft.net> | 2012-09-25 13:24:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-09-25 13:24:02 -0400 |
commit | 78cc88c408675a7cc42e6d7402c9d90080e0b841 (patch) | |
tree | 9f3f53acf4b1f5f6fd32181cc59cdbbcea0c0376 | |
parent | 1b05c4b50edbddbdde715c4a7350629819f6655e (diff) | |
parent | 7caf69fb9c5017df01945a1861c042f6aa08edeb (diff) |
Merge tag 'batman-adv-fix-for-davem' of git://git.open-mesh.org/linux-merge
Included fixes:
- fix the behaviour of batman-adv in case of virtual interface MAC change event
- fix symmetric link check in neighbour selection
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/batman-adv/bat_iv_ogm.c | 13 | ||||
-rw-r--r-- | net/batman-adv/soft-interface.c | 7 |
2 files changed, 12 insertions, 8 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index e877af8bdd1e..469daabd90c7 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
@@ -642,7 +642,8 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, | |||
642 | struct batadv_neigh_node *router = NULL; | 642 | struct batadv_neigh_node *router = NULL; |
643 | struct batadv_orig_node *orig_node_tmp; | 643 | struct batadv_orig_node *orig_node_tmp; |
644 | struct hlist_node *node; | 644 | struct hlist_node *node; |
645 | uint8_t bcast_own_sum_orig, bcast_own_sum_neigh; | 645 | int if_num; |
646 | uint8_t sum_orig, sum_neigh; | ||
646 | uint8_t *neigh_addr; | 647 | uint8_t *neigh_addr; |
647 | 648 | ||
648 | batadv_dbg(BATADV_DBG_BATMAN, bat_priv, | 649 | batadv_dbg(BATADV_DBG_BATMAN, bat_priv, |
@@ -727,17 +728,17 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, | |||
727 | if (router && (neigh_node->tq_avg == router->tq_avg)) { | 728 | if (router && (neigh_node->tq_avg == router->tq_avg)) { |
728 | orig_node_tmp = router->orig_node; | 729 | orig_node_tmp = router->orig_node; |
729 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); | 730 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); |
730 | bcast_own_sum_orig = | 731 | if_num = router->if_incoming->if_num; |
731 | orig_node_tmp->bcast_own_sum[if_incoming->if_num]; | 732 | sum_orig = orig_node_tmp->bcast_own_sum[if_num]; |
732 | spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); | 733 | spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); |
733 | 734 | ||
734 | orig_node_tmp = neigh_node->orig_node; | 735 | orig_node_tmp = neigh_node->orig_node; |
735 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); | 736 | spin_lock_bh(&orig_node_tmp->ogm_cnt_lock); |
736 | bcast_own_sum_neigh = | 737 | if_num = neigh_node->if_incoming->if_num; |
737 | orig_node_tmp->bcast_own_sum[if_incoming->if_num]; | 738 | sum_neigh = orig_node_tmp->bcast_own_sum[if_num]; |
738 | spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); | 739 | spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock); |
739 | 740 | ||
740 | if (bcast_own_sum_orig >= bcast_own_sum_neigh) | 741 | if (sum_orig >= sum_neigh) |
741 | goto update_tt; | 742 | goto update_tt; |
742 | } | 743 | } |
743 | 744 | ||
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 109ea2aae96c..21c53577c8d6 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -100,18 +100,21 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p) | |||
100 | { | 100 | { |
101 | struct batadv_priv *bat_priv = netdev_priv(dev); | 101 | struct batadv_priv *bat_priv = netdev_priv(dev); |
102 | struct sockaddr *addr = p; | 102 | struct sockaddr *addr = p; |
103 | uint8_t old_addr[ETH_ALEN]; | ||
103 | 104 | ||
104 | if (!is_valid_ether_addr(addr->sa_data)) | 105 | if (!is_valid_ether_addr(addr->sa_data)) |
105 | return -EADDRNOTAVAIL; | 106 | return -EADDRNOTAVAIL; |
106 | 107 | ||
108 | memcpy(old_addr, dev->dev_addr, ETH_ALEN); | ||
109 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); | ||
110 | |||
107 | /* only modify transtable if it has been initialized before */ | 111 | /* only modify transtable if it has been initialized before */ |
108 | if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) { | 112 | if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) { |
109 | batadv_tt_local_remove(bat_priv, dev->dev_addr, | 113 | batadv_tt_local_remove(bat_priv, old_addr, |
110 | "mac address changed", false); | 114 | "mac address changed", false); |
111 | batadv_tt_local_add(dev, addr->sa_data, BATADV_NULL_IFINDEX); | 115 | batadv_tt_local_add(dev, addr->sa_data, BATADV_NULL_IFINDEX); |
112 | } | 116 | } |
113 | 117 | ||
114 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); | ||
115 | dev->addr_assign_type &= ~NET_ADDR_RANDOM; | 118 | dev->addr_assign_type &= ~NET_ADDR_RANDOM; |
116 | return 0; | 119 | return 0; |
117 | } | 120 | } |