From: emeric Date: Fri, 22 Oct 2010 15:06:26 +0000 (+0200) Subject: [BUG] proto_tcp: potential bug on pattern fetch dst and dport X-Git-Tag: v1.5-dev8~431 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8aa6b3762cec4756b226c499f8a0cac3b0e6f9f0;p=thirdparty%2Fhaproxy.git [BUG] proto_tcp: potential bug on pattern fetch dst and dport Pattern fetches relying on destination address must first fetch the address if it has not been done yet. (cherry picked from commit 21abf441feb318b2ccd7df590fd89e9e824627f6) --- diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 22179b9ab6..7aa6d407df 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -1054,6 +1054,9 @@ static int pattern_fetch_dst(struct proxy *px, struct session *l4, void *l7, int dir, const char *arg, int arg_len, union pattern_data *data) { + if (!(l4->flags & SN_FRT_ADDR_SET)) + get_frt_addr(l4); + data->ip.s_addr = ((struct sockaddr_in *)&l4->frt_addr)->sin_addr.s_addr; return 1; } @@ -1079,6 +1082,9 @@ pattern_fetch_dport(struct proxy *px, struct session *l4, void *l7, int dir, const char *arg, int arg_len, union pattern_data *data) { + if (!(l4->flags & SN_FRT_ADDR_SET)) + get_frt_addr(l4); + data->integer = ntohs(((struct sockaddr_in *)&l4->frt_addr)->sin_port); return 1; }