Comments (2)
OK, OK, my mistake.
> from pyroute2.nftables.main import NFTables
> from pyroute2.common import hexload
> from pyroute2.nftables.expressions import genex
> conmark = genex('target', {'name': 'CONNMARK', 'rev': 2, 'info': hexload('00:00:00:00:ff:ff:ff:ff:ff:ff:ff:ff:00:00:02:00')})
> print(conmark)
{'attrs': [('NFTA_EXPR_NAME', 'target'), ('NFTA_EXPR_DATA', {'attrs': [('NFTA_TARGET_NAME', 'CONNMARK'), ('NFTA_TARGET_REV', 2), ('NFTA_TARGET_INFO', b'\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x02\x00')]})]}
> nft = NFTables(nfgen_family=2)
> nft.begin()
> nft.rule('add', table='mangle', chain='OUTPUT', expressions=((conmark, ), ) )
The problem was with expressions
attribute, it requires tuple in tuple (list in list).
from pyroute2.
Oh thanks. This part is missing documentation, and it's so complicated that I'm not sure how to start with :)
So thanks for such cases, they definitely will help me with documenting the NFTables API
from pyroute2.
Related Issues (20)
- Can't change interface for the route using NDB
- NetNS does not handle fd parameters HOT 3
- Weird behaviour when calling del_ip with no arguments twice in a row
- Full route on with wireguard wont work
- Unable to use ndb when only installing that package on Ubuntu 22.04
- wireguard: missing native netns support (?)
- compat - object is not callable with ipdb_interfaces_view() HOT 1
- Feature request: IPVS support HOT 1
- How to create XFRM interfaces HOT 2
- NFTables: Add Sets of type "inet_service"
- Tc cannot handle rate values above ~34 Gbit HOT 6
- get_nested() crashes on link kind = "erspan" (element of GRE)
- 0.7.10 tag missing HOT 4
- python 3.12 covered in CI but not really listed everywhere HOT 1
- NDB schema export doesn't work with SQLite HOT 3
- NDB: unicast FDB entry missing in NDB dump, but present in dump via IPRoute HOT 3
- How get named counter in pyroute2
- Unconditionally importing readline causes curses resize handler to break HOT 6
- source package for 0.7.11 missing on pypi HOT 2
- IPRoute decoding exceptions on linux kernel 6.6 (IFLA_INET6_ADDR_GEN_MODE) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyroute2.