GLIBC's name service switch doesn't provide a way to override getaddressinfo()
which is the only function that supports IPv6 link-local addresses.
IPv6 link-local addresses don't work without the interface name (when
written as text) that then translates to scope id.
This is actually needed for link-local name resolution (whatever NSS plugin is used for it then).
There's another usecase for getaddrinfo() in nsswitch and that is avoiding problems caused by solutions to bug 12377 including bug 12398. See discussions
in these two bug reports.
I assume you're speaking of such addresses as ipv6%zone, as specified in RFC 4007. That RFC only specifies (hex) numeric addresses in standard ipv6 format, folowed by a % and a zone id, that may be numeric, an interface name, or somesuch.
Since the address can only be numeric, without involving any lookups, and that and zone ids specified in that RFC are supported by existing getaddrinfo core implementation, what would the point be of introducing a getaddrinfo interface in the nss plugin interface?
There are name services that are capable of returning IPv6 link local addresses such as Multicast DNS. Those IPv6 link local addresses don't work as expected, though, as they miss the scope_id.
There are name resolution protocols that should avoid querying for IPv4/IPv6 data according to the system configuration when AI_ADDRCONFIG is set. On the other hand, for literal address translations, Multicast DNS and /etc/hosts, this is counter-productive, see the linked bug reports.
The gethostbyname4 features are not superset of gethostbyname3 features which means the API is not satisfactory whichever of them is used.