alobbs / macchanger

GNU MAC Changer
http://www.gnu.org/software/macchanger
GNU General Public License v3.0
588 stars 112 forks source link

It's the same MAC!! #17

Open aalzahrani2 opened 8 years ago

aalzahrani2 commented 8 years ago

Mac address won't change with state up or down ???

twisted-pear commented 8 years ago

I'm getting the same problem, whenever I call macchanger with the same parameters, I end up getting the same MAC.

I finally traced the problem to the random_seed() function in main.c: It does no error handling on the actual read() call, which means that if the read fails for some reason, macchanger will use whatever is on the stack as the seed. I'm not sure if that can happen with /dev/urandom or /dev/random but it can and does happen with /dev/hwrng on Linux if the system has the TPM code in the kernel enabled but the TPM is disabled in the BIOS (the case on my machine). Please consider doing proper error handling on the read() call and falling through to the next device when it fails, or reordering the devices such that /dev/(u)random is first, or using the new getrandom syscall on Linux.

Thanks.