Commit Graph

168 Commits

Author SHA1 Message Date
Roy Marples
b837f45f78 Make eloop entirely independant from dhcpcd. 2015-05-12 17:24:29 +00:00
Roy Marples
2e522a24bc Give up on _BSD_SOURCE and use _GNU_SOURCE for Linux.
This is requires for newer Linux headers as there is no easy way to get at the
in6_pktinfo structure, so we have to fallback to the glibc variant which
requires _GNU_SOURCE being set.
This does have the advantage of no longer sprinkling _GNU_SOURCE around and
no longer having to cast ipi.ipi_ifindex but may break compile on older Linux.
2015-04-20 09:02:58 +00:00
Roy Marples
250966db52 Fix ./configure --debug=yes 2015-03-18 18:31:07 +00:00
Roy Marples
069e2f284f syslogd(8) may not always be running before dhcpcd so any startup errors are
lost. Also, it's output with LOG_PERROR is ugly and LOG_PERROR isn't portable.

logger is a new function to solve the above which is identical to syslog(3)
but takes a dhcpcd_ctx for context so it functions in the RTEMS OS.
When writing to stdout/stderr or a given logfile, logger will convert %m
into the error string based on errno, just like syslog(3) does.
If your libc supports %m via printf, then define HAVE_PRINTF_M to remove
a fair chunk of code. There is no way of working out if your libc supports
this, especially in cross-compiled environment.
If the logfile is rotated, send dhcpcd a SIGUSR2 and the logfile will be
re-opened.

This does add about an exta 4K on 64-bit platforms so for size constraints
this can be compiled out by defining USE_LOGFILE to 0.
2015-03-17 23:46:38 +00:00
Roy Marples
4777e9841b Improve debug flags. 2015-03-14 11:04:36 +00:00
Roy Marples
f433c2f6cf Turn on Large File Support for Linux systems.
Fixes [6ae09d0514] thanks to Mike Frysinger.
2015-03-12 15:57:42 +00:00
Roy Marples
940aaf18e7 Fix compile on FreeBSD 2015-03-04 17:28:27 +00:00
Roy Marples
804d1ead10 Test for kqueue1 or set O_CLOEXEC on the kqueue fd. 2015-03-04 16:40:21 +00:00
Roy Marples
8c3d363e8b Support kqueue(2). 2015-03-04 15:47:04 +00:00
Roy Marples
8dc5723bce Support epoll(7) 2015-03-04 11:51:55 +00:00
Roy Marples
f94b4eab06 Use strtoi(3) and strtou(3) from NetBSD-8 instead of the harder to use
strtol(3) calls.
Add shims around strtoimax(3) and strtoumax(3) when these functions
are not available.
2015-01-31 01:02:07 +00:00
Roy Marples
2179b718aa OpenBSD fixed their posix_spawn(3) implementation in 5.7 2015-01-05 14:12:23 +00:00
Roy Marples
2360efb8cf Add qnx* to OS detection so we can pass the __EXT define and stay using
--cstd=c99.
2014-12-23 09:46:02 +00:00
Roy Marples
71d20c8a12 Fix compile on QNX. Thanks to Will Miles. 2014-12-20 14:11:38 +00:00
Roy Marples
c6c54d9e96 Include linux/rtnetlink.h in config.h rather than each file that needs it.
Detect RTM_NEWNEIGH rather than force a define based on __linux__.
2014-12-10 22:42:12 +00:00
Roy Marples
cf2469a152 If we don't include sys/queue.h directly the clang analyzer complains
about using freed memory.
That seems to be a workaround for this upstream bug:
http://llvm.org/bugs/show_bug.cgi?id=18222
2014-11-11 10:33:28 +00:00
Roy Marples
e3159b9cc0 Align config.h contents better 2014-11-11 10:02:17 +00:00
Roy Marples
bc09d81de2 TAILQ is now inlcuded via config.h either via sys/queue.h or compat/queue.h.
This allows dhcpcd to compile on systems that do not even supply sys/queue.h,
such as the musl C library.

Thanks to Juan RP.
2014-11-10 16:56:32 +00:00
Roy Marples
68c8a3cf6f Remove RCSIDs from dhcpcd, they belong in the upstream project only. 2014-11-07 20:56:47 +00:00
Roy Marples
91692ea1c7 Improve FreeBSD support by using the actual AF_LINK address. 2014-10-10 20:35:13 +00:00
Roy Marples
8f008ca7f5 Remove vis based encoding - instead expand the DHCP option encoding to a
natural string based on content except as noted:
  *  domain (RFC3397)/dname (string) is strict domain name allowance
     (ie, [alnum] with _- (but not at the start or end))
  *  string is now printable ascii (1-127) until invalid
  *  ascii is all ascii (1-127) until invalid
  *  raw is all chars (1-255) until NUL
  *  binhex is a hex representation of the option including embedded NULs
  *  ssid is still escpaed octal because it's expected to be human readable
     AND can technically be all NUL
  *  everything else has strict option -> value encoding

This removes all shell escaped encoding - dhcpcd will assume that IF the
--script option is a shell, it will quote variables correctly.
The stock dhcpcd-run-hooks does.

