Changeset 16183 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt/linux
- Timestamp:
- Jan 22, 2009 5:31:11 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 41933
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
r16098 r16183 939 939 struct net_device * pDev; 940 940 941 LogFlow(("vboxNetFltPortOsSetActive: pThis=%p (%s), fActive=%s\n", 942 pThis, pThis->szName, fActive?"true":"false")); 941 LogFlow(("vboxNetFltPortOsSetActive: pThis=%p (%s), fActive=%s, fDisablePromiscuous=%s\n", 942 pThis, pThis->szName, fActive?"true":"false", 943 pThis->fDisablePromiscuous?"true":"false")); 944 945 if (pThis->fDisablePromiscuous) 946 return; 943 947 944 948 pDev = vboxNetFltLinuxRetainNetDev(pThis); … … 951 955 * host the interface promiscuity for vboxNetFltPortOsIsPromiscuous. 952 956 */ 957 #ifdef LOG_ENABLED 953 958 u_int16_t fIf; 954 #ifdef LOG_ENABLED955 959 unsigned const cPromiscBefore = VBOX_GET_PCOUNT(pDev); 956 960 #endif … … 959 963 Assert(!pThis->u.s.fPromiscuousSet); 960 964 961 #if 0 962 /* 963 * Try bring the interface up and running if it's down. 964 */ 965 fIf = dev_get_flags(pDev); 966 if ((fIf & (IFF_UP | IFF_RUNNING)) != (IFF_UP | IFF_RUNNING)) 967 { 968 rtnl_lock(); 969 int err = dev_change_flags(pDev, fIf | IFF_UP); 970 rtnl_unlock(); 971 fIf = dev_get_flags(pDev); 972 } 973 974 /* 975 * Is it already up? If it isn't, leave it to the link event or 976 * we'll upset if_pcount (as stated above, ifnet_set_promiscuous is weird). 977 */ 978 if ((fIf & (IFF_UP | IFF_RUNNING)) == (IFF_UP | IFF_RUNNING) 979 && !ASMAtomicReadBool(&pThis->u.s.fPromiscuousSet)) 980 { 981 #endif 982 rtnl_lock(); 983 dev_set_promiscuity(pDev, 1); 984 rtnl_unlock(); 985 pThis->u.s.fPromiscuousSet = true; 986 Log(("vboxNetFltPortOsSetActive: enabled promiscuous mode on %s (%d)\n", pThis->szName, VBOX_GET_PCOUNT(pDev))); 987 #if 0 988 /* check if it actually worked, this stuff is not always behaving well. */ 989 if (!(dev_get_flags(pDev) & IFF_PROMISC)) 990 { 991 err = dev_change_flags(pDev, fIf | IFF_PROMISC); 992 if (!err) 993 Log(("vboxNetFlt: fixed IFF_PROMISC on %s (%d->%d)\n", pThis->szName, cPromiscBefore, VBOX_GET_PCOUNT(pDev))); 994 else 995 Log(("VBoxNetFlt: failed to fix IFF_PROMISC on %s, err=%d (%d->%d)\n", 996 pThis->szName, err, cPromiscBefore, VBOX_GET_PCOUNT(pDev))); 997 } 998 #endif 999 #if 0 1000 } 1001 else if (!err) 1002 Log(("VBoxNetFlt: Waiting for the link to come up... (%d->%d)\n", cPromiscBefore, VBOX_GET_PCOUNT(pDev))); 1003 if (err) 1004 LogRel(("VBoxNetFlt: Failed to put '%s' into promiscuous mode, err=%d (%d->%d)\n", pThis->szName, err, cPromiscBefore, VBOX_GET_PCOUNT(pDev))); 1005 #endif 965 rtnl_lock(); 966 dev_set_promiscuity(pDev, 1); 967 rtnl_unlock(); 968 pThis->u.s.fPromiscuousSet = true; 969 Log(("vboxNetFltPortOsSetActive: enabled promiscuous mode on %s (%d)\n", pThis->szName, VBOX_GET_PCOUNT(pDev))); 1006 970 } 1007 971 else … … 1016 980 pThis->u.s.fPromiscuousSet = false; 1017 981 982 #ifdef LOG_ENABLED 1018 983 fIf = dev_get_flags(pDev); 1019 984 Log(("VBoxNetFlt: fIf=%#x; %d->%d\n", fIf, cPromiscBefore, VBOX_GET_PCOUNT(pDev))); 985 #endif 1020 986 } 1021 987
Note:
See TracChangeset
for help on using the changeset viewer.