On Thu, Dec 20, 2018 at 04:09:17PM +0100, Phil Sutter wrote:
[...]
> +     if (chain) {
> +             c = nftnl_chain_list_lookup_byname(list, chain);
> +             if (!c) {
> +                     errno = ENOENT;
> +                     return 0;
> +             }
> +             d.builtin_err = -2;
> +             ret = __nft_chain_user_del(c, &d);
> +             if (ret == -2)

We can probably do an upfront check for built-in chain to avoid this
special code? __nft_chain_user_del() is only called from
nft_chain_user_del().

> +                     errno = EINVAL;
> +             goto out;
>       }
>  
> +     ret = nftnl_chain_list_foreach(list, __nft_chain_user_del, &d);
> +out:
>       /* the core expects 1 for success and 0 for error */
>       return ret == 0 ? 1 : 0;
>  }
> -- 
> 2.19.0
> 

Reply via email to