odhcp6c: Add renew handler for proto dhcpv6
authorFelix Fietkau <nbd@openwrt.org>
Sat, 5 Apr 2014 18:17:25 +0000 (18:17 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 5 Apr 2014 18:17:25 +0000 (18:17 +0000)
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
SVN-Revision: 40386

package/network/ipv6/odhcp6c/files/dhcpv6.sh

index 9b6275e3f97b921c89e6aac477bbde9dd1a423a0..90a83718e527120d5b0f33c450f4db47ad7492d0 100755 (executable)
@@ -5,6 +5,8 @@
 init_proto "$@"
 
 proto_dhcpv6_init_config() {
 init_proto "$@"
 
 proto_dhcpv6_init_config() {
+       renew_handler=1
+
        proto_config_add_string 'reqaddress:or("try","force","none")'
        proto_config_add_string 'reqprefix:or("auto","no",range(0, 64))'
        proto_config_add_string clientid
        proto_config_add_string 'reqaddress:or("try","force","none")'
        proto_config_add_string 'reqprefix:or("auto","no",range(0, 64))'
        proto_config_add_string clientid
@@ -67,6 +69,13 @@ proto_dhcpv6_setup() {
                $opts $iface
 }
 
                $opts $iface
 }
 
+proto_dhcpv6_renew() {
+       local interface="$1"
+       # SIGUSR1 forces odhcp6c to renew its lease
+       local sigusr1="$(kill -l SIGUSR1)"
+       [ -n "$sigusr1" ] && proto_kill_command "$interface" $sigusr1
+}
+
 proto_dhcpv6_teardown() {
        local interface="$1"
        proto_kill_command "$interface"
 proto_dhcpv6_teardown() {
        local interface="$1"
        proto_kill_command "$interface"