build,json: fix build failure in case no data is found
[openwrt/openwrt.git] / package / network / services / ppp / files / lib / netifd / ppp6-up
1 #!/bin/sh
2 PPP_IPPARAM="$6"
3
4 . /lib/netifd/netifd-proto.sh
5 proto_init_update "$IFNAME" 1 1
6 proto_set_keep 1
7 [ -n "$PPP_IPPARAM" ] && {
8 [ -n "$LLLOCAL" ] && proto_add_ipv6_address "$LLLOCAL" 128
9 }
10 proto_send_update "$PPP_IPPARAM"
11
12 [ -d /etc/ppp/ip-up.d ] && {
13 for SCRIPT in /etc/ppp/ip-up.d/*
14 do
15 [ -x "$SCRIPT" ] && "$SCRIPT" "$@"
16 done
17 }
18
19 if [ -n "$AUTOIPV6" ]; then
20 ZONE=$(fw3 -q network $PPP_IPPARAM 2>/dev/null)
21
22 json_init
23 json_add_string name "${PPP_IPPARAM}_6"
24 json_add_string ifname "@$PPP_IPPARAM"
25 json_add_string proto "dhcpv6"
26 [ -n "$ZONE" ] && json_add_string zone "$ZONE"
27 [ -n "$EXTENDPREFIX" ] && json_add_string extendprefix 1
28 [ -n "$IP6TABLE" ] && json_add_string ip6table $IP6TABLE
29 [ -n "$PEERDNS" ] && json_add_boolean peerdns $PEERDNS
30 json_close_object
31 ubus call network add_dynamic "$(json_dump)"
32 fi