提交 db162cb2 编写于 作者: D Daniel P. Berrange

Fix saving of iptables rules

上级 74fb2b97
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> 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 * src/qemu_conf.c: Deal with failure due to inactive virtual
......
...@@ -1259,7 +1259,7 @@ qemudAddIptablesRules(virConnectPtr conn, ...@@ -1259,7 +1259,7 @@ qemudAddIptablesRules(virConnectPtr conn,
if (!driver->iptables && !(driver->iptables = iptablesContextNew())) { if (!driver->iptables && !(driver->iptables = iptablesContextNew())) {
qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
"%s", _("failed to allocate space for IP tables support")); "%s", _("failed to allocate space for IP tables support"));
return 1; return 0;
} }
...@@ -1319,23 +1319,22 @@ qemudAddIptablesRules(virConnectPtr conn, ...@@ -1319,23 +1319,22 @@ qemudAddIptablesRules(virConnectPtr conn,
} }
/* The remaining rules are only needed for IP forwarding */ if (network->def->forward) {
if (!network->def->forward) { /* If masquerading is enabled, set up the rules*/
iptablesSaveRules(driver->iptables); if (network->def->forwardMode == QEMUD_NET_FORWARD_NAT &&
return 1; !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*/ iptablesSaveRules(driver->iptables);
if (network->def->forwardMode == QEMUD_NET_FORWARD_NAT) {
if (qemudAddMasqueradingIptablesRules(conn, driver, network)) return 1;
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;
}
err8:
iptablesRemoveForwardAllowCross(driver->iptables, iptablesRemoveForwardAllowCross(driver->iptables,
network->bridge); network->bridge);
err7: err7:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册