jow- / ucode

JavaScript-like language with optional templating
ISC License
87 stars 24 forks source link

Netlink and code duplication #172

Open pktpls opened 9 months ago

pktpls commented 9 months ago

I'm working on netlink impls for Wireguard and L2TP, my crappy ucode-mod-wireguard is already working. I based it off nl80211, deleted much and added some: https://github.com/freifunk-berlin/falter-packages/blob/master/packages/ucode-mod-wireguard/src/wireguard.c

I noticed that there's a lot of duplicated netlink boilerplate code and I'm only adding more to the pile.

My thoughts are it would be good to share some of that between modules, or alternatively expose the lower-level netlink plumbing to ucode userspace and implement things like nl80211, wireguard, l2tp in ucode.

What are your thoughts? I'm pushing ahead for now, but I'm open for anything and will adapt the wireguard/l2tp modules accordingly.

jow- commented 9 months ago

For now I tend towards living with the code duplication since factoring out the shared bits into a shared library would complicate things. Maybe the boilerplate parts can be extracted into some kind of header-only library which will be shipped alongside the other ucode headers and which can be included by those modules that need it.