* libiptc: fix retry path in TC_INIT
@ 2012-04-17 8:29 Miguel GAIO
2012-04-18 23:12 ` Pablo Neira Ayuso
0 siblings, 1 reply; 4+ messages in thread
From: Miguel GAIO @ 2012-04-17 8:29 UTC (permalink / raw)
To: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 201 bytes --]
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
[-- Attachment #2: libiptc-TC_INIT-fix-retry.patch --]
[-- Type: text/x-patch, Size: 730 bytes --]
>From 6dbb1a9f16c70a60c06559b31eac7ab3af789fa1 Mon Sep 17 00:00:00 2001
From: Miguel GAIO <miguel.gaio@efixo.com>
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(-)
diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c
index 63965e7..cd2ad9d 100644
--- a/libiptc/libiptc.c
+++ b/libiptc/libiptc.c
@@ -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);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: libiptc: fix retry path in TC_INIT
2012-04-17 8:29 libiptc: fix retry path in TC_INIT Miguel GAIO
@ 2012-04-18 23:12 ` Pablo Neira Ayuso
2012-04-19 10:14 ` Miguel GAIO
0 siblings, 1 reply; 4+ messages in thread
From: Pablo Neira Ayuso @ 2012-04-18 23:12 UTC (permalink / raw)
To: Miguel GAIO; +Cc: netfilter-devel
Hi Miguel,
On Tue, Apr 17, 2012 at 10:29:23AM +0200, Miguel GAIO wrote:
> 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
>
> From 6dbb1a9f16c70a60c06559b31eac7ab3af789fa1 Mon Sep 17 00:00:00 2001
> From: Miguel GAIO <miguel.gaio@efixo.com>
> 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(-)
>
> diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c
> index 63965e7..cd2ad9d 100644
> --- a/libiptc/libiptc.c
> +++ b/libiptc/libiptc.c
> @@ -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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libiptc: fix retry path in TC_INIT
2012-04-18 23:12 ` Pablo Neira Ayuso
@ 2012-04-19 10:14 ` Miguel GAIO
2012-04-19 16:55 ` Pablo Neira Ayuso
0 siblings, 1 reply; 4+ messages in thread
From: Miguel GAIO @ 2012-04-19 10:14 UTC (permalink / raw)
To: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 1135 bytes --]
On Thu, 2012-04-19 at 01:12 +0200, Pablo Neira Ayuso wrote:
Hi,
> Hi Miguel,
>
> On Tue, Apr 17, 2012 at 10:29:23AM +0200, Miguel GAIO wrote:
> > 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
> >
> > From 6dbb1a9f16c70a60c06559b31eac7ab3af789fa1 Mon Sep 17 00:00:00 2001
> > From: Miguel GAIO <miguel.gaio@efixo.com>
> > 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(-)
> >
> > diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c
> > index 63965e7..cd2ad9d 100644
> > --- a/libiptc/libiptc.c
> > +++ b/libiptc/libiptc.c
> > @@ -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.
Your right, I miss it.
I resend patch with the retry at the beginning of TC_INIT.
[-- Attachment #2: 0001-libiptc-TC_INIT-fix-retry.patch --]
[-- Type: text/x-patch, Size: 716 bytes --]
>From 202e62cd5f143ce9ef5d7fc8cdd2aca81dc013bf Mon Sep 17 00:00:00 2001
From: Miguel GAIO <miguel.gaio@efixo.com>
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(-)
diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c
index 63965e7..f0f7815 100644
--- a/libiptc/libiptc.c
+++ b/libiptc/libiptc.c
@@ -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);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: libiptc: fix retry path in TC_INIT
2012-04-19 10:14 ` Miguel GAIO
@ 2012-04-19 16:55 ` Pablo Neira Ayuso
0 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2012-04-19 16:55 UTC (permalink / raw)
To: Miguel GAIO; +Cc: netfilter-devel
On Thu, Apr 19, 2012 at 12:14:33PM +0200, Miguel GAIO wrote:
> On Thu, 2012-04-19 at 01:12 +0200, Pablo Neira Ayuso wrote:
[...]
> >
> > Still iptc_fn is set to TC_FREE. We have to move up to the beginning
> > of TC_INIT.
>
> Your right, I miss it.
> I resend patch with the retry at the beginning of TC_INIT.
Applied, Thanks Miguel.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-04-19 16:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-17 8:29 libiptc: fix retry path in TC_INIT Miguel GAIO
2012-04-18 23:12 ` Pablo Neira Ayuso
2012-04-19 10:14 ` Miguel GAIO
2012-04-19 16:55 ` Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.