Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nfnetlink nft_rule_msg regression #575

Closed
liam-mcb opened this issue Jan 6, 2019 · 3 comments
Closed

nfnetlink nft_rule_msg regression #575

liam-mcb opened this issue Jan 6, 2019 · 3 comments

Comments

@liam-mcb
Copy link
Contributor

liam-mcb commented Jan 6, 2019

nft_rule_msg in netlink/nfnetlink/nftsocket.py no longer generates the correct netlink message.
#524 (specifically 254fc3e) changed nla array encoding so that the header type increments with each element.
The nfnetlink NFTA_RULE_EXPRESSIONS message requires that the header type remain as 1 for all elements in the array.

Following code should add a rule but doesn't.

import pyroute2
from pyroute2.nftables.expressions import ipv4addr, verdict
nft = pyroute2.NFTables()
nft.table('add', name='test0')
nft.chain('add', table='test0', name='test_chain0')
nft.rule('add',
         table='test0',
         chain='test_chain0',
         expressions=(ipv4addr(src='192.168.0.0/24'),
                      verdict(code=1)))
@svinota svinota added the bug label Feb 9, 2019
@svinota
Copy link
Owner

svinota commented Feb 9, 2019

Thanks! Investigating

svinota added a commit that referenced this issue Feb 28, 2019
svinota added a commit that referenced this issue Feb 28, 2019
@svinota
Copy link
Owner

svinota commented Feb 28, 2019

Should work now, pls check

@liam-mcb
Copy link
Contributor Author

liam-mcb commented Mar 2, 2019

It's fixed. Thanks.

@svinota svinota closed this as completed Mar 2, 2019
@svinota svinota added the fixed label Mar 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants