Age | Commit message (Collapse) | Author | Files | Lines |
|
This fixes the following GCC warning:
llmnr-query.c:345:12: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
This fixes the following GCC warning:
util.h:55:2: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Enable some sensible GCC warnings for default build. The list of flags
was based on the flags from the nftables source.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Implement the check whether IPv6 is enabled properly, checking the bool
variable llmnr_ipv6 < 0 doesn't make sense.
Found by the coverity scanner (CID 159830).
Fixes: e9cd5a6826f1 ("llmnrd: merge rtnl interface event loop into main select() loops")
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Instead of spawming a thread for the sole purpose of watching the rtnl
for (presumably) seldom events, just merge the select() for all sockets
together in one single main loop.
This reduces unnecessary complexity and makes llmnrd no longer require
any locking.
It also allows us to handle signals in a thread-safe manner (as there
aren't any ;) and thus the race condition on exit reported in #20
Closes #20
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Distribution build scripts commonly assume the CPPFLAGS, CFLAGS and
LDFLAGS passed via command line or environment to be appended to the
base set of flags defined in the Makefile. Follow this assumption
instead of overriding the already defined values.
Also treat these three variables entriely independently instead of
appending CPPFLAGS to CFLAGS.
Reported-by: @pali
Really-fixes: #17
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Avoid echoing the CC/LD string in verbose mode, just show the plain
commands:
$ make Q=
gcc -W -Wall -DVERSION_STRING=\"v0.2.1\" -DGIT_VERSION=\""(git id v0.2.1-6-gab7cd2fc9043)"\" -O2 -o llmnr.o -c llmnr.c
gcc -W -Wall -DVERSION_STRING=\"v0.2.1\" -DGIT_VERSION=\""(git id v0.2.1-6-gab7cd2fc9043)"\" -O2 -o iface.o -c iface.c
gcc -W -Wall -DVERSION_STRING=\"v0.2.1\" -DGIT_VERSION=\""(git id v0.2.1-6-gab7cd2fc9043)"\" -O2 -o socket.o -c socket.c
gcc -W -Wall -DVERSION_STRING=\"v0.2.1\" -DGIT_VERSION=\""(git id v0.2.1-6-gab7cd2fc9043)"\" -O2 -o util.o -c util.c
gcc -W -Wall -DVERSION_STRING=\"v0.2.1\" -DGIT_VERSION=\""(git id v0.2.1-6-gab7cd2fc9043)"\" -O2 -o llmnrd.o -c llmnrd.c
gcc -o llmnrd llmnr.o iface.o socket.o util.o llmnrd.o -lpthread
gcc -W -Wall -DVERSION_STRING=\"v0.2.1\" -DGIT_VERSION=\""(git id v0.2.1-6-gab7cd2fc9043)"\" -O2 -o llmnr-query.o -c llmnr-query.c
gcc -o llmnr-query util.o llmnr-query.o
Also consider $(Q) for the clean and install targets.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Currently Makefile ignores CPPFLAGS and so any defines passed via
environment/command line ignored. E.g. running
make CPPFLAGS="-D_FORTIFY_SOURCE=2"
does not compile llmnrd with buffer overflow checks.
Fix it by considering CPPFLAGS in the Makefile and appending them to
CFLAGS.
Closes #17
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
There is no need to have a timeout for select(2) to check llmnr_running
periodically. It can just block until a packet is received and will be
interrupted by any terminating signal.
Closes #19
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
FreeBSD defines these in sys/cdefs.h
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Make llmnr-query work on FreeBSD and Darwin by using sendmsg() to send
UDP packets. Using sendto() doesn't seem to work for IPv6 sockets. Also
specify the size of the corresponding sockaddr type, not of
sockaddr_storage.
Tested on FreeBSD 11.0, Mac OS X 10.11.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Also change the description slightly and mention the LLMNR RFC number.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Also add a comment indicating the repurposing of the pkt struct.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Bugfix release to create source packages without debian packaging
information.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add a release target to the Makefile (akin to the one from netsniff-ng)
in order to streamline the release process.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add a small section about basic usage of llmnrd/llmnr-query.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Acknowledge Pali Rohár for feedback and contributions regarding
packaging for Debian.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Ignore dotfiles and debian packaging in exports. The reason for
excluding the debian/ directory is that Debian preferes upstream source
packages to not contain devian packaging info.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add Elazar Leibovich to the list of contributors for #12, #13 and commit
0c6df1b8 ("debian: add debian packaging files").
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
This allows to build a debian package by running debuild, fixes #12.
Signed-off-by: Elazar Leibovich <elazarl@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Convert the README file to markdown syntax so we get the nice rendering
on GitHub.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Mention all people how contributed to the development of llmnrd in one
way or another.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
This changes fixes misaligned memory access. Without the patch I get
several "Misaligend access trap for user program 'llmnrd'" messages on
my platform if the system has odd hostname length.
|
|
Don't send an AAAA response if IPv6 is disabled or if no address of the
requested address family was found for a given interface.
Closes #10
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add a command line option -i/--interface which allows to bind the llmnrd
sockets to a specific interface. If used, requests are only answered on
the specified interface.
Example: llmnrd -i eth0
Closes #9
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Currently IPv6 addresses are always enumerated via RTNL socket and then
stored internally, even if llmnrd was started without the IPv6 command
line option '-6'. Even though no queries on AF_INET6 sockets will be
answered, this behavior might be confusing. Especially due to messages
like:
Added IPv6 address fe80::f0eb:aaff:feb3:ae58 on interface tap0
being logged.
Explicitely disable IPv6 address enumeration on the RTNL socket to fix
this behavior.
Closes #8
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
When accessing the compressed name in a response, verify that the
pointer is within the packet size.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Use MAXHOSTNAMELEN defined in sys/param.h to determine the size of the
hostname buffer to allocate. Also make sure the string is properly
zero-terminated in all cases, as in some cases it might be undefined
whether a truncated string is properly terminated.
Note: Also remove a TODO comment, as watching for hostname changes at
runtime is outside the scope of llmnrd (also, avahi behaves the same).
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
There is no need to have such a short timeout value (200us), increase
it to 50ms in order to reduce CPU load.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add a simple example of a systemd service file as a base for e.g.
distribution service files.
Fixes #3
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Allow to override the transaction id in the LLMNR query header. Default
value is 0. The id will be incremented for consecutive queries (i.e.
count > 1).
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Fix typo in RFC number, make writing of "RFC NNNN" consistent.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Follow commit 64644dde ("socket: Set TTL values as suggested in RFC
4795, section 2.5") and set the TTL of the IP header to 255 for UDP
unicast and multicast packets, as recommended in RFC 4795, section 2.5.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Set the TTL of the IP header to 255 for UDP unicast and multicast
packets, as recommended in RFC 4795, section 2.5.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Fix a resource leak by closing the socket if iface_rtnl_enumerate()
fails.
Discovered by the Coverity scanner CID 99694.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
If add from leaking in case the address was (unexpectedly) not found.
This addresses CID 99695 discovered by the Coverity scanner.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Use getnameinfo() instead of inet_ntop() with weird (and incorrect)
pointer arithmetics to get the numeric address from a struct
sockaddr_storage.
This addresses CID 99692 & 99696 discovered by the Coverity scanner.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Make certain syscalls restartable after signal handler.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Discovered by the Coverity scanner CID 99693.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Set up Travis CI integration for Coverity scan.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|