7 proto_dhcpv6_init_config() {
10 proto_config_add_string 'reqaddress:or("try","force","none")'
11 proto_config_add_string 'reqprefix:or("auto","no",range(0, 64))'
12 proto_config_add_string clientid
13 proto_config_add_string 'reqopts:list(uinteger)'
14 proto_config_add_string 'defaultreqopts:bool'
15 proto_config_add_string 'noslaaconly:bool'
16 proto_config_add_string 'forceprefix:bool'
17 proto_config_add_string 'extendprefix:bool'
18 proto_config_add_string 'norelease:bool'
19 proto_config_add_string 'noserverunicast:bool'
20 proto_config_add_string 'noclientfqdn:bool'
21 proto_config_add_string 'noacceptreconfig:bool'
22 proto_config_add_array 'ip6prefix:list(ip6addr)'
23 proto_config_add_string iface_dslite
24 proto_config_add_string zone_dslite
25 proto_config_add_string encaplimit_dslite
26 proto_config_add_string iface_map
27 proto_config_add_string zone_map
28 proto_config_add_string encaplimit_map
29 proto_config_add_string iface_464xlat
30 proto_config_add_string zone_464xlat
31 proto_config_add_string zone
32 proto_config_add_string 'ifaceid:ip6addr'
33 proto_config_add_string "userclass"
34 proto_config_add_string "vendorclass"
35 proto_config_add_array "sendopts:list(string)"
36 proto_config_add_boolean delegate
37 proto_config_add_int "soltimeout"
38 proto_config_add_boolean fakeroutes
39 proto_config_add_boolean sourcefilter
40 proto_config_add_boolean keep_ra_dnslifetime
41 proto_config_add_int "ra_holdoff"
44 proto_dhcpv6_add_prefix() {
48 proto_dhcpv6_add_sendopts() {
49 [ -n "$1" ] && append "$3" "-x$1"
52 proto_dhcpv6_setup() {
56 local reqaddress reqprefix clientid reqopts defaultreqopts noslaaconly forceprefix extendprefix norelease noserverunicast noclientfqdn noacceptreconfig ip6prefix ip6prefixes iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass sendopts delegate zone_dslite zone_map zone_464xlat zone encaplimit_dslite encaplimit_map soltimeout fakeroutes sourcefilter keep_ra_dnslifetime ra_holdoff
57 json_get_vars reqaddress reqprefix clientid reqopts defaultreqopts noslaaconly forceprefix extendprefix norelease noserverunicast noclientfqdn noacceptreconfig iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone encaplimit_dslite encaplimit_map soltimeout fakeroutes sourcefilter keep_ra_dnslifetime ra_holdoff
58 json_for_each_item proto_dhcpv6_add_prefix ip6prefix ip6prefixes
62 [ -n "$reqaddress" ] && append opts "-N$reqaddress"
64 [ -z "$reqprefix" -o "$reqprefix" = "auto" ] && reqprefix=0
65 [ "$reqprefix" != "no" ] && append opts "-P$reqprefix"
67 [ -n "$clientid" ] && append opts "-c$clientid"
69 [ "$defaultreqopts" = "0" ] && append opts "-R"
71 [ "$noslaaconly" = "1" ] && append opts "-S"
73 [ "$forceprefix" = "1" ] && append opts "-F"
75 [ "$norelease" = "1" ] && append opts "-k"
77 [ "$noserverunicast" = "1" ] && append opts "-U"
79 [ "$noclientfqdn" = "1" ] && append opts "-f"
81 [ "$noacceptreconfig" = "1" ] && append opts "-a"
83 [ -n "$ifaceid" ] && append opts "-i$ifaceid"
85 [ -n "$vendorclass" ] && append opts "-V$vendorclass"
87 [ -n "$userclass" ] && append opts "-u$userclass"
89 [ "$keep_ra_dnslifetime" = "1" ] && append opts "-L"
91 [ -n "$ra_holdoff" ] && append opts "-m$ra_holdoff"
94 for opt in $reqopts; do
98 json_for_each_item proto_dhcpv6_add_sendopts sendopts opts
100 append opts "-t${soltimeout:-120}"
102 [ -n "$ip6prefixes" ] && proto_export "USERPREFIX=$ip6prefixes"
103 [ -n "$iface_dslite" ] && proto_export "IFACE_DSLITE=$iface_dslite"
104 [ -n "$iface_map" ] && proto_export "IFACE_MAP=$iface_map"
105 [ -n "$iface_464xlat" ] && proto_export "IFACE_464XLAT=$iface_464xlat"
106 [ "$delegate" = "0" ] && proto_export "IFACE_DSLITE_DELEGATE=0"
107 [ "$delegate" = "0" ] && proto_export "IFACE_MAP_DELEGATE=0"
108 [ -n "$zone_dslite" ] && proto_export "ZONE_DSLITE=$zone_dslite"
109 [ -n "$zone_map" ] && proto_export "ZONE_MAP=$zone_map"
110 [ -n "$zone_464xlat" ] && proto_export "ZONE_464XLAT=$zone_464xlat"
111 [ -n "$zone" ] && proto_export "ZONE=$zone"
112 [ -n "$encaplimit_dslite" ] && proto_export "ENCAPLIMIT_DSLITE=$encaplimit_dslite"
113 [ -n "$encaplimit_map" ] && proto_export "ENCAPLIMIT_MAP=$encaplimit_map"
114 [ "$fakeroutes" != "0" ] && proto_export "FAKE_ROUTES=1"
115 [ "$sourcefilter" = "0" ] && proto_export "NOSOURCEFILTER=1"
116 [ "$extendprefix" = "1" ] && proto_export "EXTENDPREFIX=1"
118 proto_export "INTERFACE=$config"
119 proto_run_command "$config" odhcp6c \
120 -s /lib/netifd/dhcpv6.script \
124 proto_dhcpv6_renew() {
126 # SIGUSR1 forces odhcp6c to renew its lease
127 local sigusr1="$(kill -l SIGUSR1)"
128 [ -n "$sigusr1" ] && proto_kill_command "$interface" $sigusr1
131 proto_dhcpv6_teardown() {
133 proto_kill_command "$interface"