MINOR: tcp: replace tcp_src_to_stktable_key with addr_to_stktable_key

Make it more obvious that this function does not depend on any knowledge
of the session. This is important to plan for TCP rules that can run on
connection without any initialized session yet.
diff --git a/include/proto/proto_tcp.h b/include/proto/proto_tcp.h
index 5b6bf44..1a1dcfa 100644
--- a/include/proto/proto_tcp.h
+++ b/include/proto/proto_tcp.h
@@ -39,19 +39,19 @@
 int tcp_exec_req_rules(struct session *s);
 int smp_fetch_rdp_cookie(struct proxy *px, struct session *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp);
 
-/* Converts the TCP source address to a stick_table key usable for table
+/* Converts the INET/INET6 source address to a stick_table key usable for table
  * lookups. Returns either NULL if the source cannot be converted (eg: not
  * IPv4) or a pointer to the converted result in static_table_key in the
  * appropriate format (IP).
  */
-static inline struct stktable_key *tcp_src_to_stktable_key(struct session *s)
+static inline struct stktable_key *addr_to_stktable_key(struct sockaddr_storage *addr)
 {
-	switch (s->si[0].conn.addr.from.ss_family) {
+	switch (addr->ss_family) {
 	case AF_INET:
-		static_table_key.key = (void *)&((struct sockaddr_in *)&s->si[0].conn.addr.from)->sin_addr;
+		static_table_key.key = (void *)&((struct sockaddr_in *)addr)->sin_addr;
 		break;
 	case AF_INET6:
-		static_table_key.key = (void *)&((struct sockaddr_in6 *)&s->si[0].conn.addr.from)->sin6_addr;
+		static_table_key.key = (void *)&((struct sockaddr_in6 *)addr)->sin6_addr;
 		break;
 	default:
 		return NULL;
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index b61d87e..af9dbf9 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -839,7 +839,7 @@
 					 * to consider rule->act_prm->trk_ctr.type.
 					 */
 					t = rule->act_prm.trk_ctr.table.t;
-					ts = stktable_get_entry(t, tcp_src_to_stktable_key(s));
+					ts = stktable_get_entry(t, addr_to_stktable_key(&s->si[0].conn.addr.from));
 					if (ts) {
 						session_track_stkctr1(s, t, ts);
 						if (s->fe != s->be)
@@ -855,7 +855,7 @@
 					 * to consider rule->act_prm->trk_ctr.type.
 					 */
 					t = rule->act_prm.trk_ctr.table.t;
-					ts = stktable_get_entry(t, tcp_src_to_stktable_key(s));
+					ts = stktable_get_entry(t, addr_to_stktable_key(&s->si[0].conn.addr.from));
 					if (ts) {
 						session_track_stkctr2(s, t, ts);
 						if (s->fe != s->be)
@@ -1009,7 +1009,7 @@
 					 * to consider rule->act_prm->trk_ctr.type.
 					 */
 					t = rule->act_prm.trk_ctr.table.t;
-					ts = stktable_get_entry(t, tcp_src_to_stktable_key(s));
+					ts = stktable_get_entry(t, addr_to_stktable_key(&s->si[0].conn.addr.from));
 					if (ts)
 						session_track_stkctr1(s, t, ts);
 				}
@@ -1022,7 +1022,7 @@
 					 * to consider rule->act_prm->trk_ctr.type.
 					 */
 					t = rule->act_prm.trk_ctr.table.t;
-					ts = stktable_get_entry(t, tcp_src_to_stktable_key(s));
+					ts = stktable_get_entry(t, addr_to_stktable_key(&s->si[0].conn.addr.from));
 					if (ts)
 						session_track_stkctr2(s, t, ts);
 				}
diff --git a/src/session.c b/src/session.c
index 774a8a3..db13fc6 100644
--- a/src/session.c
+++ b/src/session.c
@@ -2369,7 +2369,7 @@
 {
 	struct stktable_key *key;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;
 
@@ -2429,7 +2429,7 @@
 {
 	struct stktable_key *key;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;
 
@@ -2490,7 +2490,7 @@
 {
 	struct stktable_key *key;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;
 
@@ -2546,7 +2546,7 @@
 {
 	struct stktable_key *key;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;
 
@@ -2607,7 +2607,7 @@
 {
 	struct stktable_key *key;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;
 
@@ -2627,7 +2627,7 @@
 	struct stktable_key *key;
 	void *ptr;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;
 
@@ -2696,7 +2696,7 @@
 {
 	struct stktable_key *key;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;
 
@@ -2752,7 +2752,7 @@
 {
 	struct stktable_key *key;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;
 
@@ -2813,7 +2813,7 @@
 {
 	struct stktable_key *key;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;
 
@@ -2869,7 +2869,7 @@
 {
 	struct stktable_key *key;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;
 
@@ -2930,7 +2930,7 @@
 {
 	struct stktable_key *key;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;
 
@@ -2986,7 +2986,7 @@
 {
 	struct stktable_key *key;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;
 
@@ -3047,7 +3047,7 @@
 {
 	struct stktable_key *key;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;
 
@@ -3108,7 +3108,7 @@
 {
 	struct stktable_key *key;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;
 
@@ -3171,7 +3171,7 @@
 {
 	struct stktable_key *key;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;
 
@@ -3232,7 +3232,7 @@
 {
 	struct stktable_key *key;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;
 
@@ -3295,7 +3295,7 @@
 {
 	struct stktable_key *key;
 
-	key = tcp_src_to_stktable_key(l4);
+	key = addr_to_stktable_key(&l4->si[0].conn.addr.from);
 	if (!key)
 		return 0;