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

query icmp ype from rule #310

Open
dmzoneill opened this issue Sep 3, 2020 · 1 comment
Open

query icmp ype from rule #310

dmzoneill opened this issue Sep 3, 2020 · 1 comment

Comments

@dmzoneill
Copy link

dmzoneill commented Sep 3, 2020

Hi,

I have the following rules:

ACCEPT icmp -- 10.246.0.0/16 10.255.253.4 icmptype 8 state NEW,RELATED,ESTABLISHED
ACCEPT tcp -- 10.246.0.0/16 10.255.253.4 tcp dpt:22 ctstate NEW,ESTABLISHED
ACCEPT all -- 10.246.0.0/16 10.255.253.4 state RELATED,ESTABLISHED
DROP all -- 10.246.0.0/16 10.255.253.4

how do you query icmpttype =8 from the rule?
Cant see it anywhere, and there is no documentation. related to it.

also, when i iterate the rules in a chain 'all' returns are 'ip'.
and 'icmp' returns as 'ip'.

Whilst i understand the underlying network layer 3.
Its not consistent with the iptables command output.
any feedback appreciated.

for chain in table.chains:
for rule in chain.rules:
if hasattr(rule, "protocol"):
logging.info("???: " + rule.get_protocol())

???: ip
???: tcp
???: ip
???: ip

thank you

@jllorente
Copy link
Collaborator

Try using the "dump_table" function to see what the internals of the iptc rules are:
https://github.com/ldx/python-iptables/blob/master/README.md#high-level-abstractions

Paste here the output :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants