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

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