On Thu, Aug 03, 2023 at 09:35:24PM +0200, Thomas Haller wrote: > Similar to the existing Nftables.{get,set}_debug() API. > > Only notable (internal) difference is that nft_ctx_input_set_flags() > returns the old value already, so we don't need to call > Nftables.get_input() first. > > The benefit of this API, is that it follows the existing API for debug > flags. Also, when future flags are added it requires few changes to the > python code. > > The disadvantage is that it looks different from the underlying C API, > which is confusing when reading the C API. Also, it's a bit cumbersome > to reset only one flag. For example: > > def _drop_flag_foo(flag): > if isinstance(flag, int): > return flag & ~FOO_NUM > if flag == 'foo': > return 0 > return flag > > ctx.set_input(_drop_flag_foo(v) for v in ctx.get_input()) IMO the name is too short. While I find it works with debug ("set_debug" as in "enable_debugging") but with input I expect something to follow. So I suggest renaming to (get|set)_input_flags(), similar to __(get|set)_output_flag() (which get/set a single flag instead of multiple). Cheers, Phil