Linux Netfilter discussions
 help / color / mirror / Atom feed
* device list reversed
@ 2021-04-11 13:07 Frank Wunderlich
  2021-04-20 11:28 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Wunderlich @ 2021-04-11 13:07 UTC (permalink / raw)
  To: netfilter

Hi,

i import ruleset by file with a devicelist (flowtable)

devices = { wan, lan0, lan3 }

and if i do a nft list ruleset, it gets reversed

devices = { lan3, lan0, wan }

imho this is a cosmetic thing, but strange anyway

took a look in ./libnftnl/src/flowtable.c but it seems the loop is always done in forward way

any idea why this happen?

regards Frank


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: device list reversed
  2021-04-11 13:07 device list reversed Frank Wunderlich
@ 2021-04-20 11:28 ` Pablo Neira Ayuso
  2021-04-20 11:47   ` Frank Wunderlich
  0 siblings, 1 reply; 3+ messages in thread
From: Pablo Neira Ayuso @ 2021-04-20 11:28 UTC (permalink / raw)
  To: Frank Wunderlich; +Cc: netfilter

Hi,

On Sun, Apr 11, 2021 at 03:07:41PM +0200, Frank Wunderlich wrote:
> Hi,
> 
> i import ruleset by file with a devicelist (flowtable)
> 
> devices = { wan, lan0, lan3 }
> 
> and if i do a nft list ruleset, it gets reversed
> 
> devices = { lan3, lan0, wan }
> 
> imho this is a cosmetic thing, but strange anyway
> 
> took a look in ./libnftnl/src/flowtable.c but it seems the loop is always done in forward way
> 
> any idea why this happen?

Each device is represented as a hook, and hook are registered using
list_add() IIRC, which is reversing the order.

Probably just sort device names alphanumerically?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: device list reversed
  2021-04-20 11:28 ` Pablo Neira Ayuso
@ 2021-04-20 11:47   ` Frank Wunderlich
  0 siblings, 0 replies; 3+ messages in thread
From: Frank Wunderlich @ 2021-04-20 11:47 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter

Am 20. April 2021 13:28:04 MESZ schrieb Pablo Neira Ayuso <pablo@netfilter.org>:
>On Sun, Apr 11, 2021 at 03:07:41PM +0200, Frank Wunderlich wrote:
>> Hi,
>> 
>> i import ruleset by file with a devicelist (flowtable)
>> 
>> devices = { wan, lan0, lan3 }
>> 
>> and if i do a nft list ruleset, it gets reversed
>> 
>> devices = { lan3, lan0, wan }

>Each device is represented as a hook, and hook are registered using
>list_add() IIRC, which is reversing the order.

Should list_add not append (instead of insert at 0) and if devices read from left to right it should not reverse?

>Probably just sort device names alphanumerically?

From user pov i expect the order i have used for importing. As far as i understand internally order does not matter,only if device is listed or not. Maybe reversing it (again) on printing? Maybe user wants wan first and lan-ports after it.

But as far as i've wrote...it's cosmetic...just stumbled over it
Hi Pablo,
regards Frank

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-20 11:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-11 13:07 device list reversed Frank Wunderlich
2021-04-20 11:28 ` Pablo Neira Ayuso
2021-04-20 11:47   ` Frank Wunderlich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox