git.samba.org
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d392e0a
)
lib:socket: get interface index from kernel
author
Michael Adam
<obnox@samba.org>
Mon, 25 Jan 2016 11:23:40 +0000
(12:23 +0100)
committer
Michael Adam
<obnox@samba.org>
Tue, 26 Jan 2016 06:33:16 +0000
(07:33 +0100)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/socket/interfaces.c
patch
|
blob
|
history
diff --git
a/lib/socket/interfaces.c
b/lib/socket/interfaces.c
index e62da3c3a1f906012d61a789a6f2b12fda32c875..3b15615b8d1c0be710df1078abe20b1af2a55262 100644
(file)
--- a/
lib/socket/interfaces.c
+++ b/
lib/socket/interfaces.c
@@
-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)) {