Hacker News new | ask | show | jobs
by dronemallone 2846 days ago
Why not use the routines from the Linux kernel, which are battle tested?

https://elixir.bootlin.com/linux/latest/source/arch/x86/incl...

Or even NetBSD: http://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/net/...

EDIT:

freebsd: https://github.com/freebsd/freebsd/blob/master/sys/netinet/i...

openbsd: https://github.com/openbsd/src/blob/master/sys/netinet/in4_c...

2 comments

It’s impressive of you to dig out all those implementations! Do you have a trick for navigating codebases?
Thanks. Not really, I just look at the IPv4 implementation, it's easily to search for csum or chksum or checksum in codebases.
The first provided link is extremely useful as it lets you jump to declarations, files, and line numbers in the current Linux Kernel source. For digging up kernel code snippets it it is extremely useful.

Also like the kernel is fairly sanely laid out. Its a project with literally hundreds of contributors so keeping the code base organized is important.

I mean, there are LXR and OpenGrok indexes of the various kernels... E.g., http://src.illumos.org/source/ https://elixir.bootlin.com/linux/latest/source etc... If you make a local clone, then cscope is great.
Not to downplay their achievements, but it seems to me that they just dug up the implementations in the IP stack for each OS.
That's true, pretty easy to do once you look in the "net" or "inet" or "netinet" folders and then look for ipv4.
Linux kernel license is GPLv2, so you will need to release your code under terms of GPLv2 if you copy code from Linux.

Copy code from NT kernel instead.