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

Re: [libvirt] [PATCH V2 00/10] Make inner workings of nwfilters more flexible + extensions



On 10/19/2011 04:55 PM, David Stevens wrote:

-----Stefan Berger <stefanb linux vnet ibm com> wrote: -----
   
>      
>    The problem is that at the moment rules (in the 'root' table) can
>    have priorities [0, 1000]. So nothing prevents one to write a
>rule
>    with priority 0. However, due to how nwfilters works right now
>the
>    jumps into the protocol-specific tables will always be created
>    *before* those rules. I am trying to address this now with
>assigning
>    negative numbers to the chains to achieve the same sorting and
>    maintain backwards compatibility.

      Priorities aren't directly line numbers, but I think extending negative
numbers to be "from the end" as ebtables/iptables would be a useful
thing (and less arcane due to the precedent already there).
      But since you are extending to allow more chains, couldn't you
in fact just expose the root chain to XML and create a default that
It's already exposed.. you can add the following rule to the 'clean-traffic' filter

<rule action='' direction='inout' priority='999'>
    <arp/>
  </rule>

and it will appear in the interface root chain.

does the protocol switch that's generated in code now? Then, you
The protocol 'switch', assuming we both talk about 'the same', becomes a lot more flexible and dynamic with this patch series. It lets you insert jumps to new chains (whose names have known protocol names as prefixes) and interleave them with rules in the 'root' table.
could insert new chains before the standard ones, reorder, or do
anything you want -- with "RETURN" as the policy or action for acceptable
frames in the early chains so later chains are still run.
I do have the intention to accept your 'RETURN' and 'CONTINUE' patch. So that's not going to be the problem. I just have some concerns about how the multiple IP address support is implemented. I don't think it works with multiples of anything else than what is in the IP variable, i.e., comma-separated 'items' in other variables.
     If you didn't want to expose libvirt-{I,O}-vnetXX chains, couldn't you
at least accomplish the same thing with new chains in the code-generated
chains by adding a "pre-protocol" chain assuming "RETURN" is available.
Then, a filter that adds to "pre-protocol" (or whatever you call it) would always
happen before the standard chains. A similar chain hook could be done for
post-protocol chains, if those were converted to do "RETURN" instead of
ACCEPT/DROP too.
  
>                    Using priorities in multiple places is very
>          like programming in basic
>
>          and what both ebtables/iptables and nwfilters could use
>better
>          I think would
>
>          be the capability to label rules by name and reference d
>          label to identify the
>
>          rule location. Then you might, e.g., add a rule at "myrules
>+
>          5" and don't care
>
>          what particular priority/line number "myrules" is.
>
>        
>      
>    You have patches for that?

        Actually, you do. If the labels are new chains then
the existing priority within that chain is essentially the same. But the
existing priority mechanism doesn't have the full flexibility available in
ebtables/iptables with "insert before", "append", "offset from beginning",
"offset from end". Wouldn't you get that with the combination of user-defined
chains, a user-modifiable root chain, and priorities interpretted like this:

Priorities are used for sorting and not for absolute position of a rule within a chain. You can compose filters of building blocks and leave some building blocks out and you'll end up missing rules with certain priorities. So the mapping to positions from priorities directly is not possible in that way.

   Stefan
0 - insert at beginning
N - insert at N
MAX - append at end (and this ought to be 2G-1, not 1000)
-N - insert at END-N.
?
                                                                             +-DLS



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