[OpenWrt-Devel] [PATCH] package/config/netifd: Replace ifconfig/route with ip command
Daniel Dickinson
openwrt at daniel.thecshore.com
Fri Jan 29 23:55:46 EST 2016
It worked with a /24 subnet but that might be because of defaults. I do
not currently have test bed for testing other configurations.
I plan on setting that up once I'm back from travelling.
Regards,
Daniel
On 28/01/16 05:52 PM, Felix Fietkau wrote:
> On 2016-01-20 19:21, openwrt at daniel.thecshore.com wrote:
>> From: Daniel Dickinson <openwrt at daniel.thecshore.com>
>>
>> v3: Drop comment thanking user who gave mask2cidr at their
>> request
>> : Fix echo had correct CIDR but actual command did not
>> : Fix style issue
>> : Use full -family in ip command line instead of -f
>>
>> v2: Also update previously missed deconfig use of ifconfig
>> : Replace ipcalc.sh callout with pure shell mask2cidr
>> : Remove unused local variable
>>
>> ip from busybox is now standard and it would be good to
>> eventually drop the ancient and 10+ year deprecated
>> upstream commands ifconfig and route, so eliminate
>> one of the last consumers of ifconfig and route in
>> the base system.
>>
>> Signed-off-by: Daniel Dickinson <openwrt at daniel.thecshore.com>
>> ---
>> .../netifd/files/usr/share/udhcpc/default.script | 34 +++++++++++++++-------
>> 1 file changed, 23 insertions(+), 11 deletions(-)
>>
>> diff --git a/package/network/config/netifd/files/usr/share/udhcpc/default.script b/package/network/config/netifd/files/usr/share/udhcpc/default.script
>> index ac765a6..5eeeec0 100755
>> --- a/package/network/config/netifd/files/usr/share/udhcpc/default.script
>> +++ b/package/network/config/netifd/files/usr/share/udhcpc/default.script
>> @@ -1,34 +1,46 @@
>> setup_interface() {
>> - echo "udhcpc: ifconfig $interface $ip netmask ${subnet:-255.255.255.0} broadcast ${broadcast:-+}"
>> - ifconfig $interface $ip netmask ${subnet:-255.255.255.0} broadcast ${broadcast:-+}
>> + local CIDR
>> +
>> + mask2cidr ${subnet:-255.255.255.0}
>> +
>> + echo "udhcpc: ip address add $ip/${CIDR} ${broadcast:-+} dev $interface"
>> + ip address add $ip/${CIDR} ${broadcast:-+} dev $interface"
> This doesn't work. Did you test this code?
>
> - Felix
>
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list