IPv6 - DHCPv6 [PATCH]

Uwe Glaeser uwe.glaeser at dormakaba.com
Wed Jun 10 12:54:07 UTC 2020


Hi all,

as Martin suggests, I here have my changes in a way like most Patches are in the mailing list...
I did not push them to Git because I think I have no rights...The changes cause the multicast message now to be received by the Server. Still the answer seems to have no effect to the dhcpc6,
perhaps someone has an idea about that...


diff --git a/./org/networking/udhcp/common.h b/./new/networking/udhcp/common.h
index bba3d60..f6aeee8 100644
--- a/./org/networking/udhcp/common.h
+++ b/./new/networking/udhcp/common.h
@@ -16,6 +16,7 @@
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
 extern const uint8_t MAC_BCAST_ADDR[6] ALIGN2; /* six all-ones */
+extern const uint8_t MAC_DHCP6MCAST_ADDR[6] ALIGN2; /* IPv6 has new multicast format */
--------------------------

diff --git a/./org/networking/udhcp/common.c b/./new/networking/udhcp/common.c
index 62ad248..c19fb65 100644
--- a/./org/networking/udhcp/common.c
+++ b/./new/networking/udhcp/common.c
@@ -14,6 +14,10 @@ const uint8_t MAC_BCAST_ADDR[6] ALIGN2 = {
               0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
+const uint8_t MAC_DHCP6MCAST_ADDR[6] ALIGN2= {
+             0x33, 0x33, 0x00, 0x01, 0x00, 0x02
+}; /* IPv6 requires different multicast contents in Ethernet Frame (RFC 2464) */
+

-----------------------------

diff --git a/./org/networking/udhcp/d6_dhcpc.c b/./new/networking/udhcp/d6_dhcpc.c
index 422b888..4e8adb4 100644
--- a/./org/networking/udhcp/d6_dhcpc.c
+++ b/./new/networking/udhcp/d6_dhcpc.c
@@ -536,10 +536,10 @@ static int d6_mcast_from_client_data_ifindex(struct d6_packet *packet, uint8_t *
                              0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02,
               };
-              return d6_send_raw_packet(
-                              packet, (end - (uint8_t*) packet),
+             return d6_send_raw_packet(
+                             packet, (end - (uint8_t*) packet),
                               /*src*/ &client6_data.ll_ip6, CLIENT_PORT6,
-                              /*dst*/ (struct in6_addr*)FF02__1_2, SERVER_PORT6, MAC_BCAST_ADDR,
+                             /*dst*/ (struct in6_addr*)FF02__1_2, SERVER_PORT6, MAC_DHCP6MCAST_ADDR,
                              client_data.ifindex
               );


I will see if can summarize the problem with the DHCP server on Windows Server2012 and try to attach perhaps some Wireshark logs

Uwe




>Hello,

>I have a few notes.

>

>First of all, you should send the diff as a git patch. Not only will it

>make the code much easier to read, but will also make it possible to commit

>into the git repository.

>Also you mentioned that the server still doesn't respond as expected,

>perhaps you could address that too?

>

>Martin

>

>On Tue, 5 May 2020 at 12:29, Uwe Glaeser <uwe.glaeser at dormakaba.com<http://lists.busybox.net/mailman/listinfo/busybox>> wrote:

>

>> Hi all,

>>

>>

>>

>> I try to get a IPv6 address via DHCP from a "Windows 2012 R2 Server with

>> DHCPv6 Server".

>>

>> With actual busybox 1.31.1 and enabled IPv6 and udhcpc6 feature I try to

>> make contact to the server.

>>

>> My deivce is an embedded Linux 2.6

>>

>> What is working perfectly well is busybox ping6 and I get an IPv6 address

>> when connecting my PC(Win 10) to the server.

>>

>> I watched the network with Wireshark and found out, that the ping6 and the

>> dhcp-solicit from the PC are transmitted as ipv6-multicast.

>>

>> But the udhcpc6 solicit message is sent as IPv4 broadcast (with

>> FF:FF:FF:FF:FF:FF as destination in the EthernetII frame) which is not

>> correct I think.

>>

>> I have made some changes in the sources that way:

>>

>>

>>

>> I defined the field in common.h/.c for the IPv6 multicast to a DHCPv6

>> (general address is FF02::1:2)

>>

>>

>>

>> const uint8_t MAC_DHCPBCAST_ADDR[6] ALIGN2= {

>>

>>                 0x33, 0x33, 0x00, 0x01, 0x00, 0x02

>>

>> };

>>

>>

>>

>> and used it in d6_dhcp.c  in the call of:

>>

>>

>>

>> static int d6_mcast_from_client_data_ifindex(struct d6_packet *packet,

>> uint8_t *end)

>>

>> {

>>

>>                 /* FF02::1:2 is "All_DHCP_Relay_Agents_and_Servers"

>> address */

>>

>>                 static const uint8_t FF02__1_2[16] = {

>>

>>                                0xFF, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,

>> 0x00,

>>

>>                                0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,

>> 0x02,

>>

>>                 };

>>

>>

>>

>>                 return d6_send_raw_packet(  packet, (end - (uint8_t*)

>> packet),

>>

>>

>>                                                                /*src*/

>> &client6_data.ll_ip6, CLIENT_PORT6,

>>

>>

>> /*dst*/ (struct in6_addr*)FF02__1_2, SERVER_PORT6, MAC_DHCPBCAST_ADDR,

>>

>>

>> client_data.ifindex

>>

>>                 );

>>

>> }

>>

>>

>>

>> That works better now and I can see nearly the same contents in Wireshark

>> as in the PC-dhcpv6 request. Ther Server still does not answer but that may

>> have other reasons...

>>

>> I'm not sure if there are other parts where it would make sense to change

>> the header...Please have a look!

>>

>>

>>

>> Best regards!

>>

>>

>>

>> Uwe Glaeser

>> dormakaba EAD GmbH

>> _______________________________________________

>> busybox mailing list

>> busybox at busybox.net<http://lists.busybox.net/mailman/listinfo/busybox>

>> http://lists.busybox.net/mailman/listinfo/busybox

>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20200610/3e039fe1/attachment-0001.html>


More information about the busybox mailing list