netfilter: ipset: use the stored first cidr value instead of '1'
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
Родитель
9d8832320f
Коммит
9b03a5ef49
|
@ -156,8 +156,9 @@ hash_ipportnet4_kadt(struct ip_set *set, const struct sk_buff *skb,
|
||||||
{
|
{
|
||||||
const struct ip_set_hash *h = set->data;
|
const struct ip_set_hash *h = set->data;
|
||||||
ipset_adtfn adtfn = set->variant->adt[adt];
|
ipset_adtfn adtfn = set->variant->adt[adt];
|
||||||
struct hash_ipportnet4_elem data =
|
struct hash_ipportnet4_elem data = {
|
||||||
{ .cidr = h->nets[0].cidr || HOST_MASK };
|
.cidr = h->nets[0].cidr ? h->nets[0].cidr : HOST_MASK
|
||||||
|
};
|
||||||
|
|
||||||
if (data.cidr == 0)
|
if (data.cidr == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -434,8 +435,9 @@ hash_ipportnet6_kadt(struct ip_set *set, const struct sk_buff *skb,
|
||||||
{
|
{
|
||||||
const struct ip_set_hash *h = set->data;
|
const struct ip_set_hash *h = set->data;
|
||||||
ipset_adtfn adtfn = set->variant->adt[adt];
|
ipset_adtfn adtfn = set->variant->adt[adt];
|
||||||
struct hash_ipportnet6_elem data =
|
struct hash_ipportnet6_elem data = {
|
||||||
{ .cidr = h->nets[0].cidr || HOST_MASK };
|
.cidr = h->nets[0].cidr ? h->nets[0].cidr : HOST_MASK
|
||||||
|
};
|
||||||
|
|
||||||
if (data.cidr == 0)
|
if (data.cidr == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -139,7 +139,9 @@ hash_net4_kadt(struct ip_set *set, const struct sk_buff *skb,
|
||||||
{
|
{
|
||||||
const struct ip_set_hash *h = set->data;
|
const struct ip_set_hash *h = set->data;
|
||||||
ipset_adtfn adtfn = set->variant->adt[adt];
|
ipset_adtfn adtfn = set->variant->adt[adt];
|
||||||
struct hash_net4_elem data = { .cidr = h->nets[0].cidr || HOST_MASK };
|
struct hash_net4_elem data = {
|
||||||
|
.cidr = h->nets[0].cidr ? h->nets[0].cidr : HOST_MASK
|
||||||
|
};
|
||||||
|
|
||||||
if (data.cidr == 0)
|
if (data.cidr == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -336,7 +338,9 @@ hash_net6_kadt(struct ip_set *set, const struct sk_buff *skb,
|
||||||
{
|
{
|
||||||
const struct ip_set_hash *h = set->data;
|
const struct ip_set_hash *h = set->data;
|
||||||
ipset_adtfn adtfn = set->variant->adt[adt];
|
ipset_adtfn adtfn = set->variant->adt[adt];
|
||||||
struct hash_net6_elem data = { .cidr = h->nets[0].cidr || HOST_MASK };
|
struct hash_net6_elem data = {
|
||||||
|
.cidr = h->nets[0].cidr ? h->nets[0].cidr : HOST_MASK
|
||||||
|
};
|
||||||
|
|
||||||
if (data.cidr == 0)
|
if (data.cidr == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -153,7 +153,8 @@ hash_netport4_kadt(struct ip_set *set, const struct sk_buff *skb,
|
||||||
const struct ip_set_hash *h = set->data;
|
const struct ip_set_hash *h = set->data;
|
||||||
ipset_adtfn adtfn = set->variant->adt[adt];
|
ipset_adtfn adtfn = set->variant->adt[adt];
|
||||||
struct hash_netport4_elem data = {
|
struct hash_netport4_elem data = {
|
||||||
.cidr = h->nets[0].cidr || HOST_MASK };
|
.cidr = h->nets[0].cidr ? h->nets[0].cidr : HOST_MASK
|
||||||
|
};
|
||||||
|
|
||||||
if (data.cidr == 0)
|
if (data.cidr == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -397,7 +398,8 @@ hash_netport6_kadt(struct ip_set *set, const struct sk_buff *skb,
|
||||||
const struct ip_set_hash *h = set->data;
|
const struct ip_set_hash *h = set->data;
|
||||||
ipset_adtfn adtfn = set->variant->adt[adt];
|
ipset_adtfn adtfn = set->variant->adt[adt];
|
||||||
struct hash_netport6_elem data = {
|
struct hash_netport6_elem data = {
|
||||||
.cidr = h->nets[0].cidr || HOST_MASK };
|
.cidr = h->nets[0].cidr ? h->nets[0].cidr : HOST_MASK
|
||||||
|
};
|
||||||
|
|
||||||
if (data.cidr == 0)
|
if (data.cidr == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче