summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhasso <hasso>2004-07-13 05:06:51 +0200
committerhasso <hasso>2004-07-13 05:06:51 +0200
commit25dac85507ca3a107351a9f84173b5bcaea8a450 (patch)
treef3730bab6fdd8b9d45e6ae960bffbd5fafd86120
parent1) extract.pl is braindead, but I will not touch it willingly. (diff)
downloadfrr-25dac85507ca3a107351a9f84173b5bcaea8a450.tar.xz
frr-25dac85507ca3a107351a9f84173b5bcaea8a450.zip
Creating irdp socket requires more privileges.
-rw-r--r--zebra/ChangeLog4
-rw-r--r--zebra/irdp_main.c12
2 files changed, 16 insertions, 0 deletions
diff --git a/zebra/ChangeLog b/zebra/ChangeLog
index fab7acb58..acf2f8cba 100644
--- a/zebra/ChangeLog
+++ b/zebra/ChangeLog
@@ -1,3 +1,7 @@
+2004-07-13 Hasso Tepper <hasso@estpak.ee>
+
+ * irdp_main.c: Add privilege change.
+
2004-07-12 Hasso Tepper <hasso@estpak.ee>
* irdp_interface.c: follow common style while naming vty command
diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c
index dac6aea1a..56e418402 100644
--- a/zebra/irdp_main.c
+++ b/zebra/irdp_main.c
@@ -50,6 +50,7 @@
#include "log.h"
#include "zclient.h"
#include "thread.h"
+#include "privs.h"
#include "zebra/interface.h"
#include "zebra/rtadv.h"
#include "zebra/rib.h"
@@ -64,6 +65,8 @@
/* GLOBAL VARS */
+extern struct zebra_privs_t zserv_privs;
+
/* Master of threads. */
extern struct zebra_t zebrad;
struct thread *t_irdp_raw;
@@ -98,7 +101,16 @@ irdp_sock_init (void)
{
int ret, i;
+ if ( zserv_privs.change (ZPRIVS_RAISE) )
+ zlog_err ("irdp_sock_init: could not raise privs, %s",
+ strerror (errno) );
+
irdp_sock = socket (AF_INET, SOCK_RAW, IPPROTO_ICMP);
+
+ if ( zserv_privs.change (ZPRIVS_LOWER) )
+ zlog_err ("irdp_sock_init: could not lower privs, %s",
+ strerror (errno) );
+
if (irdp_sock < 0) {
zlog_warn ("IRDP: can't create irdp socket %s", strerror(errno));
return irdp_sock;