[libvirt] Re: [PATCH] Add virFileWriteStr()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2009-02-13 at 12:06 +0000, Mark McLoughlin wrote:

>  static int
>  networkEnableIpForwarding(void)
>  {
...
> -    return 1;
> -
> -#undef PROC_IP_FORWARD
> +    return virFileWriteStr("/proc/sys/net/ipv4/ip_forward", "1\n");

networkEnableIpForwarding() used to return 1 on success, now it is
returning zero. I'm commiting the change below to fix it.

Cheers,
Mark.

diff --git a/src/network_driver.c b/src/network_driver.c
index b256e3d..3c765c8 100644
--- a/src/network_driver.c
+++ b/src/network_driver.c
@@ -794,7 +794,7 @@ networkRemoveIptablesRules(struct network_driver *driver,
     iptablesSaveRules(driver->iptables);
 }
 
-/* Enable IP Forwarding. Return 0 for success, nonzero for failure. */
+/* Enable IP Forwarding. Return 0 for success, -1 for failure. */
 static int
 networkEnableIpForwarding(void)
 {
@@ -853,7 +853,7 @@ static int networkStartNetworkDaemon(virConnectPtr conn,
         goto err_delbr1;
 
     if (network->def->forwardType != VIR_NETWORK_FORWARD_NONE &&
-        !networkEnableIpForwarding()) {
+        networkEnableIpForwarding() < 0) {
         virReportSystemError(conn, errno, "%s",
                              _("failed to enable IP forwarding"));
         goto err_delbr2;

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]