Show HN: DHCP as a file system – an experiment with Go and FUSE
github.com
github.com
FUSE is actually specific to the Linux VFS subsystem. However, there have been many reimplementations on the API compatibility level, even though there is no formal standard beyond the header file, which has seen several divergences.
to give you an example: what happens if the same machine appears twice in the lease file? what happens if some of the fields you are reading are missing? (let's say do you don't have a hostname)
Those particular obstacles proved quiet easy to work around, but I fully expect there's other hidden traps I've overlooked. So I'm welcome to other suggestions for retrieving lease information :)
I was just pointing out the pitfalls of lease parsing (i've been bitten by this over the course of time - it looks trivial to do until you look at what isc does under the covers)
side questions: what happens with 50000 leases? what about 50000 subnets - do you have support for hierarchically displaying subnets :) how fast is the whole thing? can you handle malformed input?
Performance wise, it's definitely not ready for any serious use. However there are some easy wins I didn't bother with that would dramatically speed things up (eg the leases file is read with each FUSE API request - which happens a lot. So I really should be running that as a separate thread that runs every x minutes and caches the object.
if Im honest, scalability was a secondary concern. I was more interested in building a working proof of concept and sadly only had one afternoon to do it in. But I tried to keep the code clean enough (though you can be the judge of that) so it could be scaled up at a later date if needed.
It's an alternative approach to the HTML output that home routers display on their DHCP management pages. Arguably less useful approach, but I wanted an excuse to play with FUSE.