]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libiptc: fix retry path in TC_INIT
authorMiguel GAIO <miguel.gaio@efixo.com>
Thu, 19 Apr 2012 00:14:33 +0000 (00:14 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 19 Apr 2012 16:54:20 +0000 (18:54 +0200)
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 reopens sockfd in retry patch.

Signed-off-by: Miguel GAIO <miguel.gaio@efixo.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
libiptc/libiptc.c

index 63965e7385960bf854f6c9e004f6cd64b780fdd6..f0f78155ad2d0776e3b66575683d7bcafaa68ad3 100644 (file)
@@ -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);