All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Dario Alcocer <dalcocer@helixd.com>
Cc: netfilter@vger.kernel.org
Subject: UTF8 for non-breaking space reports junk in nftables [was Re: Rule error using ct helper for TFTP]
Date: Wed, 19 Apr 2023 10:30:13 +0200	[thread overview]
Message-ID: <ZD+mlbFYeLpj0fs+@calendula> (raw)
In-Reply-To: <20988da8-f5d0-063d-0507-5472772b0b18@helixd.com>

Hi,

On Wed, Apr 19, 2023 at 01:14:23AM -0700, Dario Alcocer wrote:
> The nftables utility fails when using a "ct helper" rule for TFTP:
> 
> # /usr/sbin/nft -f /usr/share/netfw/netfw.conf
> /usr/share/netfw/netfw.conf:32:30-33: Error: Could not process rule: No such
> file or directory
>                  udp dport 69 ct helper set tftp
> ^^^^
> 
> How should nftables be configured so TFTP is allowed with a default-deny
> firewall?
> 
> For the record, I'm using nftables 1.0.2 built for an i.MX8 embedded
> platform running Linux 5.15.71.
> 
> The complete ruleset is:
> 
> flush ruleset
> table inet filter {
>         ct helper tftp {
>                 type "tftp" protocol udp;
>                 l3proto inet
>         }
>         chain input {
>                 type filter hook input priority filter; policy drop;
>                 ct state invalid drop comment "early drop of invalid
> packets"
>                 ct state established,related accept
>                 iif lo accept
>                 iif != lo ip daddr 127.0.0.1/8 drop
>                 iif != lo ip6 daddr ::1/128 drop
>                 ip protocol icmp accept
>                 ip6 nexthdr icmpv6 accept
>                 udp dport 69 ct helper set tftp
>         }
>         chain forward {
>                 type filter hook forward priority 0; policy drop;
>         }
> }

Changing topic.

Uh, copy and paste of this shows you use UTF8 for non-breaking space.

I have already seen this on several websites, the copy and paste of
the nftables snippets does not work because of this.

Typical error is:

x.nft:3:1-1: Error: syntax error, unexpected junk
        ct helper tftp {
^

Easy to fix with

sed -i 's/\xC2\xA0/ /g' myfile.

      reply	other threads:[~2023-04-19  8:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-19  8:14 Rule error using ct helper for TFTP Dario Alcocer
2023-04-19  8:30 ` Pablo Neira Ayuso [this message]

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=ZD+mlbFYeLpj0fs+@calendula \
    --to=pablo@netfilter.org \
    --cc=dalcocer@helixd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.