[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [resend PATCH] add possibility to use modern "ip"
From: Denys Vlasenko <vda.linux () googlemail ! com>
Date: 2018-10-30 11:03:44
Message-ID: CAK1hOcOzKdPTs-uwZhUaT9yEf0AGAxfQK801tefQGrKt20dzmw () mail ! gmail ! com
[Download RAW message or body]
Applied, thanks!
On Thu, Oct 4, 2018 at 9:02 AM Jiří Prchal <jiri.prchal@aksignal.cz> wrote:
>
> Script uses "ifconfig" only, not up-to-date so much. This patch adds "ip" in condition if exists.
>
> Signed-off-by: Jiri Prchal <jiri.prchal@aksignal.cz>
> ---
> examples/udhcp/simple.script | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/examples/udhcp/simple.script b/examples/udhcp/simple.script
> index e4c1f2d76..d043d39de 100755
> --- a/examples/udhcp/simple.script
> +++ b/examples/udhcp/simple.script
> @@ -6,19 +6,31 @@ RESOLV_CONF="/etc/resolv.conf"
> [ -n "$1" ] || { echo "Error: should be called from udhcpc"; exit 1; }
>
> NETMASK=""
> -[ -n "$subnet" ] && NETMASK="netmask $subnet"
> +if [ -x /sbin/ip ]; then
> + [ -n "$subnet" ] && NETMASK="/$subnet"
> +else
> + [ -n "$subnet" ] && NETMASK="netmask $subnet"
> +fi
> BROADCAST="broadcast +"
> [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
>
> case "$1" in
> deconfig)
> echo "Setting IP address 0.0.0.0 on $interface"
> - ifconfig $interface 0.0.0.0
> + if [ -x /sbin/ip ]; then
> + ip addr flush dev $interface
> + else
> + ifconfig $interface 0.0.0.0
> + fi
> ;;
>
> renew|bound)
> echo "Setting IP address $ip on $interface"
> - ifconfig $interface $ip $NETMASK $BROADCAST
> + if [ -x /sbin/ip ]; then
> + ip addr add $ip$NETMASK $BROADCAST dev $interface
> + else
> + ifconfig $interface $ip $NETMASK $BROADCAST
> + fi
>
> if [ -n "$router" ] ; then
> echo "Deleting routers"
> --
> 2.17.1
>
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic