ensure random new MAC is not same as old MAC When requesting a random MAC with or without some specific prefix there is a small probability (1 / 2^24 for -e) that the new adress is the same as the old one. However unlikely, we don't want that. . If the requested mac is the same as the current mac; don't even try to change it. Print an error message instead.
Check for random device read errors In some cases it is possible to open /dev/hwrng but not to read from it. We need to check for errors and move on to the next possible random device in this case.
actively verify if the MAC was changed macchanger tries to detect if the new MAC is the same as the old. However, it does this by calling mc_net_info_get_mac, on the same net_info structure that it's called mc_net_info_set_mac on. . So, mc_net_info_set_mac sets the mac *in the data structure*, then calls SIOCSIFHWADDR, which returns success even without doing anything if the kernel driver is buggy. And then mc_net_info_get_mac examines the data structure, without calling SIOCGIFHWADDR to check if the MAC was actually changed. . This patch actively verifies if the MAC was changed.