All of lore.kernel.org
 help / color / mirror / Atom feed
* nftables: defining variables containing ipv6 adresses
@ 2020-05-21 10:27 Thomas Weberstaedt
  2020-05-21 17:29 ` Oliver O'Boyle
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Weberstaedt @ 2020-05-21 10:27 UTC (permalink / raw)
  To: netfilter

Hi,

I am wondering, how may I define IPv6 variables?

The obvious idea:

define IP6PREFIX = fdaa:bbbb:cccc:dddd

produces an error:

/etc/nftables/setup.conf:7:29-29: Error: syntax error,
unexpected colon, expecting newline or semicolon

define IP6PREFIX = fdaa:bbbb:cccc:dddd
                            ^

What would be the proper way to do so? Any documentation on this?

Thanks

Ede

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: nftables: defining variables containing ipv6 adresses
  2020-05-21 10:27 nftables: defining variables containing ipv6 adresses Thomas Weberstaedt
@ 2020-05-21 17:29 ` Oliver O'Boyle
  2020-05-22  4:35   ` Ede Wolf
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver O'Boyle @ 2020-05-21 17:29 UTC (permalink / raw)
  To: Thomas Weberstaedt; +Cc: netfilter

You need to use a valid ipv6 address. E.g.:

define IP6ADDR = 2607:f8b0:400b:80f::2004    <-- a single address with no CIDR
define IP6PREFIX = 2607:f8b0:400b:80f::/64       <-- prefix with CIDR

If you're referencing the IP6PREFIX variable in a set, then you need
to set the interval flag in the set. E.g.:

set IP6PREFIX_SET {
    type ipv6_addr
    flags interval
    elements = {
        $IP6PREFIX
    }
}

otherwise you do not need the interval flag for single addresses:

set IP6ADDR_SET {
    type ipv6_addr
    elements = {
        $IP6ADDR
    }
}

Oliver


On Thu, May 21, 2020 at 6:38 AM Thomas Weberstaedt
<thomas.weberstaedt@nebelschwaden.de> wrote:
>
> Hi,
>
> I am wondering, how may I define IPv6 variables?
>
> The obvious idea:
>
> define IP6PREFIX = fdaa:bbbb:cccc:dddd
>
> produces an error:
>
> /etc/nftables/setup.conf:7:29-29: Error: syntax error,
> unexpected colon, expecting newline or semicolon
>
> define IP6PREFIX = fdaa:bbbb:cccc:dddd
>                             ^
>
> What would be the proper way to do so? Any documentation on this?
>
> Thanks
>
> Ede



-- 
:o@>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: nftables: defining variables containing ipv6 adresses
  2020-05-21 17:29 ` Oliver O'Boyle
@ 2020-05-22  4:35   ` Ede Wolf
  0 siblings, 0 replies; 3+ messages in thread
From: Ede Wolf @ 2020-05-22  4:35 UTC (permalink / raw)
  Cc: netfilter

Thanks very much. Works now. I would not have expected nftables to do a 
semantical check, I believed, I'd had a syntax error somewhere and had 
put the cidr in the rule, not the variable definition

Ede


Am 21.05.20 um 19:29 schrieb Oliver O'Boyle:
> You need to use a valid ipv6 address. E.g.:
> 
> define IP6ADDR = 2607:f8b0:400b:80f::2004    <-- a single address with no CIDR
> define IP6PREFIX = 2607:f8b0:400b:80f::/64       <-- prefix with CIDR
> 
> If you're referencing the IP6PREFIX variable in a set, then you need
> to set the interval flag in the set. E.g.:
> 
> set IP6PREFIX_SET {
>      type ipv6_addr
>      flags interval
>      elements = {
>          $IP6PREFIX
>      }
> }
> 
> otherwise you do not need the interval flag for single addresses:
> 
> set IP6ADDR_SET {
>      type ipv6_addr
>      elements = {
>          $IP6ADDR
>      }
> }
> 
> Oliver
> 
> 
> On Thu, May 21, 2020 at 6:38 AM Thomas Weberstaedt
> <thomas.weberstaedt@nebelschwaden.de> wrote:
>>
>> Hi,
>>
>> I am wondering, how may I define IPv6 variables?
>>
>> The obvious idea:
>>
>> define IP6PREFIX = fdaa:bbbb:cccc:dddd
>>
>> produces an error:
>>
>> /etc/nftables/setup.conf:7:29-29: Error: syntax error,
>> unexpected colon, expecting newline or semicolon
>>
>> define IP6PREFIX = fdaa:bbbb:cccc:dddd
>>                              ^
>>
>> What would be the proper way to do so? Any documentation on this?
>>
>> Thanks
>>
>> Ede
> 
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-22  4:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-21 10:27 nftables: defining variables containing ipv6 adresses Thomas Weberstaedt
2020-05-21 17:29 ` Oliver O'Boyle
2020-05-22  4:35   ` Ede Wolf

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.