Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[.joined/src/trunk]: .joined/src/sys/net sys/net: Document if_mcast_op with c...
details: https://anonhg.NetBSD.org/.joined/src/rev/661076791f2d
branches: trunk
changeset: 359348:661076791f2d
user: riastradh <riastradh%NetBSD.org@localhost>
date: Fri Dec 31 14:26:29 2021 +0000
description:
sys/net: Document if_mcast_op with comment and refuse other commands.
Meant only for multicast addition/deletion operations, nothing else.
diffstat:
sys/net/if.c | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
diffs (50 lines):
diff -r edf17e2033ea -r 661076791f2d sys/net/if.c
--- a/sys/net/if.c Fri Dec 31 14:26:19 2021 +0000
+++ b/sys/net/if.c Fri Dec 31 14:26:29 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.500 2021/12/31 14:26:19 riastradh Exp $ */
+/* $NetBSD: if.c,v 1.501 2021/12/31 14:26:29 riastradh Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.500 2021/12/31 14:26:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.501 2021/12/31 14:26:29 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -3879,12 +3879,31 @@
return rc;
}
+/*
+ * if_mcast_op(ifp, cmd, sa)
+ *
+ * Apply a multicast command, SIOCADDMULTI/SIOCDELMULTI, to the
+ * interface. Returns 0 on success, nonzero errno(3) number on
+ * failure.
+ *
+ * May sleep.
+ *
+ * Use this, not if_ioctl, for the multicast commands.
+ */
int
if_mcast_op(ifnet_t *ifp, const unsigned long cmd, const struct sockaddr *sa)
{
int rc;
struct ifreq ifr;
+ switch (cmd) {
+ case SIOCADDMULTI:
+ case SIOCDELMULTI:
+ break;
+ default:
+ panic("invalid ifnet multicast command: 0x%lx", cmd);
+ }
+
ifreq_setaddr(cmd, &ifr, sa);
rc = if_ioctl(ifp, cmd, &ifr);
Home |
Main Index |
Thread Index |
Old Index