git: fc035df8af32 - main - if_vtnet(4): Restore the ability to set promisc mode.

From: Aleksandr Fedorov <afedorov_at_FreeBSD.org>
Date: Sat, 05 Feb 2022 15:53:42 UTC
The branch main has been updated by afedorov:

URL: https://cgit.FreeBSD.org/src/commit/?id=fc035df8af32d496885e5da26e519ce6a262c9bf

commit fc035df8af32d496885e5da26e519ce6a262c9bf
Author:     Aleksandr Fedorov <afedorov@FreeBSD.org>
AuthorDate: 2022-02-05 15:47:46 +0000
Commit:     Aleksandr Fedorov <afedorov@FreeBSD.org>
CommitDate: 2022-02-05 15:47:46 +0000

    if_vtnet(4): Restore the ability to set promisc mode.
    
    PR:     254343, 255054
    Reviewed by:    vmaffione (mentor), donner
    Approved by:    vmaffione (mentor), donner
    MFC after:      2 weeks
    Sponsored by:   vstack.com
    Differential Revision:  https://reviews.freebsd.org/D30639
---
 sys/dev/virtio/network/if_vtnet.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c
index 7cbbe56e6c6b..0a020e6b6c91 100644
--- a/sys/dev/virtio/network/if_vtnet.c
+++ b/sys/dev/virtio/network/if_vtnet.c
@@ -1302,9 +1302,13 @@ vtnet_ioctl_ifflags(struct vtnet_softc *sc)
 
 	if ((ifp->if_flags ^ sc->vtnet_if_flags) &
 	    (IFF_PROMISC | IFF_ALLMULTI)) {
-		if ((sc->vtnet_flags & VTNET_FLAG_CTRL_RX) == 0)
-			return (ENOTSUP);
-		vtnet_rx_filter(sc);
+		if (sc->vtnet_flags & VTNET_FLAG_CTRL_RX)
+			vtnet_rx_filter(sc);
+		else {
+			if ((ifp->if_flags ^ sc->vtnet_if_flags) & IFF_ALLMULTI)
+				return (ENOTSUP);
+			ifp->if_flags |= IFF_PROMISC;
+		}
 	}
 
 out: