Skip to content

Conversation

@jdelic
Copy link
Contributor

@jdelic jdelic commented Mar 17, 2025

What does this PR do?

Fixes #67882

The nftables state just sends its kwargs to the nftables module. This in turn is currently missing support for ipv6 icmp packet types (icmpv6). This means that currently Salt cannot configure a firewall in such a way that it allows pings, for example. This small patch remedies that.

Previous Behavior

The following was impossible:

icmp-recv-ipv4:
    nftables.append:
        - table: filter
        - family: ip4
        - chain: input
        - jump: accept
        - proto: icmp
        - icmp-type: echo-reply,destination-unreachable,source-quench,redirect,echo-request,time-exceeded,parameter-problem,timestamp-request,timestamp-reply,info-request,info-reply,address-mask-request,address-mask-reply,router-advertisement,router-solicitation
        - order: 4
        - save: True
        - require:
            - pkg: nftables


icmp-recv-ipv6:
    nftables.append:
        - table: filter
        - family: ip6
        - chain: input
        - jump: accept
        - proto: icmp
        # This wasn't supported before --v
        - icmpv6-type: echo-reply,echo-request,nd-router-advert,nd-neighbor-solicit,nd-neighbor-advert
        - order: 4
        - save: True
        - require:
              - pkg: nftables

New Behavior

The above works now.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

I have not added any test for the above.

  1. The current icmp-type functionality is untested
  2. The current tests don't really test anything. They test that the module returns a state comment which fits the expectation and mock cmd.run. So nft is never executed by the tests, so you'd never know if any of this code produced an invalid rule. I do not have the time to contribute to Salt to essentially rewrite the nftables module, so this will have to live without tests.
  3. The current documentation isn't really explaining the list of available parameters from the module. Neither does the module. Both need improvement, as do the tests, but this PR is about simply adding support for icmpv6.

Commits signed with GPG?

Yes

@jdelic jdelic requested a review from a team as a code owner March 17, 2025 14:06
@jdelic
Copy link
Contributor Author

jdelic commented Mar 17, 2025

Closed this PR as I accidentally filed it against master instead of 3007.x and opened #67884 instead.

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.

[BUG] nftables module is missing support for icmpv6-types

1 participant