<br><br><div class="gmail_quote">On Thu, Mar 1, 2012 at 1:17 PM, Laine Stump <span dir="ltr"><<a href="mailto:laine@laine.org" target="_blank">laine@laine.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>On 03/01/2012 01:19 PM, Laine Stump wrote:<br>
> On 02/29/2012 07:26 PM, Ansis Atteka wrote:<br>
>><br>
>><br>
>> On Sat, Feb 18, 2012 at 7:07 PM, Laine Stump <<a href="mailto:laine@laine.org" target="_blank">laine@laine.org</a><br>
</div><div>>> <mailto:<a href="mailto:laine@laine.org" target="_blank">laine@laine.org</a>>> wrote:<br>
>><br>
>>     On 02/17/2012 02:51 PM, Ansis Atteka wrote:<br>
>>     ><br>
>>     ><br>
>>     > On Fri, Feb 17, 2012 at 10:55 AM, Laine Stump <<a href="mailto:laine@laine.org" target="_blank">laine@laine.org</a><br>
>>     <mailto:<a href="mailto:laine@laine.org" target="_blank">laine@laine.org</a>><br>
</div><div><div>>>     > <mailto:<a href="mailto:laine@laine.org" target="_blank">laine@laine.org</a> <mailto:<a href="mailto:laine@laine.org" target="_blank">laine@laine.org</a>>>> wrote:<br>
>>     ><br>
>>     >     On 02/16/2012 06:49 PM, Ansis Atteka wrote:<br>
>>     >     > Currently libvirt sets the attached-mac to altered MAC<br>
>>     address<br>
>>     >     that has<br>
>>     >     > first byte set to FE. This patch will change that behavior by<br>
>>     >     using the<br>
>>     >     > original (unaltered) MAC address from the domain XML<br>
>>     >     configuration file.<br>
>>     ><br>
>>     >     Maybe I didn't read thoroughly enough, but I don't see where it<br>
>>     >     changes<br>
>>     >     the behavior - in the cases where previously the first byte<br>
>>     was set to<br>
>>     >     0xFE, now you send discourage=true, and in the cases where<br>
>>     it didn't,<br>
>>     >     now you send discourage=false.<br>
>>     ><br>
>>     > "discourage" means whether bridge should be discouraged to use the<br>
>>     > newly added<br>
>>     > TAP device's MAC address. Libvirt does that by setting the<br>
>>     first MAC<br>
>>     > address byte<br>
>>     > high enough.<br>
>>     ><br>
>>     > And here is how this patch works:<br>
>>     ><br>
>>     >  1. Now in virNetDevTapCreateInBridgePort() function we always pass<br>
>>     >     exactly the same MAC address that was defined in XML.<br>
>>     >  2. If "discourage" flag was set to true, then we create a copy<br>
>>     of MAC<br>
>>     >     address and set its first byte to 0xFE<br>
>>     >  3. virNetDevSetMAC() function would use the MAC address that was<br>
>>     >     product of #2<br>
>>     >  4. while virNetDevOpenvswitchAddPort() function would use the<br>
>>     >     original MAC address that was passed in #1 (this code did<br>
>>     not need<br>
>>     >     to be changed so most likely that was the reason why you<br>
>>     did not<br>
>>     >     notice behavior changes)<br>
>>     ><br>
>><br>
>><br>
>>     Right. That's what I missed - all I saw was every occurrence of<br>
>>     creating<br>
>>     a temporary mac address with 0xFE in the first byte replaced with<br>
>>     adding<br>
>>     "discourage=true" to the args. I didn't notice that<br>
>>     virNetDevOpenvswitchAddPort() takes the macaddr (while<br>
>>     virNetDevBridgeAddPort() doesn't).<br>
>><br>
>>     But that means that the tap device has been created with an<br>
>>     0xFE-initiated MAC address, and then you attach to the bridge<br>
>>     using the<br>
>>     unmodified address. Is the issue that the mac address used during the<br>
>>     attach needs to match the MAC address that will be in the traffic? Do<br>
>>     connections to an openvswitch bridge have an implied MAC filter<br>
>>     on them,<br>
>>     such that only that MAC address gets through?<br>
>><br>
>>     (Also, the only time discourage is false is for libvirt's virtual<br>
>>     network bridges. I'm wondering if they could also use the<br>
>>     modified MAC<br>
>>     address for the tap devices - if that was the case we could just<br>
>>     always<br>
>>     create the temporary MAC address in virNetDevTapCreateInBridgePort()<br>
>>     (and always set the tap device's mac to that).)<br>
>><br>
><br>
>> We could get rid of the "discourage" argument if we would pass<br>
>> virDomainNetDefPtr instead of virNetDevVPortProfilePtr structure to<br>
>> virNetDevOpenvswitchAddPort() function. This approach would<br>
>> also eliminate the need to pass MAC address at all to the<br>
>> virNetDevOpenvswitchAddPort() function making both<br>
>> APIs for Linux Bridge and OVS bridge more simpler and<br>
>> similar (and this could eventually lead to abstracted bridge API).<br>
><br>
> Unfortunately this isn't an option. Files in the util directory can't<br>
> reference anything in the conf directory (or anywhere else). See the<br>
> followon to this patch I just posted:<br>
><br>
>   <a href="https://www.redhat.com/archives/libvir-list/2012-March/msg00043.html" target="_blank">https://www.redhat.com/archives/libvir-list/2012-March/msg00043.html</a><br>
><br>
> (I actually found this extra #include when doing a grep of #includes<br>
> in the conf directory to make sure I was correctly remembering this<br>
> restriction)<br>
><br>
> I've actually been thinking about this in the back of my mind ever<br>
> since your original patch. I think the solution for the "discourage"<br>
> bool may be to replace the existing "bool up" parameter of<br>
> virNetDevTapCreateInBridgePort with a "flags" parameter, then add the<br>
> following two flags:<br>
><br>
> typedef enum {<br>
>    /* bring the interface up */<br>
>    VIR_NETDEV_TAP_CREATE_IFUP = 1 << 0,<br>
>    /* Set this interface's MAC as the bridge's MAC address */<br>
>    VIR_NETDEV_TAP_CREATE_USE_MAC_FOR_BRIDGE = 1 << 1,<br>
> } virNetDevTapCreateFlags;<br>
><br>
> In the general case of virNetDevTapCreateInBridgePort, flags would be<br>
> (VIR_NETDEV_TAP_CREATE_IFUP), but<br>
> in the one "odd" case (where we are creating the tap device just so<br>
> that the bridge would have the provided MAC address, flags would be<br>
> (VIR_NETDEV_TAP_CREATE_USE_MAC_FOR_BRIDGE) (since the dummy tap device<br>
> created for this purpose doesn't get ifup'ed).<br>
><br>
> I'm going for a short walk, then will modify your original patch to do<br>
> this and post it back to the list.<br>
<br>
</div></div>Ansis - I posted my changes as a separate patch rather than squashed<br>
into yours, and posted it. If you're okay with my patch, I'll ACK yours<br>
and push them both together.<br>
<br>
   <a href="https://www.redhat.com/archives/libvir-list/2012-March/msg00056.html" target="_blank">https://www.redhat.com/archives/libvir-list/2012-March/msg00056.html</a></blockquote><div>I am ok with this approach as well.</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<div><div><br>
--<br>
libvir-list mailing list<br>
<a href="mailto:libvir-list@redhat.com" target="_blank">libvir-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/libvir-list" target="_blank">https://www.redhat.com/mailman/listinfo/libvir-list</a><br>
</div></div></blockquote></div><br>