comgt: fireup a dhcpv6-client for directip as well
[openwrt/staging/chunkeey.git] / package / network / utils / comgt / files / directip.sh
index f09d938b097a214a0a219b687c771c51485a85dd..2bfdf8051662a9bd8c4cbcd2a21b1765a3e8ea16 100644 (file)
@@ -8,7 +8,6 @@ proto_directip_init_config() {
        available=1
        no_device=1
        proto_config_add_string "device:device"
-       proto_config_add_string "ifname"
        proto_config_add_string "apn"
        proto_config_add_string "pincode"
        proto_config_add_string "auth"
@@ -18,10 +17,10 @@ proto_directip_init_config() {
 
 proto_directip_setup() {
        local interface="$1"
-       local chat
+       local chat devpath devname
 
        local device apn pincode ifname auth username password
-       json_get_vars device apn pincode ifname auth username password
+       json_get_vars device apn pincode auth username password
 
        [ -e "$device" ] || {
                proto_notify_error "$interface" NO_DEVICE
@@ -29,6 +28,10 @@ proto_directip_setup() {
                return 1
        }
 
+       devname="$(basename "$device")"
+       devpath="$(readlink -f /sys/class/tty/$devname/device)"
+       ifname="$( ls "$devpath"/../../*/net )"
+
        [ -n "$ifname" ] || {
                proto_notify_error "$interface" NO_IFNAME
                proto_set_available "$interface" 0
@@ -75,6 +78,12 @@ proto_directip_setup() {
        json_add_string proto "dhcp"
        ubus call network add_dynamic "$(json_dump)"
 
+       json_init
+       json_add_string name "${interface}_dhcpv6"
+       json_add_string ifname "@$interface"
+       json_add_string proto "dhcpv6"
+       ubus call network add_dynamic "$(json_dump)"
+
        return 0
 }