Re: [PATCH nft] create u32_integer type to be used as a key for sets and maps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 26, 2018 at 09:43:06AM +0200, Laura Garcia wrote:
> On Sat, Mar 24, 2018 at 12:47 AM, Duncan Roe <duncan_roe@xxxxxxxxxxxxxxx> wrote:
> > On Wed, Mar 14, 2018 at 10:00:35PM +0100, Laura Garcia Liebana wrote:
> >> Create the new type u32_integer with a fixed size in order to
> >> be used as a key in maps and sets. The type integer cannot be
> >> used as a key cause is a dynamic size type and is used as a
> >> base type of some subtypes.
> >>
> >> Without this patch we obtain the following error:
> >>
> >> Error: unqualified key type integer specified in map definition
> >> add map nftlb mapa { type integer : ipv4_addr; }
> >>                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >>
> >> After this patch, we can use an u32 integer as a key for sets
> >> and maps:
> >>
> >> table ip nftlb {
> >>         map mapa {
> >>                 type u32_integer : ipv4_addr
> >>         }
> >>
> >>         set conjunto {
> >>                 type u32_integer
> >>         }
> >> }
> >>
> >> Signed-off-by: Laura Garcia Liebana <nevola@xxxxxxxxx>
> >> ---
> >> This is the v2 of ("fix integer type size to be used as a key
> >> for sets and maps"), due to this approach fits better with the
> >> current design of nft types than the previous one and avoids
> >> possible side effects.
> >>
> >>  include/datatype.h |  3 +++
> >>  src/datatype.c     | 10 ++++++++++
> >>  2 files changed, 13 insertions(+)
> >>
> >> diff --git a/include/datatype.h b/include/datatype.h
> >> index 3f612e5..7f106cd 100644
> >> --- a/include/datatype.h
> >> +++ b/include/datatype.h
[...]
> > Why do we need an invented type when there is already uint32_t in
> > /usr/include/stdint.h?
>
> Hi Duncan,
>
> Cause the nft parser doesn't understand uint32_t and the way
> that nft sends the types to the kernel requires to specify
> the base type, size, byteorder, etc.
Thanks for the explanation - looks fine then,

Cheers ... Duncan.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux