diff mbox

[nf,3/5] netfilter: drop const qualifier from struct nf_conntrack_expect_policy

Message ID 1489934162-7415-4-git-send-email-zlpnobody@163.com
State Changes Requested
Delegated to: Pablo Neira
Headers show

Commit Message

Liping Zhang March 19, 2017, 2:36 p.m. UTC
From: Liping Zhang <zlpnobody@gmail.com>

So we can modify the nf_conntrack_expect_policy directly, the next patch
will need this.

Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
---
 include/net/netfilter/nf_conntrack_helper.h | 4 ++--
 net/ipv4/netfilter/nf_nat_snmp_basic.c      | 2 +-
 net/netfilter/nf_conntrack_amanda.c         | 2 +-
 net/netfilter/nf_conntrack_expect.c         | 2 +-
 net/netfilter/nf_conntrack_ftp.c            | 2 +-
 net/netfilter/nf_conntrack_h323_main.c      | 6 +++---
 net/netfilter/nf_conntrack_helper.c         | 2 +-
 net/netfilter/nf_conntrack_pptp.c           | 2 +-
 net/netfilter/nf_conntrack_sane.c           | 2 +-
 net/netfilter/nf_conntrack_sip.c            | 2 +-
 net/netfilter/nf_conntrack_tftp.c           | 2 +-
 11 files changed, 14 insertions(+), 14 deletions(-)

Comments

Pablo Neira Ayuso March 21, 2017, 10:34 a.m. UTC | #1
On Sun, Mar 19, 2017 at 10:36:00PM +0800, Liping Zhang wrote:
> From: Liping Zhang <zlpnobody@gmail.com>
> 
> So we can modify the nf_conntrack_expect_policy directly, the next patch
> will need this.

I'm missing why you need this.
--
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
Liping Zhang March 21, 2017, 3 p.m. UTC | #2
Hi Pablo,

2017-03-21 18:34 GMT+08:00 Pablo Neira Ayuso <pablo@netfilter.org>:
> On Sun, Mar 19, 2017 at 10:36:00PM +0800, Liping Zhang wrote:
>> From: Liping Zhang <zlpnobody@gmail.com>
>>
>> So we can modify the nf_conntrack_expect_policy directly, the next patch
>> will need this.
>
> I'm missing why you need this.

Because I want to modify the nf_conntrack_expect_policy directly when
do update expect policy in nfct_helper.

I saw you make a cast type to do this:
  policy = (struct nf_conntrack_expect_policy *) &helper->expect_policy[i];
