History log of /freebsd/sys/netinet/ip_mroute.c (Results 1 – 25 of 493)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 0fd31cf6 10-Feb-2025 Mateusz Guzik <mjg@FreeBSD.org>

mroute: fix a sysctl vs teardown race

Sponsored by: Rubicon Communications, LLC ("Netgate")


# efd36878 10-Feb-2025 Mateusz Guzik <mjg@FreeBSD.org>

mroute: serialize parallel teardown of the same vnet

Otherwise 2 threads calling here can crash the kernel.

Sponsored by: Rubicon Communications, LLC ("Netgate")


Revision tags: release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0
# 28aafeb8 31-Oct-2024 John Baldwin <jhb@FreeBSD.org>

netinet*: Add assertions for some places that don't support M_EXTPG mbufs

Found while auditing calls to M_WRITABLE to see if M_EXTPG could be
removed from its checks.

Reviewed by: gallatin
Differen

netinet*: Add assertions for some places that don't support M_EXTPG mbufs

Found while auditing calls to M_WRITABLE to see if M_EXTPG could be
removed from its checks.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D46785

show more ...


Revision tags: release/13.4.0
# 08a98731 24-Jun-2024 Zhenlei Huang <zlei@FreeBSD.org>

ip_mroute: Use NET_EPOCH_WAIT() macro

This makes it easier to grep the usage.

Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D45715


Revision tags: release/14.1.0, release/13.3.0
# 0bc82e4f 12-Dec-2023 Kristof Provost <kp@FreeBSD.org>

ip_mroute: allow MRT_DEL_MFC even if there are pending upcalls

In del_mfc() we try to find the forwarding entry, but that fails to find
the entry if mfc_stall_ring is not empty.

We should find the

ip_mroute: allow MRT_DEL_MFC even if there are pending upcalls

In del_mfc() we try to find the forwarding entry, but that fails to find
the entry if mfc_stall_ring is not empty.

We should find the entry anyway, and destroy it (and any pending
messages) on delete.

Reviewed by: glebius
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D43031

show more ...


# 29363fb4 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl s

sys: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix

show more ...


# b01cad6d 22-Nov-2023 Kristof Provost <kp@FreeBSD.org>

ip_mroute: handle V_mfchashtbl allocation failure

We allocate V_mfchashtbl with HASH_NOWAIT (which maps to M_NOWAIT), so
this allocation may fail. As we didn't handle that failure we could end
up de

ip_mroute: handle V_mfchashtbl allocation failure

We allocate V_mfchashtbl with HASH_NOWAIT (which maps to M_NOWAIT), so
this allocation may fail. As we didn't handle that failure we could end
up dereferencing a NULL pointer later (e.g. during X_ip_mrouter_done()).

Do the obvious thing and fail out if we cannot allocate the table.

See also: https://redmine.pfsense.org/issues/14917
Sponsored by: Rubicon Communications, LLC ("Netgate")

show more ...


Revision tags: release/14.0.0
# f549e229 27-Sep-2023 Zhenlei Huang <zlei@FreeBSD.org>

ip_mroute: Fix sysctl knobs

The loader tunable `net.inet.ip.mfchashsize` does not have corresponding
sysctl MIB entry. Just add it.

While here, the sysctl variable `net.inet.pim.squelch_wholepkt` i

ip_mroute: Fix sysctl knobs

The loader tunable `net.inet.ip.mfchashsize` does not have corresponding
sysctl MIB entry. Just add it.

While here, the sysctl variable `net.inet.pim.squelch_wholepkt` is actually
a loader tunable. Add sysctl flag CTLFLAG_TUN to it so that `sysctl -T`
will report it correctly.

Reviewed by: kp
Fixes: 443fc3176dee Introduce a number of changes to the MROUTING code
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41997

show more ...


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 680ad06f 27-Jul-2023 Kristof Provost <kp@FreeBSD.org>

mroute: avoid calling if_allmulti with the lock held

