Commit Graph

36 Commits

Author SHA1 Message Date
Liu Xiangchao a58e58ca6b
add set element expires field (#223) 2023-04-21 08:26:50 +02:00
konradh a93939a185
Fix getting concatenated data types for maps (#217)
This also implements parsing of concatenated data types.
2023-04-02 10:11:12 +02:00
turekt 0dda43a5f9
Fix size for TypeTimeHour (#203)
Corresponding nftables commit: https://git.netfilter.org/nftables/commit/src/meta.c?id=4e1abfc552170d6db5c511634a29918e64c1b51b
2022-11-01 21:27:48 +01:00
Joe Williams 0929dfc8bf
Support set element counters (#199) 2022-10-29 08:33:22 +02:00
turekt 535f5eb8da
Fix incorrect netlink acknowledgement handling (#194)
fixes https://github.com/google/nftables/issues/175
2022-10-02 16:01:48 +02:00
turekt 64ce05980f
Set userdata fix (#180)
Adds user data order bytes to set message
2022-08-30 22:16:08 +02:00
turekt ec1e802faf
Added dynset exprs support (#173)
fixes https://github.com/google/nftables/issues/172

- Rearranged `exprFromMsg` function
- Rearranged limit expr marshaling logic
- Added dynamic flag for sets
- Implemented connlimit
- Added missing constants 
- Added tests
2022-07-29 18:32:59 +02:00
TheDiveO eeaebcf552
add New constructor (with options functions, such as lasting connection)
* Close receiver for lasting netlink connections while defaulting to existing temporary netlink connection usage
* add unit test for New lasting connection, Close and correct default connection handling behavior
* refactor tests to use New constructor
* make Conn mutex un-exported (#159)

fixes issue #157
2022-05-09 13:25:29 +02:00
turekt 76ed01e300
Support for concat set intervals (#155)
Fixes https://github.com/google/nftables/issues/154

Added support for intervals in concat sets 
Added missing constants, Concatenation flag and KeyEnd field to Set type with marshaling support
Added ConcatSetTypeElements function to derive base types from concatenated types
Changed nftDatatypes list to map 
Added tests
2022-04-22 17:12:20 +02:00
Tommie Gannert 16a134723a Tries to fully populate Set.KeyType if it's a simple type.
Set.DataType also gets the full type descriptor. No changes in
behavior for concatenated datatypes.
2021-09-16 16:01:15 +02:00
Tommie Gannert 3a4a2bce5f Fixes masks in set flag parsing.
The NFTA_* constants identify attributes. The result is that, right
now, IsMap == Anonymous.
2021-09-16 16:01:15 +02:00
Tommie Gannert 0360b9d10a Adds all current datatypes for sets.
Based on https://git.netfilter.org/nftables/commit/include/datatype.h?id=cca4c856301caa8959ac98aac5811130bc19512c

It makes more sense to point to datatype.h in the comment since the
actual definitions of these types are scattered throughout src/.

uid_t and gid_t sizes are fixed at 4 bytes currently, but that might
of course change. I couldn't find a good way to make this
dynamic. There are a number of Sizeof* constants in x/sys/unix, so
that's probably the right place to add them.
2021-09-16 16:01:15 +02:00
Zackery Field 9caf4234bf
Report whether set has flag configured (#98) 2020-02-27 08:28:57 +01:00
Serguei Bezverkhi 1c56a1906f Add Dynset expression and unit test (#97)
* Add dynset expression and unit test

Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
2020-02-10 11:14:20 +01:00
Serguei Bezverkhi 9cdc3d048a
Add support for timeouts for set elements and sets (#96)
Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
2020-02-05 11:33:52 +01:00
Leon Vack 327d5c62cd function to create concatenated SetDatatypes (#93)
added function to create concatenated SetDatatypes
2020-01-22 22:37:16 +01:00
Serguei Bezverkhi 88b35b63a9 Add GetSetByName call (#94)
Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
2020-01-21 08:39:40 +01:00
Leon Vack 514aa0c301
stored table passed to GetSets as table in all returned sets 2020-01-14 11:06:46 +01:00
Leon Vack 19eb6eac29
fixed extraHeader in SetAddElements 2020-01-14 11:02:28 +01:00
Serguei Bezverkhi 80a905063c Add set's id to newsetelem message (#89) 2020-01-01 17:05:55 +01:00
Serguei Bezverkhi 756cfa14a8 Fix concatenated key set validation (#83) 2019-12-18 00:02:00 +01:00
Serguei Bezverkhi 4525b500cb Anonymous set creation (#79)
Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
2019-12-05 18:08:48 +01:00
Serguei Bezverkhi 4f16059f2d Composed set (#78) 2019-12-01 10:10:42 +01:00
Serguei Bezverkhi 14f3137cde protect cc.messages from racing (#75)
Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
2019-11-14 16:22:42 +01:00
Maxime Demode e3323c2482 [set] Add FlushSet function. 2019-10-23 15:10:52 +02:00
Minaru d379352a0d [set] Add Integer and Mark datatypes for set elements. (#66) 2019-10-19 08:53:01 +02:00
Serguei Bezverkhi a0a4b3333d Get sets fix (#58)
* lookup dest reg check fix

Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>

* Fix GetSets to detect Verdict Data type

Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
2019-08-31 09:36:43 +02:00
Serguei Bezverkhi 2d823533fe Add Vmap support (#56) 2019-08-28 08:51:13 +02:00
Serguei Bezverkhi 1ad7112fd7 Add support for maps (#55) 2019-08-27 17:52:20 +02:00
Serguei Bezverkhi 579fe47a77 Refactor decoding set elements (#47) 2019-08-13 22:19:49 +02:00
Serguei Bezverkhi 2f48b7d8d8 Additional change to Element to support set intervals (#44) 2019-08-09 19:36:23 +02:00
Serguei Bezverkhi 26de8f0eaa add interval flag support to set (#43)
Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
2019-08-08 07:45:20 +02:00
Serguei Bezverkhi 72bd788b11 Fixes #39 (#40)
Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
2019-07-23 05:12:57 +02:00
Michael Stapelberg 37c3f0e9eb set: desc size carries len(vals), not KeyType.Bytes
fixes #26
2019-07-20 18:35:32 +02:00
Matt Layher a975e10ef9 nftables: update for package netlink constant renames (#13) 2019-03-02 17:04:15 +01:00
Tom 2bb2b66f95 Implement support for anonymous & named sets. 2019-02-11 16:11:27 -08:00