e02bd11d2302dc73569858abfcc64bd0b95cb99c
[openwrt/staging/pepe2k.git] /
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
7 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
8 ---
9 src/rfc3315.c | 30 +++++++++++++++++-------------
10 1 file changed, 17 insertions(+), 13 deletions(-)
11
12 --- a/src/rfc3315.c
13 +++ b/src/rfc3315.c
14 @@ -219,21 +219,25 @@ static int dhcp6_maybe_relay(struct stat
15 if (opt6_ptr(opt, 0) + opt6_len(opt) > end)
16 return 0;
17
18 - int o = new_opt6(opt6_type(opt));
19 - if (opt6_type(opt) == OPTION6_RELAY_MSG)
20 + /* Don't copy MAC address into reply. */
21 + if (opt6_type(opt) != OPTION6_CLIENT_MAC)
22 {
23 - struct in6_addr align;
24 - /* the packet data is unaligned, copy to aligned storage */
25 - memcpy(&align, inbuff + 2, IN6ADDRSZ);
26 - state->link_address = &align;
27 - /* zero is_unicast since that is now known to refer to the
28 - relayed packet, not the original sent by the client */
29 - if (!dhcp6_maybe_relay(state, opt6_ptr(opt, 0), opt6_len(opt), client_addr, 0, now))
30 - return 0;
31 + int o = new_opt6(opt6_type(opt));
32 + if (opt6_type(opt) == OPTION6_RELAY_MSG)
33 + {
34 + struct in6_addr align;
35 + /* the packet data is unaligned, copy to aligned storage */
36 + memcpy(&align, inbuff + 2, IN6ADDRSZ);
37 + state->link_address = &align;
38 + /* zero is_unicast since that is now known to refer to the
39 + relayed packet, not the original sent by the client */
40 + if (!dhcp6_maybe_relay(state, opt6_ptr(opt, 0), opt6_len(opt), client_addr, 0, now))
41 + return 0;
42 + }
43 + else
44 + put_opt6(opt6_ptr(opt, 0), opt6_len(opt));
45 + end_opt6(o);
46 }
47 - else if (opt6_type(opt) != OPTION6_CLIENT_MAC)
48 - put_opt6(opt6_ptr(opt, 0), opt6_len(opt));
49 - end_opt6(o);
50 }
51
52 return 1;