All of lore.kernel.org
 help / color / mirror / Atom feed
* ss filter problem
@ 2016-03-29 19:32 Phil Sutter
  2016-03-29 20:05 ` Vadim Kochan
  2016-04-13 20:07 ` [iproute PATCH 0/2] Minor ss filter fix and review Phil Sutter
  0 siblings, 2 replies; 6+ messages in thread
From: Phil Sutter @ 2016-03-29 19:32 UTC (permalink / raw)
  To: Vadim Kochan; +Cc: Stephen Hemminger, netdev

Hi,

I am trying to fix a bug in ss filter code, but feel quite lost right
now. The issue is this:

| ss -nl -f inet '( sport = :22 )'

prints not only listening sockets (as requested by -l flag), but
established ones as well (reproduce by opening ssh connection to
127.0.0.1 before calling above).

In contrast, the following both don't show the established sockets:

| ss -nl '( sport = :22 )'
| ss -nl -f inet

My investigation led me to see that current_filter.states is altered
after ssfilter_parse() returns, and using gdb with a watchpoint I was
able to identify parse_hostcond() to be the bad guy: In line 1560, it
calls filter_af_set() after checking for fam != AF_UNSPEC (which is the
case, since fam = preferred_family and the latter is changed to AF_INET
when parsing '-f inet' parameter).

This whole jumping back and forth confuses me quite effectively. Since
you did some fixes in the past already, are you possibly able to point
out where/how this tiny mess has to be fixed?

I guess in an ideal world we would translate '-l' to 'state listen', '-f
inet' to 'src inet:*' and pass everything ANDed together to
ssfilter_parse(). Or maybe that would make things even worse. ;)

Cheers, Phil

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

end of thread, other threads:[~2016-04-19 14:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-29 19:32 ss filter problem Phil Sutter
2016-03-29 20:05 ` Vadim Kochan
2016-04-13 20:07 ` [iproute PATCH 0/2] Minor ss filter fix and review Phil Sutter
2016-04-13 20:07   ` [iproute PATCH 1/2] ss: Drop silly assignment Phil Sutter
2016-04-13 20:07   ` [iproute PATCH 2/2] ss: Fix accidental state filter override Phil Sutter
2016-04-19 14:57   ` [iproute PATCH 0/2] Minor ss filter fix and review Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.