9ae4620995cd54e43bdccce7daef499ddb5056b4
[packages.git] / net / mdnsresponder / patches / 100-Binding-IPv6-sockets-to-interface-due-to-link-local.patch
1 From 094714725481da5cfbeaa9e4c713633f3fd0dcc4 Mon Sep 17 00:00:00 2001
2 From: Markus Stenberg <markus.stenberg@iki.fi>
3 Date: Wed, 19 Feb 2014 19:21:40 +0200
4 Subject: mdnsresponder: [PATCH] Binding IPv6 sockets to interface
5
6 Due to link-local addresses, otherwise responses may wind up in wrong
7 places and mdnsd is quite confused.
8
9 ---
10  .../patches/003-ipv6-bind-to-interface.patch       |   22 ++++++++++++++++++++
11  1 file changed, 22 insertions(+)
12  create mode 100644 net/mdnsresponder/patches/003-ipv6-bind-to-interface.patch
13
14 diff --git a/net/mdnsresponder/patches/003-ipv6-bind-to-interface.patch b/net/mdnsresponder/patches/003-ipv6-bind-to-interface.patch
15 new file mode 100644
16 index 0000000..c65221e
17 --- /dev/null
18 +++ b/net/mdnsresponder/patches/003-ipv6-bind-to-interface.patch
19 @@ -0,0 +1,22 @@
20 +diff -ur mDNSResponder-544.source/mDNSPosix/mDNSPosix.c mDNSResponder-544/mDNSPosix/mDNSPosix.c
21 +--- mDNSResponder-544.source/mDNSPosix/mDNSPosix.c     2013-12-14 22:54:24.000000000 +0200
22 ++++ mDNSResponder-544/mDNSPosix/mDNSPosix.c    2014-02-19 18:59:55.000000000 +0200
23 +@@ -784,6 +784,17 @@
24 +             if (err < 0) { err = errno; perror("setsockopt - IPV6_MULTICAST_HOPS"); }
25 +         }
26
27 ++#ifdef __linux__
28 ++#ifdef SO_BINDTODEVICE
29 ++        if (err == 0)
30 ++        {
31 ++            char ifname[IFNAMSIZ];
32 ++            if (if_indextoname(interfaceIndex, ifname))
33 ++                err = setsockopt(*sktPtr, SOL_SOCKET, SO_BINDTODEVICE, ifname, strlen(ifname));
34 ++        }
35 ++#endif /* SO_BINDTODEVICE */
36 ++#endif /* __linux__ */
37 ++
38 +         // And start listening for packets
39 +         if (err == 0)
40 +         {
41 +Only in mDNSResponder-544/mDNSPosix: mDNSPosix.c~
42 -- 
43 1.7.9.5
44