blob: b85cf28da6895e33d175a7682bc44b8e5fea7187 [file] [log] [blame]
Willy Tarreauaeae66c2020-08-28 11:03:28 +02001/*
2 * AF_INET/AF_INET6 SOCK_STREAM protocol layer (tcp)
3 *
4 * Copyright 2000-2013 Willy Tarreau <w@1wt.eu>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 */
12
13#include <ctype.h>
14#include <errno.h>
15#include <fcntl.h>
16#include <stdio.h>
17#include <stdlib.h>
18#include <string.h>
19#include <time.h>
20
21#include <sys/param.h>
22#include <sys/socket.h>
23#include <sys/types.h>
24
25#include <netinet/tcp.h>
26#include <netinet/in.h>
27
28#include <haproxy/action-t.h>
29#include <haproxy/api.h>
30#include <haproxy/arg.h>
31#include <haproxy/channel.h>
32#include <haproxy/connection.h>
33#include <haproxy/global.h>
34#include <haproxy/http_rules.h>
35#include <haproxy/proto_tcp.h>
36#include <haproxy/proxy-t.h>
37#include <haproxy/sample.h>
Christopher Fauletd69377e2021-10-25 08:26:34 +020038#include <haproxy/session.h>
39#include <haproxy/stream_interface.h>
Willy Tarreauaeae66c2020-08-28 11:03:28 +020040#include <haproxy/tcp_rules.h>
41#include <haproxy/tools.h>
42
43/*
44 * Execute the "set-src" action. May be called from {tcp,http}request.
45 * It only changes the address and tries to preserve the original port. If the
46 * previous family was neither AF_INET nor AF_INET6, the port is set to zero.
47 */
48static enum act_return tcp_action_req_set_src(struct act_rule *rule, struct proxy *px,
49 struct session *sess, struct stream *s, int flags)
50{
51 struct connection *cli_conn;
Christopher Fauletd69377e2021-10-25 08:26:34 +020052 struct sockaddr_storage *src;
53 struct sample *smp;
Willy Tarreauaeae66c2020-08-28 11:03:28 +020054
Christopher Fauletd69377e2021-10-25 08:26:34 +020055 switch (rule->from) {
56 case ACT_F_TCP_REQ_CON:
57 cli_conn = objt_conn(sess->origin);
58 if (!cli_conn || !conn_get_src(cli_conn))
59 goto end;
60 src = cli_conn->src;
61 break;
Willy Tarreauaeae66c2020-08-28 11:03:28 +020062
Christopher Fauletd69377e2021-10-25 08:26:34 +020063 case ACT_F_TCP_REQ_SES:
64 if (!sess_get_src(sess))
65 goto end;
66 src = sess->src;
67 break;
Willy Tarreauaeae66c2020-08-28 11:03:28 +020068
Christopher Fauletd69377e2021-10-25 08:26:34 +020069 case ACT_F_TCP_REQ_CNT:
70 case ACT_F_HTTP_REQ:
71 if (!si_get_src(&s->si[0]))
72 goto end;
73 src = s->si[0].src;
74 break;
75
76 default:
77 goto end;
78 }
79
80 smp = sample_fetch_as_type(px, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->arg.expr, SMP_T_ADDR);
81 if (smp) {
82 int port = get_net_port(src);
83
84 if (smp->data.type == SMP_T_IPV4) {
85 ((struct sockaddr_in *)src)->sin_family = AF_INET;
86 ((struct sockaddr_in *)src)->sin_addr.s_addr = smp->data.u.ipv4.s_addr;
87 ((struct sockaddr_in *)src)->sin_port = port;
88 } else if (smp->data.type == SMP_T_IPV6) {
89 ((struct sockaddr_in6 *)src)->sin6_family = AF_INET6;
90 memcpy(&((struct sockaddr_in6 *)src)->sin6_addr, &smp->data.u.ipv6, sizeof(struct in6_addr));
91 ((struct sockaddr_in6 *)src)->sin6_port = port;
Willy Tarreauaeae66c2020-08-28 11:03:28 +020092 }
Willy Tarreauaeae66c2020-08-28 11:03:28 +020093 }
Christopher Fauletd69377e2021-10-25 08:26:34 +020094
95 end:
Willy Tarreauaeae66c2020-08-28 11:03:28 +020096 return ACT_RET_CONT;
97}
98
99/*
100 * Execute the "set-dst" action. May be called from {tcp,http}request.
101 * It only changes the address and tries to preserve the original port. If the
102 * previous family was neither AF_INET nor AF_INET6, the port is set to zero.
103 */
104static enum act_return tcp_action_req_set_dst(struct act_rule *rule, struct proxy *px,
105 struct session *sess, struct stream *s, int flags)
106{
107 struct connection *cli_conn;
Christopher Fauletd69377e2021-10-25 08:26:34 +0200108 struct sockaddr_storage *dst;
109 struct sample *smp;
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200110
Christopher Fauletd69377e2021-10-25 08:26:34 +0200111 switch (rule->from) {
112 case ACT_F_TCP_REQ_CON:
113 cli_conn = objt_conn(sess->origin);
114 if (!cli_conn || !conn_get_dst(cli_conn))
115 goto end;
116 dst = cli_conn->dst;
117 break;
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200118
Christopher Fauletd69377e2021-10-25 08:26:34 +0200119 case ACT_F_TCP_REQ_SES:
120 if (!sess_get_dst(sess))
121 goto end;
122 dst = sess->dst;
123 break;
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200124
Christopher Fauletd69377e2021-10-25 08:26:34 +0200125 case ACT_F_TCP_REQ_CNT:
126 case ACT_F_HTTP_REQ:
127 if (!si_get_dst(&s->si[0]))
128 goto end;
129 dst = s->si[0].dst;
130 break;
131
132 default:
133 goto end;
134 }
135
136 smp = sample_fetch_as_type(px, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->arg.expr, SMP_T_ADDR);
137 if (smp) {
138 int port = get_net_port(dst);
139
140 if (smp->data.type == SMP_T_IPV4) {
141 ((struct sockaddr_in *)dst)->sin_family = AF_INET;
142 ((struct sockaddr_in *)dst)->sin_addr.s_addr = smp->data.u.ipv4.s_addr;
143 ((struct sockaddr_in *)dst)->sin_port = port;
144 } else if (smp->data.type == SMP_T_IPV6) {
145 ((struct sockaddr_in6 *)dst)->sin6_family = AF_INET6;
146 memcpy(&((struct sockaddr_in6 *)dst)->sin6_addr, &smp->data.u.ipv6, sizeof(struct in6_addr));
147 ((struct sockaddr_in6 *)dst)->sin6_port = port;
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200148 }
149 }
Christopher Fauletd69377e2021-10-25 08:26:34 +0200150
151 end:
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200152 return ACT_RET_CONT;
153}
154
155/*
156 * Execute the "set-src-port" action. May be called from {tcp,http}request.
157 * We must test the sin_family before setting the port. If the address family
158 * is neither AF_INET nor AF_INET6, the address is forced to AF_INET "0.0.0.0"
159 * and the port is assigned.
160 */
161static enum act_return tcp_action_req_set_src_port(struct act_rule *rule, struct proxy *px,
162 struct session *sess, struct stream *s, int flags)
163{
164 struct connection *cli_conn;
Christopher Fauletd69377e2021-10-25 08:26:34 +0200165 struct sockaddr_storage *src;
166 struct sample *smp;
167
168 switch (rule->from) {
169 case ACT_F_TCP_REQ_CON:
170 cli_conn = objt_conn(sess->origin);
171 if (!cli_conn || !conn_get_src(cli_conn))
172 goto end;
173 src = cli_conn->src;
174 break;
175
176 case ACT_F_TCP_REQ_SES:
177 if (!sess_get_src(sess))
178 goto end;
179 src = sess->src;
180 break;
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200181
Christopher Fauletd69377e2021-10-25 08:26:34 +0200182 case ACT_F_TCP_REQ_CNT:
183 case ACT_F_HTTP_REQ:
184 if (!si_get_src(&s->si[0]))
185 goto end;
186 src = s->si[0].src;
187 break;
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200188
Christopher Fauletd69377e2021-10-25 08:26:34 +0200189 default:
190 goto end;
191 }
192
193 smp = sample_fetch_as_type(px, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->arg.expr, SMP_T_SINT);
194 if (smp) {
195 if (src->ss_family == AF_INET6) {
196 ((struct sockaddr_in6 *)src)->sin6_port = htons(smp->data.u.sint);
197 } else {
198 if (src->ss_family != AF_INET) {
199 src->ss_family = AF_INET;
200 ((struct sockaddr_in *)src)->sin_addr.s_addr = 0;
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200201 }
Christopher Fauletd69377e2021-10-25 08:26:34 +0200202 ((struct sockaddr_in *)src)->sin_port = htons(smp->data.u.sint);
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200203 }
204 }
Christopher Fauletd69377e2021-10-25 08:26:34 +0200205
206 end:
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200207 return ACT_RET_CONT;
208}
209
210/*
211 * Execute the "set-dst-port" action. May be called from {tcp,http}request.
212 * We must test the sin_family before setting the port. If the address family
213 * is neither AF_INET nor AF_INET6, the address is forced to AF_INET "0.0.0.0"
214 * and the port is assigned.
215 */
216static enum act_return tcp_action_req_set_dst_port(struct act_rule *rule, struct proxy *px,
217 struct session *sess, struct stream *s, int flags)
218{
219 struct connection *cli_conn;
Christopher Fauletd69377e2021-10-25 08:26:34 +0200220 struct sockaddr_storage *dst;
221 struct sample *smp;
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200222
Christopher Fauletd69377e2021-10-25 08:26:34 +0200223 switch (rule->from) {
224 case ACT_F_TCP_REQ_CON:
225 cli_conn = objt_conn(sess->origin);
226 if (!cli_conn || !conn_get_dst(cli_conn))
227 goto end;
228 dst = cli_conn->dst;
229 break;
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200230
Christopher Fauletd69377e2021-10-25 08:26:34 +0200231 case ACT_F_TCP_REQ_SES:
232 if (!sess_get_dst(sess))
233 goto end;
234 dst = sess->dst;
235 break;
236
237 case ACT_F_TCP_REQ_CNT:
238 case ACT_F_HTTP_REQ:
239 if (!si_get_dst(&s->si[0]))
240 goto end;
241 dst = s->si[0].dst;
242 break;
243
244 default:
245 goto end;
246 }
247
248 smp = sample_fetch_as_type(px, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->arg.expr, SMP_T_SINT);
249 if (smp) {
250 if (dst->ss_family == AF_INET6) {
251 ((struct sockaddr_in6 *)dst)->sin6_port = htons(smp->data.u.sint);
252 } else {
253 if (dst->ss_family != AF_INET) {
254 dst->ss_family = AF_INET;
255 ((struct sockaddr_in *)dst)->sin_addr.s_addr = 0;
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200256 }
Christopher Fauletd69377e2021-10-25 08:26:34 +0200257 ((struct sockaddr_in *)dst)->sin_port = htons(smp->data.u.sint);
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200258 }
259 }
Christopher Fauletd69377e2021-10-25 08:26:34 +0200260
261 end:
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200262 return ACT_RET_CONT;
263}
264
265/* Executes the "silent-drop" action. May be called from {tcp,http}{request,response} */
266static enum act_return tcp_exec_action_silent_drop(struct act_rule *rule, struct proxy *px,
267 struct session *sess, struct stream *strm, int flags)
268{
269 struct connection *conn = objt_conn(sess->origin);
270
271 if (!conn)
272 goto out;
273
274 if (!conn_ctrl_ready(conn))
275 goto out;
276
277#ifdef TCP_QUICKACK
278 /* drain is needed only to send the quick ACK */
Willy Tarreau2ded48d2020-12-11 16:20:34 +0100279 conn_ctrl_drain(conn);
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200280
281 /* re-enable quickack if it was disabled to ack all data and avoid
282 * retransmits from the client that might trigger a real reset.
283 */
Willy Tarreau4bfc6632021-03-31 08:45:47 +0200284 setsockopt(conn->handle.fd, IPPROTO_TCP, TCP_QUICKACK, &one, sizeof(one));
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200285#endif
286 /* lingering must absolutely be disabled so that we don't send a
287 * shutdown(), this is critical to the TCP_REPAIR trick. When no stream
288 * is present, returning with ERR will cause lingering to be disabled.
289 */
290 if (strm)
291 strm->si[0].flags |= SI_FL_NOLINGER;
292
293 /* We're on the client-facing side, we must force to disable lingering to
294 * ensure we will use an RST exclusively and kill any pending data.
295 */
Willy Tarreaub41a6e92021-04-06 17:49:19 +0200296 HA_ATOMIC_OR(&fdtab[conn->handle.fd].state, FD_LINGER_RISK);
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200297
298#ifdef TCP_REPAIR
Willy Tarreau4bfc6632021-03-31 08:45:47 +0200299 if (setsockopt(conn->handle.fd, IPPROTO_TCP, TCP_REPAIR, &one, sizeof(one)) == 0) {
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200300 /* socket will be quiet now */
301 goto out;
302 }
303#endif
304 /* either TCP_REPAIR is not defined or it failed (eg: permissions).
305 * Let's fall back on the TTL trick, though it only works for routed
306 * network and has no effect on local net.
307 */
308#ifdef IP_TTL
Willy Tarreauab79ee82021-03-30 17:23:50 +0200309 if (conn->src && conn->src->ss_family == AF_INET)
Willy Tarreau4bfc6632021-03-31 08:45:47 +0200310 setsockopt(conn->handle.fd, IPPROTO_IP, IP_TTL, &one, sizeof(one));
Willy Tarreauab79ee82021-03-30 17:23:50 +0200311#endif
312#ifdef IPV6_UNICAST_HOPS
Willy Tarreauda231952021-03-31 08:29:27 +0200313 if (conn->src && conn->src->ss_family == AF_INET6)
314 setsockopt(conn->handle.fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &one, sizeof(one));
315#endif
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200316 out:
317 /* kill the stream if any */
318 if (strm) {
319 channel_abort(&strm->req);
320 channel_abort(&strm->res);
321 strm->req.analysers &= AN_REQ_FLT_END;
322 strm->res.analysers &= AN_RES_FLT_END;
323 if (strm->flags & SF_BE_ASSIGNED)
Willy Tarreau4781b152021-04-06 13:53:36 +0200324 _HA_ATOMIC_INC(&strm->be->be_counters.denied_req);
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200325 if (!(strm->flags & SF_ERR_MASK))
326 strm->flags |= SF_ERR_PRXCOND;
327 if (!(strm->flags & SF_FINST_MASK))
328 strm->flags |= SF_FINST_R;
329 }
330
Willy Tarreau4781b152021-04-06 13:53:36 +0200331 _HA_ATOMIC_INC(&sess->fe->fe_counters.denied_req);
William Lallemand36119de2021-03-08 15:26:48 +0100332 if (sess->listener && sess->listener->counters)
Willy Tarreau4781b152021-04-06 13:53:36 +0200333 _HA_ATOMIC_INC(&sess->listener->counters->denied_req);
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200334
335 return ACT_RET_ABRT;
336}
337
Christopher Faulet469c06c2021-06-25 15:11:35 +0200338
David Carlierbae4cb22021-07-03 10:15:15 +0100339#if defined(SO_MARK) || defined(SO_USER_COOKIE) || defined(SO_RTABLE)
Christopher Faulet469c06c2021-06-25 15:11:35 +0200340static enum act_return tcp_action_set_mark(struct act_rule *rule, struct proxy *px,
341 struct session *sess, struct stream *s, int flags)
342{
343 conn_set_mark(objt_conn(sess->origin), (uintptr_t)rule->arg.act.p[0]);
344 return ACT_RET_CONT;
345}
Willy Tarreau5bbfff12021-06-28 07:12:22 +0200346#endif
Christopher Faulet469c06c2021-06-25 15:11:35 +0200347
Willy Tarreau5bbfff12021-06-28 07:12:22 +0200348#ifdef IP_TOS
Christopher Faulet469c06c2021-06-25 15:11:35 +0200349static enum act_return tcp_action_set_tos(struct act_rule *rule, struct proxy *px,
350 struct session *sess, struct stream *s, int flags)
351{
352 conn_set_tos(objt_conn(sess->origin), (uintptr_t)rule->arg.act.p[0]);
353 return ACT_RET_CONT;
354}
Willy Tarreau5bbfff12021-06-28 07:12:22 +0200355#endif
Christopher Faulet469c06c2021-06-25 15:11:35 +0200356
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200357/* parse "set-{src,dst}[-port]" action */
358static enum act_parse_ret tcp_parse_set_src_dst(const char **args, int *orig_arg, struct proxy *px,
359 struct act_rule *rule, char **err)
360{
361 int cur_arg;
362 struct sample_expr *expr;
363 unsigned int where;
364
365 cur_arg = *orig_arg;
366 expr = sample_parse_expr((char **)args, &cur_arg, px->conf.args.file, px->conf.args.line, err, &px->conf.args, NULL);
367 if (!expr)
368 return ACT_RET_PRS_ERR;
369
370 where = 0;
371 if (px->cap & PR_CAP_FE)
372 where |= SMP_VAL_FE_HRQ_HDR;
373 if (px->cap & PR_CAP_BE)
374 where |= SMP_VAL_BE_HRQ_HDR;
375
376 if (!(expr->fetch->val & where)) {
377 memprintf(err,
378 "fetch method '%s' extracts information from '%s', none of which is available here",
379 args[cur_arg-1], sample_src_names(expr->fetch->use));
380 free(expr);
381 return ACT_RET_PRS_ERR;
382 }
383 rule->arg.expr = expr;
384 rule->action = ACT_CUSTOM;
385
Tim Duesterhuse5ff1412021-01-02 22:31:53 +0100386 if (strcmp(args[*orig_arg - 1], "set-src") == 0) {
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200387 rule->action_ptr = tcp_action_req_set_src;
Tim Duesterhuse5ff1412021-01-02 22:31:53 +0100388 } else if (strcmp(args[*orig_arg - 1], "set-src-port") == 0) {
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200389 rule->action_ptr = tcp_action_req_set_src_port;
Tim Duesterhuse5ff1412021-01-02 22:31:53 +0100390 } else if (strcmp(args[*orig_arg - 1], "set-dst") == 0) {
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200391 rule->action_ptr = tcp_action_req_set_dst;
Tim Duesterhuse5ff1412021-01-02 22:31:53 +0100392 } else if (strcmp(args[*orig_arg - 1], "set-dst-port") == 0) {
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200393 rule->action_ptr = tcp_action_req_set_dst_port;
394 } else {
395 return ACT_RET_PRS_ERR;
396 }
397
398 (*orig_arg)++;
399
Christopher Faulet469c06c2021-06-25 15:11:35 +0200400 return ACT_RET_PRS_OK;
401}
402
403
404/* Parse a "set-mark" action. It takes the MARK value as argument. It returns
405 * ACT_RET_PRS_OK on success, ACT_RET_PRS_ERR on error.
406 */
407static enum act_parse_ret tcp_parse_set_mark(const char **args, int *cur_arg, struct proxy *px,
408 struct act_rule *rule, char **err)
409{
David Carlierbae4cb22021-07-03 10:15:15 +0100410#if defined(SO_MARK) || defined(SO_USER_COOKIE) || defined(SO_RTABLE)
Christopher Faulet469c06c2021-06-25 15:11:35 +0200411 char *endp;
412 unsigned int mark;
413
414 if (!*args[*cur_arg]) {
415 memprintf(err, "expects exactly 1 argument (integer/hex value)");
416 return ACT_RET_PRS_ERR;
417 }
418 mark = strtoul(args[*cur_arg], &endp, 0);
419 if (endp && *endp != '\0') {
420 memprintf(err, "invalid character starting at '%s' (integer/hex value expected)", endp);
421 return ACT_RET_PRS_ERR;
422 }
423
424 (*cur_arg)++;
425
426 /* Register processing function. */
427 rule->action_ptr = tcp_action_set_mark;
428 rule->action = ACT_CUSTOM;
429 rule->arg.act.p[0] = (void *)(uintptr_t)mark;
430 global.last_checks |= LSTCHK_NETADM;
431 return ACT_RET_PRS_OK;
432#else
David Carlierbae4cb22021-07-03 10:15:15 +0100433 memprintf(err, "not supported on this platform (SO_MARK|SO_USER_COOKIE|SO_RTABLE undefined)");
Christopher Faulet469c06c2021-06-25 15:11:35 +0200434 return ACT_RET_PRS_ERR;
435#endif
436}
437
438
439/* Parse a "set-tos" action. It takes the TOS value as argument. It returns
440 * ACT_RET_PRS_OK on success, ACT_RET_PRS_ERR on error.
441 */
442static enum act_parse_ret tcp_parse_set_tos(const char **args, int *cur_arg, struct proxy *px,
443 struct act_rule *rule, char **err)
444{
445#ifdef IP_TOS
446 char *endp;
447 int tos;
448
449 if (!*args[*cur_arg]) {
450 memprintf(err, "expects exactly 1 argument (integer/hex value)");
451 return ACT_RET_PRS_ERR;
452 }
453 tos = strtol(args[*cur_arg], &endp, 0);
454 if (endp && *endp != '\0') {
455 memprintf(err, "invalid character starting at '%s' (integer/hex value expected)", endp);
456 return ACT_RET_PRS_ERR;
457 }
458
459 (*cur_arg)++;
460
461 /* Register processing function. */
462 rule->action_ptr = tcp_action_set_tos;
463 rule->action = ACT_CUSTOM;
464 rule->arg.act.p[0] = (void *)(uintptr_t)tos;
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200465 return ACT_RET_PRS_OK;
Christopher Faulet469c06c2021-06-25 15:11:35 +0200466#else
467 memprintf(err, "not supported on this platform (IP_TOS undefined)");
468 return ACT_RET_PRS_ERR;
469#endif
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200470}
471
472
473/* Parse a "silent-drop" action. It takes no argument. It returns ACT_RET_PRS_OK on
474 * success, ACT_RET_PRS_ERR on error.
475 */
476static enum act_parse_ret tcp_parse_silent_drop(const char **args, int *orig_arg, struct proxy *px,
477 struct act_rule *rule, char **err)
478{
479 rule->action = ACT_CUSTOM;
480 rule->action_ptr = tcp_exec_action_silent_drop;
481 return ACT_RET_PRS_OK;
482}
483
484
485static struct action_kw_list tcp_req_conn_actions = {ILH, {
Christopher Fauletee9c98d2021-06-25 15:18:33 +0200486 { "set-dst" , tcp_parse_set_src_dst },
487 { "set-dst-port", tcp_parse_set_src_dst },
Christopher Faulet469c06c2021-06-25 15:11:35 +0200488 { "set-mark", tcp_parse_set_mark },
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200489 { "set-src", tcp_parse_set_src_dst },
490 { "set-src-port", tcp_parse_set_src_dst },
Christopher Faulet469c06c2021-06-25 15:11:35 +0200491 { "set-tos", tcp_parse_set_tos },
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200492 { "silent-drop", tcp_parse_silent_drop },
493 { /* END */ }
494}};
495
496INITCALL1(STG_REGISTER, tcp_req_conn_keywords_register, &tcp_req_conn_actions);
497
498static struct action_kw_list tcp_req_sess_actions = {ILH, {
Christopher Fauletee9c98d2021-06-25 15:18:33 +0200499 { "set-dst" , tcp_parse_set_src_dst },
500 { "set-dst-port", tcp_parse_set_src_dst },
Christopher Faulet469c06c2021-06-25 15:11:35 +0200501 { "set-mark", tcp_parse_set_mark },
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200502 { "set-src", tcp_parse_set_src_dst },
503 { "set-src-port", tcp_parse_set_src_dst },
Christopher Faulet469c06c2021-06-25 15:11:35 +0200504 { "set-tos", tcp_parse_set_tos },
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200505 { "silent-drop", tcp_parse_silent_drop },
506 { /* END */ }
507}};
508
509INITCALL1(STG_REGISTER, tcp_req_sess_keywords_register, &tcp_req_sess_actions);
510
511static struct action_kw_list tcp_req_cont_actions = {ILH, {
Christopher Faulet1e83b702021-06-23 12:07:21 +0200512 { "set-src", tcp_parse_set_src_dst },
513 { "set-src-port", tcp_parse_set_src_dst },
Christopher Fauletee9c98d2021-06-25 15:18:33 +0200514 { "set-dst" , tcp_parse_set_src_dst },
515 { "set-dst-port", tcp_parse_set_src_dst },
Christopher Faulet469c06c2021-06-25 15:11:35 +0200516 { "set-mark", tcp_parse_set_mark },
Christopher Faulet469c06c2021-06-25 15:11:35 +0200517 { "set-tos", tcp_parse_set_tos },
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200518 { "silent-drop", tcp_parse_silent_drop },
519 { /* END */ }
520}};
521
522INITCALL1(STG_REGISTER, tcp_req_cont_keywords_register, &tcp_req_cont_actions);
523
524static struct action_kw_list tcp_res_cont_actions = {ILH, {
Christopher Faulet469c06c2021-06-25 15:11:35 +0200525 { "set-mark", tcp_parse_set_mark },
526 { "set-tos", tcp_parse_set_tos },
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200527 { "silent-drop", tcp_parse_silent_drop },
528 { /* END */ }
529}};
530
531INITCALL1(STG_REGISTER, tcp_res_cont_keywords_register, &tcp_res_cont_actions);
532
533static struct action_kw_list http_req_actions = {ILH, {
Christopher Fauletee9c98d2021-06-25 15:18:33 +0200534 { "set-dst", tcp_parse_set_src_dst },
535 { "set-dst-port", tcp_parse_set_src_dst },
Christopher Faulet469c06c2021-06-25 15:11:35 +0200536 { "set-mark", tcp_parse_set_mark },
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200537 { "set-src", tcp_parse_set_src_dst },
538 { "set-src-port", tcp_parse_set_src_dst },
Christopher Faulet469c06c2021-06-25 15:11:35 +0200539 { "set-tos", tcp_parse_set_tos },
Christopher Fauletee9c98d2021-06-25 15:18:33 +0200540 { "silent-drop", tcp_parse_silent_drop },
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200541 { /* END */ }
542}};
543
544INITCALL1(STG_REGISTER, http_req_keywords_register, &http_req_actions);
545
546static struct action_kw_list http_res_actions = {ILH, {
Christopher Faulet469c06c2021-06-25 15:11:35 +0200547 { "set-mark", tcp_parse_set_mark },
548 { "set-tos", tcp_parse_set_tos },
Willy Tarreauaeae66c2020-08-28 11:03:28 +0200549 { "silent-drop", tcp_parse_silent_drop },
550 { /* END */ }
551}};
552
553INITCALL1(STG_REGISTER, http_res_keywords_register, &http_res_actions);
554
555
556/*
557 * Local variables:
558 * c-indent-level: 8
559 * c-basic-offset: 8
560 * End:
561 */