dhcpcd -V now prints how the variables will be decoded.

Changed some options in dhcpcd-definitions.conf to more sensible defaults.
2014-10-01 18:32:03 +00:00
Roy Marples
5b0c4877d5 We only supply svis(3) so rename the files as such. 2014-09-27 00:12:21 +00:00
Roy Marples
c7d3d69b81 Clean up configure _vis files 2014-09-26 23:20:35 +00:00
Roy Marples
4f2199843d Sanitise the following characters using svis(3) with VIS_CTYLE and VIS_OCTAL:
| ^ & ; < > ( ) $ ` \ " ' <tab> <newline>
This allows a non buggy unvis(1) to decode it 100% and stays compatible with
how dhcpcd used to handle encoding on most platforms.
For systems that supply svis(3) there is a code reduction, for systems that
do not, a slight code increase.

This change mitigates systems affected by bash CVE-2014-6271 and CVE-2014-7169.
2014-09-26 20:07:07 +00:00
Roy Marples
be111d4b71 Fix configure errors without pkg-config installed. 2014-09-22 13:57:58 +00:00
Roy Marples
b7e48083a6 Only hunt for a cross compiler if build != host. 2014-09-21 20:09:25 +00:00
Roy Marples
e5166f23ce Revert faulty patch 2014-09-21 20:05:20 +00:00
Roy Marples
f1d3f20c9c Only hunt for a cross compiler if build != host. 2014-09-21 20:01:53 +00:00
Roy Marples
782564885d Redirect fd 3 to config.log.
Redirect all CC errors to fd 3.
2014-09-21 11:39:02 +00:00
Roy Marples
1304ce8127 Check that CC works after applying all our CPPFLAGS and CFLAGS as one
of them might stop CC from working.
2014-09-21 10:28:54 +00:00
Roy Marples
ba17076058 Add _DEFAULT_SOURCE #define to linux builds so glibc-2.20 stops bitching about _BSD_SOURCE 2014-09-18 09:06:51 +00:00
Roy Marples
f7d83c0dfc It's possible to configure a Linux kernel with nl80211 where the
SSID won't be reported, but is available via WEXT.
This is very silly, but dhcpcd still needs to work.
Thus enable both protocols and use nl80211 if WEXT fails.
2014-09-15 23:05:20 +00:00
Roy Marples
387fde080c Fix nl80211.h test 2014-09-10 08:40:06 +00:00
Roy Marples
ffb70eff16 Fix arc4random_uniform test.
Rename if-linux-wireless.c to if-linux-wext.c to better reflect it's purpose.
2014-09-10 02:22:18 +00:00
Roy Marples
67ed6c5fdc Use the nl80211 interface on Linux to get the wireless SSID.
If this is not found in the system headers, fall back to assuming WEXT.
This has been done because the WEXT module has been marked as deprecated
for a while now and I'm getting bored of people asking me why their
wireless wasn't working. Bloated dhcpcd by another 600 bytes as a result.
2014-09-10 01:46:58 +00:00
Roy Marples
01890c79df Split arc4random_uniform into it's own compat function and add
it's proper copyright.
Add a new test for it to configure so that we can use the
uclibc arc4random function and our compat arc4random_uniform function.
2014-09-07 17:24:07 +00:00
Roy Marples
5c9c7e301b Fix the import to work on Linux as well. 2014-07-30 09:46:33 +00:00
Roy Marples
13b53e5ac4 Fix fallback test 2014-07-05 15:40:01 +00:00
Roy Marples
775739c502 Revert [26bc10be24] as some compile can't output to /dev/null. 2014-06-30 09:44:07 +00:00
Roy Marples
5e8e0b721e Simplfy configure CC test. Thanks to Thomas De Schampheleire. 2014-06-22 10:06:53 +00:00
Roy Marples
67dcaaa4dd Test that the CC command works and makes an exectuable rather
than using the type command.
Thanks to Thomas De Schampheleire.
2014-06-21 15:46:31 +00:00
Roy Marples
f3bc4056ea Allow the use of libmd in static or /usr builds 2014-06-05 17:42:21 +00:00
Roy Marples
9fe278633a Remove test files 2014-06-05 14:21:27 +00:00
Roy Marples
626462a5d0 Fix be64enc test on NetBSD. 2014-06-05 13:56:16 +00:00
Roy Marples
21350faddd Fix configure 2014-06-05 13:54:38 +00:00
Roy Marples
6c9c458324 be32enc is missing on OpenBSD, so provide a configure test.
Fix compile on OpenBSD.
2014-06-05 13:53:20 +00:00
Roy Marples
5da48f00a7 Fix compile on Linux 2014-06-02 17:10:13 +00:00
Roy Marples
45a33d2f3e Use SHA256Init on OpenBSD .... grrr 2014-06-02 16:31:37 +00:00
Roy Marples
153c1a11af Fix compile on FreeBSD 2014-06-02 15:00:24 +00:00
Roy Marples
3ed12ab824 Implement Stable Private Addresses for SLAAC as per RFC7217.
Add a SHA256 implementation by Collin Percival if one in libc/libmd not found.
2014-06-02 14:48:33 +00:00