tcp: use C99 initializers in new_state[]
authorEric Dumazet <edumazet@google.com>
Tue, 24 Mar 2015 22:58:53 +0000 (15:58 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 25 Mar 2015 01:16:29 +0000 (21:16 -0400)
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp.c

index 62f38428279aaaecc971bd753d6ae957d3f38c35..dbd51cefaf023a452894055d1e50d78218aedee9 100644 (file)
@@ -1913,18 +1913,19 @@ EXPORT_SYMBOL_GPL(tcp_set_state);
 
 static const unsigned char new_state[16] = {
   /* current state:        new state:      action:     */
-  /* (Invalid)         */ TCP_CLOSE,
-  /* TCP_ESTABLISHED   */ TCP_FIN_WAIT1 | TCP_ACTION_FIN,
-  /* TCP_SYN_SENT      */ TCP_CLOSE,
-  /* TCP_SYN_RECV      */ TCP_FIN_WAIT1 | TCP_ACTION_FIN,
-  /* TCP_FIN_WAIT1     */ TCP_FIN_WAIT1,
-  /* TCP_FIN_WAIT2     */ TCP_FIN_WAIT2,
-  /* TCP_TIME_WAIT     */ TCP_CLOSE,
-  /* TCP_CLOSE         */ TCP_CLOSE,
-  /* TCP_CLOSE_WAIT    */ TCP_LAST_ACK  | TCP_ACTION_FIN,
-  /* TCP_LAST_ACK      */ TCP_LAST_ACK,
-  /* TCP_LISTEN                */ TCP_CLOSE,
-  /* TCP_CLOSING       */ TCP_CLOSING,
+  [0 /* (Invalid) */]  = TCP_CLOSE,
+  [TCP_ESTABLISHED]    = TCP_FIN_WAIT1 | TCP_ACTION_FIN,
+  [TCP_SYN_SENT]       = TCP_CLOSE,
+  [TCP_SYN_RECV]       = TCP_FIN_WAIT1 | TCP_ACTION_FIN,
+  [TCP_FIN_WAIT1]      = TCP_FIN_WAIT1,
+  [TCP_FIN_WAIT2]      = TCP_FIN_WAIT2,
+  [TCP_TIME_WAIT]      = TCP_CLOSE,
+  [TCP_CLOSE]          = TCP_CLOSE,
+  [TCP_CLOSE_WAIT]     = TCP_LAST_ACK  | TCP_ACTION_FIN,
+  [TCP_LAST_ACK]       = TCP_LAST_ACK,
+  [TCP_LISTEN]         = TCP_CLOSE,
+  [TCP_CLOSING]                = TCP_CLOSING,
+  [TCP_NEW_SYN_RECV]   = TCP_CLOSE,    /* should not happen ! */
 };
 
 static int tcp_close_state(struct sock *sk)