From: Christopher Faulet Date: Wed, 30 Mar 2022 12:42:50 +0000 (+0200) Subject: MINOR: stream-int: Remove SI_FL_KILL_CON to rely on conn-stream endpoint only X-Git-Tag: v2.6-dev6~83 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9a5212380026f778ff0b98f411c0db784c212d86;p=thirdparty%2Fhaproxy.git MINOR: stream-int: Remove SI_FL_KILL_CON to rely on conn-stream endpoint only Instead of setting a stream-interface flag to then set the corresponding conn-stream endpoint flag, we now only rely the conn-stream endoint. Thus SI_FL_KILL_CON is replaced by CS_EP_KILL_CONN. In addition si_must_kill_conn() is replaced by cs_must_kill_conn(). --- diff --git a/dev/flags/flags.c b/dev/flags/flags.c index ba4018d480..5473903ceb 100644 --- a/dev/flags/flags.c +++ b/dev/flags/flags.c @@ -263,7 +263,6 @@ void show_si_flags(unsigned int f) return; } - SHOW_FLAG(f, SI_FL_KILL_CONN); SHOW_FLAG(f, SI_FL_WAIT_DATA); SHOW_FLAG(f, SI_FL_ISBACK); SHOW_FLAG(f, SI_FL_DONT_WAKE); diff --git a/include/haproxy/cs_utils.h b/include/haproxy/cs_utils.h index 2346a8577b..d44ea0c845 100644 --- a/include/haproxy/cs_utils.h +++ b/include/haproxy/cs_utils.h @@ -187,4 +187,11 @@ static inline int cs_get_dst(struct conn_stream *cs) return 1; } + +/* Marks on the conn-stream that next shutw must kill the whole connection */ +static inline void cs_must_kill_conn(struct conn_stream *cs) +{ + cs->endp->flags |= CS_EP_KILL_CONN; +} + #endif /* _HAPROXY_CS_UTILS_H */ diff --git a/include/haproxy/stream_interface-t.h b/include/haproxy/stream_interface-t.h index 5fe805ed10..7766f4cb54 100644 --- a/include/haproxy/stream_interface-t.h +++ b/include/haproxy/stream_interface-t.h @@ -84,7 +84,6 @@ enum { enum { SI_FL_NONE = 0x00000000, /* nothing */ /* unused: 0x00000001, 0x00000002 */ - SI_FL_KILL_CONN = 0x00000004, /* next shutw must kill the whole conn, not just the stream */ SI_FL_WAIT_DATA = 0x00000008, /* stream-int waits for more outgoing data to send */ SI_FL_ISBACK = 0x00000010, /* 0 for front-side SI, 1 for back-side */ SI_FL_DONT_WAKE = 0x00000020, /* resync in progress, don't wake up */ diff --git a/include/haproxy/stream_interface.h b/include/haproxy/stream_interface.h index 4424a7e7a6..18892b271c 100644 --- a/include/haproxy/stream_interface.h +++ b/include/haproxy/stream_interface.h @@ -327,12 +327,6 @@ static inline void si_shutw(struct stream_interface *si) si->ops->shutw(si); } -/* Marks on the stream-interface that next shutw must kill the whole connection */ -static inline void si_must_kill_conn(struct stream_interface *si) -{ - si->flags |= SI_FL_KILL_CONN; -} - /* This is to be used after making some room available in a channel. It will * return without doing anything if the stream interface's RX path is blocked. * It will automatically mark the stream interface as busy processing the end diff --git a/src/http_act.c b/src/http_act.c index 8c53beecfd..74a894ff7f 100644 --- a/src/http_act.c +++ b/src/http_act.c @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include #include @@ -718,7 +720,7 @@ static enum act_parse_ret parse_http_set_status(const char **args, int *orig_arg static enum act_return http_action_reject(struct act_rule *rule, struct proxy *px, struct session *sess, struct stream *s, int flags) { - si_must_kill_conn(chn_prod(&s->req)->si); + cs_must_kill_conn(chn_prod(&s->req)); channel_abort(&s->req); channel_abort(&s->res); s->req.analysers &= AN_REQ_FLT_END; diff --git a/src/stream_interface.c b/src/stream_interface.c index f9c68390a9..dcbe1a1720 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -1038,9 +1038,6 @@ static void stream_int_shutr_conn(struct stream_interface *si) if (!si_state_in(si->state, SI_SB_CON|SI_SB_RDY|SI_SB_EST)) return; - if (si->flags & SI_FL_KILL_CONN) - cs->endp->flags |= CS_EP_KILL_CONN; - if (si_oc(si)->flags & CF_SHUTW) { cs_close(cs); si->state = SI_ST_DIS; @@ -1089,8 +1086,6 @@ static void stream_int_shutw_conn(struct stream_interface *si) * However, if SI_FL_NOLINGER is explicitly set, we know there is * no risk so we close both sides immediately. */ - if (si->flags & SI_FL_KILL_CONN) - cs->endp->flags |= CS_EP_KILL_CONN; if (cs->endp->flags & CS_EP_ERROR) { /* quick close, the socket is already shut anyway */ @@ -1121,8 +1116,6 @@ static void stream_int_shutw_conn(struct stream_interface *si) /* we may have to close a pending connection, and mark the * response buffer as shutr */ - if (si->flags & SI_FL_KILL_CONN) - cs->endp->flags |= CS_EP_KILL_CONN; cs_close(cs); /* fall through */ case SI_ST_CER: diff --git a/src/tcp_rules.c b/src/tcp_rules.c index 37d5bed3c1..6c45f483e0 100644 --- a/src/tcp_rules.c +++ b/src/tcp_rules.c @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include #include #include @@ -253,7 +255,7 @@ resume_execution: _HA_ATOMIC_INC(&sess->listener->counters->failed_req); reject: - si_must_kill_conn(chn_prod(req)->si); + cs_must_kill_conn(chn_prod(req)); channel_abort(req); channel_abort(&s->res); @@ -391,7 +393,7 @@ resume_execution: } else if (rule->action == ACT_TCP_CLOSE) { chn_prod(rep)->si->flags |= SI_FL_NOLINGER | SI_FL_NOHALF; - si_must_kill_conn(chn_prod(rep)->si); + cs_must_kill_conn(chn_prod(rep)); si_shutr(chn_prod(rep)->si); si_shutw(chn_prod(rep)->si); s->last_rule_file = rule->conf.file; @@ -450,7 +452,7 @@ resume_execution: _HA_ATOMIC_INC(&__objt_server(s->target)->counters.failed_resp); reject: - si_must_kill_conn(chn_prod(rep)->si); + cs_must_kill_conn(chn_prod(rep)); channel_abort(rep); channel_abort(&s->req);