|
|
049c96 |
From 603d0ffb9ec9200de2395200dbc50ba762de6038 Mon Sep 17 00:00:00 2001
|
|
|
049c96 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
049c96 |
Date: Mon, 30 May 2016 16:46:58 +0200
|
|
|
049c96 |
Subject: [PATCH] ss: Fix accidental state filter override
|
|
|
049c96 |
|
|
|
049c96 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1318005
|
|
|
049c96 |
Upstream Status: iproute2.git commit e56a959e550f4
|
|
|
049c96 |
|
|
|
049c96 |
commit e56a959e550f424023ebf3ebb8437f214944a245
|
|
|
049c96 |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
049c96 |
Date: Wed Apr 13 22:07:05 2016 +0200
|
|
|
049c96 |
|
|
|
049c96 |
ss: Fix accidental state filter override
|
|
|
049c96 |
|
|
|
049c96 |
Passing a filter expression and selecting an address family using the
|
|
|
049c96 |
'-f' flag would overwrite the state filter by accident. Therefore
|
|
|
049c96 |
calling e.g. 'ss -nl -f inet '(sport = :22)' would not only print
|
|
|
049c96 |
listening sockets (as requested by '-l' flag) but connected ones, as
|
|
|
049c96 |
well.
|
|
|
049c96 |
|
|
|
049c96 |
Fix this by reusing the formerly ineffective call to filter_states_set()
|
|
|
049c96 |
to restore the state filter as it was before the call to
|
|
|
049c96 |
filter_af_set().
|
|
|
049c96 |
|
|
|
049c96 |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
049c96 |
---
|
|
|
049c96 |
misc/ss.c | 3 ++-
|
|
|
049c96 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
049c96 |
|
|
|
049c96 |
diff --git a/misc/ss.c b/misc/ss.c
|
|
|
049c96 |
index ce7fa82..c385d47 100644
|
|
|
049c96 |
--- a/misc/ss.c
|
|
|
049c96 |
+++ b/misc/ss.c
|
|
|
049c96 |
@@ -1546,9 +1546,10 @@ void *parse_hostcond(char *addr, bool is_port)
|
|
|
049c96 |
|
|
|
049c96 |
out:
|
|
|
049c96 |
if (fam != AF_UNSPEC) {
|
|
|
049c96 |
+ int states = f->states;
|
|
|
049c96 |
f->families = 0;
|
|
|
049c96 |
filter_af_set(f, fam);
|
|
|
049c96 |
- filter_states_set(f, 0);
|
|
|
049c96 |
+ filter_states_set(f, states);
|
|
|
049c96 |
}
|
|
|
049c96 |
|
|
|
049c96 |
res = malloc(sizeof(*res));
|
|
|
049c96 |
--
|
|
|
049c96 |
1.8.3.1
|
|
|
049c96 |
|