Message ID | 1465389800-27842-2-git-send-email-zlpnobody@163.com |
---|---|
State | Accepted |
Delegated to: | Pablo Neira |
Headers | show |
On Wed, Jun 08, 2016 at 08:43:17PM +0800, Liping Zhang wrote: > From: Liping Zhang <liping.zhang@spreadtrum.com> > > When we request NFPROTO_INET, it means both NFPROTO_IPV4 and NFPROTO_IPV6. > > Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com> > --- > net/netfilter/nf_log.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c > index a5d41df..73b845d 100644 > --- a/net/netfilter/nf_log.c > +++ b/net/netfilter/nf_log.c > @@ -159,6 +159,20 @@ int nf_logger_find_get(int pf, enum nf_log_type type) > struct nf_logger *logger; > int ret = -ENOENT; > > + if (pf == NFPROTO_INET) { > + ret = nf_logger_find_get(NFPROTO_IPV4, type); > + if (ret < 0) > + return ret; > + > + ret = nf_logger_find_get(NFPROTO_IPV6, type); > + if (ret < 0) { > + nf_logger_put(NFPROTO_IPV4, type); > + return ret; > + } > + > + return 0; This is already done from nft_log_init(). Are you observing any problem there? -- 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
On Thu, Jun 23, 2016 at 01:22:05PM +0200, Pablo Neira Ayuso wrote: > On Wed, Jun 08, 2016 at 08:43:17PM +0800, Liping Zhang wrote: > > From: Liping Zhang <liping.zhang@spreadtrum.com> > > > > When we request NFPROTO_INET, it means both NFPROTO_IPV4 and NFPROTO_IPV6. > > > > Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com> > > --- > > net/netfilter/nf_log.c | 20 ++++++++++++++++++++ > > 1 file changed, 20 insertions(+) > > > > diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c > > index a5d41df..73b845d 100644 > > --- a/net/netfilter/nf_log.c > > +++ b/net/netfilter/nf_log.c > > @@ -159,6 +159,20 @@ int nf_logger_find_get(int pf, enum nf_log_type type) > > struct nf_logger *logger; > > int ret = -ENOENT; > > > > + if (pf == NFPROTO_INET) { > > + ret = nf_logger_find_get(NFPROTO_IPV4, type); > > + if (ret < 0) > > + return ret; > > + > > + ret = nf_logger_find_get(NFPROTO_IPV6, type); > > + if (ret < 0) { > > + nf_logger_put(NFPROTO_IPV4, type); > > + return ret; > > + } > > + > > + return 0; > > This is already done from nft_log_init(). > > Are you observing any problem there? Oh, I see, you get rid of that code in your follow up patch. I'm going to merge 1/4 and 2/4, this change should be introduced in one go as they are part of the same logical change. No need to resend. Thanks. -- 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 --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index a5d41df..73b845d 100644 --- a/net/netfilter/nf_log.c +++ b/net/netfilter/nf_log.c @@ -159,6 +159,20 @@ int nf_logger_find_get(int pf, enum nf_log_type type) struct nf_logger *logger; int ret = -ENOENT; + if (pf == NFPROTO_INET) { + ret = nf_logger_find_get(NFPROTO_IPV4, type); + if (ret < 0) + return ret; + + ret = nf_logger_find_get(NFPROTO_IPV6, type); + if (ret < 0) { + nf_logger_put(NFPROTO_IPV4, type); + return ret; + } + + return 0; + } + if (rcu_access_pointer(loggers[pf][type]) == NULL) request_module("nf-logger-%u-%u", pf, type); @@ -179,6 +193,12 @@ void nf_logger_put(int pf, enum nf_log_type type) { struct nf_logger *logger; + if (pf == NFPROTO_INET) { + nf_logger_put(NFPROTO_IPV4, type); + nf_logger_put(NFPROTO_IPV6, type); + return; + } + BUG_ON(loggers[pf][type] == NULL); rcu_read_lock();