diff options
Diffstat (limited to 'net.Linux/ifconfig.sh')
-rw-r--r-- | net.Linux/ifconfig.sh | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/net.Linux/ifconfig.sh b/net.Linux/ifconfig.sh index 637c42f5..0b0af979 100644 --- a/net.Linux/ifconfig.sh +++ b/net.Linux/ifconfig.sh @@ -6,22 +6,6 @@ ifconfig_depend() { provide interface } -_get_mac_address() { - local mac=$(LC_ALL=C ifconfig "${IFACE}" | \ - sed -n -e 's/.* HWaddr \(..:..:..:..:..:..\).*/\1/p') - - - case "${mac}" in - 00:00:00:00:00:00) ;; - 44:44:44:44:44:44) ;; - FF:FF:FF:FF:FF:FF) ;; - "") ;; - *) echo "${mac}"; return 0 ;; - esac - - return 1 -} - _up() { ifconfig "${IFACE}" up } @@ -54,6 +38,26 @@ _is_wireless() { grep -Eq "^[[:space:]]*${IFACE}:[[:space:]]+" /proc/net/wireless } +_get_mac_address() { + local mac=$(LC_ALL=C ifconfig "${IFACE}" | \ + sed -n -e 's/.* HWaddr \(..:..:..:..:..:..\).*/\1/p') + + + case "${mac}" in + 00:00:00:00:00:00) ;; + 44:44:44:44:44:44) ;; + FF:FF:FF:FF:FF:FF) ;; + "") ;; + *) echo "${mac}"; return 0 ;; + esac + + return 1 +} + +_set_mac_address() { + ifconfig "${IFACE}" hw ether "$1" +} + _get_inet_address() { set -- $(LC_ALL=C ifconfig "${IFACE}" | sed -n -e 's/.*inet addr:\([^ ]*\).*Mask:\([^ ]*\).*/\1 \2/p') |