提交 4d774a7f 编写于 作者: M Marek Lindner 提交者: Greg Kroah-Hartman

Staging: batman-adv: suppress false warning when changing the mac address

Whenever the mac address of an batman interface is changed
check_known_mac_addr() is called to print a warning if the newly added
mac address exists an another batman interface. While looping through
the batman interface list check_known_mac_addr() only compares mac
addresses and does not make sure they belong to different interfaces,
thus always printing a warning.
Signed-off-by: NMarek Lindner <lindner_marek@yahoo.de>
Signed-off-by: NSven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 f581cf21
...@@ -165,7 +165,7 @@ static void update_mac_addresses(struct batman_if *batman_if) ...@@ -165,7 +165,7 @@ static void update_mac_addresses(struct batman_if *batman_if)
batman_if->net_dev->dev_addr, ETH_ALEN); batman_if->net_dev->dev_addr, ETH_ALEN);
} }
static void check_known_mac_addr(uint8_t *addr) static void check_known_mac_addr(struct net_device *net_dev)
{ {
struct batman_if *batman_if; struct batman_if *batman_if;
...@@ -175,11 +175,16 @@ static void check_known_mac_addr(uint8_t *addr) ...@@ -175,11 +175,16 @@ static void check_known_mac_addr(uint8_t *addr)
(batman_if->if_status != IF_TO_BE_ACTIVATED)) (batman_if->if_status != IF_TO_BE_ACTIVATED))
continue; continue;
if (!compare_orig(batman_if->net_dev->dev_addr, addr)) if (batman_if->net_dev == net_dev)
continue;
if (!compare_orig(batman_if->net_dev->dev_addr,
net_dev->dev_addr))
continue; continue;
pr_warning("The newly added mac address (%pM) already exists " pr_warning("The newly added mac address (%pM) already exists "
"on: %s\n", addr, batman_if->net_dev->name); "on: %s\n", net_dev->dev_addr,
batman_if->net_dev->name);
pr_warning("It is strongly recommended to keep mac addresses " pr_warning("It is strongly recommended to keep mac addresses "
"unique to avoid problems!\n"); "unique to avoid problems!\n");
} }
...@@ -430,7 +435,7 @@ static struct batman_if *hardif_add_interface(struct net_device *net_dev) ...@@ -430,7 +435,7 @@ static struct batman_if *hardif_add_interface(struct net_device *net_dev)
atomic_set(&batman_if->refcnt, 0); atomic_set(&batman_if->refcnt, 0);
hardif_hold(batman_if); hardif_hold(batman_if);
check_known_mac_addr(batman_if->net_dev->dev_addr); check_known_mac_addr(batman_if->net_dev);
spin_lock(&if_list_lock); spin_lock(&if_list_lock);
list_add_tail_rcu(&batman_if->list, &if_list); list_add_tail_rcu(&batman_if->list, &if_list);
...@@ -515,7 +520,7 @@ static int hard_if_event(struct notifier_block *this, ...@@ -515,7 +520,7 @@ static int hard_if_event(struct notifier_block *this,
goto out; goto out;
} }
check_known_mac_addr(batman_if->net_dev->dev_addr); check_known_mac_addr(batman_if->net_dev);
update_mac_addresses(batman_if); update_mac_addresses(batman_if);
bat_priv = netdev_priv(batman_if->soft_iface); bat_priv = netdev_priv(batman_if->soft_iface);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册