path: root/kernel/net/netfilter/ipset/ip_set_hash_netiface.c
diff options
authorSergey Popovich <>2014-11-17 18:45:10 +0200
committerJozsef Kadlecsik <>2015-03-20 19:16:45 +0100
commit4c54de30906e8a048211d43bfcdeeab52617378c (patch)
tree4a6c5ba494dd3c2927a9d198d2693b5697646606 /kernel/net/netfilter/ipset/ip_set_hash_netiface.c
parent1ea77bdaa53b396366ec50062298fabf70130ad2 (diff)
netfilter: ipset: Check CIDR value only when attribute is given
There is no reason to check CIDR value regardless attribute specifying CIDR is given. Initialize cidr array in element structure on element structure declaration to let more freedom to the compiler to optimize initialization right before element structure is used. Remove local variables cidr and cidr2 for netnet and netportnet hashes as we do not use packed cidr value for such set types and can store value directly in e.cidr[]. Signed-off-by: Sergey Popovich <> Signed-off-by: Jozsef Kadlecsik <>
Diffstat (limited to 'kernel/net/netfilter/ipset/ip_set_hash_netiface.c')
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/net/netfilter/ipset/ip_set_hash_netiface.c b/kernel/net/netfilter/ipset/ip_set_hash_netiface.c
index cb8e688..29d42d0 100644
--- a/kernel/net/netfilter/ipset/ip_set_hash_netiface.c
+++ b/kernel/net/netfilter/ipset/ip_set_hash_netiface.c
@@ -417,10 +417,12 @@ hash_netiface6_uadt(struct ip_set *set, struct nlattr *tb[],
if (ret)
return ret;
- if (tb[IPSET_ATTR_CIDR])
+ if (tb[IPSET_ATTR_CIDR]) {
e.cidr = nla_get_u8(tb[IPSET_ATTR_CIDR]);
- if (e.cidr > HOST_MASK)
+ if (e.cidr > HOST_MASK)
+ }
ip6_netmask(&e.ip, e.cidr);
nla_strlcpy(e.iface, tb[IPSET_ATTR_IFACE], IFNAMSIZ);