netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Edward Dickson <edickson@hudson-trading.com>
To: netfilter@vger.kernel.org
Subject: [nftables] Multiple reject withs in a single rule
Date: Fri, 24 Nov 2023 14:57:09 +0000	[thread overview]
Message-ID: <CALqmkGz7HqTeAvyZwJDTcZsuSUVi6usAD8P6XwTnfMxzBSs=Fw@mail.gmail.com> (raw)

Hello,

I am running nftables v0.9.8 and am aiming to create a single
rejection rule which specifies multiple rejection types for different
protocols.

Something like: "reject with tcp reset with icmpx type admin-prohibited".

However when I've tried this, nftables throws an error:
Error: syntax error, unexpected with, expecting end of file or newline
or semicolon
add rule inet filter output reject with tcp reset with icmpx type
admin-prohibited

 ^^^^ (under the second with)

Error: Statement after terminal statement has no effect
add rule inet filter output reject with tcp reset reject with icmpx
type admin-prohibited
                                      ~~~~~~ (under first reject)
^^^^^^ (under the second reject)


I am currently using two rules which covers TCP, ICMP and anything
else, but would be better as a single rule:
    add rule inet filter output meta l4proto tcp reject with tcp reset
    add rule inet filter output reject with icmpx type admin-prohibited

But this would be better as a single rule, as the duplicate similar
rules create complexity and duplication.

Is there a way to specify multiple rejection types in a single nftables rule?

Kind regards,
Edward

             reply	other threads:[~2023-11-24 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 14:57 Edward Dickson [this message]
2023-11-24 17:03 ` [nftables] Multiple reject withs in a single rule Reindl Harald
2024-02-01 17:24 ` Kerin Millar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALqmkGz7HqTeAvyZwJDTcZsuSUVi6usAD8P6XwTnfMxzBSs=Fw@mail.gmail.com' \
    --to=edickson@hudson-trading.com \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).