1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-30 13:34:27 +01:00

Fixed network naming on Windows.

This commit is contained in:
Matias Fontanini
2014-09-07 23:48:37 -03:00
parent e0b9e38587
commit b532753a16
5 changed files with 62 additions and 10 deletions

View File

@@ -36,6 +36,7 @@
#include <winsock2.h>
#include <iphlpapi.h>
#undef interface
#include "network_interface.h"
#endif
#include "macros.h"
#if defined(BSD) || defined(__FreeBSD_kernel__)
@@ -389,9 +390,8 @@ void Tins::Utils::route_entries(ForwardIterator output) {
for (DWORD i = 0; i < table->dwNumEntries; i++) {
MIB_IPFORWARDROW *row = &table->table[i];
if(row->dwForwardType == MIB_IPROUTE_TYPE_INDIRECT) {
if_indextoname(row->dwForwardIfIndex, iface_name);
RouteEntry entry;
entry.interface = iface_name;
entry.interface = NetworkInterface::from_index(row->dwForwardIfIndex).name();
entry.destination = IPv4Address(row->dwForwardDest);
entry.mask = IPv4Address(row->dwForwardMask);
entry.gateway = IPv4Address(row->dwForwardNextHop);