Re: [PATCH nf] ipset: allow a 0 netmask with hash_netiface type

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

 



On Tue, 12 Jan 2016, Florian Westphal wrote:

> Jozsef Kadlecsik <kadlec@xxxxxxxxxxxxxxxxx> wrote:
> > 
> > On Tue, 12 Jan 2016, Florian Westphal wrote:
> > 
> > > Jozsef says:
> > >  The correct behaviour is that if we have
> > >  ipset create test1 hash:net,iface
> > >  ipset add test1 0.0.0.0/0,eth0
> > >  iptables -A INPUT -m set --match-set test1 src,src
> > > 
> > >  then the rule should match for any traffic coming in through eth0.
> > > 
> > > This removes the -EINVAL runtime test to make matching work
> > > in case packet arrived via the specified interface.
> > 
> > No, the patch actually would break the set type. In order to support /0 
> > prefixes, cidr + 1 is stored internally. Zero value means "empty 
> > slot/bucket".
> 
> Hmm, but matching is broken currently, the rule quoted above never
> matches.  And its exaclty because of if (e.cidr == 0) is true.
> 
> Tested with nf-next tree.
> Before patch: never matches
> After patch: matches for all packets from eth0

I was wrong and the patch is correct, the removed condition is just 
unnecessary and breaks to match /0. I have already applied the patch in 
the ipset tree and added a new test to verify the case. Thanks, Florian!

Best regards,
Jozsef
-
E-mail  : kadlec@xxxxxxxxxxxxxxxxx, kadlecsik.jozsef@xxxxxxxxxxxxx
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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



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

  Powered by Linux