- Timestamp:
- Jun 9, 2015 12:08:44 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp
r56267 r56281 86 86 #define VBOXNETFLT_DARWIN_TEST_SEG_SIZE 14 87 87 #endif 88 89 /* XXX: hidden undef #ifdef __APPLE__ */ 90 #define VBOX_IN_LOOPBACK(addr) (((addr) & IN_CLASSA_NET) == 0x7f000000) 91 #define VBOX_IN_LINKLOCAL(addr) (((addr) & IN_CLASSB_NET) == 0xa9fe0000) 92 88 93 89 94 … … 1400 1405 u_int32_t u32Addr = ntohl(sin->sin_addr.s_addr); 1401 1406 1402 if ((u32Addr >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) 1407 if (VBOX_IN_LOOPBACK(u32Addr)) 1408 continue; 1409 1410 if (ifaddr_ifnet(ifa) != pIfNet && VBOX_IN_LINKLOCAL(u32Addr)) 1403 1411 continue; 1404 1412 … … 1415 1423 1416 1424 /* link-local from other interfaces are out of scope */ 1417 if ( IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) && ifaddr_ifnet(ifa) != pIfNet)1425 if (ifaddr_ifnet(ifa) != pIfNet && IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) 1418 1426 continue; 1419 1427 … … 1449 1457 return; 1450 1458 } 1459 1460 struct net_event_data my_link; 1461 ifnet_t pIfNet = pThis->u.s.pIfNet; /* XXX: retain? */ 1462 ifnet_family_t if_family = ifnet_family(pIfNet); 1463 u_int32_t if_unit = ifnet_unit(pIfNet); 1451 1464 1452 1465 for (;;) { … … 1490 1503 struct net_event_data *link = &iev->link_data; 1491 1504 PCRTNETADDRU pAddr = (PCRTNETADDRU)&iev->ia_addr; 1505 u_int32_t u32Addr = ntohl(pAddr->IPv4.u); 1506 1507 if (VBOX_IN_LOOPBACK(u32Addr)) 1508 { 1509 mbuf_freem(m); 1510 continue; 1511 } 1512 1513 if ( (link->if_family != if_family || link->if_unit != if_unit) 1514 && VBOX_IN_LINKLOCAL(u32Addr)) 1515 { 1516 mbuf_freem(m); 1517 continue; 1518 } 1519 1492 1520 switch (msg->event_code) 1493 1521 { 1494 1522 case KEV_INET_NEW_ADDR: 1495 1523 Log(("KEV_INET_NEW_ADDR %.*s%d: %RTnaipv4\n", 1496 IFNAMSIZ, link->if_name, link->if_unit, pAddr->IPv4 ));1524 IFNAMSIZ, link->if_name, link->if_unit, pAddr->IPv4.u)); 1497 1525 1498 1526 pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort, … … 1502 1530 case KEV_INET_ADDR_DELETED: 1503 1531 Log(("KEV_INET_ADDR_DELETED %.*s%d: %RTnaipv4\n", 1504 IFNAMSIZ, link->if_name, link->if_unit, pAddr->IPv4 ));1532 IFNAMSIZ, link->if_name, link->if_unit, pAddr->IPv4.u)); 1505 1533 1506 1534 pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort, … … 1510 1538 default: 1511 1539 Log(("KEV INET event %u %.*s%d: addr %RTnaipv4\n", 1512 msg->event_code, IFNAMSIZ, link->if_name, link->if_unit, pAddr->IPv4 ));1540 msg->event_code, IFNAMSIZ, link->if_name, link->if_unit, pAddr->IPv4.u)); 1513 1541 break; 1514 1542 } … … 1527 1555 struct net_event_data *link = &iev6->link_data; 1528 1556 PCRTNETADDRU pAddr = (PCRTNETADDRU)&iev6->ia_addr.sin6_addr; 1557 1558 if (IN6_IS_ADDR_LOOPBACK(&iev6->ia_addr.sin6_addr)) 1559 { 1560 mbuf_freem(m); 1561 continue; 1562 } 1563 1564 if ( (link->if_family != if_family || link->if_unit != if_unit) 1565 && IN6_IS_ADDR_LINKLOCAL(&iev6->ia_addr.sin6_addr)) 1566 { 1567 mbuf_freem(m); 1568 continue; 1569 } 1570 1571 1572 1529 1573 switch (msg->event_code) 1530 1574 { … … 1532 1576 Log(("KEV_INET6_NEW_USER_ADDR %.*s%d: %RTnaipv6\n", 1533 1577 IFNAMSIZ, link->if_name, link->if_unit, pAddr)); 1534 /*1535 * XXX: TODO: link-local addresses are first1536 * reported as KEV_INET6_NEW_LL_ADDR, but then are1537 * also reported here too, after DAD, I guess.1538 */1539 1578 goto kev_inet6_new; 1540 1579 … … 1542 1581 Log(("KEV_INET6_NEW_LL_ADDR %.*s%d: %RTnaipv6\n", 1543 1582 IFNAMSIZ, link->if_name, link->if_unit, pAddr)); 1544 /* XXX: uwe: TODO: only interface we are attached to */1545 1583 goto kev_inet6_new; 1546 1584
Note:
See TracChangeset
for help on using the changeset viewer.