<br><tt><font size=2>libvir-list-bounces@redhat.com wrote on 01/26/2010
08:24:43 AM:<br>
<br>
<br>
<br>
> <br>
> Daniel,<br>
> <br>
> ok, trying to combine your suggestions:<br>
> <br>
> - guest contains a single filter reference per interface<br>
> <br>
> guest.xml:<br>
> ----------<br>
> <domain type='kvm'><br>
>   <name>demo</name><br>
>   <memory>256000</memory><br>
>   <devices><br>
>     <interface type="bridge"><br>
>       <filter name='demofilter' ipaddr='10.0.0.1'/><br>
>     </interface><br>
>   </devices><br>
> </domain><br>
> </font></tt>
<br>
<br><tt><font size=2>As the implementation of this progresses and we make
design decision, we now introduced attributes and values for the </font></tt>
<br><tt><font size=2>filters to be passed in the format of</font></tt>
<br>
<br><tt><font size=2>att%d='<attribute>' val%d='<value>'</font></tt>
<br>
<br><tt><font size=2>thus we would rewrite the above example to:</font></tt>
<br>
<br><tt><font size=2><domain type='kvm'><br>
  <name>demo</name><br>
  <memory>256000</memory><br>
  <devices><br>
    <interface type="bridge"><br>
      <filter name='demofilter' att0='IP' val0='10.0.0.1'/><br>
    </interface><br>
  </devices><br>
</domain><br>
</font></tt>
<br><tt><font size=2>This allows us to pass any necessary parameters to
the filters for instantiation in</font></tt>
<br><tt><font size=2>the respective environment. So, if a filter is to
be instantiated and holds the variable</font></tt>
<br><tt><font size=2>XYZ, then one may add</font></tt>
<br>
<br><tt><font size=2>att1='XYZ' val1='<some value>'</font></tt>
<br>
<br>
<br><tt><font size=2>> - complex filter include other filter and can
contain rules<br>
> <br>
> complex demofilter.xml:<br>
> -----------------------<br>
> <filter name='demofilter'><br>
>   <include href='drop-all'/><br>
>   <include href='no-arp-spoofing' srcipaddr='$IP'/><br>
</font></tt>
<br><tt><font size=2>-->   <include href='no-arp-spoofing' att0='IP'
val0='1.2.3.4'.</font></tt>
<br>
<br><tt><font size=2>>   <include href='no-mac-spoofing'/><br>
>   <include href='no-ip-spoofing' srcipaddr='$IP'/><br>
>   <!-- no ip spoofing --><br>
>   <rule action='drop' direction='out'><br>
>     <ip match='no' srcipaddr='$IP'/><br>
>   </rule><br>
> </filter><br>
> <br>
</font></tt>
<br><tt><font size=2>So any referenced filter, also as shown above in the
demofilter.xml, could hold environment-specific values for required variables.
</font></tt>
<br><tt><font size=2>A filter requiring a variable that is not passed is
not instantiated and will prevent interface creation / attachment or the
start</font></tt>
<br><tt><font size=2>of the VM.</font></tt>
<br><tt><font size=2>Further, if an attribute value pair (IP) as shown
here is passed from the domain XML and another value as shown here in the
referenced filter</font></tt>
<br><tt><font size=2>is again set, the one from further 'up' is used, i.e.,
IP=10.0.0.1 rather than IP=1.2.3.4.</font></tt>
<br>
<br><tt><font size=2>Does this sound ok?</font></tt>
<br>
<br><tt><font size=2>Regards,</font></tt>
<br><tt><font size=2>   Stefan</font></tt>
<br>