BUG/MINOR: http: fix "set-tos" not working in certain configurations

s->req->prod->conn->addr.to.ss_family contains only useful data if
conn_get_to_addr() is called early. If thats not the case (nothing in the
configuration needs the destination address like logs, transparent, ...)
then "set-tos" doesn't work.

Fix this by checking s->req->prod->conn->addr.from.ss_family instead.
Also fix a minor doc issue about set-tos in http-response.
This commit is contained in:
Lukas Tribus 2013-06-19 23:34:41 +02:00 committed by Willy Tarreau
parent dc13c11c1e
commit 2dd1d1a93f
2 changed files with 4 additions and 3 deletions

View File

@ -2803,7 +2803,8 @@ http-request { allow | deny | tarpit | auth [realm <realm>] | redirect <rule> |
http-response { allow | deny | add-header <name> <fmt> | set-nice <nice> |
set-header <name> <fmt> | set-log-level <level> |
set-mark <mark> } [ { if | unless } <condition> ]
set-mark <mark> | set-tos <tos> }
[ { if | unless } <condition> ]
Access control for Layer 7 responses
May be used in sections: defaults | frontend | listen | backend

View File

@ -3213,7 +3213,7 @@ http_req_get_intercept_rule(struct proxy *px, struct list *rules, struct session
case HTTP_REQ_ACT_SET_TOS:
#ifdef IP_TOS
if (s->req->prod->conn->addr.to.ss_family == AF_INET)
if (s->req->prod->conn->addr.from.ss_family == AF_INET)
setsockopt(s->req->prod->conn->t.sock.fd, IPPROTO_IP, IP_TOS, &rule->arg.tos, sizeof(rule->arg.tos));
#endif
break;
@ -3299,7 +3299,7 @@ http_res_get_intercept_rule(struct proxy *px, struct list *rules, struct session
case HTTP_RES_ACT_SET_TOS:
#ifdef IP_TOS
if (s->req->prod->conn->addr.to.ss_family == AF_INET)
if (s->req->prod->conn->addr.from.ss_family == AF_INET)
setsockopt(s->req->prod->conn->t.sock.fd, IPPROTO_IP, IP_TOS, &rule->arg.tos, sizeof(rule->arg.tos));
#endif
break;