Patchwork [2/3] ipset: Handle properly an IPSET_CMD_NONE

login
register
mail settings
Submitter Tomasz Bursztyka
Date June 28, 2012, 12:57 p.m.
Message ID <1340888269-4926-3-git-send-email-tomasz.bursztyka@linux.intel.com>
Download mbox | patch
Permalink /patch/167873/
State Accepted
Headers show

Comments

Tomasz Bursztyka - June 28, 2012, 12:57 p.m.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
---
 net/netfilter/ipset/ip_set_core.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
Jozsef Kadlecsik - June 28, 2012, 2:40 p.m.
On Thu, 28 Jun 2012, Tomasz Bursztyka wrote:

> Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>

Acked-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>

Never occured to me to send IPSET_CMD_NONE :-).

Best regards,
Jozsef
> ---
>  net/netfilter/ipset/ip_set_core.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
> index 819c342..9730882 100644
> --- a/net/netfilter/ipset/ip_set_core.c
> +++ b/net/netfilter/ipset/ip_set_core.c
> @@ -640,6 +640,14 @@ find_free_id(const char *name, ip_set_id_t *index, struct ip_set **set)
>  }
>  
>  static int
> +ip_set_none(struct sock *ctnl, struct sk_buff *skb,
> +	    const struct nlmsghdr *nlh,
> +	    const struct nlattr * const attr[])
> +{
> +	return -EOPNOTSUPP;
> +}
> +
> +static int
>  ip_set_create(struct sock *ctnl, struct sk_buff *skb,
>  	      const struct nlmsghdr *nlh,
>  	      const struct nlattr * const attr[])
> @@ -1539,6 +1547,10 @@ nlmsg_failure:
>  }
>  
>  static const struct nfnl_callback ip_set_netlink_subsys_cb[IPSET_MSG_MAX] = {
> +	[IPSET_CMD_NONE]	= {
> +		.call		= ip_set_none,
> +		.attr_count	= IPSET_ATTR_CMD_MAX,
> +	},
>  	[IPSET_CMD_CREATE]	= {
>  		.call		= ip_set_create,
>  		.attr_count	= IPSET_ATTR_CMD_MAX,
> -- 
> 1.7.8.6
> 
> --
> 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
> 

-
E-mail  : kadlec@blackhole.kfki.hu, kadlecsik.jozsef@wigner.mta.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
          H-1525 Budapest 114, POB. 49, Hungary
--
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 - June 29, 2012, 11:13 a.m.
On Thu, Jun 28, 2012 at 04:40:30PM +0200, Jozsef Kadlecsik wrote:
> On Thu, 28 Jun 2012, Tomasz Bursztyka wrote:
> 
> > Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
> 
> Acked-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
> 
> Never occured to me to send IPSET_CMD_NONE :-).

Applied, 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

Patch

diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index 819c342..9730882 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -640,6 +640,14 @@  find_free_id(const char *name, ip_set_id_t *index, struct ip_set **set)
 }
 
 static int
+ip_set_none(struct sock *ctnl, struct sk_buff *skb,
+	    const struct nlmsghdr *nlh,
+	    const struct nlattr * const attr[])
+{
+	return -EOPNOTSUPP;
+}
+
+static int
 ip_set_create(struct sock *ctnl, struct sk_buff *skb,
 	      const struct nlmsghdr *nlh,
 	      const struct nlattr * const attr[])
@@ -1539,6 +1547,10 @@  nlmsg_failure:
 }
 
 static const struct nfnl_callback ip_set_netlink_subsys_cb[IPSET_MSG_MAX] = {
+	[IPSET_CMD_NONE]	= {
+		.call		= ip_set_none,
+		.attr_count	= IPSET_ATTR_CMD_MAX,
+	},
 	[IPSET_CMD_CREATE]	= {
 		.call		= ip_set_create,
 		.attr_count	= IPSET_ATTR_CMD_MAX,