Blame SOURCES/dnsmasq-2.81-dhcpv6-relay-link-address.patch

8e2f36
From f8c77edbdffb8ada7753ea9fa104f0f6da70cfe3 Mon Sep 17 00:00:00 2001
8e2f36
From: Simon Kelley <simon@thekelleys.org.uk>
8e2f36
Date: Thu, 10 Jan 2019 21:58:18 +0000
8e2f36
Subject: [PATCH] Fix removal of DHCP_CLIENT_MAC options from DHCPv6 relay
8e2f36
 replies.
8e2f36
8e2f36
---
8e2f36
 src/rfc3315.c | 30 +++++++++++++++++-------------
8e2f36
 1 file changed, 17 insertions(+), 13 deletions(-)
8e2f36
8e2f36
diff --git a/src/rfc3315.c b/src/rfc3315.c
8e2f36
index d3c1722..79b2a86 100644
8e2f36
--- a/src/rfc3315.c
8e2f36
+++ b/src/rfc3315.c
8e2f36
@@ -219,21 +219,25 @@ static int dhcp6_maybe_relay(struct state *state, void *inbuff, size_t sz,
8e2f36
       if (opt6_ptr(opt, 0) + opt6_len(opt) > end) 
8e2f36
         return 0;
8e2f36
      
8e2f36
-      int o = new_opt6(opt6_type(opt));
8e2f36
-      if (opt6_type(opt) == OPTION6_RELAY_MSG)
8e2f36
+      /* Don't copy MAC address into reply. */
8e2f36
+      if (opt6_type(opt) != OPTION6_CLIENT_MAC)
8e2f36
 	{
8e2f36
-	  struct in6_addr align;
8e2f36
-	  /* the packet data is unaligned, copy to aligned storage */
8e2f36
-	  memcpy(&align, inbuff + 2, IN6ADDRSZ); 
8e2f36
-	  state->link_address = &align;
8e2f36
-	  /* zero is_unicast since that is now known to refer to the 
8e2f36
-	     relayed packet, not the original sent by the client */
8e2f36
-	  if (!dhcp6_maybe_relay(state, opt6_ptr(opt, 0), opt6_len(opt), client_addr, 0, now))
8e2f36
-	    return 0;
8e2f36
+	  int o = new_opt6(opt6_type(opt));
8e2f36
+	  if (opt6_type(opt) == OPTION6_RELAY_MSG)
8e2f36
+	    {
8e2f36
+	      struct in6_addr align;
8e2f36
+	      /* the packet data is unaligned, copy to aligned storage */
8e2f36
+	      memcpy(&align, inbuff + 2, IN6ADDRSZ); 
8e2f36
+	      state->link_address = &align;
8e2f36
+	      /* zero is_unicast since that is now known to refer to the 
8e2f36
+		 relayed packet, not the original sent by the client */
8e2f36
+	      if (!dhcp6_maybe_relay(state, opt6_ptr(opt, 0), opt6_len(opt), client_addr, 0, now))
8e2f36
+		return 0;
8e2f36
+	    }
8e2f36
+	  else
8e2f36
+	    put_opt6(opt6_ptr(opt, 0), opt6_len(opt));
8e2f36
+	  end_opt6(o);
8e2f36
 	}
8e2f36
-      else if (opt6_type(opt) != OPTION6_CLIENT_MAC)
8e2f36
-	put_opt6(opt6_ptr(opt, 0), opt6_len(opt));
8e2f36
-      end_opt6(o);	    
8e2f36
     }
8e2f36
   
8e2f36
   return 1;
8e2f36
-- 
8e2f36
2.39.1
8e2f36