From 04e9acaef4945534cf4ea639f596368a032a0a37 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 2 May 2022 17:27:34 +0200 Subject: [PATCH] MINOR: conn_stream: remove the now unused CS_FL_ADDR_*_SET flags These flags indicate that the ->src or ->dst field in the conn_stream is not null, which is something the caller already sees (and even tests from the two sets of functions that set them). They maintain some burden because an agent trying to set a source or destination has to manually set the flags in addition to setting the pointer, so they provide no value anymore, let's drop them. --- dev/flags/flags.c | 2 -- include/haproxy/conn_stream-t.h | 4 ++-- include/haproxy/cs_utils.h | 10 ++++------ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/dev/flags/flags.c b/dev/flags/flags.c index 3a2b48ab9..2164a352b 100644 --- a/dev/flags/flags.c +++ b/dev/flags/flags.c @@ -230,8 +230,6 @@ void show_cs_flags(unsigned int f) SHOW_FLAG(f, CS_FL_DONT_WAKE); SHOW_FLAG(f, CS_FL_NOLINGER); SHOW_FLAG(f, CS_FL_NOHALF); - SHOW_FLAG(f, CS_FL_ADDR_FROM_SET); - SHOW_FLAG(f, CS_FL_ADDR_TO_SET); SHOW_FLAG(f, CS_FL_ISBACK); if (f) { diff --git a/include/haproxy/conn_stream-t.h b/include/haproxy/conn_stream-t.h index 9c5ccfb8f..ed25c2848 100644 --- a/include/haproxy/conn_stream-t.h +++ b/include/haproxy/conn_stream-t.h @@ -86,8 +86,8 @@ enum { CS_FL_NONE = 0x00000000, /* Just for initialization purposes */ CS_FL_ISBACK = 0x00000001, /* Set for CS on back-side */ - CS_FL_ADDR_FROM_SET = 0x00000002, /* source address is set */ - CS_FL_ADDR_TO_SET = 0x00000004, /* destination address is set */ + /* not used: 0x00000002 */ + /* not used: 0x00000004 */ CS_FL_NOLINGER = 0x00000008, /* may close without lingering. One-shot. */ CS_FL_NOHALF = 0x00000010, /* no half close, close both sides at once */ diff --git a/include/haproxy/cs_utils.h b/include/haproxy/cs_utils.h index 684cb589c..990998436 100644 --- a/include/haproxy/cs_utils.h +++ b/include/haproxy/cs_utils.h @@ -171,7 +171,7 @@ static inline int cs_alloc_ibuf(struct conn_stream *cs, struct buffer_wait *wait */ static inline const struct sockaddr_storage *cs_src(struct conn_stream *cs) { - if (cs->flags & CS_FL_ADDR_FROM_SET) + if (cs->src) return cs->src; if (!(cs->flags & CS_FL_ISBACK)) return sess_src(strm_sess(__cs_strm(cs))); @@ -191,7 +191,7 @@ static inline const struct sockaddr_storage *cs_src(struct conn_stream *cs) */ static inline const struct sockaddr_storage *cs_dst(struct conn_stream *cs) { - if (cs->flags & CS_FL_ADDR_TO_SET) + if (cs->dst) return cs->dst; if (!(cs->flags & CS_FL_ISBACK)) return sess_dst(strm_sess(__cs_strm(cs))); @@ -214,7 +214,7 @@ static inline int cs_get_src(struct conn_stream *cs) { const struct sockaddr_storage *src = NULL; - if (cs->flags & CS_FL_ADDR_FROM_SET) + if (cs->src) return 1; if (!(cs->flags & CS_FL_ISBACK)) @@ -231,7 +231,6 @@ static inline int cs_get_src(struct conn_stream *cs) if (!sockaddr_alloc(&cs->src, src, sizeof(*src))) return 0; - cs->flags |= CS_FL_ADDR_FROM_SET; return 1; } @@ -245,7 +244,7 @@ static inline int cs_get_dst(struct conn_stream *cs) { const struct sockaddr_storage *dst = NULL; - if (cs->flags & CS_FL_ADDR_TO_SET) + if (cs->dst) return 1; if (!(cs->flags & CS_FL_ISBACK)) @@ -262,7 +261,6 @@ static inline int cs_get_dst(struct conn_stream *cs) if (!sockaddr_alloc(&cs->dst, dst, sizeof(*dst))) return 0; - cs->flags |= CS_FL_ADDR_TO_SET; return 1; }