An IPv4 route with IPv6 gateways (RFC 5549, used by FRR's BGP
unnumbered) can have only one path: adding the second one fails with
EINVAL. Nexthops with an IPv6 gateway are linked to the IPv6
nh_control by nhop_get_rh(), and nhgrp_alloc() requires all members
to be in the nh_control of the group.
Accept members from the same fib and upper family. Nexthop indexes
are allocated per nh_control, so an IPv4 and an IPv6 member can have
the same index: sort the members by neighbor family and then index,
and detect duplicates by pointer.
decompose_change_notification() walks the old and new group in that
order, so use the same compare function there. Otherwise deleting a
path from a mixed group sends RTM_DELETE with the wrong gateway on
the routing socket.
netstat -On still shows IPv6 members of an IPv4 group wrong. That
needs the family in the group sysctl and is done separately.
Signed-off-by: Abdul Wasey <w453y.me@gmail.com>