mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
Fix saving of iptables rules
This commit is contained in:
parent
74fb2b9704
commit
db162cb2b8
@ -1,3 +1,7 @@
|
||||
Thu Jun 12 14:46:08 BST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/qemu_driver.c: Fix saving of iptables rules
|
||||
|
||||
Thu Jun 12 11:18:08 BST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/qemu_conf.c: Deal with failure due to inactive virtual
|
||||
|
@ -1259,7 +1259,7 @@ qemudAddIptablesRules(virConnectPtr conn,
|
||||
if (!driver->iptables && !(driver->iptables = iptablesContextNew())) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
|
||||
"%s", _("failed to allocate space for IP tables support"));
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1319,23 +1319,22 @@ qemudAddIptablesRules(virConnectPtr conn,
|
||||
}
|
||||
|
||||
|
||||
/* The remaining rules are only needed for IP forwarding */
|
||||
if (!network->def->forward) {
|
||||
iptablesSaveRules(driver->iptables);
|
||||
return 1;
|
||||
if (network->def->forward) {
|
||||
/* If masquerading is enabled, set up the rules*/
|
||||
if (network->def->forwardMode == QEMUD_NET_FORWARD_NAT &&
|
||||
!qemudAddMasqueradingIptablesRules(conn, driver, network))
|
||||
goto err8;
|
||||
/* else if routing is enabled, set up the rules*/
|
||||
else if (network->def->forwardMode == QEMUD_NET_FORWARD_ROUTE &&
|
||||
!qemudAddRoutingIptablesRules(conn, driver, network))
|
||||
goto err8;
|
||||
}
|
||||
|
||||
/* If masquerading is enabled, set up the rules*/
|
||||
if (network->def->forwardMode == QEMUD_NET_FORWARD_NAT) {
|
||||
if (qemudAddMasqueradingIptablesRules(conn, driver, network))
|
||||
return 1;
|
||||
}
|
||||
/* else if routing is enabled, set up the rules*/
|
||||
else if (network->def->forwardMode == QEMUD_NET_FORWARD_ROUTE) {
|
||||
if (qemudAddRoutingIptablesRules(conn, driver, network))
|
||||
return 1;
|
||||
}
|
||||
iptablesSaveRules(driver->iptables);
|
||||
|
||||
return 1;
|
||||
|
||||
err8:
|
||||
iptablesRemoveForwardAllowCross(driver->iptables,
|
||||
network->bridge);
|
||||
err7:
|
||||
|
Loading…
Reference in New Issue
Block a user