Network_get_ipaddr6 is not getting ipv6 address from wan :(

Let me know if I'm doing it wrong, but...
root@EA8500:~# . /lib/functions/
root@EA8500:~# network_get_ipaddr6 ipv6wan wan; echo $ipv6wan

root@EA8500:~# ifconfig eth0.2
eth0.2    Link encap:Ethernet  HWaddr **:**:**:**:**:**
          inet addr:**.***.***.***  Bcast:**.**.***.***  Mask:
          inet6 addr: fe80::****:****:****:***/64 Scope:Link
          RX packets:13671531 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10265232 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:20899685116 (19.4 GiB)  TX bytes:1691274934 (1.5 GiB)

So howcome I'm not getting that inet6 addr thru network_get_ipaddr6?

PS. Can't get it to format properly with discourse -- it should be one big blockquote.

That function is intended to return an ULA or global IPv6 address, and that only if netifd knows about it. The address above is a link local one which you need to find using other means.

Is there a function I could use? Neither network_get_ipaddrs_all nor ubus call network.interface.wan status return the IPv6 address displayed by ifconfig.
Should I determine the WAN interface name with network_get_physdev and then screen scrape ifconfig? Is there a better option?

@jow -- pretty please comment on the above.

Yes, you need to scrape ifconfig / ip if you're really interested in the link-local addess