[libvirt] [PATCH V5 02/10] Introduce an internal priority for chains

Eric Blake eblake at redhat.com
Thu Nov 17 22:25:06 UTC 2011


On 11/17/2011 01:11 PM, Stefan Berger wrote:
> For better handling of the sorting of chains introduce an internally used
> priority. Use a lookup table to store the priorities. For now their actual
> values do not matter just that the values cause the chains to be properly
> sorted through changes in the following patches. However, the values are
> chosen as negative so that once they are sorted along with filtering rules
> (whose priority may only be positive for now) they will always be instantiated
> before them (lower values cause instantiation before higher values). This
> is done to maintain backwards compatibility.
> 
> 
> Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
> 
> ---
> 
> v3:
>  - increased filter priorities to have more room before them
> 
> ---
>  src/conf/nwfilter_conf.c                  |   14 ++++++++++++++
>  src/conf/nwfilter_conf.h                  |   12 ++++++++++++
>  src/nwfilter/nwfilter_ebiptables_driver.c |    4 ++++
>  src/nwfilter/nwfilter_ebiptables_driver.h |    1 +
>  4 files changed, 31 insertions(+)

ACK.

> @@ -2028,6 +2036,12 @@ virNWFilterDefParseXML(xmlXPathContextPt
>                                     _("unknown chain suffix '%s'"), chain);
>              goto cleanup;
>          }
> +        /* assign an implicit priority -- support XML attribute later */
> +        if (intMapGetByString(chain_priorities, chain, 0,
> +                              &ret->chainPriority) == false) {

I tend not to compare to true or false, but it's not wrong so you don't
have to change it.  My argument is that comparison to bool is redundant,
since the other side of the comparison is already in bool context; I
would have used:

if (!intMapGetByString(chain_priorities, chain, 0,
                       &ret->chainPriority)) {

-- 
Eric Blake   eblake at 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: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111117/46f378b8/attachment-0001.sig>


More information about the libvir-list mailing list