[Devel] [PATCH vz7 v2 1/3] ipvs: provide just conn to ip_vs_state_name
Alexander Atanasov
alexander.atanasov at virtuozzo.com
Fri Jun 14 18:34:55 MSK 2024
From: Julian Anastasov <ja at ssi.bg>
In preparation for followup patches, provide just the cp
ptr to ip_vs_state_name.
Signed-off-by: Julian Anastasov <ja at ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
(cherry picked from commit ec1b28ca9674def4a158808a6493bdb87b993d81)
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
include/net/ip_vs.h | 2 +-
net/netfilter/ipvs/ip_vs_conn.c | 9 +++++----
net/netfilter/ipvs/ip_vs_proto.c | 9 ++++-----
3 files changed, 10 insertions(+), 10 deletions(-)
v1->v2: added missed patches
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index e1a626e3b7ae..497265fbdb5b 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1218,7 +1218,7 @@ struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p,
struct ip_vs_dest *dest, __u32 fwmark);
void ip_vs_conn_expire_now(struct ip_vs_conn *cp);
-const char *ip_vs_state_name(__u16 proto, int state);
+const char *ip_vs_state_name(const struct ip_vs_conn *cp);
void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp);
int ip_vs_check_template(struct ip_vs_conn *ct, struct ip_vs_dest *cdest);
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index d71661bf1641..f571868c9aa9 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -1082,7 +1082,8 @@ static int ip_vs_conn_seq_show(struct seq_file *seq, void *v)
&cp->caddr.in6, ntohs(cp->cport),
&cp->vaddr.in6, ntohs(cp->vport),
&cp->daddr.in6, ntohs(cp->dport),
- ip_vs_state_name(cp->protocol, cp->state),
+ ip_vs_state_name(cp),
+ &cp->daddr.in6, ntohs(cp->dport),
(cp->timer.expires-jiffies)/HZ, pe_data);
else
#endif
@@ -1093,7 +1094,7 @@ static int ip_vs_conn_seq_show(struct seq_file *seq, void *v)
ntohl(cp->caddr.ip), ntohs(cp->cport),
ntohl(cp->vaddr.ip), ntohs(cp->vport),
ntohl(cp->daddr.ip), ntohs(cp->dport),
- ip_vs_state_name(cp->protocol, cp->state),
+ ip_vs_state_name(cp),
(cp->timer.expires-jiffies)/HZ, pe_data);
}
return 0;
@@ -1148,7 +1149,7 @@ static int ip_vs_conn_sync_seq_show(struct seq_file *seq, void *v)
&cp->caddr.in6, ntohs(cp->cport),
&cp->vaddr.in6, ntohs(cp->vport),
&cp->daddr.in6, ntohs(cp->dport),
- ip_vs_state_name(cp->protocol, cp->state),
+ ip_vs_state_name(cp),
ip_vs_origin_name(cp->flags),
(cp->timer.expires-jiffies)/HZ);
else
@@ -1160,7 +1161,7 @@ static int ip_vs_conn_sync_seq_show(struct seq_file *seq, void *v)
ntohl(cp->caddr.ip), ntohs(cp->cport),
ntohl(cp->vaddr.ip), ntohs(cp->vport),
ntohl(cp->daddr.ip), ntohs(cp->dport),
- ip_vs_state_name(cp->protocol, cp->state),
+ ip_vs_state_name(cp),
ip_vs_origin_name(cp->flags),
(cp->timer.expires-jiffies)/HZ);
}
diff --git a/net/netfilter/ipvs/ip_vs_proto.c b/net/netfilter/ipvs/ip_vs_proto.c
index 939f7fbe9b46..7a8c193fd8ab 100644
--- a/net/netfilter/ipvs/ip_vs_proto.c
+++ b/net/netfilter/ipvs/ip_vs_proto.c
@@ -202,7 +202,6 @@ ip_vs_create_timeout_table(int *table, int size)
return kmemdup(table, size, GFP_KERNEL);
}
-
/*
* Set timeout value for state specified by name
*/
@@ -225,13 +224,13 @@ ip_vs_set_state_timeout(int *table, int num, const char *const *names,
}
-const char * ip_vs_state_name(__u16 proto, int state)
+const char *ip_vs_state_name(const struct ip_vs_conn *cp)
{
- struct ip_vs_protocol *pp = ip_vs_proto_get(proto);
+ struct ip_vs_protocol *pp = ip_vs_proto_get(cp->protocol);
if (pp == NULL || pp->state_name == NULL)
- return (IPPROTO_IP == proto) ? "NONE" : "ERR!";
- return pp->state_name(state);
+ return (cp->protocol == IPPROTO_IP) ? "NONE" : "ERR!";
+ return pp->state_name(cp->state);
}
--
2.43.0
More information about the Devel
mailing list