| 1 |
# This file is part of the FreeWRT project. FreeWRT is copyrighted |
| 2 |
# material, please see the LICENCE file in the top-level directory |
| 3 |
# or at http://www.freewrt.org/licence for details. |
| 4 |
#- |
| 5 |
# plugin to set the link-layer address |
| 6 |
# © Thorsten Glaser <tg@freewrt.org> |
| 7 |
|
| 8 |
lladdr_preup() { |
| 9 |
[[ -z $IF_LLADDR ]] && return 0 |
| 10 |
case $IF_LLADDR in |
| 11 |
[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]) ;; |
| 12 |
*) |
| 13 |
echo "lladdr: invalid address '$IF_LLADDR' entered" |
| 14 |
return 0 |
| 15 |
;; |
| 16 |
esac |
| 17 |
[[ -n $IFACE ]] || return 0 |
| 18 |
ip link set addr $IF_LLADDR dev "$IFACE" |
| 19 |
} |