summaryrefslogtreecommitdiff
path: root/usr.sbin/mrouted/kern.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-14 01:46:23 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-14 01:46:23 +0000
commitacfc88313dd86a33e6c0424cda0578b15a539e42 (patch)
tree8831738b9326fa2111446b81b93fee2285da3e07 /usr.sbin/mrouted/kern.c
parenta10a6913325bfa093081ff08628e32d3b0f2a565 (diff)
from netbsd; update to mrouted 3.8
Diffstat (limited to 'usr.sbin/mrouted/kern.c')
-rw-r--r--usr.sbin/mrouted/kern.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/usr.sbin/mrouted/kern.c b/usr.sbin/mrouted/kern.c
index 0dbae18624a..f41edce77c4 100644
--- a/usr.sbin/mrouted/kern.c
+++ b/usr.sbin/mrouted/kern.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern.c,v 1.3 1995/10/09 03:51:43 thorpej Exp $ */
+/* $NetBSD: kern.c,v 1.4 1995/12/10 10:07:03 mycroft Exp $ */
/*
* The mrouted program is covered by the license in the accompanying file
@@ -157,12 +157,15 @@ void k_del_vif(vifi)
* Adds a (source, mcastgrp) entry to the kernel
*/
void k_add_rg(origin, g)
- u_long origin;
+ u_int32_t origin;
struct gtable *g;
{
struct mfcctl mc;
- int i;
+ vifi_t i;
+#ifdef DEBUG_MFC
+ md_log(MD_ADD, origin, g->gt_mcastgrp);
+#endif
/* copy table values so that setsockopt can process it */
mc.mfcc_origin.s_addr = origin;
#ifdef OLD_KERNEL
@@ -175,8 +178,12 @@ void k_add_rg(origin, g)
/* write to kernel space */
if (setsockopt(igmp_socket, IPPROTO_IP, MRT_ADD_MFC,
- (char *)&mc, sizeof(mc)) < 0)
+ (char *)&mc, sizeof(mc)) < 0) {
+#ifdef DEBUG_MFC
+ md_log(MD_ADD_FAIL, origin, g->gt_mcastgrp);
+#endif
log(LOG_WARNING, errno, "setsockopt MRT_ADD_MFC");
+ }
}
@@ -184,12 +191,15 @@ void k_add_rg(origin, g)
* Deletes a (source, mcastgrp) entry from the kernel
*/
int k_del_rg(origin, g)
- u_long origin;
+ u_int32_t origin;
struct gtable *g;
{
struct mfcctl mc;
- int retval, i;
+ int retval;
+#ifdef DEBUG_MFC
+ md_log(MD_DEL, origin, g->gt_mcastgrp);
+#endif
/* copy table values so that setsockopt can process it */
mc.mfcc_origin.s_addr = origin;
#ifdef OLD_KERNEL
@@ -199,8 +209,12 @@ int k_del_rg(origin, g)
/* write to kernel space */
if ((retval = setsockopt(igmp_socket, IPPROTO_IP, MRT_DEL_MFC,
- (char *)&mc, sizeof(mc))) < 0)
+ (char *)&mc, sizeof(mc))) < 0) {
+#ifdef DEBUG_MFC
+ md_log(MD_DEL_FAIL, origin, g->gt_mcastgrp);
+#endif
log(LOG_WARNING, errno, "setsockopt MRT_DEL_MFC");
+ }
return retval;
}
@@ -210,6 +224,9 @@ int k_del_rg(origin, g)
*/
int k_get_version()
{
+#ifdef OLD_KERNEL
+ return -1;
+#else
int vers;
int len = sizeof(vers);
@@ -219,4 +236,5 @@ int k_get_version()
"getsockopt MRT_VERSION: perhaps your kernel is too old");
return vers;
+#endif
}