summaryrefslogtreecommitdiff
path: root/zebra/ipforward_proc.c
diff options
context:
space:
mode:
authorhasso <hasso>2004-04-06 11:59:00 +0000
committerhasso <hasso>2004-04-06 11:59:00 +0000
commit41d3fc96959c9dea614822dfbb1891cd9a6f38a4 (patch)
treeb493df69256ed58534ddd9a00a9a900f1ed80c6e /zebra/ipforward_proc.c
parent4991f6ca305a325d1ec7a38eeb2a7cf8cf6d7f2d (diff)
* Fixed lowering privileges in proc ipforward method.
* Fixed "(no) ipv6 forwarding" command logic. * Added --disable-capabilities switch to configure.
Diffstat (limited to 'zebra/ipforward_proc.c')
-rw-r--r--zebra/ipforward_proc.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/zebra/ipforward_proc.c b/zebra/ipforward_proc.c
index befa2369..4c30cf67 100644
--- a/zebra/ipforward_proc.c
+++ b/zebra/ipforward_proc.c
@@ -81,16 +81,19 @@ ipforward_on ()
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 @@ ipforward_off ()
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 @@ ipforward_ipv6_on ()
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 @@ ipforward_ipv6_off ()
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 */