Re: [libnftnl PATCH] src/utils: Add a common dev_array parser

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

 



On Wed, Oct 16, 2024 at 06:42:23PM +0200, Phil Sutter wrote:
> Parsing of dev_array fields in flowtable and chain are identical, merge
> them into a shared function nftnl_parse_devs() which does a quick scan
> through the nested attributes to check validity and calculate required
> array size instead of calling realloc() as needed.
> 
> This required to align structs nftnl_chain and nftnl_flowtable field
> dev_array_len types, though uint32_t should match the size of int on
> both 32 and 64 bit architectures.

Maybe go the extra mile and add an internal object for string arrays:

struct nftnl_str_array {
        const char      **array;
        uint32_t        len;
};

and use it in chain and flowtable?




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux