1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

lib:socket: get interface index from kernel

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Michael Adam 2016-01-25 12:23:40 +01:00
parent d392e0a66d
commit 235f37baa7

View File

@ -214,6 +214,12 @@ static int _get_interfaces(TALLOC_CTX *mem_ctx, struct iface_struct **pifaces)
continue;
}
ifaces[total].if_index = if_nametoindex(ifptr->ifa_name);
if (ifaces[total].if_index == 0) {
DBG_ERR("Failed to retrieve interface index for '%s': "
"%s\n", ifptr->ifa_name, strerror(errno));
}
if (strlcpy(ifaces[total].name, ifptr->ifa_name,
sizeof(ifaces[total].name)) >=
sizeof(ifaces[total].name)) {