Setting the DHCPv6-PD DUID like this:
set interfaces ethernet eth0 dhcpv6-pd duid 00:03:00:01:00:11:22:33:44:55
Causes the daemon to fail to start on MediaTek based EdgeRouters. The reason is that the DUID file is written with a 16-bit length prefix in big endian, while the daemon interprets it in the native endian. This is big endian for Cavium devices, but little endian for MediaTek devices.
The fix is simple:
--- /opt/vyatta/sbin/dhcpv6-pd-duid.pl.orig
+++ /opt/vyatta/sbin/dhcpv6-pd-duid.pl
@@ -41,7 +41,7 @@
$duid =~ s/://g;
my $len = length($duid) / 2;
- my $buf = pack("n", $len);
+ my $buf = pack("S", $len);
print $FH $buf || die "duid length write failed: $!\n";
my $bin_duid = pack("H*", $duid);
@@ -57,7 +57,7 @@
$duid =~ s/://g;
my $len = length($duid);
- my $buf = pack("n", $len);
+ my $buf = pack("S", $len);
print $FH $buf || die "write failed\n";
print $FH $duid;
This patch makes it work on both endiannesses, since 'S' means native endian, which will be correct regardless of the architecture variant.
Hi @marcan42,
Thank you for bringing this up and for providing the fix.
We will look into this issue.
-Ben