From: Christopher Faulet Date: Thu, 21 Nov 2024 08:51:36 +0000 (+0100) Subject: CLEANUP: cfgparse: Add direction in functions name that warn on misplaced rules X-Git-Tag: v3.1-dev14~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5dcd3b0d994d083720ddb79a5a0dfe6d6690d20d;p=thirdparty%2Fhaproxy.git CLEANUP: cfgparse: Add direction in functions name that warn on misplaced rules This only concerns functions emitting warnings about misplaced tcp-request rules. The direction is now specified in the functions name. For instance "warnif_misplaced_tcp_conn" is replaced by "warnif_misplaced_tcp_req_conn". --- diff --git a/include/haproxy/cfgparse.h b/include/haproxy/cfgparse.h index 27c60c5dce..de23bb7466 100644 --- a/include/haproxy/cfgparse.h +++ b/include/haproxy/cfgparse.h @@ -128,9 +128,9 @@ int cfg_register_postparser(char *name, int (*func)()); void cfg_unregister_sections(void); void cfg_backup_sections(struct list *backup_sections); void cfg_restore_sections(struct list *backup_sections); -int warnif_misplaced_tcp_conn(struct proxy *proxy, const char *file, int line, const char *arg1, const char *arg2); -int warnif_misplaced_tcp_sess(struct proxy *proxy, const char *file, int line, const char *arg, const char *arg2); -int warnif_misplaced_tcp_cont(struct proxy *proxy, const char *file, int line, const char *arg, const char *arg2); +int warnif_misplaced_tcp_req_conn(struct proxy *proxy, const char *file, int line, const char *arg1, const char *arg2); +int warnif_misplaced_tcp_req_sess(struct proxy *proxy, const char *file, int line, const char *arg, const char *arg2); +int warnif_misplaced_tcp_req_cont(struct proxy *proxy, const char *file, int line, const char *arg, const char *arg2); int warnif_misplaced_quic_init(struct proxy *proxy, const char *file, int line, const char *arg, const char *arg2); int warnif_cond_conflicts(const struct acl_cond *cond, unsigned int where, const char *file, int line); int warnif_tcp_http_cond(const struct proxy *px, const struct acl_cond *cond); diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index b3f02c6f0e..2357333433 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -193,30 +193,30 @@ static int warnif_misplaced_monitor(struct proxy *proxy, const char *file, int l } /* report a warning if a "tcp request content" rule is dangerously placed */ -int warnif_misplaced_tcp_cont(struct proxy *proxy, const char *file, int line, const char *arg1, const char *arg2) +int warnif_misplaced_tcp_req_cont(struct proxy *proxy, const char *file, int line, const char *arg1, const char *arg2) { return warnif_rule_after_monitor(proxy, file, line, arg1, arg2) || warnif_misplaced_monitor(proxy, file, line, arg1, arg2); } /* report a warning if a "tcp request session" rule is dangerously placed */ -int warnif_misplaced_tcp_sess(struct proxy *proxy, const char *file, int line, const char *arg1, const char *arg2) +int warnif_misplaced_tcp_req_sess(struct proxy *proxy, const char *file, int line, const char *arg1, const char *arg2) { return warnif_rule_after_tcp_cont(proxy, file, line, arg1, arg2) || - warnif_misplaced_tcp_cont(proxy, file, line, arg1, arg2); + warnif_misplaced_tcp_req_cont(proxy, file, line, arg1, arg2); } /* report a warning if a "tcp request connection" rule is dangerously placed */ -int warnif_misplaced_tcp_conn(struct proxy *proxy, const char *file, int line, const char *arg1, const char *arg2) +int warnif_misplaced_tcp_req_conn(struct proxy *proxy, const char *file, int line, const char *arg1, const char *arg2) { return warnif_rule_after_tcp_sess(proxy, file, line, arg1, arg2) || - warnif_misplaced_tcp_sess(proxy, file, line, arg1, arg2); + warnif_misplaced_tcp_req_sess(proxy, file, line, arg1, arg2); } int warnif_misplaced_quic_init(struct proxy *proxy, const char *file, int line, const char *arg1, const char *arg2) { return warnif_rule_after_tcp_conn(proxy, file, line, arg1, arg2) || - warnif_misplaced_tcp_conn(proxy, file, line, arg1, arg2); + warnif_misplaced_tcp_req_conn(proxy, file, line, arg1, arg2); } int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) diff --git a/src/tcp_rules.c b/src/tcp_rules.c index 0d92c1a943..b8848e5250 100644 --- a/src/tcp_rules.c +++ b/src/tcp_rules.c @@ -1319,7 +1319,7 @@ static int tcp_parse_tcp_req(char **args, int section_type, struct proxy *curpx, } /* the following function directly emits the warning */ - warnif_misplaced_tcp_cont(curpx, file, line, args[0], args[1]); + warnif_misplaced_tcp_req_cont(curpx, file, line, args[0], args[1]); LIST_APPEND(&curpx->tcp_req.inspect_rules, &rule->list); } else if (strcmp(args[1], "connection") == 0) { @@ -1364,7 +1364,7 @@ static int tcp_parse_tcp_req(char **args, int section_type, struct proxy *curpx, } /* the following function directly emits the warning */ - warnif_misplaced_tcp_conn(curpx, file, line, args[0], args[1]); + warnif_misplaced_tcp_req_conn(curpx, file, line, args[0], args[1]); LIST_APPEND(&curpx->tcp_req.l4_rules, &rule->list); } else if (strcmp(args[1], "session") == 0) { @@ -1408,7 +1408,7 @@ static int tcp_parse_tcp_req(char **args, int section_type, struct proxy *curpx, } /* the following function directly emits the warning */ - warnif_misplaced_tcp_sess(curpx, file, line, args[0], args[1]); + warnif_misplaced_tcp_req_sess(curpx, file, line, args[0], args[1]); LIST_APPEND(&curpx->tcp_req.l5_rules, &rule->list); } else {