virNetworkObjPtr network);
static int networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
- virNetworkObjPtr network);
+ virNetworkObjPtr network);
static int networkShutdownNetworkVirtual(virNetworkDriverStatePtr driver,
virNetworkObjPtr network);
static int networkStartNetworkExternal(virNetworkDriverStatePtr driver,
- virNetworkObjPtr network);
+ virNetworkObjPtr network);
static int networkShutdownNetworkExternal(virNetworkDriverStatePtr driver,
- virNetworkObjPtr network);
+ virNetworkObjPtr network);
static void networkReloadFirewallRules(virNetworkDriverStatePtr driver);
static void networkRefreshDaemons(virNetworkDriverStatePtr driver);
virNetworkObjPtr obj = driver->networks.objs[i];
if (!obj->active)
- continue;
+ continue;
virNetworkObjLock(obj);
if (driver->networks.objs[i]->autostart &&
!virNetworkObjIsActive(driver->networks.objs[i])) {
if (networkStartNetwork(driver, driver->networks.objs[i]) < 0) {
- /* failed to start but already logged */
+ /* failed to start but already logged */
}
}
virNetworkObjUnlock(driver->networks.objs[i]);
if (virAsprintf(&oldPath, "%s/%s",
oldStateDir, entry->d_name) < 0)
- goto cleanup;
+ goto cleanup;
if (virFileReadAll(oldPath, 1024*1024, &contents) < 0)
- goto cleanup;
+ goto cleanup;
if (virAsprintf(&newPath, "%s/%s",
driver->stateDir, entry->d_name) < 0)
- goto cleanup;
+ goto cleanup;
if (virFileWriteStr(newPath, contents, S_IRUSR | S_IWUSR) < 0) {
virReportSystemError(errno,
_("failed to write network status file '%s'"),
VIR_FREE(contents);
}
if (direrr < 0)
- goto cleanup;
+ goto cleanup;
ret = 0;
cleanup:
return ret;
}
- /* the following does not build a file, it builds a list
- * which is later saved into a file
- */
+/* the following does not build a file, it builds a list
+ * which is later saved into a file
+ */
static int
networkBuildDnsmasqDhcpHostsList(dnsmasqContext *dctx,
virBufferAddLit(&configbuf, "no-resolv\n");
for (i = 0; i < network->def->dns.nfwds; i++) {
virBufferAsprintf(&configbuf, "server=%s\n",
- network->def->dns.forwarders[i]);
+ network->def->dns.forwarders[i]);
}
}
/* Write the file */
if (virFileWriteStr(configfile, configstr, 0600) < 0) {
virReportSystemError(errno,
- _("couldn't write dnsmasq config file '%s'"),
- configfile);
+ _("couldn't write dnsmasq config file '%s'"),
+ configfile);
goto cleanup;
}
}
if (ipv4def && (networkBuildDnsmasqDhcpHostsList(dctx, ipv4def) < 0))
- goto cleanup;
+ goto cleanup;
if (ipv6def && (networkBuildDnsmasqDhcpHostsList(dctx, ipv6def) < 0))
- goto cleanup;
+ goto cleanup;
if (networkBuildDnsmasqHostsList(dctx, &network->def->dns) < 0)
- goto cleanup;
+ goto cleanup;
if ((ret = dnsmasqSave(dctx)) < 0)
goto cleanup;
static int
networkStartRadvd(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED,
- virNetworkObjPtr network)
+ virNetworkObjPtr network)
{
char *pidfile = NULL;
char *radvdpidbase = NULL;
network->radvdPid = -1;
/* Is dnsmasq handling RA? */
- if (DNSMASQ_RA_SUPPORT(driver->dnsmasqCaps)) {
+ if (DNSMASQ_RA_SUPPORT(driver->dnsmasqCaps)) {
ret = 0;
goto cleanup;
}
int enabled = 1;
if (enableIPv4)
ret = sysctlbyname("net.inet.ip.forwarding", NULL, 0,
- &enabled, sizeof(enabled));
+ &enabled, sizeof(enabled));
if (enableIPv6 && ret == 0)
ret = sysctlbyname("net.inet6.ip6.forwarding", NULL, 0,
- &enabled, sizeof(enabled));
+ &enabled, sizeof(enabled));
#else
if (enableIPv4)
ret = virFileWriteStr("/proc/sys/net/ipv4/ip_forward", "1\n", 0);
if (routedef->has_prefix && routedef->prefix == 0)
prefix = 0;
else if ((VIR_SOCKET_ADDR_IS_FAMILY(mask, AF_INET) &&
- virSocketAddrEqual(mask, &zero)))
+ virSocketAddrEqual(mask, &zero)))
prefix = 0;
else
prefix = virSocketAddrGetIpPrefix(addr, mask, routedef->prefix);
static int
networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
- virNetworkObjPtr network)
+ virNetworkObjPtr network)
{
size_t i;
bool v4present = false, v6present = false;
}
static int networkShutdownNetworkExternal(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED,
- virNetworkObjPtr network ATTRIBUTE_UNUSED)
+ virNetworkObjPtr network ATTRIBUTE_UNUSED)
{
/* put anything here that needs to be done each time a network of
* type BRIDGE, PRIVATE, VEPA, HOSTDEV or PASSTHROUGH is shutdown. On
}
static int networkShutdownNetwork(virNetworkDriverStatePtr driver,
- virNetworkObjPtr network)
+ virNetworkObjPtr network)
{
int ret = 0;
char *stateFile;
*/
vlanAllowed = ((def->forward.type == VIR_NETWORK_FORWARD_BRIDGE &&
- def->virtPortProfile &&
- def->virtPortProfile->virtPortType
+ def->virtPortProfile &&
+ def->virtPortProfile->virtPortType
== VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) ||
def->forward.type == VIR_NETWORK_FORWARD_HOSTDEV);
goto cleanup;
if (networkValidate(driver, def, true) < 0)
- goto cleanup;
+ goto cleanup;
/* NB: even though this transient network hasn't yet been started,
* we assign the def with live = true in anticipation that it will
goto cleanup;
if (networkValidate(driver, def, false) < 0)
- goto cleanup;
+ goto cleanup;
if (!(network = virNetworkAssignDef(&driver->networks, def, false)))
- goto cleanup;
+ goto cleanup;
/* def was assigned to network object */
freeDef = false;
if (event)
virObjectEventStateQueue(driver->networkEventState, event);
if (freeDef)
- virNetworkDefFree(def);
+ virNetworkDefFree(def);
if (network)
virNetworkObjUnlock(network);
networkDriverUnlock(driver);
/* VIR_NETWORK_UPDATE_AFFECT_CURRENT means "change LIVE if network
* is active, else change CONFIG
- */
+ */
isActive = virNetworkObjIsActive(network);
if ((flags & (VIR_NETWORK_UPDATE_AFFECT_LIVE |
VIR_NETWORK_UPDATE_AFFECT_CONFIG)) ==
}
static int networkGetAutostart(virNetworkPtr net,
- int *autostart)
+ int *autostart)
{
virNetworkObjPtr network;
int ret = -1;
virReportError(VIR_ERR_INTERNAL_ERROR,
_("No Vf's present on SRIOV PF %s"),
netdef->forward.pfs->dev);
- goto finish;
+ goto finish;
}
if (VIR_ALLOC_N(netdef->forward.ifs, num_virt_fns) < 0)
/* portgroup can be present for any type of network, in particular
* for bandwidth information, so we need to check for that and
* fill it in appropriately for all forward types.
- */
+ */
portgroup = virPortGroupFindByName(netdef, iface->data.network.portgroup);
/* If there is already interface-specific bandwidth, just use that
/* for these forward types, the actual net type really *is*
*NETWORK; we just keep the info from the portgroup in
* iface->data.network.actual
- */
+ */
iface->data.network.actual->type = VIR_DOMAIN_NET_TYPE_NETWORK;
if (networkPlugBandwidth(network, iface) < 0)
int ret = -1;
if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK)
- return 0;
+ return 0;
networkDriverLock(driver);
network = virNetworkFindByName(&driver->networks, iface->data.network.name);
hostdev->source.subsys.u.pci.addr.bus,
hostdev->source.subsys.u.pci.addr.slot,
hostdev->source.subsys.u.pci.addr.function);
- goto error;
+ goto error;
}
/* PASSTHROUGH mode, PRIVATE Mode + 802.1Qbh, and hostdev (PCI
int ret = -1;
if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK)
- return 0;
+ return 0;
networkDriverLock(driver);
network = virNetworkFindByName(&driver->networks, iface->data.network.name);
hostdev->source.subsys.u.pci.addr.bus,
hostdev->source.subsys.u.pci.addr.slot,
hostdev->source.subsys.u.pci.addr.function);
- goto error;
+ goto error;
}
dev->connections--;
dev->device.pci.domain, dev->device.pci.bus,
dev->device.pci.slot, dev->device.pci.function,
dev->connections);
- }
+ }
success:
if (iface->data.network.actual) {