zcip.script 691 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/sh
  2. # only for use as a "zcip" callback script
  3. if [ "x$interface" = x ]
  4. then
  5. exit 1
  6. fi
  7. # zcip should start on boot/resume and various media changes
  8. case "$1" in
  9. init)
  10. # for now, zcip requires the link to be already up,
  11. # and it drops links when they go down. that isn't
  12. # the most robust model...
  13. exit 0
  14. ;;
  15. config)
  16. if [ "x$ip" = x ]
  17. then
  18. exit 1
  19. fi
  20. # remember $ip for $interface, to use on restart
  21. if [ "x$IP" != x -a -w "$IP.$interface" ]
  22. then
  23. echo $ip > "$IP.$interface"
  24. fi
  25. exec ip address add dev $interface \
  26. scope link local "$ip/16" broadcast +
  27. ;;
  28. deconfig)
  29. if [ x$ip = x ]
  30. then
  31. exit 1
  32. fi
  33. exec ip address del dev $interface local $ip
  34. ;;
  35. esac
  36. exit 1