Re: [PATCH 3/7] netfilter: nf_ct_helper: implement variable length helper private data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 2012-06-04 14:21, pablo@xxxxxxxxxxxxx wrote:

>+static inline void *nfct_help_data(const struct nf_conn *ct)
>+{
>+	struct nf_conn_help *help;
>+
>+	help = nf_ct_ext_find(ct, NF_CT_EXT_HELPER);
>+
>+	return (void *)&help->data;
>+}

I think you wanted

	return help->data;

here. Remember that help->data is of type char[0] which is
convertible to char* - which is what you want,
while adding an extra & would turn that into the undesired (char[0])*.



>@@ -89,12 +59,13 @@ struct nf_conn_help {
> 	/* Helper. if any */
> 	struct nf_conntrack_helper __rcu *helper;
> 
>-	union nf_conntrack_help help;
>-
> 	struct hlist_head expectations;
> 
> 	/* Current number of expected connections */
> 	u8 expecting[NF_CT_MAX_EXPECT_CLASSES];
>+
>+	/* private helper information. */
>+	char data[0];

There is a now-standardized notation:

	char data[];



>@@ -218,13 +221,13 @@ int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
> 	}
> 
> 	if (help == NULL) {
>-		help = nf_ct_helper_ext_add(ct, flags);
>+		help = nf_ct_helper_ext_add(ct, helper, flags);
> 		if (help == NULL) {
> 			ret = -ENOMEM;
> 			goto out;
> 		}
> 	} else {
>-		memset(&help->help, 0, sizeof(help->help));
>+		memset(&help->data, 0, sizeof(helper->data_len));
> 	}

memset(help->data, 0, sizeof(helper->data_len));

>index 6f4b00a..30f5e12 100644
>--- a/net/netfilter/nf_conntrack_netlink.c
>+++ b/net/netfilter/nf_conntrack_netlink.c
>@@ -1218,7 +1218,7 @@ ctnetlink_change_helper(struct nf_conn *ct, const struct nlattr * const cda[])
> 		if (help->helper)
> 			return -EBUSY;
> 		/* need to zero data of old helper */
>-		memset(&help->help, 0, sizeof(help->help));
>+		memset(&help->data, 0, help->helper->data_len);

Here too.. memset(help->data,...
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux