0029-Fix-removal-of-DHCP_CLIENT_MAC-options-from-DHCPv6-r.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From f8c77edbdffb8ada7753ea9fa104f0f6da70cfe3 Mon Sep 17 00:00:00 2001
  2. From: Simon Kelley <simon@thekelleys.org.uk>
  3. Date: Thu, 10 Jan 2019 21:58:18 +0000
  4. Subject: [PATCH 29/32] Fix removal of DHCP_CLIENT_MAC options from DHCPv6
  5. relay replies.
  6. Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
  7. ---
  8. src/rfc3315.c | 30 +++++++++++++++++-------------
  9. 1 file changed, 17 insertions(+), 13 deletions(-)
  10. --- a/src/rfc3315.c
  11. +++ b/src/rfc3315.c
  12. @@ -219,21 +219,25 @@ static int dhcp6_maybe_relay(struct stat
  13. if (opt6_ptr(opt, 0) + opt6_len(opt) > end)
  14. return 0;
  15. - int o = new_opt6(opt6_type(opt));
  16. - if (opt6_type(opt) == OPTION6_RELAY_MSG)
  17. + /* Don't copy MAC address into reply. */
  18. + if (opt6_type(opt) != OPTION6_CLIENT_MAC)
  19. {
  20. - struct in6_addr align;
  21. - /* the packet data is unaligned, copy to aligned storage */
  22. - memcpy(&align, inbuff + 2, IN6ADDRSZ);
  23. - state->link_address = &align;
  24. - /* zero is_unicast since that is now known to refer to the
  25. - relayed packet, not the original sent by the client */
  26. - if (!dhcp6_maybe_relay(state, opt6_ptr(opt, 0), opt6_len(opt), client_addr, 0, now))
  27. - return 0;
  28. + int o = new_opt6(opt6_type(opt));
  29. + if (opt6_type(opt) == OPTION6_RELAY_MSG)
  30. + {
  31. + struct in6_addr align;
  32. + /* the packet data is unaligned, copy to aligned storage */
  33. + memcpy(&align, inbuff + 2, IN6ADDRSZ);
  34. + state->link_address = &align;
  35. + /* zero is_unicast since that is now known to refer to the
  36. + relayed packet, not the original sent by the client */
  37. + if (!dhcp6_maybe_relay(state, opt6_ptr(opt, 0), opt6_len(opt), client_addr, 0, now))
  38. + return 0;
  39. + }
  40. + else
  41. + put_opt6(opt6_ptr(opt, 0), opt6_len(opt));
  42. + end_opt6(o);
  43. }
  44. - else if (opt6_type(opt) != OPTION6_CLIENT_MAC)
  45. - put_opt6(opt6_ptr(opt, 0), opt6_len(opt));
  46. - end_opt6(o);
  47. }
  48. return 1;