Author: marek Date: 2009-10-17 22:11:17 +0000 (Sat, 17 Oct 2009) New Revision: 1452
Modified: trunk/batman-adv-kernelland/hard-interface.c Log: [batman-adv] print a warning when an existing mac address is added again
Modified: trunk/batman-adv-kernelland/hard-interface.c =================================================================== --- trunk/batman-adv-kernelland/hard-interface.c 2009-10-17 22:01:20 UTC (rev 1451) +++ trunk/batman-adv-kernelland/hard-interface.c 2009-10-17 22:11:17 UTC (rev 1452) @@ -70,6 +70,28 @@ 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 @@ 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;