summaryrefslogtreecommitdiff
path: root/llmnr.c
AgeCommit message (Collapse)AuthorFilesLines
2017-01-10llmnrd: Correct IPv6 check in llmnr_respond()Tobias Klauser1-1/+1
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>
2017-01-10llmnrd: merge rtnl interface event loop into main select() loopsTobias Klauser1-83/+6
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>
2017-01-07llmnrd: Don't busy wait in receive loopTobias Klauser1-6/+2
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>
2016-09-12Fix misaligned memory accessMichael Evertz1-2/+4
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 Klauser1-3/+5
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-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>
2015-02-19llmnrd: Fix address family type in event callbackTobias Klauser1-1/+2
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-18llmnrd: Add IPv6 supportTobias Klauser1-42/+88
Closes #5 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-18llmnrd: Join IP multicast group on each new interfaceTobias Klauser1-17/+38
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-17all: Remove unnecessary log messagesTobias Klauser1-43/+15
These could be used to DoS llmnrd, just silently discard invalid packets. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-17llmnr: Report proper address type in response for qtype ANYTobias Klauser1-1/+4
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-16llmnr: Remove some unnecessary log messagesTobias Klauser1-5/+0
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-16llmnr: Fix response packet byte order and name sizeTobias Klauser1-5/+5
We need to return type, class, ttl and rdlength in network byte order. Also we need to pkt_put() 2 bytes in addition to the hostname length (length and NULL byte). Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-16llmnr: Unindent llmnr_respond()Tobias Klauser1-87/+89
Exit out early if the query class is not LLMNR_QCLASS_IN. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-16pkt: Implement growing of packet on pkt_putTobias Klauser1-1/+1
Also get rid of the unnecessary head member of struct pkt. For now we only append data at the end of a packet. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-16all: Remove trailing whitespacesTobias Klauser1-5/+5
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-06Initial import, still work in progressTobias Klauser1-0/+293