Index: trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp
===================================================================
--- trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp	(revision 56280)
+++ trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp	(revision 56281)
@@ -86,4 +86,9 @@
 #define VBOXNETFLT_DARWIN_TEST_SEG_SIZE 14
 #endif
+
+/* XXX: hidden undef #ifdef __APPLE__ */
+#define VBOX_IN_LOOPBACK(addr)  (((addr) & IN_CLASSA_NET) == 0x7f000000)
+#define VBOX_IN_LINKLOCAL(addr) (((addr) & IN_CLASSB_NET) == 0xa9fe0000)
+
 
 
@@ -1400,5 +1405,8 @@
             u_int32_t u32Addr = ntohl(sin->sin_addr.s_addr);
 
-            if ((u32Addr >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET)
+            if (VBOX_IN_LOOPBACK(u32Addr))
+                continue;
+
+            if (ifaddr_ifnet(ifa) != pIfNet && VBOX_IN_LINKLOCAL(u32Addr))
                 continue;
 
@@ -1415,5 +1423,5 @@
 
             /* link-local from other interfaces are out of scope */
-            if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) && ifaddr_ifnet(ifa) != pIfNet)
+            if (ifaddr_ifnet(ifa) != pIfNet && IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))
                 continue;
 
@@ -1449,4 +1457,9 @@
         return;
     }
+
+    struct net_event_data my_link;
+    ifnet_t pIfNet = pThis->u.s.pIfNet; /* XXX: retain? */
+    ifnet_family_t if_family = ifnet_family(pIfNet);
+    u_int32_t if_unit = ifnet_unit(pIfNet);
 
     for (;;) {
@@ -1490,9 +1503,24 @@
             struct net_event_data *link = &iev->link_data;
             PCRTNETADDRU pAddr = (PCRTNETADDRU)&iev->ia_addr;
+            u_int32_t u32Addr = ntohl(pAddr->IPv4.u);
+
+            if (VBOX_IN_LOOPBACK(u32Addr))
+            {
+                mbuf_freem(m);
+                continue;
+            }
+
+            if (   (link->if_family != if_family || link->if_unit != if_unit)
+                && VBOX_IN_LINKLOCAL(u32Addr))
+            {
+                mbuf_freem(m);
+                continue;
+            }
+
             switch (msg->event_code)
             {
                 case KEV_INET_NEW_ADDR:
                     Log(("KEV_INET_NEW_ADDR %.*s%d: %RTnaipv4\n",
-                         IFNAMSIZ, link->if_name, link->if_unit, pAddr->IPv4));
+                         IFNAMSIZ, link->if_name, link->if_unit, pAddr->IPv4.u));
 
                     pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort,
@@ -1502,5 +1530,5 @@
                 case KEV_INET_ADDR_DELETED:
                     Log(("KEV_INET_ADDR_DELETED %.*s%d: %RTnaipv4\n",
-                         IFNAMSIZ, link->if_name, link->if_unit, pAddr->IPv4));
+                         IFNAMSIZ, link->if_name, link->if_unit, pAddr->IPv4.u));
 
                     pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort,
@@ -1510,5 +1538,5 @@
                 default:
                     Log(("KEV INET event %u %.*s%d: addr %RTnaipv4\n",
-                         msg->event_code, IFNAMSIZ, link->if_name, link->if_unit, pAddr->IPv4));
+                         msg->event_code, IFNAMSIZ, link->if_name, link->if_unit, pAddr->IPv4.u));
                     break;
             }
@@ -1527,4 +1555,20 @@
             struct net_event_data *link = &iev6->link_data;
             PCRTNETADDRU pAddr = (PCRTNETADDRU)&iev6->ia_addr.sin6_addr;
+
+            if (IN6_IS_ADDR_LOOPBACK(&iev6->ia_addr.sin6_addr))
+            {
+                mbuf_freem(m);
+                continue;
+            }
+
+            if (   (link->if_family != if_family || link->if_unit != if_unit)
+                && IN6_IS_ADDR_LINKLOCAL(&iev6->ia_addr.sin6_addr))
+            {
+                mbuf_freem(m);
+                continue;
+            }
+
+
+
             switch (msg->event_code)
             {
@@ -1532,9 +1576,4 @@
                     Log(("KEV_INET6_NEW_USER_ADDR %.*s%d: %RTnaipv6\n",
                          IFNAMSIZ, link->if_name, link->if_unit, pAddr));
-                    /*
-                     * XXX: TODO: link-local addresses are first
-                     * reported as KEV_INET6_NEW_LL_ADDR, but then are
-                     * also reported here too, after DAD, I guess.
-                     */
                     goto kev_inet6_new;
 
@@ -1542,5 +1581,4 @@
                     Log(("KEV_INET6_NEW_LL_ADDR %.*s%d: %RTnaipv6\n",
                          IFNAMSIZ, link->if_name, link->if_unit, pAddr));
-                    /* XXX: uwe: TODO: only interface we are attached to */
                     goto kev_inet6_new;
 
