[libvirt] [PATCH libvirt 1/2] domain: add <forward> element for user mode networking
Daniel P. Berrange
berrange at redhat.com
Thu May 10 10:21:51 UTC 2012
On Thu, May 10, 2012 at 02:10:44AM +0200, Marc-André Lureau wrote:
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 70129fe..7fde05e 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -768,6 +768,23 @@ struct _virDomainActualNetDef {
> virNetDevBandwidthPtr bandwidth;
> };
>
> +enum virDomainNetForwardType {
> + VIR_DOMAIN_NET_FORWARD_TYPE_TCP,
> + VIR_DOMAIN_NET_FORWARD_TYPE_UDP,
> +
> + VIR_DOMAIN_NET_FORWARD_TYPE_LAST,
> +};
> +
> +typedef struct _virDomainNetForwardDef virDomainNetForwardDef;
> +typedef virDomainNetForwardDef *virDomainNetForwardDefPtr;
> +struct _virDomainNetForwardDef {
> + int type; /* enum virDomainNetForwardType */
Lets call this 'protocol' since it matches the terminology used
by ip[6]tables
> + char *host_addr;
> + int host_port;
> + char *guest_addr;
> + int guest_port;
> +};
Our current best practice is to store all IP addresses
using virSocketAddr rather than char *. This ensures we
perform syntactic validation at parse time. It also means
when generating the rules we can easily distinguish between
ipv4 and ipv6 addresses.
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list