On 09/12/2017 05:53 AM, Martin Kletzander wrote:
> On Tue, Sep 12, 2017 at 11:32:52AM +0200, Michal Privoznik wrote:
>>
https://bugzilla.redhat.com/show_bug.cgi?id=1075520
>>
>> Currently, all that users can specify for an interface type of
>> 'user' is the common attributes: PCI address, NIC model (and
>> that's basically it). However, some need to configure other
>> address range than the default one.
>>
>> Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
>> ---
>>
>> Notes:
>> Frankly, I'm not that convinced about this one. I mean,
>> this puts IP addresses into net->hostIP while we are
>> configuring guest side of the SLIRP. However, it just
>> feels better to have the IP addresses under <source/>
>> than under <interface/>. Which actually is the other
>> option. So it's either:
>>
>> <interface type='user'>
>> <source>
>> <ip address='1.2.2.4'/>
>> </source>
>> </interface>
>>
>> for net->hostIP, or it's:
>>
>> <interface type='user'>
>> <ip address='1.2.2.4'/>
>> </interface>
>>
>
In order to be consistent between all different hypervisors and
interface connection types, any ip addresses and routes that are set to
be visible on the host side of the interface "apparatus" must be under
<source>, and those that are set to be visible on the guest side must be
directly under the top level of <interface>. Since the IP you're
configuring in this patch will be seen in the guest, it needs to be at
the toplevel (i.e. it will be parsed into net->guestIP).
> I'm not convinced either. If you don't like the fact that it's in
> hostIP (even though we're setting up the backend of that device, not the
> device itself, it's just the IP that the internal DHCP server should
> send to the guest) and want to have it in guestIP (which would make
> sense as well) then it should be:
>
> <interface type='user'>
> <target>
> <ip address='1.2.2.4'/>
> </target>
> </interface>
When I dropped into this code to add support for specifying the IP
address and routes on the *host* side of a tap device/veth device (see
commit 98fa8f3ef) for QEMU and LXC (along with the "peer IP" for the
other end of a tap/veth, which is *not* the same thing!), I *wished*
that we had added the new <ip> and <route> elements for specifying
guest-side <ip> and <route> under <target> as you suggest, since
<target> is intended to contain items configuring how the device appears
on the guest side[*]. Unfortunately, the decision on the location of
guest-side <ip> was made *long* ago (at least prior to July of 2008, I
didn't feel like spelunking any further), when <ip> was added directly
under <interface> to support setting the guest-side IP address on Xen.
I totally agree with <interface><ip/>..., after I sent that mail Michal
explained to me that there already is such concept for LXC for example.
Had I known that, I wouldn't have talked about any <target/>. But
thanks for thorough explanation anyway ;)