* [PATCH] runqemu: Replace use of ifconfig with ip
@ 2013-05-08 19:40 Khem Raj
2013-05-08 20:15 ` Trevor Woerner
0 siblings, 1 reply; 3+ messages in thread
From: Khem Raj @ 2013-05-08 19:40 UTC (permalink / raw)
To: openembedded-core
ifconfig and its ilk (net-tools package) is deprecated in favour of iproute2 package
and is now removed by many distro's e.g. Archlinux. So we replace ifconfig with ip utility
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
scripts/runqemu-gen-tapdevs | 6 +++---
scripts/runqemu-ifup | 6 +++---
scripts/runqemu-internal | 6 +++---
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/scripts/runqemu-gen-tapdevs b/scripts/runqemu-gen-tapdevs
index f5be30a..d3b27be 100755
--- a/scripts/runqemu-gen-tapdevs
+++ b/scripts/runqemu-gen-tapdevs
@@ -59,10 +59,10 @@ if [ ! -x "$RUNQEMU_IFUP" ]; then
exit 1
fi
-IFCONFIG=`which ifconfig 2> /dev/null`
+IFCONFIG=`which ip 2> /dev/null`
if [ -z "$IFCONFIG" ]; then
# Is it ever anywhere else?
- IFCONFIG=/sbin/ifconfig
+ IFCONFIG=/sbin/ip
fi
if [ ! -x "$IFCONFIG" ]; then
echo "$IFCONFIG cannot be executed"
@@ -70,7 +70,7 @@ if [ ! -x "$IFCONFIG" ]; then
fi
# Ensure we start with a clean slate
-for tap in `$IFCONFIG | grep ^tap | awk '{ print \$1 }' | sed s/://`; do
+for tap in `$IFCONFIG link | grep tap | awk '{ print \$2 }' | sed s/://`; do
echo "Note: Destroying pre-existing tap interface $tap..."
$TUNCTL -d $tap
done
diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup
index 0926faf..8948153 100755
--- a/scripts/runqemu-ifup
+++ b/scripts/runqemu-ifup
@@ -70,10 +70,10 @@ if [ $STATUS -ne 0 ]; then
fi
fi
-IFCONFIG=`which ifconfig 2> /dev/null`
+IFCONFIG=`which ip 2> /dev/null`
if [ "x$IFCONFIG" = "x" ]; then
# better than nothing...
- IFCONFIG=/sbin/ifconfig
+ IFCONFIG=/sbin/ip
fi
if [ ! -x "$IFCONFIG" ]; then
echo "$IFCONFIG cannot be executed"
@@ -100,7 +100,7 @@ if [ ! -x "$IPTABLES" ]; then
fi
n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
-$IFCONFIG $TAP 192.168.7.$n netmask 255.255.255.255
+$IFCONFIG addr add 192.168.7.$n/32 dev $TAP
dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
$ROUTE add -host 192.168.7.$dest $TAP
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
index f11706d..d295013 100755
--- a/scripts/runqemu-internal
+++ b/scripts/runqemu-internal
@@ -139,16 +139,16 @@ if [ ! -d "$LOCKDIR" ]; then
chmod 777 $LOCKDIR
fi
-IFCONFIG=`which ifconfig 2> /dev/null`
+IFCONFIG=`which ip 2> /dev/null`
if [ -z "$IFCONFIG" ]; then
- IFCONFIG=/sbin/ifconfig
+ IFCONFIG=/sbin/ip
fi
if [ ! -x "$IFCONFIG" ]; then
echo "$IFCONFIG cannot be executed"
exit 1
fi
-POSSIBLE=`$IFCONFIG -a | grep '^tap' | awk '{print $1}' | sed s/://`
+POSSIBLE=`$IFCONFIG link | grep 'tap' | awk '{print $2}' | sed s/://`
TAP=""
LOCKFILE=""
for tap in $POSSIBLE; do
--
1.8.2.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] runqemu: Replace use of ifconfig with ip
2013-05-08 19:40 [PATCH] runqemu: Replace use of ifconfig with ip Khem Raj
@ 2013-05-08 20:15 ` Trevor Woerner
2013-05-08 20:43 ` Khem Raj
0 siblings, 1 reply; 3+ messages in thread
From: Trevor Woerner @ 2013-05-08 20:15 UTC (permalink / raw)
To: Khem Raj; +Cc: Patches and discussions about the oe-core layer
On Wed, May 8, 2013 at 3:40 PM, Khem Raj <raj.khem@gmail.com> wrote:
> ifconfig and its ilk (net-tools package) is deprecated in favour of iproute2 package
> and is now removed by many distro's e.g. Archlinux. So we replace ifconfig with ip utility
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> scripts/runqemu-gen-tapdevs | 6 +++---
> scripts/runqemu-ifup | 6 +++---
> scripts/runqemu-internal | 6 +++---
> 3 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/scripts/runqemu-gen-tapdevs b/scripts/runqemu-gen-tapdevs
> index f5be30a..d3b27be 100755
> --- a/scripts/runqemu-gen-tapdevs
> +++ b/scripts/runqemu-gen-tapdevs
> @@ -59,10 +59,10 @@ if [ ! -x "$RUNQEMU_IFUP" ]; then
> exit 1
> fi
>
> -IFCONFIG=`which ifconfig 2> /dev/null`
> +IFCONFIG=`which ip 2> /dev/null`
> if [ -z "$IFCONFIG" ]; then
> # Is it ever anywhere else?
> - IFCONFIG=/sbin/ifconfig
> + IFCONFIG=/sbin/ip
Is the "command" command a Bourne shell builtin? If so, using
IFCONFIG=$(command -pv ip)
might be better? (same applies to the other, following instances)
> fi
> if [ ! -x "$IFCONFIG" ]; then
> echo "$IFCONFIG cannot be executed"
> @@ -70,7 +70,7 @@ if [ ! -x "$IFCONFIG" ]; then
> fi
>
> # Ensure we start with a clean slate
> -for tap in `$IFCONFIG | grep ^tap | awk '{ print \$1 }' | sed s/://`; do
> +for tap in `$IFCONFIG link | grep tap | awk '{ print \$2 }' | sed s/://`; do
> echo "Note: Destroying pre-existing tap interface $tap..."
> $TUNCTL -d $tap
> done
> diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup
> index 0926faf..8948153 100755
> --- a/scripts/runqemu-ifup
> +++ b/scripts/runqemu-ifup
> @@ -70,10 +70,10 @@ if [ $STATUS -ne 0 ]; then
> fi
> fi
>
> -IFCONFIG=`which ifconfig 2> /dev/null`
> +IFCONFIG=`which ip 2> /dev/null`
> if [ "x$IFCONFIG" = "x" ]; then
> # better than nothing...
> - IFCONFIG=/sbin/ifconfig
> + IFCONFIG=/sbin/ip
> fi
> if [ ! -x "$IFCONFIG" ]; then
> echo "$IFCONFIG cannot be executed"
> @@ -100,7 +100,7 @@ if [ ! -x "$IPTABLES" ]; then
> fi
>
> n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
> -$IFCONFIG $TAP 192.168.7.$n netmask 255.255.255.255
> +$IFCONFIG addr add 192.168.7.$n/32 dev $TAP
>
> dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
> $ROUTE add -host 192.168.7.$dest $TAP
> diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
> index f11706d..d295013 100755
> --- a/scripts/runqemu-internal
> +++ b/scripts/runqemu-internal
> @@ -139,16 +139,16 @@ if [ ! -d "$LOCKDIR" ]; then
> chmod 777 $LOCKDIR
> fi
>
> -IFCONFIG=`which ifconfig 2> /dev/null`
> +IFCONFIG=`which ip 2> /dev/null`
> if [ -z "$IFCONFIG" ]; then
> - IFCONFIG=/sbin/ifconfig
> + IFCONFIG=/sbin/ip
> fi
> if [ ! -x "$IFCONFIG" ]; then
> echo "$IFCONFIG cannot be executed"
> exit 1
> fi
>
> -POSSIBLE=`$IFCONFIG -a | grep '^tap' | awk '{print $1}' | sed s/://`
> +POSSIBLE=`$IFCONFIG link | grep 'tap' | awk '{print $2}' | sed s/://`
> TAP=""
> LOCKFILE=""
> for tap in $POSSIBLE; do
It does seem a little silly to continue to use a variable named
IFCONFIG now that you're switching away from "ifconfig" :-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] runqemu: Replace use of ifconfig with ip
2013-05-08 20:15 ` Trevor Woerner
@ 2013-05-08 20:43 ` Khem Raj
0 siblings, 0 replies; 3+ messages in thread
From: Khem Raj @ 2013-05-08 20:43 UTC (permalink / raw)
To: Trevor Woerner; +Cc: Patches and discussions about the oe-core layer
On May 8, 2013, at 1:15 PM, Trevor Woerner <twoerner@gmail.com> wrote:
> On Wed, May 8, 2013 at 3:40 PM, Khem Raj <raj.khem@gmail.com> wrote:
>> ifconfig and its ilk (net-tools package) is deprecated in favour of iproute2 package
>> and is now removed by many distro's e.g. Archlinux. So we replace ifconfig with ip utility
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>> scripts/runqemu-gen-tapdevs | 6 +++---
>> scripts/runqemu-ifup | 6 +++---
>> scripts/runqemu-internal | 6 +++---
>> 3 files changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/scripts/runqemu-gen-tapdevs b/scripts/runqemu-gen-tapdevs
>> index f5be30a..d3b27be 100755
>> --- a/scripts/runqemu-gen-tapdevs
>> +++ b/scripts/runqemu-gen-tapdevs
>> @@ -59,10 +59,10 @@ if [ ! -x "$RUNQEMU_IFUP" ]; then
>> exit 1
>> fi
>>
>> -IFCONFIG=`which ifconfig 2> /dev/null`
>> +IFCONFIG=`which ip 2> /dev/null`
>> if [ -z "$IFCONFIG" ]; then
>
>> # Is it ever anywhere else?
>> - IFCONFIG=/sbin/ifconfig
>> + IFCONFIG=/sbin/ip
>
> Is the "command" command a Bourne shell builtin? If so, using
>
> IFCONFIG=$(command -pv ip)
>
> might be better? (same applies to the other, following instances)
this would be for another day.
>>
>> -POSSIBLE=`$IFCONFIG -a | grep '^tap' | awk '{print $1}' | sed s/://`
>> +POSSIBLE=`$IFCONFIG link | grep 'tap' | awk '{print $2}' | sed s/://`
>> TAP=""
>> LOCKFILE=""
>> for tap in $POSSIBLE; do
>
> It does seem a little silly to continue to use a variable named
> IFCONFIG now that you're switching away from "ifconfig" :-)
ip would replace more commands there eventually, thats why I left the variable as it is
since eventually we want to replace all net-tools with iproute2 provides utilities.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-05-08 21:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-08 19:40 [PATCH] runqemu: Replace use of ifconfig with ip Khem Raj
2013-05-08 20:15 ` Trevor Woerner
2013-05-08 20:43 ` Khem Raj
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox