5bf5d89
From f3d697a84e90f31a86874e334240ee1360a2fbf8 Mon Sep 17 00:00:00 2001
5bf5d89
From: Jiri Popelka <jpopelka@redhat.com>
5bf5d89
Date: Thu, 9 Oct 2014 18:57:22 +0200
5bf5d89
Subject: [PATCH] Work-around for hop-limit set to 1
5bf5d89
5bf5d89
---
5bf5d89
 common/socket.c | 16 +++++++++++++++-
5bf5d89
 1 file changed, 15 insertions(+), 1 deletion(-)
5bf5d89
5bf5d89
diff --git a/common/socket.c b/common/socket.c
5bf5d89
index b8b44a6..93406ef 100644
5bf5d89
--- a/common/socket.c
5bf5d89
+++ b/common/socket.c
5bf5d89
@@ -301,7 +301,21 @@ if_register_socket(struct interface_info *info, int family,
5bf5d89
 	}
5bf5d89
 
5bf5d89
 	if ((family == AF_INET6) &&
5bf5d89
-	    ((info->flags & INTERFACE_UPSTREAM) != 0)) {
5bf5d89
+	    /*
5bf5d89
+	     * rfc3315 says that: "If relay agent relays messages to
5bf5d89
+	     * All_DHCP_Servers multicast address or other multicast addresses,
5bf5d89
+	     * it sets the Hop Limit field to 32."
5bf5d89
+	     *
5bf5d89
+	     * Because we use the same socket for all (upper/lower)
5bf5d89
+	     * interfaces, the hop limit is the same for both/all.
5bf5d89
+	     * There should be INTERFACE_UPSTREAM in the below condition, but
5bf5d89
+	     * problem is when the interface which registers the socket is
5bf5d89
+	     * lower interface, in that case the hop limit was not set
5bf5d89
+	     * (i.e. set to 1) for both.
5bf5d89
+	     * Because rfc doesn't say anything about hop limit for lower,
5bf5d89
+	     * it'd be lesser evil to have 32 in both cases.
5bf5d89
+	     */
5bf5d89
+	    ((info->flags & INTERFACE_STREAMS) != 0)) {
5bf5d89
 		int hop_limit = 32;
5bf5d89
 		if (setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
5bf5d89
 			       &hop_limit, sizeof(int)) < 0) {
5bf5d89
-- 
5bf5d89
2.1.0
5bf5d89