The following commit has been merged in the master branch: commit 60b750e5ad69e7a06b9db09561e89f4b7456ec93 Author: marek marek@45894c77-fb22-0410-b583-ff6e7d5dbf6c Date: Sat Oct 17 22:11:17 2009 +0000
[batman-adv] print a warning when an existing mac address is added again
git-svn-id: http://downloads.open-mesh.net/svn/batman/trunk/batman-adv-kernelland@1452 45894c77-fb22-0410-b583-ff6e7d5dbf6c
diff --git a/hard-interface.c b/hard-interface.c index dd5e784..f04d2db 100644 --- a/hard-interface.c +++ b/hard-interface.c @@ -70,6 +70,28 @@ int hardif_min_mtu(void) return min_mtu; }
+void check_known_mac_addr(uint8_t *addr) +{ + struct batman_if *batman_if; + char mac_string[ETH_STR_LEN]; + + rcu_read_lock(); + list_for_each_entry_rcu(batman_if, &if_list, list) { + if ((batman_if->if_active != IF_ACTIVE) && + (batman_if->if_active != IF_TO_BE_ACTIVATED)) + continue; + + if (!compare_orig(batman_if->net_dev->dev_addr, addr)) + continue; + + addr_to_string(mac_string, addr); + debug_log(LOG_TYPE_WARN, "The newly added mac address (%s) already exists on: %s\n", + mac_string, batman_if->dev); + debug_log(LOG_TYPE_WARN, "It is strongly recommended to keep mac addresses unique to avoid problems!\n"); + } + rcu_read_unlock(); +} + /* adjusts the MTU if a new interface with a smaller MTU appeared. */ void update_min_mtu(void) { @@ -191,6 +213,8 @@ void hardif_activate_interface(struct batman_if *batman_if) goto bind_err; }
+ check_known_mac_addr(batman_if->net_dev->dev_addr); + batman_if->raw_sock->sk->sk_user_data = batman_if->raw_sock->sk->sk_data_ready; batman_if->raw_sock->sk->sk_data_ready = batman_data_ready;