summaryrefslogtreecommitdiff
path: root/aports/dhcpcd/99-radvd.conf
blob: 8bab6743f76efbb7dbdaaceb4c6cde33424ba7cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Update domain name server IPv6 addresses and
# restart radvd on reconfiguration of the interface.

RESOLV_CONF="/etc/resolv.conf"
RADVD_CONF="/tmp/radvd.conf"
RADVD_CONF_TEMPLATE="/etc/radvd.conf"

if $if_configured; then
  [ ! -f "$RESOLV_CONF" ] && return 

  # Filter resolv.conf to get the IPv6 name servers
  # only.
  dns=$(grep -F nameserver $RESOLV_CONF | cut -c 12- | grep -E "^[0-9]*:")

  cat $RADVD_CONF_TEMPLATE \
    | sed "s!%%DNS%%!$dns!" \
    > $RADVD_CONF
  chmod a+r "$RADVD_CONF"
  service radvd --ifstarted restart
fi