OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2 KiB

  1. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # T2 SDE: package/.../iproute2/rocknet_iproute2.sh
  5. # Copyright (C) 2004 - 2006 The T2 SDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; version 2 of the License. A copy of the
  12. # GNU General Public License can be found in the file COPYING.
  13. # --- T2-COPYRIGHT-NOTE-END ---
  14. iproute2_init_if() {
  15. if isfirst "iproute2_$if"; then
  16. addcode up 5 4 "ip link set $if up"
  17. addcode down 5 4 "ip link set $if down"
  18. addcode down 5 5 "ip addr flush dev $if"
  19. fi
  20. }
  21. public_ip() {
  22. ip="${1%/*}"
  23. # common config error sanity check
  24. [ $ip = $1 ] &&
  25. echo "WARNING: IP has no CIDR network prefix (e.g. /24)!"
  26. addcode up 5 5 "ip addr add $1 broadcast + dev $if"
  27. iproute2_init_if
  28. }
  29. public_gw() {
  30. code="ip route append default via $1 dev $if" ; shift
  31. case "$1" in
  32. metric)
  33. code="$code metric $2" ; shift ;;
  34. esac
  35. shift
  36. addcode up 6 5 "$code"
  37. iproute2_init_if
  38. }
  39. public_mac() {
  40. addcode up 4 3 "ip link set $if address $1"
  41. iproute2_init_if
  42. }