[exim-cvs] Explicit log of failiing bind addr & port

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Exim Git Commits Mailing List
Date:  
À: exim-cvs
Sujet: [exim-cvs] Explicit log of failiing bind addr & port
Gitweb: https://git.exim.org/exim.git/commitdiff/2b3ac4f13c815ad1b0d59165f2f441f8e4cc6b99
Commit:     2b3ac4f13c815ad1b0d59165f2f441f8e4cc6b99
Parent:     64c7468bb735db31402e82e2c5a343e611c05dd7
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Thu Jul 6 21:43:50 2023 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Thu Jul 6 21:43:50 2023 +0100


    Explicit log of failiing bind addr & port
---
 src/src/deliver.c | 8 ++++----
 src/src/ip.c      | 5 ++++-
 test/log/0227     | 1 +
 test/log/0477     | 1 +
 test/stderr/0227  | 4 +++-
 5 files changed, 13 insertions(+), 6 deletions(-)


diff --git a/src/src/deliver.c b/src/src/deliver.c
index 47368a860..8f0f350d7 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -3353,8 +3353,8 @@ while (!done)

   pipeheader[PIPE_HEADER_SIZE] = '\0';
   DEBUG(D_deliver)
-    debug_printf("got %ld bytes (pipeheader) from transport process %d\n",
-      (long) got, pid);
+    debug_printf("got %ld bytes (pipeheader) '%c' from transport process %d\n",
+      (long) got, *id, pid);


{
/* If we can't decode the pipeheader, the subprocess seems to have a
@@ -3469,7 +3469,7 @@ while (!done)

     /* Put the amount of data written into the parlist block */


-    case 'S':
+    case 'S':        /* Size */
       memcpy(&(p->transport_count), ptr, sizeof(transport_count));
       ptr += sizeof(transport_count);
       break;
@@ -3559,7 +3559,7 @@ while (!done)
       if (*subid > '1') setflag(addr, af_tcp_fastopen_data);
       break;


-    case 'D':
+    case 'D':        /* DSN */
       if (!addr) goto ADDR_MISMATCH;
       memcpy(&(addr->dsn_aware), ptr, sizeof(addr->dsn_aware));
       ptr += sizeof(addr->dsn_aware);
diff --git a/src/src/ip.c b/src/src/ip.c
index b50130be3..6ff8fe626 100644
--- a/src/src/ip.c
+++ b/src/src/ip.c
@@ -161,7 +161,10 @@ ip_bind(int sock, int af, uschar *address, int port)
 {
 union sockaddr_46 sin;
 int s_len = ip_addr(&sin, af, address, port);
-return bind(sock, (struct sockaddr *)&sin, s_len);
+int rc = bind(sock, (struct sockaddr *)&sin, s_len);
+if (rc < 0)
+  log_write(0, LOG_MAIN, "bind of [%s]:%d failed", address, port);
+return rc;
 }



diff --git a/test/log/0227 b/test/log/0227
index 3f56272cd..fd4c64d10 100644
--- a/test/log/0227
+++ b/test/log/0227
@@ -8,6 +8,7 @@
1999-03-02 09:44:33 H=(test) [V4NET.0.0.1] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: Sender verify failed
1999-03-02 09:44:33 H=(test) [V4NET.0.0.1] U=root sender verify fail for <uncheckable2@localhost1>: 127.0.0.1 [127.0.0.1] : response to "MAIL FROM:<>" was: 550 Bad-char error for <> topbitchar:\200\377\377
1999-03-02 09:44:33 H=(test) [V4NET.0.0.1] U=root F=<uncheckable2@localhost1> rejected RCPT <z@???>: Sender verify failed
+1999-03-02 09:44:33 bind of [1.1.1.1]:1111 failed
1999-03-02 09:44:33 recipient verify defer (making calloout connection): T=smtp Netwk addr not available
1999-03-02 09:44:33 H=(test) [V4NET.0.0.1] U=root sender verify defer for <bindfail@localhost1>: Could not complete sender verify callout: 127.0.0.1 [127.0.0.1] : Netwk addr not available
1999-03-02 09:44:33 H=(test) [V4NET.0.0.1] U=root F=<bindfail@localhost1> temporarily rejected RCPT <z@???>: Could not complete sender verify callout
diff --git a/test/log/0477 b/test/log/0477
index 8bbf3edc8..3594ad2d0 100644
--- a/test/log/0477
+++ b/test/log/0477
@@ -1,3 +1,4 @@
1999-03-02 09:44:33 10HmaX-000000005vi-0000 <= CALLER@??? U=CALLER P=local S=sss
+1999-03-02 09:44:33 10HmaX-000000005vi-0000 bind of [99.99.99.99]:1111 failed
1999-03-02 09:44:33 10HmaX-000000005vi-0000 H=127.0.0.1 [127.0.0.1] Netwk addr not available
1999-03-02 09:44:33 10HmaX-000000005vi-0000 == userx@??? R=r1 T=t1 defer (EEE): Netwk addr not available
diff --git a/test/stderr/0227 b/test/stderr/0227
index 7150fbd72..0a4c4f1df 100644
--- a/test/stderr/0227
+++ b/test/stderr/0227
@@ -115,7 +115,9 @@ LOG: smtp_connection MAIN
SMTP connection from root D=qqs closed by QUIT
LOG: smtp_connection MAIN
SMTP connection from root
-Connecting to 127.0.0.1 [127.0.0.1]:PORT_S from 1.1.1.1 ... unable to bind outgoing SMTP call to 1.1.1.1: Netwk addr not available
+Connecting to 127.0.0.1 [127.0.0.1]:PORT_S from 1.1.1.1 ... LOG: MAIN
+ bind of [1.1.1.1]:1111 failed
+unable to bind outgoing SMTP call to 1.1.1.1: Netwk addr not available
failed: Netwk addr not available
LOG: MAIN PANIC
recipient verify defer (making calloout connection): T=smtp Netwk addr not available

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-cvs.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-cvs-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/