diff mbox

[conntrack-tools] sync-mode: print errno message on failure

Message ID 147756361728.15386.11786527603548778870.stgit@nfdev2.cica.es
State Accepted
Delegated to: Florian Westphal
Headers show

Commit Message

Arturo Borrero Gonzalez Oct. 27, 2016, 10:20 a.m. UTC
I have observed this message several times:

 [ERROR] can't open channel socket
 [ERROR] initialization failed

which is very difficult to understand.

The errno message should help this to be a bit more explicit.
With this patch, in the case of wrong interface:

 [ERROR] can't open channel socket: No such device
 [ERROR] initialization failed

Signed-off-by: Arturo Borrero Gonzalez <arturo@debian.org>
---
 src/sync-mode.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Florian Westphal Oct. 27, 2016, 2:45 p.m. UTC | #1
Arturo Borrero Gonzalez <arturo@debian.org> wrote:
> I have observed this message several times:
> 
>  [ERROR] can't open channel socket
>  [ERROR] initialization failed
> 
> which is very difficult to understand.
> 
> The errno message should help this to be a bit more explicit.
> With this patch, in the case of wrong interface:
> 
>  [ERROR] can't open channel socket: No such device

Indeed, much better.

Applied, thanks Arturo.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/sync-mode.c b/src/sync-mode.c
index e69ecfe..8fe65f1 100644
--- a/src/sync-mode.c
+++ b/src/sync-mode.c
@@ -412,7 +412,8 @@  static int init_sync(void)
 	STATE_SYNC(channel) =
 		multichannel_open(CONFIG(channel), CONFIG(channel_num));
 	if (STATE_SYNC(channel) == NULL) {
-		dlog(LOG_ERR, "can't open channel socket");
+		dlog(LOG_ERR, "can't open channel socket: %s",
+		     strerror(errno));
 		return -1;
 	}
 	for (i=0; i<STATE_SYNC(channel)->channel_num; i++) {