[Dnsmasq-discuss] Announce: dnsmasq-2.73rc1
Simon Kelley
simon at thekelleys.org.uk
Fri Mar 20 20:13:03 GMT 2015
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hmm, from the BUGS section of the manpage for realpath:
The POSIX.1-2001 standard version of this function is broken by design,
since it is impossible to determine a suitable size for the output buf?
fer, resolved_path. According to POSIX.1-2001 a buffer of size
PATH_MAX suffices, but PATH_MAX need not be a defined constant, and may
have to be obtained using pathconf(3). And asking pathconf(3) does not
really help, since, on the one hand POSIX warns that the result of
pathconf(3) may be huge and unsuitable for mallocing memory, and on the
other hand pathconf(3) may return -1 to signify that PATH_MAX is not
bounded. The resolved_path == NULL feature, not standardized in
POSIX.1-2001, but standardized in POSIX.1-2008, allows this design
problem to be avoided.
It looks like your C library has the impossible-to-use-safely
POSIX-2001 version, and changing the dnsmasq code to accomodate that
cannot be safe. I think the best solution to this is to recommend
building dnsmasq with
make COPTS=-DNO_INOTIFY
in this case. It will still work fine using the polling method which
has worked for 15 years.
Cheers,
Simon.
On 20/03/15 12:49, Alfonso Ranieri wrote:
> Il 20/03/2015 00:42, Simon Kelley ha scritto:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>
>> I want to start the release-process towards 2.73. There's a whole
>> heap of good stuff since 2.72, and good reasons to get it out
>> there before proceeding further with stuff that's in progress.
>>
>> Please test if you can, code is available at
>
> I, am using dnsmasq in a small router firmware for some Netgear
> router modem.
>
> To make the new inotify system dnsmasq compile under my toolchain
> (which is gcc 4.2.2, kernel 2.6.30, uClibc 0.9.29) I had to make
> these changes (expecially realpath() wants the second args to be
> not NULL)
>
> --- src/inotify.c.orig 2015-03-20 13:44:29.000000000 +0100 +++
> src/inotify.c 2015-03-20 13:44:42.000000000 +0100 @@ -19,6
> +19,13 @@
>
> #include <sys/inotify.h>
>
> +#ifndef IN_CLOEXEC +#ifndef O_CLOEXEC +#define O_CLOEXEC 02000000
> +#endif +#define IN_CLOEXEC O_CLOEXEC +#endif + #ifndef
> IN_NONBLOCK # define IN_NONBLOCK O_NONBLOCK #endif @@ -57,7 +64,9
> @@ for (res = daemon->resolv_files; res; res = res->next) { char *d
> = NULL, *path; - if (!(path = realpath(res->name, NULL))) +
> char _b[256]; + + if (!(path = realpath(res->name, _b))) { /*
> realpath will fail if the file doesn't exist, but dnsmasq copes
> with missing files, so fall back
>
> Ciao. Alfonso
>
> _______________________________________________ Dnsmasq-discuss
> mailing list Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iEYEARECAAYFAlUMf08ACgkQKPyGmiibgrd2ewCeL3O1MT4c/wc3Swi12tXH92Yv
q2IAoKFkAfYnay7d2uGQeTe/dlbh29Mm
=vMKQ
-----END PGP SIGNATURE-----
More information about the Dnsmasq-discuss
mailing list