NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

if_type and sdl_type definitions in net/if_dl.h cause in WINE building



NetBSD (at least 9.2) defines:
-- net/if.h --------------------------------------------------------------------
#define if_type   if_data.ifi_type
--------------------------------------------------------------------------------
and
-- net/if_dl.h -----------------------------------------------------------------
#define sdl_type  sdl_addr.dl_type
--------------------------------------------------------------------------------

In the source code of WINE 7.0, we can find:
-- dlls/nsiproxy.sys/ndis.c:90 -------------------------------------------------
struct if_entry
{
    struct list entry;
    GUID if_guid;
    NET_LUID if_luid;
    WCHAR *if_name;
    char if_unix_name[IFNAMSIZ];
    IF_PHYSICAL_ADDRESS if_phys_addr;
    DWORD if_index;
    DWORD if_type;
};
--------------------------------------------------------------------------------
and
-- dlls/nsiproxy.sys/ndis.c:187 ------------------------------------------------
    static const struct type_lookup
    {
        u_char sdl_type;
        IFTYPE mib_type;
    } types[] =
    {
        { IFT_ETHER, MIB_IF_TYPE_ETHERNET },
        { IFT_FDDI, MIB_IF_TYPE_FDDI },
        { IFT_ISO88024, MIB_IF_TYPE_TOKENRING },
        { IFT_ISO88025, MIB_IF_TYPE_TOKENRING },
        { IFT_PPP, MIB_IF_TYPE_PPP },
        { IFT_SLIP, MIB_IF_TYPE_SLIP },
        { IFT_LOOP, MIB_IF_TYPE_LOOPBACK }
    };
--------------------------------------------------------------------------------

There are compilation errors with if_type and sdl_type. I fix them with the following patch. But I would like to ask if we could consider a better approach to fix them before submitting this patch upstream.
-- patches/patch-dlls_nsiproxy.sys_ndis.c --------------------------------------
$NetBSD$

Fix errors due to {if,sdl}_type definition in net/if_dl.h.

--- dlls/nsiproxy.sys/ndis.c.orig 2022-01-21 20:02:16.886853181 +0000
+++ dlls/nsiproxy.sys/ndis.c
@@ -32,6 +32,8 @@
#ifdef HAVE_NET_IF_H
 #include <net/if.h>
+#if defined(__NetBSD__)
+#undef if_type
 #endif
#ifdef HAVE_NET_IF_ARP_H
@@ -56,6 +58,9 @@
#ifdef HAVE_NET_IF_DL_H
 #include <net/if_dl.h>
+#if defined(__NetBSD__)
+#undef sdl_type
+#endif
 #endif
#ifdef HAVE_NET_IF_TYPES_H
@@ -225,7 +230,11 @@ static NTSTATUS if_get_physical( const c
             continue;
for (i = 0; i < ARRAY_SIZE(types); i++)
+#if defined(__NetBSD__)
+            if (sdl->sdl_addr.dl_type == types[i].sdl_type)
+#else
             if (sdl->sdl_type == types[i].sdl_type)
+#endif
             {
                 *type = types[i].mib_type;
                 break;
--------------------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index