summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-09-12Fix misaligned memory accessMichael Evertz2-4/+6
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.
2016-08-29llmnrd: Don't send empty AAAA responseTobias Klauser1-1/+8
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>
2016-08-17llmnrd: Allow to bind to a specific network interfaceTobias Klauser7-14/+55
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>
2016-08-16llmnrd: Don't enumerate and store IPv6 addresses if IPv6 is disabledTobias Klauser5-13/+21
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>
2016-08-03llmnrd v0.1v0.1Tobias Klauser1-2/+2
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-08-03llmnr-query: Prevent read buffer overflow in response parsingTobias Klauser1-2/+6
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>
2016-08-02llmnrd: Use MAXHOSTNAMELEN for hostname buffer and zero-terminate stringTobias Klauser1-3/+4
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>
2016-08-02llmnrd: Increase select() timeoutTobias Klauser1-2/+2
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>
2016-08-02Add simple systemd service fileTobias Klauser1-0/+11
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>
2016-08-02llmnrd: Update copyrightTobias Klauser1-2/+2
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-08-02llmnr-query: Allow to set LLMNR transaction idTobias Klauser1-3/+8
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>
2016-08-02llmnr-packet: Correct LLMNR RFC numberTobias Klauser1-4/+4
Fix typo in RFC number, make writing of "RFC NNNN" consistent. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-08-02llmnr-query: Make query type ANY the defaultSchimmelreiter1-2/+2
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-08-02llmnr-query: Set TTL values as suggested in RFC 4795, section 2.5Tobias Klauser1-2/+27
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>
2016-08-02socket: Set TTL values as suggested in RFC 4795, section 2.5Tobias Klauser1-1/+24
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>
2016-04-29iface: Close rtnl socket if address enumeration failsTobias Klauser1-2/+2
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>
2016-04-29iface: Fix memory leak in error caseTobias Klauser1-0/+3
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>
2016-04-29iface: Use getnameinfo() to get address from struct sockaddr_storageTobias Klauser1-2/+5
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>
2016-04-29llmnrd: Use SA_RESTART for installed signal handlersTobias Klauser1-0/+1
Make certain syscalls restartable after signal handler. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-29llmnrd: Add missing break in switchTobias Klauser1-0/+1
Discovered by the Coverity scanner CID 99693. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-28COPYING: Add verbatim copy of GPLv2Tobias Klauser1-0/+339
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-28build: travis: Set up Coverity scanTobias Klauser1-0/+14
Set up Travis CI integration for Coverity scan. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-01-26build: Fix install targets for use with DESTDIRTobias Klauser1-2/+2
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-07-28llmnr-query: Consistently name variables containing number of msecsTobias Klauser1-7/+7
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-07-01llmnr-query: Allow to specifiy query timeout on command lineTobias Klauser1-5/+10
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-04-08socket: Remove unused constantTobias Klauser1-1/+0
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-04-08util: Add attribute warn_unused_result to allocation functionsTobias Klauser2-4/+5
Add the warn_unused_result GCC function attribute to all allocation functions in xmalloc. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-20iface: Proper types for arguments to iface_rtnl_enumerate()Tobias Klauser1-1/+1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-19llmnrd: Fix address family type in event callbackTobias Klauser2-2/+4
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-19llmnr-query: Inform about empty responsesTobias Klauser1-0/+5
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-19iface: Correctly compare addresses, otherwise they're never actually deletedTobias Klauser1-37/+69
This also fixes a double free() and other memory corruption errors on interface delete. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-19iface: Correct error messageTobias Klauser1-1/+1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-18llmnrd: Add IPv6 supportTobias Klauser5-55/+121
Closes #5 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-18socket: Add functions for multicast group join/leave and IPv6 socket creationTobias Klauser2-10/+89
Add functions missed in previous commit, 069060cad6d9 ("llmnrd: Join IP multicast group on each new interface"). Also add socket_open_ipv6() to creat IPv6 sockets. Not used yet. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-18llmnrd: Join IP multicast group on each new interfaceTobias Klauser5-27/+70
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-18llmnr-query: Add option to send query over different interfaceTobias Klauser1-11/+44
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-18llmnrd: Fix usageTobias Klauser1-5/+5
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-18socket: Don't unnecessarily disable IP_MULTICAST_LOOPTobias Klauser1-6/+0
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-18llmnrd: Support daemonizationTobias Klauser1-1/+5
No logging to syslog or dropping of privileges etc yet. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-18socket: Use inet_pton instead of inet_addrTobias Klauser1-1/+1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-18build: Check if called from git repo when generating GIT_VERSIONTobias Klauser3-5/+10
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-18llmnrd, llmnr-query: Add git id to version outputTobias Klauser3-5/+8
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-18llmnr-query: Support sending queries using IPv6Tobias Klauser1-13/+35
Partially resolves #5 (IPv6 support) Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-17all: Add version informationTobias Klauser3-9/+37
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-17llmnrd: Implement message compression for nameTobias Klauser1-7/+8
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-17llmnr-query: Skip length byte when getting previous name in compressed name ↵Tobias Klauser1-1/+1
extraction Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-17llmnrd: Rename main.c to llmnrd.cTobias Klauser2-2/+2
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-17llmnr-query: Add simple LLMNR query programTobias Klauser4-12/+279
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-17compiler: Protect against redefinition of offsetof()Tobias Klauser1-4/+6
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-17main: Add options to usage messageTobias Klauser1-2/+9
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>