summaryrefslogtreecommitdiff
path: root/iface.c
AgeCommit message (Collapse)AuthorFilesLines
2017-02-08iface: Merge duplicate codeTobias Klauser1-19/+9
Call iface_recv() from iface_rtnl_enumerate() instead of open-coding it. Reorder code a bit to avoid duplication. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-01-10llmnrd: merge rtnl interface event loop into main select() loopsTobias Klauser1-76/+18
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>
2016-08-17llmnrd: Allow to bind to a specific network interfaceTobias Klauser1-1/+11
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 Klauser1-5/+10
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-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>
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-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: Join IP multicast group on each new interfaceTobias Klauser1-4/+14
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-17all: Remove unnecessary log messagesTobias Klauser1-2/+0
These could be used to DoS llmnrd, just silently discard invalid packets. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-16all: Remove trailing whitespacesTobias Klauser1-1/+1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-06Initial import, still work in progressTobias Klauser1-0/+355