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

Macros for ICMP and ICMPv6 payloads #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jwhb
Copy link

@jwhb jwhb commented Mar 15, 2022

This MR adds macros to use payload instructions for ICMP and ICMPv6.

This allows to do:

/// IPv4
rule.add_expr(&nft_expr!(payload icmp icmptype));
rule.add_expr(&nft_expr!(cmp == 8_u8));

rule.add_expr(&nft_expr!(payload icmp code));
rule.add_expr(&nft_expr!(cmp == 7_u8));

/// IPv6
rule.add_expr(&nft_expr!(payload icmpv6 icmptype));
rule.add_expr(&nft_expr!(cmp == 133_u8));

rule.add_expr(&nft_expr!(payload icmpv6 code));
rule.add_expr(&nft_expr!(cmp == 129_u8));

For ICMP type the keyword is icmptype. The keyword type can not be used, as it is a reserved keyword in Rust.


This change is Reviewable

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

Successfully merging this pull request may close these issues.

1 participant