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.

42 lines
990 B

  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2012 OpenWrt.org
  3. START=91
  4. SERVICE_SIG="KILL"
  5. SERVICE_PID_FILE="/var/run/dhcrelay6.pid"
  6. SERVICE_USE_PID=1
  7. start() {
  8. local relay_dhcpserver
  9. local relay_upper
  10. local relay_lowers
  11. local relay_lower_args
  12. config_load dhcrelay
  13. config_get relay_dhcpserver ipv6 dhcpserver
  14. config_get relay_upper ipv6 upper
  15. config_get relay_lowers ipv6 lower
  16. # If a specific DHCP server is specified,
  17. # add it to the upper interface.
  18. if [ -n "$relay_dhcpserver" ]; then
  19. relay_upper="${relay_dhcpserver}%$relay_upper"
  20. fi
  21. # Add all lower interfaces at the end.
  22. if [ -n "$relay_lowers" ]; then
  23. local relay_lower
  24. for relay_lower in $relay_lowers; do
  25. append relay_lower_args "-U $relay_lower"
  26. done
  27. fi
  28. service_start /usr/sbin/dhcrelay -6 -q \
  29. -pf $SERVICE_PID_FILE \
  30. -u $relay_upper $relay_lower_args
  31. }
  32. stop() {
  33. service_stop /usr/sbin/dhcrelay
  34. }