]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] proto_tcp: potential bug on pattern fetch dst and dport
authoremeric <emeric@exceliance.fr>
Fri, 22 Oct 2010 15:06:26 +0000 (17:06 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 30 Oct 2010 17:04:35 +0000 (19:04 +0200)
Pattern fetches relying on destination address must first fetch
the address if it has not been done yet.

(cherry picked from commit 21abf441feb318b2ccd7df590fd89e9e824627f6)

src/proto_tcp.c

index 22179b9ab6bdbd8fe3cecfd4bc5487a8e06ba635..7aa6d407dfa6213314e25608168ba2201e330df2 100644 (file)
@@ -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;
 }