diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2015-01-18 21:05:56 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2015-01-18 21:05:56 +0000 |
commit | aeaf5db33f20a06399b8b15630cd2f5e9755e38a (patch) | |
tree | fbb7bb494996ec616d6680fff4c3c995de935452 /src | |
parent | 09b99df91359c95c1c5a7f25c9a9cfcb17b7dd02 (diff) |
Log local IP on delivery log line, under the incoming_interface log selector. Bug 507
Diffstat (limited to 'src')
-rw-r--r-- | src/src/deliver.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/src/deliver.c b/src/src/deliver.c index a0c48d652..afbadca6a 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -817,6 +817,10 @@ else s = string_append(s, &size, &ptr, 2, US"> ", log_address); } +if (log_extra_selector & LX_incoming_interface && sending_ip_address) + s = string_append(s, &size, &ptr, 3, US" I=[", sending_ip_address, US"]"); + /* for the port: string_sprintf("%d", sending_port) */ + if ((log_extra_selector & LX_sender_on_delivery) != 0 || msg) s = string_append(s, &size, &ptr, 3, US" F=<", sender_address, US">"); @@ -3219,6 +3223,14 @@ while (!done) addr = addr->next; break; + /* Local interface address/port */ + case 'I': + if (*ptr) sending_ip_address = string_copy(ptr); + while (*ptr++) ; + if (*ptr) sending_port = atoi(ptr); + while (*ptr++) ; + break; + /* Z marks the logical end of the data. It is followed by '0' if continue_transport was NULL at the end of transporting, otherwise '1'. We need to know when it becomes NULL during a delivery down a passed SMTP @@ -4430,6 +4442,18 @@ for (delivery_count = 0; addr_remote != NULL; delivery_count++) rmt_dlv_checked_write(fd, 'A', '0', big_buffer, ptr - big_buffer); } + /* Local interface address/port */ + if (log_extra_selector & LX_incoming_interface && sending_ip_address) + { + uschar * ptr = big_buffer; + sprintf(CS ptr, "%.128s", sending_ip_address); + while(*ptr++); + sprintf(CS ptr, "%d", sending_port); + while(*ptr++); + + rmt_dlv_checked_write(fd, 'I', '0', big_buffer, ptr - big_buffer); + } + /* Add termination flag, close the pipe, and that's it. The character after 'Z' indicates whether continue_transport is now NULL or not. A change from non-NULL to NULL indicates a problem with a continuing |