Commit Graph

69 Commits

Author SHA1 Message Date
rmind 04cb50ac51 libnpf/npfctl: support dynamic NAT rulesets using a name prefix. 2019-09-30 00:37:11 +00:00
martin 0c393ecfe5 Include libnv directly into this library 2019-08-27 14:54:17 +00:00
rmind 0dd7abe473 libnpf fix: link the library itself to libnv; libnpf users should not be
expected to assume this dependency.
2019-08-24 13:20:52 +00:00
rmind 0e1944da36 npfkern/libnpf: Add support for the table replace/swap operation.
Contributed by Timshel Knoll-Miller.
2019-08-21 21:45:47 +00:00
wiz eed20ae12c Try improving a description. 2019-07-23 14:18:20 +00:00
rmind dadc88e3b0 NPF improvements:
- Add support for dynamic NETMAP algorithm (stateful net-to-net).
- Add most of the support for the dynamic NAT rules; a little bit more
  userland work is needed to finish this up and enable.
- Replace 'stateful-ends' with more permissive 'stateful-all'.
- Add various tunable parameters and document them, see npf-params(7).
- Reduce the memory usage of the connection state table (conndb).
- Portmap rewrite: use memory more efficiently, handle addresses dynamically.
- Bug fix: add splsoftnet()/splx() around the thmap writers and comment.
- npftest: clean up and simplify; fix some memleaks to make ASAN happy.
2019-07-23 00:52:01 +00:00
dholland ad8aa774f5 fix duplicated chunk from merge 2019-01-27 04:33:29 +00:00
pgoyette d91f98a871 Merge the [pgoyette-compat] branch 2019-01-27 02:08:33 +00:00
rmind 3d9a792dd8 Major NPF improvements:
- Convert NPF connection table to thmap.  State lookup is now lock-free.
- Improve connection state G/C: it is now incremental and tunable.
- Add support for dynamic NAT address.  Translation addresses can now be
  selected from a pool of addresses.  There are two selection algorithms,
  "ip-hash" and "round-robin" (see the man page).
- Translation address can be specified as e.g. ifaddrs(wm0) in npf.conf
  to dynamically choose an IP from the interface address(es).
- Add support for the NETMAP algorithm with static NAT for net-to-net
  translation (it is equivalent to iptables NETMAP logic).
- Convert 'ipset' tables to use thmap; the table lookup is now lock-free.
- Misc improvements, bug fixes and more unit tests.
- Bump NPF_VERSION (will also bump libnpf).
2019-01-19 21:19:31 +00:00
christos c5c9ba2461 - re-enable lint (otherwise the sets break)
- no space after -I (for consistency)
2018-09-29 15:52:44 +00:00
rmind 39013e66c1 NPF: Major rework -- migrate NPF to the libnv library.
- This conversion significantly simplifies the code and moves NPF to
  a binary serialisation format (replacing the XML-like format).
- Fix some memory/reference leaks and possibly use-after-free bugs.
- Bump NPF_VERSION as this change makes libnpf incompatible with the
  previous versions.  Also, different serialisation format means NPF
  connection/config saving and loading is not compatible with the
  previous versions either.

Thanks to christos@ for extra testing.
2018-09-29 14:41:35 +00:00
rmind f24cbc0ab2 libnpf(3): improve the wording, fix and expand some sections. 2017-12-07 00:22:06 +00:00
christos 29343d16d1 set to NULL after releasing to avoid double free. 2017-01-03 00:59:31 +00:00
wiz 146c3bb911 Fix typos. 2016-12-27 21:25:12 +00:00
rmind cbc7bab49c KNF 2016-12-27 20:32:58 +00:00
christos 52d8bce52a Add a function to iterate over endpoints 2016-12-27 20:14:07 +00:00
rmind 5e66d73d01 Update libnpf(3) man page. 2016-12-27 17:58:56 +00:00
christos f75d79eb69 Sync NPF with the version on github: backport standalone NPF changes,
which allow us to create and run separate NPF instances. Minor fixes.
(from rmind@)
2016-12-26 23:05:05 +00:00
christos 5467719bc0 use array notation 2016-12-10 21:04:12 +00:00
christos 431fde0e65 update for v18 conn list; more error checks 2016-12-10 19:07:22 +00:00
kre c0121372b2 Remove what was probably a left over remnant of a debugging printf
which was incompletely deleted.   Hopefully fix the build.
2016-12-10 08:48:11 +00:00
christos 3d5a430c2b add npf_nat_lookup() 2016-12-10 05:37:55 +00:00
christos 8ec658f57a - Change LDADD/DPADD in library dependencies to LIBDPLIBS
- Fix some LDADD abuse and remove useless dependencies
- include <bsd.init.mk> in the right place where appropriate
From Rin Okuyama
2016-01-05 13:07:46 +00:00
rmind 3e73e7e64b libnpf: add npf_rule_getid() and npf_rule_getcode().
Missed in the previous commit.
2015-02-02 00:55:28 +00:00
rmind 209a62dda0 npf_config_submit: finally, include the saved connections. 2014-08-24 20:37:35 +00:00
rmind 670c10ba87 - Add and use npf_alg_export().
- npf_conn_import: handle NAT metadata correctly.
- npf_nat_newpolicy: restore the policy ID.
- npfctl_load: fix error code handling for the limit cases.
- npf_config_import: fix the inverted logic.
- npfctl_load: improve error handling.
2014-08-11 23:48:01 +00:00
rmind d0850273a2 - Add npf_ruleset_export(), npf_rule_export() and npf_nat_policyexport().
- Split off npf_conn_export().  Add npf_ifmap_getname() and use it to save
  the interface name; pick it up on npf_conn_import().
