git: 009a56b2e416 - stable/13 - if_vtnet(4): Restore the ability to set promisc mode.

From: Aleksandr Fedorov <afedorov_at_FreeBSD.org>
Date: Wed, 23 Feb 2022 11:09:37 UTC
The branch stable/13 has been updated by afedorov:

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

commit 009a56b2e416cf32b28be405876ab38bd7544d98
Author:     Aleksandr Fedorov <afedorov@FreeBSD.org>
AuthorDate: 2022-02-05 15:47:46 +0000
Commit:     Aleksandr Fedorov <afedorov@FreeBSD.org>
CommitDate: 2022-02-23 11:08:24 +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
    
    (cherry picked from commit fc035df8af32d496885e5da26e519ce6a262c9bf)
---
 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 3650d19fbe0e..2b25fbfb6b93 100644
--- a/sys/dev/virtio/network/if_vtnet.c
+++ b/sys/dev/virtio/network/if_vtnet.c
@@ -1296,9 +1296,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: