Skip to contentSkip to conversation

about the qemu net interface name

DISCUSSION Ni Qingliang 2 participants 3 messages Nov 4, 2011

lore
Share & tools
lore
#0 lore raw

file: scripts/runqemu-internal
line153: POSSIBLE=$IFCONFIG -a|grep '^tap' | awk {print $1}'`

on archlinux, I got that:
tap0:
tap1:

maybe it should be:
tap0
tap1

Is it right?

so I change it to
POSSIBLE=$IFCONFIG -a|grep '^tap' | awk {print $1}' | sed 's/:$//'`

Signature · 3 lines
Yi Qingliang
[email protected]
https://niqingliang2003.wordpress.com
#1 lore raw

I have checked the version of ifconfig, it blongs to package "net-tools".

only the latest version 1.60.20110819cvs-1 have the ":" after Interface name. In this version, the output format of ifconfig has changed.

Quoted 21 lines · 倪庆亮

file: scripts/runqemu-internal
line153: POSSIBLE=$IFCONFIG -a|grep '^tap' | awk {print $1}'`

on archlinux, I got that:
tap0:
tap1:

maybe it should be:
tap0
tap1

Is it right?

so I change it to
POSSIBLE=$IFCONFIG -a|grep '^tap' | awk {print $1}' | sed 's/:$//'`

--
Yi Qingliang
[email protected]
https://niqingliang2003.wordpress.com

Signature · 3 lines
Yi Qingliang
[email protected]
https://niqingliang2003.wordpress.com
#2 lore raw
Quoted 5 lines · Ni Qingliang

I have checked the version of ifconfig, it blongs to package "net-tools".

only the latest version 1.60.20110819cvs-1 have the ":" after Interface name. In this version, the output format of ifconfig has changed.

Parsing the output of ifconfig isn't a very good way to get a list of devices (not least because ifconfig isn't guaranteed to be available). It would be better to read /proc/net/dev directly since this file is intended to be machine-readable.

p.