Re: [libnftnl PATCH v2] utils: Add helpers for interface name wildcards

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

 



On Wed, Jul 16, 2025 at 12:01:55PM +0200, Phil Sutter wrote:
> Hi,
> 
> On Wed, Jul 16, 2025 at 11:44:59AM +0200, Florian Westphal wrote:
> > Phil Sutter <phil@xxxxxx> wrote:
> > >  #include <string.h>
> > >  #include <stdlib.h>
> > > +#include <libmnl/libmnl.h>
> > 
> > Why is this include needed?
> 
> Because of:
> 
> | In file included from udata.c:9:
> | ../include/utils.h:88:40: warning: 'struct nlattr' declared inside parameter list will not be visible outside of this definition or declaration
> |    88 | const char *mnl_attr_get_ifname(struct nlattr *attr);
> |       |                                        ^~~~~~

I think this helper belongs to src/netlink.c

> 
> > >  #include <libnftnl/common.h>
> > >  
> > >  #include "config.h"
> > > @@ -83,4 +84,7 @@ int nftnl_fprintf(FILE *fpconst, const void *obj, uint32_t cmd, uint32_t type,
> > >  int nftnl_set_str_attr(const char **dptr, uint32_t *flags,
> > >  		       uint16_t attr, const void *data, uint32_t data_len);
> > >  
> > > +void mnl_attr_put_ifname(struct nlmsghdr *nlh, int attr, const char *ifname);
> > > +const char *mnl_attr_get_ifname(struct nlattr *attr);
> > > +
> > 
> > nftnl_attr_put_ifname, nftnl_attr_get_ifname?
> > Using mnl_ prefix seems wrong, that should be reserved for libmnl.
> 
> I chose the prefix since they 1:1 replace calls to mnl_attr_put_strz() and
> mnl_attr_get_str(). You're right, since they are implemented by libnftnl the
> prefix is wrong. I was a bit undecided whether to put them into libmnl, but
> they are a bit too specific for that. Will fix the prefix and respin!

I think they are fine in nftables only.




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

  Powered by Linux