Page MenuHomeFreeBSD

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

Authored by afedorov on Fri, Jun 4, 4:16 PM.

Details

Reviewers
vmaffione
jhb
grehan
bryanv
donner
Group Reviewers
network
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

Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

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

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.Fri, Jun 4, 4:21 PM
afedorov marked an inline comment as done.
This revision is now accepted and ready to land.Fri, Jun 4, 5:45 PM