(refer to http://patchwork.ozlabs.org/patch/741528/)

But when I'm working on this, I'm not sure "cast type" is proper or not.
So I just remove the const qualifier.
--
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
Pablo Neira Ayuso March 21, 2017, 3:03 p.m. UTC | #3
On Tue, Mar 21, 2017 at 11:00:02PM +0800, Liping Zhang wrote:
> Hi Pablo,
> 
> 2017-03-21 18:34 GMT+08:00 Pablo Neira Ayuso <pablo@netfilter.org>:
> > On Sun, Mar 19, 2017 at 10:36:00PM +0800, Liping Zhang wrote:
> >> From: Liping Zhang <zlpnobody@gmail.com>
> >>
> >> So we can modify the nf_conntrack_expect_policy directly, the next patch
> >> will need this.
> >
> > I'm missing why you need this.
> 
> Because I want to modify the nf_conntrack_expect_policy directly when
> do update expect policy in nfct_helper.
> 
> I saw you make a cast type to do this:
>   policy = (struct nf_conntrack_expect_policy *) &helper->expect_policy[i];
> (refer to http://patchwork.ozlabs.org/patch/741528/)
> 
> But when I'm working on this, I'm not sure "cast type" is proper or not.
> So I just remove the const qualifier.

I see. I prefer we just cast away the type from the single spot in
nfnl_cthelper.
--
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 mbox

Patch

diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 1eaac1f..621a404 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -27,7 +27,7 @@  struct nf_conntrack_helper {
 
 	char name[NF_CT_HELPER_NAME_LEN]; /* name of the module */
 	struct module *me;		/* pointer to self */
-	const struct nf_conntrack_expect_policy *expect_policy;
+	struct nf_conntrack_expect_policy *expect_policy;
 
 	/* length of internal data, ie. sizeof(struct nf_ct_*_master) */
 	size_t data_len;
@@ -61,7 +61,7 @@  struct nf_conntrack_helper *nf_conntrack_helper_try_module_get(const char *name,
 void nf_ct_helper_init(struct nf_conntrack_helper *helper,
 		       u16 l3num, u16 protonum, const char *name,
 		       u16 default_port, u16 spec_port, u32 id,
-		       const struct nf_conntrack_expect_policy *exp_pol,
+		       struct nf_conntrack_expect_policy *exp_pol,
 		       u32 expect_class_max, u32 data_len,
 		       int (*help)(struct sk_buff *skb, unsigned int protoff,
 				   struct nf_conn *ct,
diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic.c b/net/ipv4/netfilter/nf_nat_snmp_basic.c
index c9b52c3..5f32532 100644
--- a/net/ipv4/netfilter/nf_nat_snmp_basic.c
+++ b/net/ipv4/netfilter/nf_nat_snmp_basic.c
@@ -1255,7 +1255,7 @@  static int help(struct sk_buff *skb, unsigned int protoff,
 	return ret;
 }
 
-static const struct nf_conntrack_expect_policy snmp_exp_policy = {
+static struct nf_conntrack_expect_policy snmp_exp_policy = {
 	.max_expected	= 0,
 	.timeout	= 180,
 };
diff --git a/net/netfilter/nf_conntrack_amanda.c b/net/netfilter/nf_conntrack_amanda.c
index 57a26cc..fbf9f59 100644
--- a/net/netfilter/nf_conntrack_amanda.c
+++ b/net/netfilter/nf_conntrack_amanda.c
@@ -167,7 +167,7 @@  static int amanda_help(struct sk_buff *skb,
 	return ret;
 }
 
-static const struct nf_conntrack_expect_policy amanda_exp_policy = {
+static struct nf_conntrack_expect_policy amanda_exp_policy = {
 	.max_expected		= 3,
 	.timeout		= 180,
 };
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
index 4b2e1fb..2d81122 100644
--- a/net/netfilter/nf_conntrack_expect.c
+++ b/net/netfilter/nf_conntrack_expect.c
@@ -402,7 +402,7 @@  static void evict_oldest_expect(struct nf_conn *master,
 
 static inline int __nf_ct_expect_check(struct nf_conntrack_expect *expect)
 {
-	const struct nf_conntrack_expect_policy *p;
+	struct nf_conntrack_expect_policy *p;
 	struct nf_conntrack_expect *i;
 	struct nf_conn *master = expect->master;
 	struct nf_conn_help *master_help = nfct_help(master);
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c
index 4aecef4..ad51dd3 100644
--- a/net/netfilter/nf_conntrack_ftp.c
+++ b/net/netfilter/nf_conntrack_ftp.c
@@ -561,7 +561,7 @@  static int nf_ct_ftp_from_nlattr(struct nlattr *attr, struct nf_conn *ct)
 
 static struct nf_conntrack_helper ftp[MAX_PORTS * 2] __read_mostly;
 
-static const struct nf_conntrack_expect_policy ftp_exp_policy = {
+static struct nf_conntrack_expect_policy ftp_exp_policy = {
 	.max_expected	= 1,
 	.timeout	= 5 * 60,
 };
diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c
index f65d936..2223c57 100644
--- a/net/netfilter/nf_conntrack_h323_main.c
+++ b/net/netfilter/nf_conntrack_h323_main.c
@@ -629,7 +629,7 @@  static int h245_help(struct sk_buff *skb, unsigned int protoff,
 }
 
 /****************************************************************************/
-static const struct nf_conntrack_expect_policy h245_exp_policy = {
+static struct nf_conntrack_expect_policy h245_exp_policy = {
 	.max_expected	= H323_RTP_CHANNEL_MAX * 4 + 2 /* T.120 */,
 	.timeout	= 240,
 };
@@ -1205,7 +1205,7 @@  static int q931_help(struct sk_buff *skb, unsigned int protoff,
 }
 
 /****************************************************************************/
-static const struct nf_conntrack_expect_policy q931_exp_policy = {
+static struct nf_conntrack_expect_policy q931_exp_policy = {
 	/* T.120 and H.245 */
 	.max_expected		= H323_RTP_CHANNEL_MAX * 4 + 4,
 	.timeout		= 240,
@@ -1791,7 +1791,7 @@  static int ras_help(struct sk_buff *skb, unsigned int protoff,
 }
 
 /****************************************************************************/
-static const struct nf_conntrack_expect_policy ras_exp_policy = {
+static struct nf_conntrack_expect_policy ras_exp_policy = {
 	.max_expected		= 32,
 	.timeout		= 240,
 };
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index 6dc44d9..b8591fb 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -483,7 +483,7 @@  EXPORT_SYMBOL_GPL(nf_conntrack_helper_unregister);
 void nf_ct_helper_init(struct nf_conntrack_helper *helper,
 		       u16 l3num, u16 protonum, const char *name,
 		       u16 default_port, u16 spec_port, u32 id,
-		       const struct nf_conntrack_expect_policy *exp_pol,
+		       struct nf_conntrack_expect_policy *exp_pol,
 		       u32 expect_class_max, u32 data_len,
 		       int (*help)(struct sk_buff *skb, unsigned int protoff,
 				   struct nf_conn *ct,
diff --git a/net/netfilter/nf_conntrack_pptp.c b/net/netfilter/nf_conntrack_pptp.c
index f60a475..1f20d6a 100644
--- a/net/netfilter/nf_conntrack_pptp.c
+++ b/net/netfilter/nf_conntrack_pptp.c
@@ -587,7 +587,7 @@  conntrack_pptp_help(struct sk_buff *skb, unsigned int protoff,
 	return ret;
 }
 
-static const struct nf_conntrack_expect_policy pptp_exp_policy = {
+static struct nf_conntrack_expect_policy pptp_exp_policy = {
 	.max_expected	= 2,
 	.timeout	= 5 * 60,
 };
diff --git a/net/netfilter/nf_conntrack_sane.c b/net/netfilter/nf_conntrack_sane.c
index 9dcb9ee..d54cfec 100644
--- a/net/netfilter/nf_conntrack_sane.c
+++ b/net/netfilter/nf_conntrack_sane.c
@@ -168,7 +168,7 @@  static int help(struct sk_buff *skb,
 
 static struct nf_conntrack_helper sane[MAX_PORTS * 2] __read_mostly;
 
-static const struct nf_conntrack_expect_policy sane_exp_policy = {
+static struct nf_conntrack_expect_policy sane_exp_policy = {
 	.max_expected	= 1,
 	.timeout	= 5 * 60,
 };
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index 0d17894..3ec7b734 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -1592,7 +1592,7 @@  static int sip_help_udp(struct sk_buff *skb, unsigned int protoff,
 
 static struct nf_conntrack_helper sip[MAX_PORTS * 4] __read_mostly;
 
-static const struct nf_conntrack_expect_policy sip_exp_policy[SIP_EXPECT_MAX + 1] = {
+static struct nf_conntrack_expect_policy sip_exp_policy[SIP_EXPECT_MAX + 1] = {
 	[SIP_EXPECT_SIGNALLING] = {
 		.name		= "signalling",
 		.max_expected	= 1,
diff --git a/net/netfilter/nf_conntrack_tftp.c b/net/netfilter/nf_conntrack_tftp.c
index b1227dc..fcc4965 100644
--- a/net/netfilter/nf_conntrack_tftp.c
+++ b/net/netfilter/nf_conntrack_tftp.c
@@ -99,7 +99,7 @@  static int tftp_help(struct sk_buff *skb,
 
 static struct nf_conntrack_helper tftp[MAX_PORTS * 2] __read_mostly;
 
-static const struct nf_conntrack_expect_policy tftp_exp_policy = {
+static struct nf_conntrack_expect_policy tftp_exp_policy = {
 	.max_expected	= 1,
 	.timeout	= 5 * 60,
 };