Profile cover photo
Profile photo
Barney Desmond (furinkan)
Linux and technology nerd, mentor, photographer.
Linux and technology nerd, mentor, photographer.

Barney's posts

Post has attachment
Turns out it's pretty easy to change your MAC address for the sake of keeping one piece of software happy, without changing it for the whole OS.

I've been tasked with migrating a piece of video transcoding software called Flix off of RHEL5, and the startup license is tied to the machine's hardware identity. The usual way to solve this would be to copy the MAC address to a new virtual machine but it's kind of messy and a bit of a pain in the arse (especially because another team manages the VM infrastructure here). Fixing and renewing the license key isn't an option because Google bought the company (On2) several years ago and took the license-generating servers offline six months later.

Back when I worked at Anchor I remember being shown some cute LD_PRELOAD tricks to mess with programs. You can transparently intercept library calls and do whatever you like with them, which seemed useful here. With a bit of strace work I could see that it was detecting the host's MAC address, and also doing a hostname lookup, thankfully nothing too intrusive. The hostname could probably wait, but the MAC address should be solveable - it's calling ioctl(), which I think is a library function in libc.

The upshot of doing it this way is that it only affects one program, so it's easily isolated from the rest of the system and very tidy to install. A small tweak to Flix's initscript starts the daemon with faked-up MAC addresses, and the job is done.

Poking around the manpages I figured out how to knock up a data structure that would be just complete enough to satisfy Flix's request for MAC addresses, and palm everything off to the real ioctl() function in the library. It's surprisingly few lines of code, except for the dodgy bit where I fill in the MAC address one byte at a time, because getting just the right syntax for pointer-into-an-array is too damn hard. With a little extra work I was able to pull the fake MAC address from the environment, meaning I could generalise the solution for all the Flix servers we manage in different environments.

I can't post the code right now because it's for work, but out of all the resources I dug through this is easily the most comprehensive and useful:

For extra fun, you can hijack functions at the syscall level too! But that's more than I needed right now, and delving into kernel modules is just adding a messy dependency and it's more effort to maintain. I'd use this page as a resource if I wanted to descend that route though: 

Post has attachment
Ohhh pretty clever, and simple too

Post has shared content
George Brandis suggests "just ring up CentreLink and they'll solve your problem" for people who have been wrongly sent debt notices.

That got a laugh, and more importantly it allowed one person to say that she'd spent weeks on the phone for 1.5 hours each day to try and get the issue resolved. Yes, Senator, you're out of touch with how the world works.

George Brandis suggests that his government is not to blame for the continuing abysmal detention conditions on Nauru and Manus Island because they didn't set them up. Funnily enough, Senator, you kept them open and continued to pour money into them. If you didn't like them, Senator, if they offend your Christian sense of being a good Samaritan - maybe you should close them?

Post has attachment

Post has attachment

Post has attachment
I have so many uses for these, I can't believe I've not come across them before

Post has attachment
Didn't know about these, they seem pretty new, apparently being used for anonymity in a new-ish digital currency, Monero

Post has attachment

Post has attachment
These JSDF recruitment posters are pretty cool

Post has attachment
Now this is some good science! A study about how coffee sloshes in coffee cups and how human movement affects the subsequent spilling.
Wait while more posts are being loaded