Re: [TCK][PATCH] nwfilter: convert ctstate to state

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

 



On 08/06/2013 09:24 AM, Stefan Berger wrote:
> iptables version 1.4.16 and later automatically convert -m state --state ...
> to -m conntrack --ctstate ... In the test cases we will then only see 'ctstate'
> and convert that back to the older 'state' before comparing actual against
> expected output.
> 
> Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxxxxxxx>
> 
> ---

>  
> +probeIptablesCtstate() {
> +  rev=$(iptables --version | \
> +        sed -n 's/.*v\([[:digit:]].\)/\1/p' |
> +        gawk -F. '{print $1 * 1000000 + $2 * 1000 + $3 }')
> +  # 1.4.16 or later uses ctstate
> +  if [ $rev -ge 1004016 ]; then

Version number probes are inherently fragile.  Can you do a feature
probe instead, in case someone backports this feature to a build of
iptables that reports an earlier version?

>  
> +        if [ $IPTABLES_USE_CTSTATE -ne 0 ]; then
> +          #change ctstate tback o state
> +          sed -i "s/ctstate/state/" ${tmpfile}

Do we even need the version/feature probe?  What if we just ALWAYS do
this substitution?  It won't hurt on older iptables (it will just be a
no-op).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]