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 'noslaaconly:bool'
15 proto_config_add_string 'forceprefix:bool'
16 proto_config_add_string 'norelease:bool'
17 proto_config_add_string 'ip6prefix:ip6addr'
18 proto_config_add_string iface_dslite
19 proto_config_add_string zone_dslite
20 proto_config_add_string iface_map
21 proto_config_add_string zone_map
22 proto_config_add_string iface_464xlat
23 proto_config_add_string zone_464xlat
24 proto_config_add_string zone
25 proto_config_add_string 'ifaceid:ip6addr'
26 proto_config_add_string "userclass"
27 proto_config_add_string "vendorclass"
28 proto_config_add_boolean delegate
29 proto_config_add_int "soltimeout"
30 proto_config_add_boolean fakeroutes
31 proto_config_add_boolean sourcefilter
34 proto_dhcpv6_setup() {
38 local reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter
39 json_get_vars reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter
44 [ -n "$reqaddress" ] && append opts "-N$reqaddress"
46 [ -z "$reqprefix" -o "$reqprefix" = "auto" ] && reqprefix=0
47 [ "$reqprefix" != "no" ] && append opts "-P$reqprefix"
49 [ -n "$clientid" ] && append opts "-c$clientid"
51 [ "$noslaaconly" = "1" ] && append opts "-S"
53 [ "$forceprefix" = "1" ] && append opts "-F"
55 [ "$norelease" = "1" ] && append opts "-k"
57 [ -n "$ifaceid" ] && append opts "-i$ifaceid"
59 [ -n "$vendorclass" ] && append opts "-V$vendorclass"
61 [ -n "$userclass" ] && append opts "-u$userclass"
63 for opt in $reqopts; do
67 append opts "-t${soltimeout:-120}"
69 [ -n "$ip6prefix" ] && proto_export "USERPREFIX=$ip6prefix"
70 [ -n "$iface_dslite" ] && proto_export "IFACE_DSLITE=$iface_dslite"
71 [ -n "$iface_map" ] && proto_export "IFACE_MAP=$iface_map"
72 [ -n "$iface_464xlat" ] && proto_export "IFACE_464XLAT=$iface_464xlat"
73 [ "$delegate" = "0" ] && proto_export "IFACE_DSLITE_DELEGATE=0"
74 [ "$delegate" = "0" ] && proto_export "IFACE_MAP_DELEGATE=0"
75 [ -n "$zone_dslite" ] && proto_export "ZONE_DSLITE=$zone_dslite"
76 [ -n "$zone_map" ] && proto_export "ZONE_MAP=$zone_map"
77 [ -n "$zone_464xlat" ] && proto_export "ZONE_464XLAT=$zone_464xlat"
78 [ -n "$zone" ] && proto_export "ZONE=$zone"
79 [ "$fakeroutes" != "0" ] && proto_export "FAKE_ROUTES=1"
80 [ "$sourcefilter" = "0" ] && proto_export "NOSOURCEFILTER=1"
82 proto_export "INTERFACE=$config"
83 proto_run_command "$config" odhcp6c \
84 -s /lib/netifd/dhcpv6.script \
88 proto_dhcpv6_renew() {
90 # SIGUSR1 forces odhcp6c to renew its lease
91 local sigusr1="$(kill -l SIGUSR1)"
92 [ -n "$sigusr1" ] && proto_kill_command "$interface" $sigusr1
95 proto_dhcpv6_teardown() {
97 proto_kill_command "$interface"