I needed a way to persist the conntrack table on an OpenWRT based router, so I made this quick & dirty script.
The table structure has primary keys on nearly all the fields, except namely packets and bytes. If a duplicate key is detected on INSERT, it’ll update those 2 fields instead.
Figured I’d put this on Gist in case anyone else needed it.
Never made anything in Lua before, so I’m sure there are better ways to do certain things.