So what I'm looking for is an interface index (or name) but the real one.
if_nametoindex(3) and ioctl(2) don't seem to help me here. Now the only way I found how to do this is via /sys. Let me demonstrate on example what I need:
# cat /sys/class/net/bond0.1007/ifindex
26
# cat /sys/class/net/bond0.1007/iflink
23 <-- I need either this or a reference to bond0
# cat /sys/class/net/bond0/ifindex
23
Is there a way to do it with a function call or the only way is sysfs?