Quote:
Originally Posted by Frannacky
Hello,
A few software are based on a command like ifconfig -a | grep HWaddr .... to get either the mac address or the IP address. In fedora 17, this HWaddr is missing. Even though we can easily replace HWaddr by "ether" to get the mac address when it is our own software, it's hard when it's some one else. And sometimes it's just embedded and we cannot change anything.
Questions:
1) Is there a way to get back the old output. (like if we don't want the new interface name, we can go back to the old eth*)?
2) Why has it been changed?
thanks
Franck
|
ifconfig is being deprecated and uses deprecated ioctl to obtain information. You should switch to 'ip' for general use. 'ip uses netlink which is the modern way to do this.
It is
NOT SMART (tm) to create scripts or programs that depend on the specific format output of commands. That is amateurish. It's OK for a local hack, but does not belong in supported software. The text changed b/c the upstream developer thought the new text was better. The text output of these commands of is meant for humans and WILL change again.
Before we get to the question of HOW a script should get get the IP or MAC address, I think we should ask WHY is your script trying to get these ? Normally unless you are changing the interface you should just use the hostname of the interface and not the numerical IP. The MAC address is an 802.11 station identifier and not all networks use 802.11 - so this may be undesirable.
Sadly there is no good way to access I P& MAC from a script w/o writing some code. Maybe ther eis a perl or tcl libary t ouse netlink.