Re: [PATCH nf] selftests: netfilter: use randomized netns names

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

 



Phil Sutter <phil@xxxxxx> wrote:
> Hi,
> 
> On Mon, Dec 02, 2019 at 06:35:40PM +0100, Florian Westphal wrote:
> [...]
> > @@ -532,32 +547,32 @@ EOF
> >  	# ns1 should not have seen packets from ns2, due to masquerade
> >  	expect="packets 0 bytes 0"
> >  	for dir in "in" "out" ; do
> > -		cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect")
> > +		cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect")
> >  		if [ $? -ne 0 ]; then
> > -			bad_counter ns1 ns0$dir "$expect"
> > +			bad_counter "$ns1" ns0$dir "$expect" "test_masquerade 5"
> >  			lret=1
> >  		fi
> >  
> > -		cnt=$(ip netns exec ns1 nft list counter inet filter ns2${dir} | grep -q "$expect")
> > +		cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect")
> 
> This is confusing. You're fixing a bug and it is correct?

It was a duplicate of the check above.

> >  		if [ $? -ne 0 ]; then
> > -			bad_counter ns2 ns1$dir "$expect"
> > +			bad_counter "$ns0" ns1$dir "$expect" "test_masquerade 6"
> 
> And here as well?

Yes, this should test ns0 did not get packets from ns1.

> [...]
> > @@ -708,28 +723,28 @@ EOF
> >  	# ns0 should have seen packets from ns2, due to masquerade
> >  	expect="packets 1 bytes 84"
> >  	for dir in "in" "out" ; do
> > -		cnt=$(ip netns exec ns0 nft list counter inet filter ns2${dir} | grep -q "$expect")
> > +		cnt=$(ip netns exec "$ns0" nft list counter inet filter ns2${dir} | grep -q "$expect")
> >  		if [ $? -ne 0 ]; then
> > -			bad_counter ns1 ns0$dir "$expect"
> > +			bad_counter "$ns0" ns0$dir "$expect" "test_redirect 4"
> 
> This is actually a bugfix, right?

Yes, test is correct but if it fails it dumped the wrong counter.



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux