[libvirt] [PATCH v3] nwfilter: check for inverted ctdir

Eric Blake eblake at redhat.com
Tue May 14 21:29:37 UTC 2013


On 05/14/2013 03:10 PM, Laine Stump wrote:
> On 05/14/2013 03:58 PM, Stefan Berger wrote:
>> Linux netfilter at some point (Linux 2.6.39) inverted the meaning of the
>> '--ctdir reply' and newer netfilter implementations now expect
>> '--ctdir original' instead and vice-versa.
>> We check for the kernel version and assume that all Linux kernels with version
>> 2.6.39 have the newer inverted logic.
>>

>> +
>> +    /* following Linux lxr, the logic was inverted in 2.6.39 */
>> +    if (sscanf(utsname.release, "%u.%u.%u", &major, &minor, &micro) != 3) {
> 
> Since these functions are only ever compiled on Linux, I think it's fine
> that you're only checking release, and not looking at sysname (we
> already know what it is.
> 
> I'm not a fan of sscanf(), and would prefer it was completely eliminated
> from libvirt, but it is still in use in a few places, so I guess this
> could go in too. But I would prefer something similar to the way we
> parse the qemu version number at the top of virQEMUCapsParseHelpStr().

Use virParseVersionString (search for "uts\.release" in
tools/virt-host-validate-common.c for an example usage).

> 
> Does anyone else have an opinion one way or another on sscanf?
> 
> At any rate, ACK either way.


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130514/9f46b466/attachment-0001.sig>


More information about the libvir-list mailing list