I'm sharing a potential patch here which implements the proposed change.

This patch is provided under UPL.

On 3/27/25 19:30, serenissi via vbox-dev wrote:

Seems like I was looking into the wrong part (the netfilter module) to look for a decision. For anybody searching through the mailing list, the wireless specific work is done based on `PNETIFINFO->fWireless`  property of the interface, which is set in `getInterfaceInfo` using some WEXT magic in linux.

The original issue mentioned is also caused by this as recent fedora kernel compiles out WEXT support and all interfaces are wrongly thought as non-wireless. This has nothing to do with any upstream kernel change.

hth

I think I should open a ticket to switch to modern uevent based (or something else) check as WEXT is pretty outdated and it is unlikely that fedora will add it back

~ serene

On 3/27/25 13:15, serenissi via vbox-dev wrote:

I came across this

```

@param   cbHdrs      Size of the packet headers.  This must be at least 6
     *                      bytes (the destination MAC address), but should if      *                      possible also include any VLAN tag and network      *                      layer header (*wireless mac address sharing*).

```

in doc for `INTNETTRUNKSWPORT::pfnPreRecv` and some similar other mentions; but after somewhat good greping could not find where the mac address of egress packet is replaced from guest to host in case of wifi bridges. I am new to VirtualBox source so I must be missing something obvious. Could you give a pointer to this?


I'm looking for this in an attempt to trace an issue I'm facing myself, which I posted in the forum (topic 113409) recently. The guest mac is present in egress packet in kernel 6.12 and above. My guess is some kernel change is breaking some assumption in the 'switch' internal logic.


~ serene


_______________________________________________
vbox-dev mailing list
vbox-dev@virtualbox.org
https://www.virtualbox.org/mailman/listinfo/vbox-dev

_______________________________________________
vbox-dev mailing list
vbox-dev@virtualbox.org
https://www.virtualbox.org/mailman/listinfo/vbox-dev
diff --git a/src/VBox/Main/src-server/linux/NetIf-linux.cpp b/src/VBox/Main/src-server/linux/NetIf-linux.cpp
index d5f1d9f..9871950 100644
--- a/src/VBox/Main/src-server/linux/NetIf-linux.cpp
+++ b/src/VBox/Main/src-server/linux/NetIf-linux.cpp
@@ -44,6 +44,7 @@
 #include <unistd.h>
 #include <iprt/asm.h>
 #include <errno.h>
+#include <stdbool.h>
 
 #include "HostNetworkInterfaceImpl.h"
 #include "netif.h"
@@ -196,10 +197,25 @@ static int getInterfaceInfo(int iSocket, const char *pszName, PNETIFINFO pInfo)
         if (ioctl(iSocket, SIOCGIFFLAGS, &Req) >= 0)
             pInfo->enmStatus = Req.ifr_flags & IFF_UP ? NETIF_S_UP : NETIF_S_DOWN;
 
-        struct iwreq WRq;
-        RT_ZERO(WRq);
-        RTStrCopy(WRq.ifr_name, sizeof(WRq.ifr_name), pszName);
-        pInfo->fWireless = ioctl(iSocket, SIOCGIWNAME, &WRq) >= 0;
+        pInfo->fWireless = false;
+        char sys_dev_path[256];
+        RTStrPrintf(sys_dev_path, sizeof(sys_dev_path), "/sys/class/net/%s/uevent", pszName);
+        FILE *fp = fopen(sys_dev_path, "r");
+        if (fp)
+        {
+            char szBuf[256];
+            if (fscanf(fp, "%255s", szBuf) != -1 && strstr(szBuf, "DEVTYPE=wlan"))
+                pInfo->fWireless = true;
+            fclose(fp);
+        }
+        // WEXT mathod, kept for compatibility in case above fails
+        if (!pInfo->fWireless)
+        {
+            struct iwreq WRq;
+            RT_ZERO(WRq);
+            RTStrCopy(WRq.ifr_name, sizeof(WRq.ifr_name), pszName);
+            pInfo->fWireless = ioctl(iSocket, SIOCGIWNAME, &WRq) >= 0;
+        }
 
         FILE *fp = fopen("/proc/net/if_inet6", "r");
         if (fp)

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
vbox-dev mailing list
vbox-dev@virtualbox.org
https://www.virtualbox.org/mailman/listinfo/vbox-dev

Reply via email to