summaryrefslogtreecommitdiff
path: root/ripngd
diff options
context:
space:
mode:
authorgdt <gdt>2004-07-01 19:26:33 +0000
committergdt <gdt>2004-07-01 19:26:33 +0000
commit4d4653afe362d6ea549c6e21b27afe01fb8b8aac (patch)
tree933f0445306c6a6c5904485e4991bc208de6e407 /ripngd
parent79683de8c645ca46395280049f240cfbe71f9e35 (diff)
2004-07-01 Greg Troxel <gdt@fnord.ir.bbn.com>
* ripng_interface.c (ripng_multicast_join): Use privs to do join, to work around bug on gif(4) on NetBSD 1.6.2.
Diffstat (limited to 'ripngd')
-rw-r--r--ripngd/ChangeLog5
-rw-r--r--ripngd/ripng_interface.c14
2 files changed, 19 insertions, 0 deletions
diff --git a/ripngd/ChangeLog b/ripngd/ChangeLog
index 8122ec55..059ee757 100644
--- a/ripngd/ChangeLog
+++ b/ripngd/ChangeLog
@@ -1,3 +1,8 @@
+2004-07-01 Greg Troxel <gdt@fnord.ir.bbn.com>
+
+ * ripng_interface.c (ripng_multicast_join): Use privs to do join,
+ to work around bug on gif(4) on NetBSD 1.6.2.
+
2004-05-11 Paul Jakma <paul@dishone.st>
* ripng_nexthop.h: SUNOS_5 does not define s6_addr32
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index 28977bea..d4d1e642 100644
--- a/ripngd/ripng_interface.c
+++ b/ripngd/ripng_interface.c
@@ -34,6 +34,7 @@
#include "command.h"
#include "table.h"
#include "thread.h"
+#include "privs.h"
#include "ripngd/ripngd.h"
#include "ripngd/ripng_debug.h"
@@ -46,6 +47,8 @@
#define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
#endif
+extern struct zebra_privs_t ripngd_privs;
+
/* Static utility function. */
static void ripng_enable_apply (struct interface *);
static void ripng_passive_interface_apply (struct interface *);
@@ -65,9 +68,20 @@ ripng_multicast_join (struct interface *ifp)
inet_pton(AF_INET6, RIPNG_GROUP, &mreq.ipv6mr_multiaddr);
mreq.ipv6mr_interface = ifp->ifindex;
+ /*
+ * NetBSD 1.6.2 requires root to join groups on gif(4).
+ * While this is bogus, privs are available and easy to use
+ * for this call as a workaround.
+ */
+ if (ripngd_privs.change (ZPRIVS_RAISE))
+ zlog_err ("ripng_multicast_join: could not raise privs");
+
ret = setsockopt (ripng->sock, IPPROTO_IPV6, IPV6_JOIN_GROUP,
(char *) &mreq, sizeof (mreq));
+ if (ripngd_privs.change (ZPRIVS_LOWER))
+ zlog_err ("ripng_multicast_join: could not lower privs");
+
if (ret < 0 && errno == EADDRINUSE)
{
/*