* Fixed lowering privileges in proc ipforward method.
* Fixed "(no) ipv6 forwarding" command logic.
* Added --disable-capabilities switch to configure.
diff --git a/zebra/ipforward_proc.c b/zebra/ipforward_proc.c
index befa236..4c30cf6 100644
--- a/zebra/ipforward_proc.c
+++ b/zebra/ipforward_proc.c
@@ -81,16 +81,19 @@
fp = fopen (proc_ipv4_forwarding, "w");
- if ( zserv_privs.change(ZPRIVS_LOWER) )
- zlog_err ("Can't lower privileges, %s", strerror (errno));
-
- if (fp == NULL)
+ if (fp == NULL) {
+ if ( zserv_privs.change(ZPRIVS_LOWER) )
+ zlog_err ("Can't lower privileges, %s", strerror (errno));
return -1;
+ }
fprintf (fp, "1\n");
fclose (fp);
+ if ( zserv_privs.change(ZPRIVS_LOWER) )
+ zlog_err ("Can't lower privileges, %s", strerror (errno));
+
return ipforward ();
}
@@ -104,17 +107,19 @@
fp = fopen (proc_ipv4_forwarding, "w");
- if ( zserv_privs.change(ZPRIVS_LOWER) )
- zlog_err ("Can't lower privileges, %s", strerror (errno));
-
-
- if (fp == NULL)
+ if (fp == NULL) {
+ if ( zserv_privs.change(ZPRIVS_LOWER) )
+ zlog_err ("Can't lower privileges, %s", strerror (errno));
return -1;
+ }
fprintf (fp, "0\n");
fclose (fp);
+ if ( zserv_privs.change(ZPRIVS_LOWER) )
+ zlog_err ("Can't lower privileges, %s", strerror (errno));
+
return ipforward ();
}
#ifdef HAVE_IPV6
@@ -149,16 +154,19 @@
fp = fopen (proc_ipv6_forwarding, "w");
- if ( zserv_privs.change(ZPRIVS_LOWER) )
- zlog_err ("Can't lower privileges, %s", strerror (errno));
-
- if (fp == NULL)
+ if (fp == NULL) {
+ if ( zserv_privs.change(ZPRIVS_LOWER) )
+ zlog_err ("Can't lower privileges, %s", strerror (errno));
return -1;
+ }
fprintf (fp, "1\n");
fclose (fp);
+ if ( zserv_privs.change(ZPRIVS_LOWER) )
+ zlog_err ("Can't lower privileges, %s", strerror (errno));
+
return ipforward_ipv6 ();
}
@@ -172,16 +180,19 @@
fp = fopen (proc_ipv6_forwarding, "w");
- if ( zserv_privs.change(ZPRIVS_LOWER) )
- zlog_err ("Can't lower privileges, %s", strerror (errno));
-
- if (fp == NULL)
+ if (fp == NULL) {
+ if ( zserv_privs.change(ZPRIVS_LOWER) )
+ zlog_err ("Can't lower privileges, %s", strerror (errno));
return -1;
+ }
fprintf (fp, "0\n");
fclose (fp);
+ if ( zserv_privs.change(ZPRIVS_LOWER) )
+ zlog_err ("Can't lower privileges, %s", strerror (errno));
+
return ipforward_ipv6 ();
}
#endif /* HAVE_IPV6 */