netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Flavio Leitner <fbl@redhat.com>
To: netdev@vger.kernel.org
Cc: Joe Stringer <joe@ovn.org>, Pravin B Shelar <pshelar@ovn.org>,
	dev@openvswitch.org, netfilter-devel@vger.kernel.org,
	Pablo Neira Ayuso <pablo@netfilter.org>
Subject: [PATCH net-next v2 4/8] netfilter: nf_nat: register ftp NAT helper.
Date: Sat, 13 Apr 2019 20:17:12 -0300	[thread overview]
Message-ID: <20190413231716.28711-5-fbl@redhat.com> (raw)
In-Reply-To: <20190413231716.28711-1-fbl@redhat.com>

Signed-off-by: Flavio Leitner <fbl@redhat.com>
---
 net/netfilter/nf_nat_ftp.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

V2
  - defined NAT_HELPER_NAME for consistency.
  - C99 static change.
  - renamed the variables to be nat_helper.*

diff --git a/net/netfilter/nf_nat_ftp.c b/net/netfilter/nf_nat_ftp.c
index 0e93b1f19432..0ea6b1bc52de 100644
--- a/net/netfilter/nf_nat_ftp.c
+++ b/net/netfilter/nf_nat_ftp.c
@@ -21,13 +21,18 @@
 #include <net/netfilter/nf_conntrack_expect.h>
 #include <linux/netfilter/nf_conntrack_ftp.h>
 
+#define NAT_HELPER_NAME "ftp"
+
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Rusty Russell <rusty@rustcorp.com.au>");
 MODULE_DESCRIPTION("ftp NAT helper");
-MODULE_ALIAS_NF_NAT_HELPER("ftp");
+MODULE_ALIAS_NF_NAT_HELPER(NAT_HELPER_NAME);
 
 /* FIXME: Time out? --RR */
 
+static struct nf_conntrack_nat_helper nat_helper_ftp =
+	NF_CT_NAT_HELPER_INIT(NAT_HELPER_NAME);
+
 static int nf_nat_ftp_fmt_cmd(struct nf_conn *ct, enum nf_ct_ftp_type type,
 			      char *buffer, size_t buflen,
 			      union nf_inet_addr *addr, u16 port)
@@ -124,6 +129,7 @@ static unsigned int nf_nat_ftp(struct sk_buff *skb,
 
 static void __exit nf_nat_ftp_fini(void)
 {
+	nf_nat_helper_unregister(&nat_helper_ftp);
 	RCU_INIT_POINTER(nf_nat_ftp_hook, NULL);
 	synchronize_rcu();
 }
@@ -131,6 +137,7 @@ static void __exit nf_nat_ftp_fini(void)
 static int __init nf_nat_ftp_init(void)
 {
 	BUG_ON(nf_nat_ftp_hook != NULL);
+	nf_nat_helper_register(&nat_helper_ftp);
 	RCU_INIT_POINTER(nf_nat_ftp_hook, nf_nat_ftp);
 	return 0;
 }
-- 
2.20.1


  parent reply	other threads:[~2019-04-13 23:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-13 23:17 [PATCH net-next v2 0/8] openvswitch: load and reference the NAT helper Flavio Leitner
2019-04-13 23:17 ` [PATCH net-next v2 1/8] netfilter: use macros to create module aliases Flavio Leitner
2019-04-13 23:17 ` [PATCH net-next v2 2/8] netfilter: add API to manage NAT helpers Flavio Leitner
2019-04-15  5:48   ` Pablo Neira Ayuso
2019-04-15 14:04     ` Flavio Leitner
2019-04-15  5:50   ` Pablo Neira Ayuso
2019-04-15 14:05     ` Flavio Leitner
2019-04-13 23:17 ` [PATCH net-next v2 3/8] netfilter: nf_nat: register amanda NAT helper Flavio Leitner
2019-04-13 23:17 ` Flavio Leitner [this message]
2019-04-13 23:17 ` [PATCH net-next v2 5/8] netfilter: nf_nat: register irc " Flavio Leitner
2019-04-13 23:17 ` [PATCH net-next v2 6/8] netfilter: nf_nat: register sip " Flavio Leitner
2019-04-13 23:17 ` [PATCH net-next v2 7/8] netfilter: nf_nat: register tftp " Flavio Leitner
2019-04-13 23:17 ` [PATCH net-next v2 8/8] openvswitch: load and reference the " Flavio Leitner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190413231716.28711-5-fbl@redhat.com \
    --to=fbl@redhat.com \
    --cc=dev@openvswitch.org \
    --cc=joe@ovn.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=pshelar@ovn.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).