Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
libvirt.1263
cef6eb77-lxc-set-routes.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File cef6eb77-lxc-set-routes.patch of Package libvirt.1263
From cef6eb77b838097597a59053c695b306f065b73d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <cbosdonnat@suse.com> Date: Thu, 24 Jul 2014 15:20:27 +0200 Subject: [PATCH 14/17] LXC: use the new net devices routes definition Actually set routes in lxc containers if there are defined ones. --- src/lxc/lxc_container.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) Index: libvirt-1.2.5/src/lxc/lxc_container.c =================================================================== --- libvirt-1.2.5.orig/src/lxc/lxc_container.c +++ libvirt-1.2.5/src/lxc/lxc_container.c @@ -497,6 +497,8 @@ static int lxcContainerRenameAndEnableIn int rc = 0; size_t i, j; char *newname = NULL; + char *toStr = NULL; + char *viaStr = NULL; virDomainNetDefPtr netDef; bool privNet = vmDef->features[VIR_DOMAIN_FEATURE_PRIVNET] == VIR_DOMAIN_FEATURE_STATE_ON; @@ -539,6 +541,28 @@ static int lxcContainerRenameAndEnableIn if (rc < 0) goto error_out; + /* Set the routes */ + for (j = 0; j < netDef->nroutes; j++) { + virDomainNetRouteDefPtr route = netDef->routes[j]; + if (VIR_SOCKET_ADDR_VALID(&route->to)) + toStr = virSocketAddrFormat(&route->to); + else + if (VIR_STRDUP(toStr, "default") < 0) + goto error_out; + viaStr = virSocketAddrFormat(&route->via); + VIR_DEBUG("Adding route %s/%d via %s", toStr, route->prefix, viaStr); + + if (virNetDevAddRoute(newname, &route->to, route->prefix, + &route->via, 0) < 0) { + virReportError(VIR_ERR_SYSTEM_ERROR, + _("Failed to add route %s/%d via %s"), + toStr, route->prefix, viaStr); + goto error_out; + } + VIR_FREE(toStr); + VIR_FREE(viaStr); + } + VIR_FREE(newname); } @@ -547,6 +571,8 @@ static int lxcContainerRenameAndEnableIn rc = virNetDevSetOnline("lo", true); error_out: + VIR_FREE(toStr); + VIR_FREE(viaStr); VIR_FREE(newname); return rc; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor