Re: [PATCH 5/5] qemu: Implement usernet address

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

 



On 09/13/2017 06:02 PM, Laine Stump wrote:
> On 09/13/2017 06:46 AM, Michal Privoznik wrote:
>> On 09/12/2017 09:16 PM, Laine Stump wrote:
>>> On 09/12/2017 05:32 AM, Michal Privoznik wrote:
>>>> https://bugzilla.redhat.com/show_bug.cgi?id=1075520
>>>>
>>>> +                /* QEMU needs some space to have
>>>> +                 * some other 'hosts' on the network. */
>>>> +                if ((hasIPv4 && ip->prefix > 27) ||
>>>> +                    (hasIPv6 && ip->prefix > 120)) {
>>>> +                    virReportError(VIR_ERR_XML_ERROR, "%s",
>>>> +                                   _("prefix too long"));
>>> You should also probably check for conflict with the addresses that are
>>> automatically used by slirp for DNS, default route, dhcp server, etc.
>>> (Although I *hate* needing to hard code stuff like that :-/)
>> Do I? If the prefix allows sufficiently enough room for them then the
>> defaults shouldn't clash. Or you mean checking against host's IPs? The
>> defaults according to the qemu docs are as follows:
>>
>> host = x.x.x.2
>> dhcpstart = x.x.x.15 - x.x.x.30
>> dns = x.x.x.3
>> smb = x.x.x.4
>>
> 
> Right. So let's say the user requests x.x.x.3 for the IP - that would
> conflict with the DNS server address.
> 
> I would really hate to have those specific checks hardcoded though (in
> case qemu changed the addresses for some reason. Maybe if we're lucky,
> qemu itself will error out if there is a conflict. If that's the case,
> then we can just leave it to them to report the error (as long as we're
> able to adequately scrape the error message so we can report something
> sensible).
> 

Ah, qemu does not report any error. They merely take the default netmask
for given IP address and zero out the subnet part. This is what I tried:

    <interface type='user'>
      <mac address='00:11:22:33:44:55'/>
      <ip address='172.17.2.2' family='ipv4'/>
      <ip address='2001:db8:ac10:fd01::3' family='ipv6'/>
      <model type='rtl8139'/>
    </interface>

and this is how guest sees the interface:

3: ens8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff
    inet 172.16.2.15/12 brd 172.31.255.255 scope global dynamic ens8
       valid_lft 86373sec preferred_lft 86373sec
    inet6 2001:db8:ac10:fd01:a37e:8d3e:c189:d4f1/64 scope global noprefixroute dynamic 
       valid_lft 86374sec preferred_lft 14374sec


So, what if while parsing the IP address we would do the same? I mean,
zero out the subnet part of the address. If prefix was provided use that
otherwise use the default. Users are required to reload the domain XML
after any edit anyway. This also makes more sense IMO because users are
providing network address, not a host one.

Having said that, thanks for review on v2, but I'll postpone the push
until we have a clear agreement here.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux