Signed-off-by: Phil Sutter <p...@nwl.cc>
---
 misc/ss.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/misc/ss.c b/misc/ss.c
index e82c416b5fa72..8439f473d7f7b 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -655,21 +655,6 @@ static unsigned long long cookie_sk_get(const uint32_t 
*cookie)
        return (((unsigned long long)cookie[1] << 31) << 1) | cookie[0];
 }
 
-static const char *sstate_name[] = {
-       "UNKNOWN",
-       [SS_ESTABLISHED] = "ESTAB",
-       [SS_SYN_SENT] = "SYN-SENT",
-       [SS_SYN_RECV] = "SYN-RECV",
-       [SS_FIN_WAIT1] = "FIN-WAIT-1",
-       [SS_FIN_WAIT2] = "FIN-WAIT-2",
-       [SS_TIME_WAIT] = "TIME-WAIT",
-       [SS_CLOSE] = "UNCONN",
-       [SS_CLOSE_WAIT] = "CLOSE-WAIT",
-       [SS_LAST_ACK] = "LAST-ACK",
-       [SS_LISTEN] =   "LISTEN",
-       [SS_CLOSING] = "CLOSING",
-};
-
 static const char *sctp_sstate_name[] = {
        [SCTP_STATE_CLOSED] = "CLOSED",
        [SCTP_STATE_COOKIE_WAIT] = "COOKIE_WAIT",
@@ -815,6 +800,20 @@ static const char *proto_name(int protocol)
 static void sock_state_print(struct sockstat *s)
 {
        const char *sock_name;
+       static const char * const sstate_name[] = {
+               "UNKNOWN",
+               [SS_ESTABLISHED] = "ESTAB",
+               [SS_SYN_SENT] = "SYN-SENT",
+               [SS_SYN_RECV] = "SYN-RECV",
+               [SS_FIN_WAIT1] = "FIN-WAIT-1",
+               [SS_FIN_WAIT2] = "FIN-WAIT-2",
+               [SS_TIME_WAIT] = "TIME-WAIT",
+               [SS_CLOSE] = "UNCONN",
+               [SS_CLOSE_WAIT] = "CLOSE-WAIT",
+               [SS_LAST_ACK] = "LAST-ACK",
+               [SS_LISTEN] =   "LISTEN",
+               [SS_CLOSING] = "CLOSING",
+       };
 
        switch (s->local.family) {
        case AF_UNIX:
-- 
2.10.0

Reply via email to