]> git.puffer.fish Git - mirror/frr.git/commitdiff
Creating irdp socket requires more privileges.
authorhasso <hasso>
Tue, 13 Jul 2004 03:06:51 +0000 (03:06 +0000)
committerhasso <hasso>
Tue, 13 Jul 2004 03:06:51 +0000 (03:06 +0000)
zebra/ChangeLog
zebra/irdp_main.c

index fab7acb58f2a83182324e0db554f4e9debabb289..acf2f8cba3a87efeb2a3a1cf8841a76698697d4c 100644 (file)
@@ -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
index dac6aea1ac1c2b200ddc2038ae44c93013a71d36..56e41840281335c4a9f04d140511fd56b7a02350 100644 (file)
@@ -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;