libiptc: fix retry path in TC_INIT
Hi,
There is an issue on TC_INIT retry path:
In error case, TC_FREE is called and close sockfd. The retry does not reopen then always fail.
The proposing patch reopen sockfd in retry patch.
Miguel
Quoted 1 line
From
6dbb1a9f16c70a60c06559b31eac7ab3af789fa1Mon Sep 17 00:00:00 2001
From: Miguel GAIO <[email protected]>
Date: Tue, 17 Apr 2012 10:16:28 +0200
Subject: [PATCH 2008/2008] libiptc: TC_INIT fix retry
--- libiptc/libiptc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libiptc/libiptc.c +1 -1
@@ -1314,6 +1314,7 @@ TC_INIT(const char *tablename)return NULL ; } +retry: sockfd =socket (TC_AF ,SOCK_RAW ,IPPROTO_RAW );if (sockfd <0 )return NULL ;
@@ -1324,7 +1325,6 @@ TC_INIT(const char *tablename)abort (); } -retry: s =sizeof (info);strcpy (info.name, tablename);
Signature · 1 line
1.7.9.5
Pablo Neira Ayuso
maintainerHi Miguel,
Quoted 25 lines · Miguel GAIO
Hi,
There is an issue on
TC_INITretry path:
In error case,TC_FREEis called and close sockfd. The retry does not reopen then always fail.The proposing patch reopen sockfd in retry patch.
Miguel
From
6dbb1a9f16c70a60c06559b31eac7ab3af789fa1Mon Sep 17 00:00:00 2001
From: Miguel GAIO <[email protected]>
Date: Tue, 17 Apr 2012 10:16:28 +0200
Subject: [PATCH 2008/2008] libiptc:TC_INITfix retry--- libiptc/libiptc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)libiptc/libiptc.c +0
-0
libiptc/libiptc.c TC_INIT(const char *tablename) · line 1317
Quoted 4 lines
libiptc/libiptc.c +1
-0@@ -1314,6 +1314,7 @@ TC_INIT(const char *tablename)return NULL ; } +retry:
Still iptc_fn is set to TC_FREE. We have to move up to the beginning of TC_INIT.
On Thu, 2012-04-19 at 01:12 +0200, Pablo Neira Ayuso wrote:
Hi,
Quoted 31 lines
Hi Miguel,
Quoted 28 lines · Miguel GAIO
Hi,
There is an issue on
TC_INITretry path:
In error case,TC_FREEis called and close sockfd. The retry does not reopen then always fail.The proposing patch reopen sockfd in retry patch.
Miguel
From
6dbb1a9f16c70a60c06559b31eac7ab3af789fa1Mon Sep 17 00:00:00 2001
From: Miguel GAIO <[email protected]>
Date: Tue, 17 Apr 2012 10:16:28 +0200
Subject: [PATCH 2008/2008] libiptc:TC_INITfix retry--- libiptc/libiptc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)libiptc/libiptc.c +0
-0@@ -1314,6 +1314,7 @@ TC_INIT(const char *tablename)return NULL ; }
Quoted 4 lines
libiptc/libiptc.c TC_INIT(const char *tablename) · line 1317
Quoted 1 line
libiptc/libiptc.c +1
-0+retry:Still
iptc_fnis set toTC_FREE. We have to move up to the beginning ofTC_INIT.
Your right, I miss it.
I resend patch with the retry at the beginning of TC_INIT.
Quoted 1 line
From
202e62cd5f143ce9ef5d7fc8cdd2aca81dc013bfMon Sep 17 00:00:00 2001
From: Miguel GAIO <[email protected]>
Date: Thu, 19 Apr 2012 12:11:06 +0200
Subject: [PATCH] libiptc: TC_INIT fix retry
--- libiptc/libiptc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libiptc/libiptc.c +1 -1
@@ -1307,6 +1307,7 @@ TC_INIT(const char *tablename)socklen_t s;int sockfd; +retry: iptc_fn =TC_INIT ;if (strlen (tablename) >=TABLE_MAXNAMELEN ) {
@@ -1324,7 +1325,6 @@ TC_INIT(const char *tablename)abort (); } -retry: s =sizeof (info);strcpy (info.name, tablename);
Signature · 1 line
1.7.9.5
Quoted 1 line · Miguel GAIO
On Thu, 2012-04-19 at 01:12 +0200, Pablo Neira Ayuso wrote:
[...]
Quoted 6 lines
Quoted 3 lines
Still
iptc_fnis set toTC_FREE. We have to move up to the beginning ofTC_INIT.Your right, I miss it.
I resend patch with the retry at the beginning ofTC_INIT.
Applied, Thanks Miguel.