Avoid locking issues when if_allmulti() calls the driver's if_ioctl,
because that may acquire sleepable locks (while we hold a non-sleepable
rwlo

mroute: avoid calling if_allmulti with the lock held

Avoid locking issues when if_allmulti() calls the driver's if_ioctl,
because that may acquire sleepable locks (while we hold a non-sleepable
rwlock).

Fortunately there's no pressing need to hold the mroute lock while we
do this, so we can postpone the call slightly, until after we've
released the lock.

This avoids the following WITNESS warning (with iflib drivers):

lock order reversal: (sleepable after non-sleepable)
1st 0xffffffff82f64960 IPv4 multicast forwarding (IPv4 multicast forwarding, rw) @ /usr/src/sys/netinet/ip_mroute.c:1050
2nd 0xfffff8000480f180 iflib ctx lock (iflib ctx lock, sx) @ /usr/src/sys/net/iflib.c:4525
lock order IPv4 multicast forwarding -> iflib ctx lock attempted at:
#0 0xffffffff80bbd6ce at witness_checkorder+0xbbe
#1 0xffffffff80b56d10 at _sx_xlock+0x60
#2 0xffffffff80c9ce5c at iflib_if_ioctl+0x2dc
#3 0xffffffff80c7c395 at if_setflag+0xe5
#4 0xffffffff82f60a0e at del_vif_locked+0x9e
#5 0xffffffff82f5f0d5 at X_ip_mrouter_set+0x265
#6 0xffffffff80bfd402 at sosetopt+0xc2
#7 0xffffffff80c02105 at kern_setsockopt+0xa5
#8 0xffffffff80c02054 at sys_setsockopt+0x24
#9 0xffffffff81046be8 at amd64_syscall+0x138
#10 0xffffffff8101930b at fast_syscall_common+0xf8

See also: https://redmine.pfsense.org/issues/12079
Reviewed by: mjg
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D41209

show more ...


# b658c0fc 23-Apr-2023 Zhenlei Huang <zlei@FreeBSD.org>

ip_mroute: Delete unreachable code

As the flag M_WAITOK is passed to ip_encap_attach(), then the function
will never return NULL, and the following code within NULL check branch
will be unreachable.

ip_mroute: Delete unreachable code

As the flag M_WAITOK is passed to ip_encap_attach(), then the function
will never return NULL, and the following code within NULL check branch
will be unreachable.

No functional change intended.

Reviewed by: kp
Fixes: 6d8fdfa9d5e7d Rework IP encapsulation handling code
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39746

show more ...


Revision tags: release/13.2.0
# 3a01a97d 17-Feb-2023 Mateusz Guzik <mjg@FreeBSD.org>

mroute: partially sanitize the file

There is rampant inconsistent formatting all around, make it mostly
style(9)-conformant.

While here:
- drop malloc casts
- rename a rw lock from mroute_mtx to mr

mroute: partially sanitize the file

There is rampant inconsistent formatting all around, make it mostly
style(9)-conformant.

While here:
- drop malloc casts
- rename a rw lock from mroute_mtx to mroute_lock
- replace NOTREACHED comment with __assert_unreachable

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D38652

show more ...


# 3d0d5b21 23-Jan-2023 Justin Hibbits <jhibbits@FreeBSD.org>

IfAPI: Explicitly include <net/if_private.h> in netstack

Summary:
In preparation of making if_t completely opaque outside of the netstack,
explicitly include the header. <net/if_var.h> will stop in

IfAPI: Explicitly include <net/if_private.h> in netstack

Summary:
In preparation of making if_t completely opaque outside of the netstack,
explicitly include the header. <net/if_var.h> will stop including the
header in the future.

Sponsored by: Juniper Networks, Inc.
Reviewed by: glebius, melifaro
Differential Revision: https://reviews.freebsd.org/D38200

show more ...


Revision tags: release/12.4.0
# 74ed2e8a 02-Sep-2022 Gleb Smirnoff <glebius@FreeBSD.org>

raw ip: fix regression with multicast and RSVP

With 61f7427f02a raw sockets protosw has wildcard pr_protocol. Protocol
of a specific pcb is stored in inp_ip_p.

Reviewed by: karels
Reported by: k

raw ip: fix regression with multicast and RSVP

With 61f7427f02a raw sockets protosw has wildcard pr_protocol. Protocol
of a specific pcb is stored in inp_ip_p.

Reviewed by: karels
Reported by: karels
Differential revision: https://reviews.freebsd.org/D36429
Fixes: 61f7427f02a307d28af674a12c45dd546e3898e4

show more ...


Revision tags: release/13.1.0
# 6ca0ca7b 08-Apr-2022 Mike Karels <karels@FreeBSD.org>

IPv4 multicast: fix LOR in shutdown path

X_ip_mrouter_done() was calling the interface ioctl routines via
if_allmulti() while holding a write lock. However, some interface
ioctl routines, including

IPv4 multicast: fix LOR in shutdown path

X_ip_mrouter_done() was calling the interface ioctl routines via
if_allmulti() while holding a write lock. However, some interface
ioctl routines, including em/iflib and tap, use sxlocks, which are
not permitted while holding a non-sleepable lock, and this elicits
a warning from WITNESS. Fix the locking issue by recording the
affected interface pointers in a malloc'ed array, and call
if_allmulti() on each after dropping the rwlock.

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D34845

show more ...


# 04cd74b4 21-Mar-2022 Mike Karels <karels@FreeBSD.org>

IPv4 multicast: fix netstat -g

The vif structure includes fields at the end which are #ifdef KERNEL,
causing a mismatch between the structure sizes between kernel and
user level. netstat -g failed

IPv4 multicast: fix netstat -g

The vif structure includes fields at the end which are #ifdef KERNEL,
causing a mismatch between the structure sizes between kernel and
user level. netstat -g failed with an ENOMEM on the sysctl to fetch
the vif table. Change the vif sysctl code in ip_mroute to copy out
only the user-level-visible portion of each table entry.

Reviewed by: bz, wma
Differential Revision: https://reviews.freebsd.org/D34627

show more ...


# 2cf1e120 21-Mar-2022 Mike Karels <karels@FreeBSD.org>

Enter epoch when addding IPv4 multicast forwarding cache entry

The code path from the IPv4 multicast setsockopt could call ip_output()
without entering an epoch. Specifically, the MRT_ADD_MFC setbs

Enter epoch when addding IPv4 multicast forwarding cache entry

The code path from the IPv4 multicast setsockopt could call ip_output()
without entering an epoch. Specifically, the MRT_ADD_MFC setbsocopt
would call add_mfc(), which in turn called ip_mdq() to send queued
packets. This resulted in an epoch assert failure in ip_output().
Enter an epoch in add_mfc(), and add some epoch asserts to check
for similar failures.

Reviewed by: kp, bz, wma, cy
Differential Revision: https://reviews.freebsd.org/D34624

show more ...


# cd7306bb 04-Feb-2022 Sylvian Meygret <sylvain.meygret.external@stormshield.eu>

ip_mroute: split mrouter interface deactivation and if_free

Move if_free outside MRW_LOCK. This will silence LOR message
which might appere during deinitialization.


# 77223d98 25-Jan-2022 Wojciech Macek <wma@FreeBSD.org>

ip_mroute: refactor epoch-basd locking

Remove duplicated epoch_enter and epoch_exit in IP inp/outp routines.
Remove unnecessary macros as well.

Obtained from: Semihalf
Spponsored by: Stormshield

ip_mroute: refactor epoch-basd locking

Remove duplicated epoch_enter and epoch_exit in IP inp/outp routines.
Remove unnecessary macros as well.

Obtained from: Semihalf
Spponsored by: Stormshield
Reviewed by: glebius
Differential revision: https://reviews.freebsd.org/D34030

show more ...


# 0daa2805 22-Jan-2022 Wojciech Macek <wma@FreeBSD.org>

ip_mroute: add unlock in early-exit

Add missing unlock if V_ip_mrotue is not set

Obtained from: Semihalf


# 9ce46cbc 21-Jan-2022 Wojciech Macek <wma@FreeBSD.org>

ip_mroute: move ip_mrouter_done outside lock

X_ip_mrouter_done might sleep, which triggers INVARIANTS to
print additional errors on the screen.
Move it outside the lock, but provide some basic synch

ip_mroute: move ip_mrouter_done outside lock

X_ip_mrouter_done might sleep, which triggers INVARIANTS to
print additional errors on the screen.
Move it outside the lock, but provide some basic synchronization
to avoid race condition during module uninit/unload.

Obtained from: Semihalf
Sponsored by: Stormshield

show more ...


# 776c34f6 11-Jan-2022 Wojciech Macek <wma@FreeBSD.org>

ip_mroute: remove unused variables

Sponsored by: Stormshield
Obtained from: Semihalf


# 68f28dd1 10-Jan-2022 Wojciech Macek <wma@FreeBSD.org>

ip_mroute: do not sleep when lock is taken

Kthread initialization calls uma_alloc which can sleep.
Modify the code to use deferred work instead.


Revision tags: release/12.3.0
# 8a727c3d 28-Oct-2021 Wojciech Macek <wma@FreeBSD.org>

mroute: add missing WUNLOCK

Add missing WNLOCK as in all other error cases.

Reported by: Stormshield
Obtained from: Semihalf


# fb385484 28-Oct-2021 Wojciech Macek <wma@FreeBSD.org>

mroute: fix memory leak

Add MFC to linked list to store incoming packets
before MCAST JOIN was captured.

Sponsored by: Stormshield
Obtained from: Semihalf
MFC after: 2 weeks


12345678910>>...20