git: f2c2e5b0bf9d - main - multicast.4: Fix disabling multicast forwarding
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 Feb 2026 22:05:15 UTC
The branch main has been updated by pouria:
URL: https://cgit.FreeBSD.org/src/commit/?id=f2c2e5b0bf9def01b10651b9802fa38d07d9d265
commit f2c2e5b0bf9def01b10651b9802fa38d07d9d265
Author: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
AuthorDate: 2026-02-12 23:06:15 +0000
Commit: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-02-13 22:02:04 +0000
multicast.4: Fix disabling multicast forwarding
Reviewed by: markj, glebius
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D55266
---
share/man/man4/multicast.4 | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/share/man/man4/multicast.4 b/share/man/man4/multicast.4
index aa3293e107eb..84c6c5c4199b 100644
--- a/share/man/man4/multicast.4
+++ b/share/man/man4/multicast.4
@@ -23,7 +23,7 @@
.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
.\" DEALINGS IN THE SOFTWARE.
.\"
-.Dd May 27, 2009
+.Dd February 13, 2026
.Dt MULTICAST 4
.Os
.\"
@@ -124,15 +124,15 @@ Therefore, for portability reason the multicast
routing socket should be reused for IGMP and MLD messages as well.
.Pp
After the multicast routing socket is open, it can be used to enable
-or disable multicast forwarding in the kernel:
+multicast forwarding in the kernel:
.Bd -literal
/* IPv4 */
-int v = 1; /* 1 to enable, or 0 to disable */
+int v = 1;
setsockopt(mrouter_s4, IPPROTO_IP, MRT_INIT, (void *)&v, sizeof(v));
.Ed
.Bd -literal
/* IPv6 */
-int v = 1; /* 1 to enable, or 0 to disable */
+int v = 1;
setsockopt(mrouter_s6, IPPROTO_IPV6, MRT6_INIT, (void *)&v, sizeof(v));
\&...
/* If necessary, filter all ICMPv6 messages */
@@ -142,6 +142,24 @@ setsockopt(mrouter_s6, IPPROTO_ICMPV6, ICMP6_FILTER, (void *)&filter,
sizeof(filter));
.Ed
.Pp
+When applied to the multicast routing socket, the
+.Dv MRT_DONE
+and
+.Dv MRT6_DONE
+socket options disable multicast forwarding in the kernel:
+.Bd -literal
+/* IPv4 */
+int v = 1;
+setsockopt(mrouter_s4, IPPROTO_IP, MRT_DONE, (void *)&v, sizeof(v));
+.Ed
+.Bd -literal
+/* IPv6 */
+int v = 1;
+setsockopt(mrouter_s6, IPPROTO_IPV6, MRT6_DONE, (void *)&v, sizeof(v));
+.Ed
+.Pp
+Closing the socket has the same effect.
+.Pp
After multicast forwarding is enabled, the multicast routing socket
can be used to enable PIM processing in the kernel if we are running PIM-SM or
PIM-DM