Page MenuHomeFreeBSD

if_vtnet(4): Restore the ability to set promisc mode.
ClosedPublic

Authored by afedorov on Jun 4 2021, 4:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 12 2024, 3:04 PM
Unknown Object (File)
Oct 4 2024, 7:28 PM
Unknown Object (File)
Oct 4 2024, 5:01 PM
Unknown Object (File)
Oct 3 2024, 9:59 PM
Unknown Object (File)
Oct 3 2024, 7:08 PM
Unknown Object (File)
Oct 2 2024, 10:24 AM
Unknown Object (File)
Oct 1 2024, 3:21 AM
Unknown Object (File)
Sep 30 2024, 12:52 AM
Subscribers

Details

Summary

After updating the driver in the 13th release. Regression was introduced.

12.2 RELEASE and 12-STABLE allow you to set the interface to PROMISC mode if VTNET_FLAG_CTRL_RX is not advertised by the hypervisor.

But, 13-RELEASE allow this only if VTNET_FLAG_CTRL_RX is advertised.

For example, bhyve(8) doesn't support VTNET_FLAG_CTRL_RX.

Technically, if the hypervisor doesn't support the VTNET_FLAG_CTRL_RX, then the interface is always in PROMISC mode.
I see no reason to prohibit switching the interface to PROMISC mode if VTNET_FLAG_CTRL_RX is not supported by the hypervisor.

PR: 254343 and PR: 255054

This changes restore 12-STABLE behavior https://github.com/freebsd/freebsd-src/blob/stable/12/sys/dev/virtio/network/if_vtnet.c#L1103:

			if ((ifp->if_flags ^ sc->vtnet_if_flags) &
			    (IFF_PROMISC | IFF_ALLMULTI)) {
				if (sc->vtnet_flags & VTNET_FLAG_CTRL_RX)
					vtnet_rx_filter(sc);
				else {
					ifp->if_flags |= IFF_PROMISC;
					if ((ifp->if_flags ^ sc->vtnet_if_flags)
					    & IFF_ALLMULTI)
						error = ENOTSUP;
				}
			}
Test Plan
  • Add vtnet0 to if_bridge.
  • tcpdump vtnet0.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

afedorov created this revision.
donner requested changes to this revision.Jun 4 2021, 4:21 PM
donner added a subscriber: donner.
donner added inline comments.
sys/dev/virtio/network/if_vtnet.c
1308–1310

You are modifying the flags even if there is an error?
Should the modification only occur after the check?

This revision now requires changes to proceed.Jun 4 2021, 4:21 PM
afedorov marked an inline comment as done.
This revision is now accepted and ready to land.Jun 4 2021, 5:45 PM