[libvirt] [PATCH] Convert virNetwork to use virSocketAddr everywhere
Daniel P. Berrange
berrange at redhat.com
Fri Oct 22 08:18:02 UTC 2010
On Thu, Oct 21, 2010 at 03:14:25PM -0600, Eric Blake wrote:
> On 10/21/2010 12:21 PM, Daniel P. Berrange wrote:
> >Instead of storing the IP address string in virNetwork related
> >structs, store the parsed virSocketAddr. This will make it
> >easier to add IPv6 support in the future, by letting driver
> >code directly check what address family is present
> >
> >* src/conf/network_conf.c, src/conf/network_conf.h,
> > src/network/bridge_driver.c: Convert to use virSocketAddr
> > in virNetwork, instead of char *.
> >* src/util/bridge.c, src/util/bridge.h,
> > src/util/dnsmasq.c, src/util/dnsmasq.h,
> > src/util/iptables.c, src/util/iptables.h: Convert to
> > take a virSocketAddr instead of char * for any IP
> > address parameters
> >* src/util/network.h: Add macros to determine if an address
> > is set, and what address family is set.
> >---
> > src/conf/network_conf.c | 121 +++++++++++++----------
> > src/conf/network_conf.h | 16 ++--
> > src/network/bridge_driver.c | 162 +++++++++++++++++-------------
> > src/util/bridge.c | 14 +--
> > src/util/bridge.h | 5 +-
> > src/util/dnsmasq.c | 17 ++-
> > src/util/dnsmasq.h | 4 +-
> > src/util/iptables.c | 230
> > +++++++++++++++++++++++++++----------------
> > src/util/iptables.h | 18 ++--
> > src/util/network.h | 6 +
> > 10 files changed, 353 insertions(+), 240 deletions(-)
>
> Big change, but mostly good.
>
> >@@ -1112,12 +1134,10 @@ static int
> >networkCheckRouteCollision(virNetworkObjPtr network)
> > addr_val&= mask_val;
> >
> > if ((net_dest == addr_val)&&
> >- (innetmask.data.inet4.sin_addr.s_addr == mask_val)) {
> >+ (network->def->netmask.data.inet4.sin_addr.s_addr ==
> >mask_val)) {
> > networkReportError(VIR_ERR_INTERNAL_ERROR,
> >- _("Network %s/%s is already in use by "
> >- "interface %s"),
> >- network->def->ipAddress,
> >- network->def->netmask, iface);
> >+ _("Network is already in use by interface
> >%s"),
> >+ iface);
>
> This one loses some information in the error message; is that okay?
It wasn't ideal, but I didn't fancy doing a string conversion
just to add the address in here.
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list