- Misc fixes.  Bump NPF_VERSION.
2014-08-10 19:09:43 +00:00
rmind c2b1c6cc23 Cross-link npf(7). 2014-08-03 00:02:56 +00:00
htodd c1a007a161 Build fix (use error when defined). 2014-07-23 05:00:38 +00:00
rmind a02b7176fb NPF: rework of the connection saving and restoring:
- Add support for saving a snapshot of the current connections together
  with a full configuration.  Support a reverse load operation.  Eliminate
  the old 'sess-save' and 'sess-load' in favour of the new mechanism.
- Share code between load and reload operations: the latter performs
  load from npf.conf without affecting the connections.
- Simplify and fix races with connection loading.
- Bump NPF_VERSION.
2014-07-23 01:25:34 +00:00
christos e92a47d1e2 rename npf.3 -> libnpf.3 per rmind@'s request 2014-07-22 22:28:47 +00:00
jakllsch c628b5784a add npf_ext_param_string() 2014-05-19 18:47:19 +00:00
rmind 068cee2998 NPF: add support for IPv6-to-IPv6 Network Prefix Translation (NPTv6),
as per RFC 6296.  Add a unit test.  Also, bump NPF_VERSION.

Thanks to S.P.Zeidler for the help with NPTv6 work!
2014-02-13 03:34:40 +00:00
rmind 8274d601f9 NPF: add support for static (stateless) NAT. 2014-02-07 23:45:22 +00:00
rmind ffcdc4af8d Add support for CDB based NPF tables. 2014-02-06 02:51:28 +00:00
rmind 55b0c96054 - npfctl: fix table IDs (breakage since the table naming was added).
- libnpf: remove npf_table_exists_p() from public API.
2014-02-03 02:21:52 +00:00
njoly 648dc01fac Kill extra space in function argument. 2014-01-08 10:14:21 +00:00
rmind 805a41fbfe Add npf_tableset_syncdict() to sync the table IDs in the proplib dictionary,
as they can change on reload now.  Also, fix table name checking in npfctl.
2013-11-22 00:25:51 +00:00
wiz 32db1dc333 Remove superfluous comma. 2013-11-12 06:06:21 +00:00
rmind 1e7342c150 NPF: add support for table naming and remove NPF_TABLE_SLOTS (there is
just an arbitrary sanity limit of NPF_MAX_TABLES currently set to 128).

Few misc fixes.  Bump NPF_VERSION.
2013-11-12 00:46:34 +00:00
wiz 918ebd8ff7 Mark up NULL with Dv. 2013-11-08 13:17:45 +00:00
rmind a79812ea10 NPF: add support for specifying the interfaces before they are attached.
If an interface is or gets detached, all associated rules and connections
will be deactivated (it might be useful to have an option to invalidate
the associated connections).  Once the interface is reattached they will
become active.

Bump NPF_VERSION.
2013-11-08 00:38:26 +00:00
rmind c19ced7da2 G/C npf_ncode(9) 2013-09-19 17:29:06 +00:00
rmind 7b5edfdc0d NPF: G/C n-code in favour of BPF byte-code. Delete lots of code, mmm! 2013-09-19 01:49:07 +00:00
rmind 4e592132ab - Convert NPF to use BPF byte-code by default. Compile BPF byte-code in
npfctl(8) and generate separate marks to describe the filter criteria.
- Rewrite 'npfctl show' functionality and fix some of the bugs.
- npftest: add a test for BPF COP.
- Bump NPF_VERSION.
2013-09-19 01:04:45 +00:00
christos bc0f55de88 Make ALG's autoloadable by providing in the config file:
alg "algname"
2013-03-20 00:29:46 +00:00
rmind 56910be779 - Convert NPF dynamic rule ID to just incremented 64-bit counter.
- Fix multiple bugs.  Also, update the man page.
2013-02-16 21:11:12 +00:00
rmind 50c5afcad4 - Fix NPF config reload with dynamic rules present.
- Implement list and flush commands on a dynamic ruleset.
2013-02-10 23:47:37 +00:00
rmind 0e21825481 NPF:
- Implement dynamic NPF rules.  Controlled through npf(3) library of via
  npfctl rule command.  A rule can be removed using a unique identifier,
  returned on addition, or using a key which is SHA1 hash of the rule.
  Adjust npftest and add a regression test.
- Improvements to rule inspection mechanism.
- Initial BPF support as an alternative to n-code.
- Minor fixes; bump the version.
2013-02-09 03:35:31 +00:00
wiz ddc483c50c Remove a superfluous quote and fix a recurring typo. 2012-12-24 00:35:56 +00:00