Re: Adjust dlls/iphlpapi/ipstats.c to FreeBSD 8
On Thu, 1 Jan 2009, Gerald Pfeifer wrote: [...]
ChangeLog: Only use RTF_LLINFO if #defined, fixing FreeBSD 8 after the arp-v2 rewrite. [...] #if defined(HAVE_SYS_SYSCTL_H) && defined(NET_RT_DUMP) - int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, RTF_LLINFO}; + int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, +#ifdef RTF_LLINFO + RTF_LLINFO +#else + 0 +#endif + };
Is there a way to do it so the same binary can run and work on FreeBSD 7.x and 8.0? -- Francois Gouget <fgouget(a)free.fr> http://fgouget.free.fr/ "Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it ;)" -- Linus Torvalds
Am Freitag, den 09.01.2009, 08:20 +0100 schrieb Francois Gouget:
On Thu, 1 Jan 2009, Gerald Pfeifer wrote: [...]
ChangeLog: Only use RTF_LLINFO if #defined, fixing FreeBSD 8 after the arp-v2 rewrite. [...] #if defined(HAVE_SYS_SYSCTL_H) && defined(NET_RT_DUMP) - int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, RTF_LLINFO}; + int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, +#ifdef RTF_LLINFO + RTF_LLINFO +#else + 0 +#endif + };
Is there a way to do it so the same binary can run and work on FreeBSD 7.x and 8.0?
#if defined(HAVE_SYS_SYSCTL_H) && defined(NET_RT_DUMP) +#ifndef RTF_LLINFO +#define RTF_LLINFO 0 +#endif int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, RTF_LLINFO}; should do. (Even better: Put this define to the top of the file [but still #if-protected], and just use RTF_LLINFO later on) Regards, Michael Karcher
On Fri, 9 Jan 2009, Francois Gouget wrote:
On Thu, 1 Jan 2009, Gerald Pfeifer wrote: [...]
ChangeLog: Only use RTF_LLINFO if #defined, fixing FreeBSD 8 after the arp-v2 rewrite. [...] #if defined(HAVE_SYS_SYSCTL_H) && defined(NET_RT_DUMP) - int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, RTF_LLINFO}; + int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, +#ifdef RTF_LLINFO + RTF_LLINFO +#else + 0 +#endif + }; Is there a way to do it so the same binary can run and work on FreeBSD 7.x and 8.0?
I am not aware of one. Tijl and me actually argued to get the original behavior back (for this and other reasons like source compatbility) but failed. I just pushed again. (Well, one could try run-time checks instead of compile-time checks, and then initialize mib[5] accordingly, but I have a hunch Alexandre wouldn't like that very much...) Gerald
On Fri, 9 Jan 2009, Gerald Pfeifer wrote:
I am not aware of one. Tijl and me actually argued to get the original behavior back (for this and other reasons like source compatbility) but failed. I just pushed again.
FreeBSD upstream is not going to change, from what I can tell, so we really need something like the following patch. If you guys prefer something like #ifndef RTF_LLINFO #define RTF_LLINFO 0 #endif instead, I can also create a patch for that! Gerald ======== original message ======== From: Gerald Pfeifer <gerald(a)pfeifer.com> To: wine-patches(a)winehq.org Date: Thu, 1 Jan 2009 20:32:51 Subject: Adjust dlls/iphlpapi/ipstats.c to FreeBSD 8 FreeBSD 8 is seeing a major rewrite of the arp code which removed the RTF_LLINFO flag and thus broke Wine, among others, see http://lists.freebsd.org/pipermail/freebsd-net/2008-December/020464.html and the follow-ups for details. The patch below is the solution for Wine (and other ports) agreed upon by the respective FreeBSD core maintainers; a variant thereof has been explicitly reviewed and approved. Gerald ChangeLog: Only use RTF_LLINFO if #defined, fixing FreeBSD 8 after the arp-v2 rewrite. Index: dlls/iphlpapi/ipstats.c =================================================================== RCS file: /home/wine/wine/dlls/iphlpapi/ipstats.c,v retrieving revision 1.37 diff -u -3 -p -r1.37 ipstats.c --- dlls/iphlpapi/ipstats.c 30 Jun 2008 13:28:42 -0000 1.37 +++ dlls/iphlpapi/ipstats.c 1 Jan 2009 19:24:21 -0000 @@ -1250,7 +1250,13 @@ DWORD getRouteTable(PMIB_IPFORWARDTABLE DWORD getNumArpEntries(void) { #if defined(HAVE_SYS_SYSCTL_H) && defined(NET_RT_DUMP) - int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, RTF_LLINFO}; + int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, +#ifdef RTF_LLINFO + RTF_LLINFO +#else + 0 +#endif + }; #define MIB_LEN (sizeof(mib) / sizeof(mib[0])) DWORD arpEntries = 0; size_t needed; @@ -1308,7 +1314,13 @@ DWORD getArpTable(PMIB_IPNETTABLE *ppIpN #if defined(HAVE_SYS_SYSCTL_H) && defined(NET_RT_DUMP) if (table) { - int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, RTF_LLINFO}; + int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, +#ifdef RTF_LLINFO + RTF_LLINFO +#else + 0 +#endif + }; #define MIB_LEN (sizeof(mib) / sizeof(mib[0])) size_t needed; char *buf, *lim, *next;
participants (3)
-
Francois Gouget -
Gerald Pfeifer -
Michael Karcher