Page MenuHomeFreeBSD

D46524.diff
No OneTemporary

D46524.diff

diff --git a/sys/net/if.h b/sys/net/if.h
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -160,7 +160,7 @@
#define IFF_STICKYARP 0x100000 /* (n) sticky ARP */
#define IFF_DYING 0x200000 /* (n) interface is winding down */
#define IFF_RENAMING 0x400000 /* (n) interface is being renamed */
-#define IFF_SPARE 0x800000
+#define IFF_PALLMULTI 0x800000 /* (n) user-requested allmulti mode */
#define IFF_NETLINK_1 0x1000000 /* (n) used by netlink */
/*
diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -2611,7 +2611,12 @@
(ifp->if_flags & IFF_UP) == 0) {
do_ifup = 1;
}
- /* See if permanently promiscuous mode bit is about to flip */
+
+ /*
+ * See if the promiscuous mode or allmulti bits are about to
+ * flip. They require special handling because in-kernel
+ * consumers may indepdently toggle them.
+ */
if ((ifp->if_flags ^ new_flags) & IFF_PPROMISC) {
if (new_flags & IFF_PPROMISC)
ifp->if_flags |= IFF_PROMISC;
@@ -2622,6 +2627,12 @@
((new_flags & IFF_PPROMISC) ?
"enabled" : "disabled"));
}
+ if ((ifp->if_flags ^ new_flags) & IFF_PALLMULTI) {
+ if (new_flags & IFF_PALLMULTI)
+ ifp->if_flags |= IFF_ALLMULTI;
+ else if (ifp->if_amcount == 0)
+ ifp->if_flags &= ~IFF_ALLMULTI;
+ }
ifp->if_flags = (ifp->if_flags & IFF_CANTCHANGE) |
(new_flags &~ IFF_CANTCHANGE);
if (ifp->if_ioctl) {
@@ -3383,7 +3394,8 @@
if_allmulti(struct ifnet *ifp, int onswitch)
{
- return (if_setflag(ifp, IFF_ALLMULTI, 0, &ifp->if_amcount, onswitch));
+ return (if_setflag(ifp, IFF_ALLMULTI, IFF_PALLMULTI, &ifp->if_amcount,
+ onswitch));
}
struct ifmultiaddr *

File Metadata

Mime Type
text/plain
Expires
Sat, Sep 28, 9:59 AM (2 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
11435664
Default Alt Text
D46524.diff (1 KB)

Event Timeline