mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Isaac Dunham <idunham@lavabit.com>
To: musl@lists.openwall.com
Subject: compatability: dnsmasq--missing headers, capset
Date: Thu, 10 May 2012 13:06:54 -0700	[thread overview]
Message-ID: <20120510130654.363e32f2@newbook> (raw)

[-- Attachment #1: Type: text/plain, Size: 1986 bytes --]

Hello, 
I heard (on the Puppy Linux forums) that dnsmasq
(http://www.thekelleys.org.uk/dnsmasq/) doesn't build with musl, so I
checked.
dnsmasq defines _GNU_SOURCE.
1. Needs netinet/in_systm.h
Attached is one based on the version he provided.
2. Needs 
#define _PATH_LOG "/dev/log"
This should be defined (at least for _GNU_SOURCE) when including
syslog.h (glibc has it elsewhere but errors if it is directly included)
Attached is a patch that will define it at the proper time (I also
moved vsyslog out of the SYSLOG_NAMES guard, since glibc doesn't
require that, and added _BSD_SOURCE because I was changing exactly
that area anyhow)
3. After fixing the above, I get:
musl-gcc  -o dnsmasq cache.o rfc1035.o util.o option.o
forward.o network.o dnsmasq.o dhcp.o lease.o rfc2131.o netlink.o dbus.o
bpf.o helper.o tftp.o log.o conntrack.o dhcp6.o rfc3315.o dhcp-common.o
outpacket.o radv.o slaac.o 
util.o: In function `sockaddr_isequal':
util.c:(.text+0x8cd): undefined reference to `IN6_ARE_ADDR_EQUAL'
network.o: In function `iface_check': 
network.c:(.text+0xfc9): undefined reference to `IN6_ARE_ADDR_EQUAL'
dnsmasq.o: In function `main': 
dnsmasq.c:(.text+0x1285): undefined reference to `capget'
dnsmasq.c:(.text+0x15d6): undefined reference to `capset'
dnsmasq.c:(.text+0x1666): undefined reference to `capset' 
slaac.o: In function `slaac_ping_reply': 
slaac.c:(.text+0x109): undefined reference to `IN6_ARE_ADDR_EQUAL'
slaac.o: In function `slaac_add_addrs': 
slaac.c:(.text+0x4a3): undefined reference to `IN6_ARE_ADDR_EQUAL'
collect2: ld returned 1 exit status 
make[1]: *** [dnsmasq] Error 1
make[1]: Leaving directory `/home/ibid/misc/src/musl/dnsmasq/src' 
make: *** [all] Error 2

So dnsmasq needs capset & capget (which provide support for Linux
capabilities).
IN6_ARE_ADDR_EQUAL is a long macro from netinet/in.h in glibc.

Reportedly it works if you patch them out, but that's an approach I'd
avoid if at all possible because of the security implications.

Isaac Dunham

[-- Attachment #2: in_systm.h --]
[-- Type: text/x-chdr, Size: 164 bytes --]

#ifndef _NETINET_IN_SYSTM_H
#define _NETINET_IN_SYSTM_H 1
#include <sys/types.h>
typedef uint16_t n_short;
typedef uint32_t n_long;
typedef uint32_t n_time;
#endif

[-- Attachment #3: syslog.diff --]
[-- Type: text/x-patch, Size: 776 bytes --]

--- /opt/musl/include/syslog.h	2012-04-19 21:14:04.318606875 -0700
+++ /opt/musl/pincl/syslog.h	2012-05-10 12:48:02.155276564 -0700
@@ -59,7 +59,11 @@
 int setlogmask (int);
 void syslog (int, const char *, ...);
 
-#if defined(_GNU_SOURCE) && defined(SYSLOG_NAMES)
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define _PATH_LOG "/dev/log"
+void vsyslog (int, const char *, va_list);
+
+#ifdef SYSLOG_NAMES
 #define __NEED_va_list
 #include <bits/alltypes.h>
 #define	INTERNAL_NOPRI 0x10
@@ -89,7 +93,7 @@
 	{ "local2", LOG_LOCAL2 }, { "local3", LOG_LOCAL3 }, \
 	{ "local4", LOG_LOCAL4 }, { "local5", LOG_LOCAL5 }, \
 	{ "local6", LOG_LOCAL6 }, { "local7", LOG_LOCAL7 }, { NULL, -1 } })
-void vsyslog (int, const char *, va_list);
+#endif
 #endif
 
 #ifdef __cplusplus

             reply	other threads:[~2012-05-10 20:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10 20:06 Isaac Dunham [this message]
2012-05-10 20:18 ` Kurt H Maier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120510130654.363e32f2@newbook \
    --to=idunham@lavabit.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).