[Dnsmasq-discuss] Problem compiling 2.51 on Solaris 2009.06

Lee Essen lee.essen at me.com
Sat Nov 21 14:16:37 GMT 2009

On Saturday, November 21, 2009, at 12:49PM, "Simon Kelley" <simon at thekelleys.org.uk> wrote:
>Lee Essen wrote:
>> On Saturday, November 21, 2009, at 09:30AM, "Simon Kelley" <simon at thekelleys.org.uk> wrote:
>>> Lee Essen wrote:
>>>> Hi,
>>>> I've been a dnsmasq user for quite a few years on both Solaris and
>>>> Linux, but it's been a while since I've tried to build on Solaris.
>>>> I've just tried to build 2.51 on the latest Solaris build and there
>>>> seems to be a number of really fundamental issues.
>>>> I notice Solaris mentioned quite a few times in the changelog so
>>>> there seems to be a continued effort around this, and I certainly
>>>> don't remember any issues in the past, however unless I'm doing
>>>> something fundamentally wrong (which is a distinct possibility) I
>>>> think a few tweaks are needed...
>>>> I have attached a patch that covers all the changes I needed to make,
>>>> although I must confess that whilst it's now compiles I haven't
>>>> tested it yet.
>>>> Three main problems...
>>>> 1.  config.h is included after sys/socket.h -- this means that
>>>> _XPG4_2 isn't defined yet and therefore all of the CMSG_* defines get
>>>> missed (CMSG_SPACE for example.)
>>>> 2. struct ifreq seems to have become struct lifrect (at least if you
>>>> need ifr_mtu), so this impacts a number of references in two or three
>>>> files.
>>>> 3. LOG_PRI doesn't seem to exist at all.
>>>> I'm not suggesting my patch is the right solution, it's probably far
>>>> from it, but it's enough to highlight the issues.
>>>> If I'm missed something obvious then please let me know, otherwise
>>>> I'll continue to test and see if I can come up with a less disruptive
>>>> way of incorporating these fixes.
>>> Many thanks for this.
>>> By some weird coincidence, I was working on this yesterday too. I found 
>>> and fixed your problems 1 and 3 but didn't get bitten by 2. Does that 
>>> turn up as a compile-time problem, or just run-time?
>>> Anyway, the results of my efforts are at
>>> http://www.thekelleys.org.uk/dnsmasq/test-releases/dnsmasq-2.52test7.tar.gz
>>> which compile, but have not been functionally tested yet.
>>> Please could you check that and let me know if it's OK, or if I need to 
>>> work-in your lifr stuff?
>>> Cheers,
>>> Simon.
>> Simon,
>> I still see the same problem with the ifr bits - this is on the latest Solaris release ... it looks like it's just the ifr_mtu field that's the problem, according to the if.h file the struct ifreq is kept for compatibility but there is no ifr_mtu field as part of the union.
>> I've attached if.h for your info, just in case you have an older version.
>> make[1]: Entering directory `/site/internal/build/dnsmasq-2.52test7/src'
>> cc -Wall -W -O2     -c cache.c
>> cc -Wall -W -O2     -c rfc1035.c
>> cc -Wall -W -O2     -c util.c
>> cc -Wall -W -O2     -c option.c
>> cc -Wall -W -O2     -c forward.c
>> cc -Wall -W -O2     -c network.c
>> network.c: In function `iface_allowed':
>> network.c:149: error: structure has no member named `ifr_mtu'
>> network.c: At top level:
>> network.c:555: warning: unused parameter 'intname'
>> network.c:39: warning: unused parameter 'fd'
>> make[1]: *** [network.o] Error 1
>> make[1]: Leaving directory `/site/internal/build/dnsmasq-2.52test7/src'
>> make: *** [dnsmasq] Error 2
>> Regards,
>> Lee.
>OK, it looks like that's a bug in Solaris 2009.06, since fixed in the
>svn_127 version I was using. Rather than bending lots of code out of
>shape to fix a transient problem, the following hack should work:
>--- src/dnsmasq.h.old	2009-11-21 12:44:49.000000000 +0000
>+++ src/dnsmasq.h	2009-11-21 12:48:46.000000000 +0000
>@@ -72,6 +72,10 @@
> #include <sys/un.h>
> #include <limits.h>
> #include <net/if.h>
>+#if defined(HAVE_SOLARIS_NETWORK) && !defined(ifr_mtu)
>+/* Some solaris net/if./h omit this. */
>+#  define ifr_mtu  ifr_ifru.ifru_metric
> #include <unistd.h>
> #include <stdio.h>
> #include <string.h>
>Please could you verify that?


Yes this seems to work fine and is much nicer. 

I'm just puting together a quick script that will create a new Solaris ipkg with the smf stuff in it, any interest in including this in the contrib section?



More information about the Dnsmasq-discuss mailing list