Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/include/common.global.class.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2419 by niro, Mon Aug 31 09:02:48 2015 UTC revision 2420 by niro, Tue Sep 1 08:36:09 2015 UTC
# Line 267  dns_to_ip() Line 267  dns_to_ip()
267   set -- $(getent hosts $1)   set -- $(getent hosts $1)
268   echo $1   echo $1
269  }  }
270    
271    iface_for_ip()
272    {
273     set -- $(ip -o addr show to $1)
274     echo $2
275    }
276    
277    iface_for_mac()
278    {
279     local interface="" mac="$(echo $1 | sed 'y/ABCDEF/abcdef/')"
280     for interface in /sys/class/net/*; do
281     if [ $(cat $interface/address) = "$mac" ]; then
282     echo ${interface##*/}
283     fi
284     done
285    }
286    
287    mac_for_iface()
288    {
289     local iface="$1"
290     if [ -f /sys/class/net/${iface}/address ]
291     then
292     cat /sys/class/net/${iface}/address
293     fi
294    }

Legend:
Removed from v.2419  
changed lines
  Added in v.2420