rmind / npf

NPF: packet filter with stateful inspection, NAT, IP sets, etc.
Other
239 stars 42 forks source link

Implement npfctl table replace subcommand. (#52) #53

Closed yazshel closed 5 years ago

yazshel commented 5 years ago

Here's an implementation of a frontend command for the table replacement functionality.

Command syntax is: npfctl table <tid> replace [-n <newid>] [-t ipset|lpm|const] <path>

where path is the path to the file containing IPs/networks for the table. It all uses the same npfctl_build_table() function from the config parser behind the scenes.

Let me know of any changes you'd like me to make.

yazshel commented 5 years ago

BTW I've just realised that one change I made early in the implementation is no longer necessary - I changed the signature of npfctl_table_getid() to allow passing in the config; but I've refactored since then and its no longer needed for the new functionality.

I'll look to back out the signature change and unnecessary changes; unless you see some other benefit to having the function work in this way.

yazshel commented 5 years ago

Hi Mindaugas,

I haven't forgotten about this, life has just hit a busy patch lately and it might be a few weeks before things settle down. I'll chip away at the changes in the meantime; I hope that's OK.

Cheers,

Timshel

yazshel commented 5 years ago

I've pushed fixes for most of the reviews; just the npfctl_active_table_byname() review is remains outstanding. Please see my reply to your review comment above :)