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)
Tue, Apr 16, 4:00 AM
Unknown Object (File)
Fri, Apr 12, 12:03 AM
Unknown Object (File)
Sat, Mar 30, 10:54 PM
Unknown Object (File)
Jan 17 2024, 6:31 PM
Unknown Object (File)
Dec 20 2023, 2:44 AM
Unknown Object (File)
Nov 30 2023, 1:25 AM
Unknown Object (File)
Oct 28 2023, 2:38 AM
Unknown Object (File)
Sep 16 2023, 5:57 PM
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