Modify

Opened 4 years ago

Closed 4 years ago

Last modified 22 months ago

#10648 closed defect (fixed)

/etc/init.d/dhcp6c low endian detection won't work

Reported by: pb@… Owned by: developers
Priority: high Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: ipv6 Cc:

Description

Installed wide-dhcpv6-client_20080615-9_brcm47xx.ipk on top of Backfire 10.03.1-rc6 does not proper detect low endian systems, which causes error, because DUID file is invalid.

Fix:

--- /etc/init.d/dhcp6c.orig	Tue Dec 20 19:03:55 2011
+++ /etc/init.d/dhcp6c	Tue Dec 20 19:04:50 2011
@@ -33,7 +33,7 @@
 			local oIFS="$IFS"; IFS=":"; set -- $mac; IFS="$oIFS"
 
 			# low endian
-			if [ "$(printf \\1 | hexdump -n1 -ve '8/2 "" "%04x" ""')" = "0001" ]; then
+			if [ "$(printf \\1 | hexdump -n1 -ve '8/2 "" "%04x" ""' | awk '{ print $1 }')" = "0001" ]; then
 				printf \\x0a\\x00
 
 			# big endian
@@ -51,7 +51,7 @@
 			local len_lo=$(printf "%02x" $((${#len_id} % 0xFF)) )
 
 			# low endian
-			if [ "$(printf \\1 | hexdump -n1 -ve '8/2 "%04x"')" = "0001" ]; then
+			if [ "$(printf \\1 | hexdump -n1 -ve '8/2 "%04x"' | awk '{ print $1 }')" = "0001" ]; then
 				printf \\x$len_lo\\x$len_hi
 
 			# big endian

Attachments (0)

Change History (4)

comment:1 Changed 4 years ago by pb@…

Sorry, the patch only fixes user defined DUID, here the one which fixes both:

--- /etc/init.d/dhcp6c.orig	Tue Dec 20 19:03:55 2011
+++ /etc/init.d/dhcp6c	Tue Dec 20 19:20:56 2011
@@ -33,7 +33,7 @@
 			local oIFS="$IFS"; IFS=":"; set -- $mac; IFS="$oIFS"
 
 			# low endian
-			if [ "$(printf \\1 | hexdump -n1 -ve '8/2 "" "%04x" ""')" = "0001" ]; then
+			if [ "$(printf \\1 | hexdump -n1 -ve '8/2 "%04x"' | awk '{ print $1 }')" = "0001" ]; then
 				printf \\x0a\\x00
 
 			# big endian
@@ -51,7 +51,7 @@
 			local len_lo=$(printf "%02x" $((${#len_id} % 0xFF)) )
 
 			# low endian
-			if [ "$(printf \\1 | hexdump -n1 -ve '8/2 "%04x"')" = "0001" ]; then
+			if [ "$(printf \\1 | hexdump -n1 -ve '8/2 "%04x"' | awk '{ print $1 }')" = "0001" ]; then
 				printf \\x$len_lo\\x$len_hi
 
 			# big endian

comment:2 Changed 4 years ago by pb@…

The patch above also fixes a segfault of the original lowendian detection:

# printf
1 | hexdump -n1 -ve '8/2 "" "%04x" ""'
Segmentation fault

comment:3 Changed 4 years ago by jow

  • Resolution set to fixed
  • Status changed from new to closed

Fixed with r29589 and r29590. The issue was actually a bad format pattern which adds trailing whitespace. Solving that with an awk call is inefficient and ugly.

The segmentation fault has been fixed 5 weeks ago with r29156.

comment:4 Changed 22 months ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.