CONN_HASH_PARAMS_TYPE_DST_PORT = 0x4,
CONN_HASH_PARAMS_TYPE_SRC_ADDR = 0x8,
CONN_HASH_PARAMS_TYPE_SRC_PORT = 0x10,
+ CONN_HASH_PARAMS_TYPE_PROXY = 0x20,
};
-#define CONN_HASH_PARAMS_TYPE_COUNT 5
+#define CONN_HASH_PARAMS_TYPE_COUNT 6
#define CONN_HASH_PAYLOAD_LEN \
(((sizeof(((struct connection *)0)->hash)) * 8) - CONN_HASH_PARAMS_TYPE_COUNT)
XXH64_hash_t *sni_prehash;
struct sockaddr_storage *src_addr;
struct sockaddr_storage *dst_addr;
+ XXH64_hash_t *proxy_prehash;
};
/* This structure describes a connection with its methods and data.
-hdr "in: bar"
rxresp
expect resp.http.http_unique_id == "TEST-bar"
- expect resp.http.proxy_unique_id == "TEST-foo"
+ expect resp.http.proxy_unique_id == "TEST-bar"
} -run
int err;
struct sample *sni_smp = NULL;
struct sockaddr_storage *bind_addr;
+ int proxy_line_ret;
int64_t hash = 0;
struct conn_hash_params hash_params;
- XXH64_hash_t sni_hash;
+ XXH64_hash_t sni_hash, proxy_hash;
/* first, set unique connection parameters and then calculate hash */
memset(&hash_params, 0, sizeof(hash_params));
hash_params.src_addr = bind_addr;
+ /* 4. proxy protocol */
+ if (srv && srv->pp_opts) {
+ proxy_line_ret = make_proxy_line(trash.area, trash.size, srv, cli_conn, s);
+ if (proxy_line_ret) {
+ proxy_hash = conn_hash_prehash(trash.area, proxy_line_ret);
+ hash_params.proxy_prehash = &proxy_hash;
+ }
+ }
+
if (srv)
hash = conn_calculate_hash(&hash_params);
srv_conn->send_proxy_ofs = 0;
if (srv && srv->pp_opts) {
- conn_set_private(srv_conn);
srv_conn->flags |= CO_FL_SEND_PROXY;
srv_conn->send_proxy_ofs = 1; /* must compute size */
if (cli_conn)
CONN_HASH_PARAMS_TYPE_SRC_PORT);
}
- hash = conn_hash_digest(buf, idx, hash_flags);
+ if (params->proxy_prehash) {
+ conn_hash_update(buf, &idx,
+ params->proxy_prehash, sizeof(*params->proxy_prehash),
+ &hash_flags, CONN_HASH_PARAMS_TYPE_PROXY);
+ }
+ hash = conn_hash_digest(buf, idx, hash_flags);
return hash;
}