From: Aman Gupta Date: Tue, 3 Apr 2012 01:57:55 +0000 (-0700) Subject: MINOR: Add TO/FROM_SET flags to struct stream_interface X-Git-Tag: v1.5-dev9~112 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0bc0c2426c748f8459c250b60ee701cdc0ecc517;p=thirdparty%2Fhaproxy.git MINOR: Add TO/FROM_SET flags to struct stream_interface [WT: it will make sense to remove SN_FRT_ADDR_SET and to use these flags everywhere instead ] --- diff --git a/include/types/stream_interface.h b/include/types/stream_interface.h index 8f35d643d8..dae36efdbd 100644 --- a/include/types/stream_interface.h +++ b/include/types/stream_interface.h @@ -73,6 +73,8 @@ enum { SI_FL_INDEP_STR = 0x0040, /* independant streams = don't update rex on write */ SI_FL_NOLINGER = 0x0080, /* may close without lingering. One-shot. */ SI_FL_SRC_ADDR = 0x1000, /* get the source ip/port with getsockname */ + SI_FL_TO_SET = 0x2000, /* addr.to is set */ + SI_FL_FROM_SET = 0x4000, /* addr.from is set */ }; /* target types */ diff --git a/src/frontend.c b/src/frontend.c index 12dc2c8a0e..35c3ef338a 100644 --- a/src/frontend.c +++ b/src/frontend.c @@ -54,6 +54,7 @@ void get_frt_addr(struct session *s) if (get_original_dst(s->si[0].fd, (struct sockaddr_in *)&s->si[0].addr.to, &namelen) == -1) getsockname(s->si[0].fd, (struct sockaddr *)&s->si[0].addr.to, &namelen); + s->si[0].flags |= SI_FL_TO_SET; s->flags |= SN_FRT_ADDR_SET; } diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 63241966d9..39ef26bb3e 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -443,6 +443,7 @@ int tcp_connect_server(struct stream_interface *si) if (getsockname(fd, (struct sockaddr *)&si->addr.from, &addrlen) == -1) { Warning("Cannot get source address for logging.\n"); } + si->flags |= SI_FL_FROM_SET; } fdtab[fd].owner = si;