Bug 14131 - udhcpc.script file cannot assign a right action to hook files
Summary: udhcpc.script file cannot assign a right action to hook files
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Networking (show other bugs)
Version: 1.33.x
Hardware: All Linux
: P5 major
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-16 02:54 UTC by wangwangqi2011
Modified: 2021-08-16 02:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
Configurations of busybox (32.64 KB, application/octet-stream)
2021-08-16 02:54 UTC, wangwangqi2011
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wangwangqi2011 2021-08-16 02:54:28 UTC
Created attachment 9081 [details]
Configurations of busybox

When passing `bound` or `renew` parameter to udhcpc.script, these parameters are wiped out before hooking files with them. So an empty string passed to these hooked files, which failed to configure some necessary parameters.

Following are some detailed info:

Version of Buildroot: 2021.02.2
Version of Busybox: 1.33.0

File Location: package/busybox/udhcpc.script

Description: The DHCP action is empty after the 'deconfig'. Actually, it should be 'bound'(or 'renew'). As a result, the hook operation at the end of this script will not pass the right parameters to the relevant files.
 
Cause: When the condition of Line.67 is true, then Line.75 will change '$@', after the Line.78 shifts all the parameters, the '$@' becomes empty. At last, an empty '$@' is passed to the hook operation, which will cause problems.

Fix: At first, store the '$@' to a variable and at last, use the variable instead of '$@' to get the action parameter. 

Serial Logs from GCP:
Starting network: udhcpc: started, v1.33.0
DHCP action="deconfig" with variables 
udhcpc: sending discover
udhcpc: sending select for **.**.**.**
udhcpc: lease of **.**.**.** obtained, lease time *****
deleting routers
route: SIOCADDRT: Invalid argument
adding dns **.**.**.**
DHCP action="" with variables 
OK

From the above log, we can see obviously that the DHCP action is an empty string, which should be 'bound' or 'renew'.