summaryrefslogtreecommitdiff
path: root/socket.c
AgeCommit message (Collapse)AuthorFilesLines
2017-02-07socket: ignore EADDRINUSE when joining multicast groupTobias Klauser1-6/+16
If an interface is configured with multiple addresses, llmnrd tries to join the LLMNR multicast group for each address instead of once per interface. Ideally llmnrd should track whether the group is already joined but since the kernel tells us that the group is already joined, just omit the error message on EADDRINUSE. This fixes the following error case: $ ip address add 2001:db8:1::/48 dev eth0 $ ./llmnrd -6 Starting llmnrd on port 5355, hostname foobar Added IPv4 address 127.0.0.1 on interface lo Added IPv4 address 10.42.0.42 on interface eth0 Added IPv6 address ::1 on interface lo Added IPv6 address 2001:db8:1:: on interface eth1 Error: Failed to join IPv6 multicast group on interface eth1: Address already in use Added IPv6 address fe80::xxxx:xxxx:xxxx:xxxx on interface eth0 Reference: #21 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-08-17llmnrd: Allow to bind to a specific network interfaceTobias Klauser1-2/+25
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-3/+5
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-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>
2015-04-08socket: Remove unused constantTobias Klauser1-1/+0
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-18llmnrd: Add IPv6 supportTobias Klauser1-8/+15
Closes #5 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-18socket: Add functions for multicast group join/leave and IPv6 socket creationTobias Klauser1-9/+83
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-18socket: Don't unnecessarily disable IP_MULTICAST_LOOPTobias Klauser1-6/+0
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-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/+119