1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-24 11:11:35 +01:00

Added another overload of Utils::route_entries and fixed a bug in Utils::network_interfaces.

This commit is contained in:
Matias Fontanini
2013-11-02 19:19:55 -03:00
parent 0b02af616a
commit dfbbea33d5
2 changed files with 16 additions and 3 deletions

View File

@@ -62,12 +62,12 @@ struct InterfaceCollector {
#ifdef WIN32
bool operator() (PIP_ADAPTER_ADDRESSES addr) {
ifaces.insert(addr->AdapterName);
return true;
return false;
}
#else
bool operator() (struct ifaddrs *addr) {
ifaces.insert(addr->ifa_name);
return true;
return false;
}
#endif
};
@@ -121,6 +121,12 @@ HWAddress<6> resolve_hwaddr(IPv4Address ip, PacketSender &sender) {
return resolve_hwaddr(sender.default_interface(), ip, sender);
}
std::vector<RouteEntry> route_entries() {
std::vector<RouteEntry> entries;
route_entries(std::back_inserter(entries));
return entries;
}
bool gateway_from_ip(IPv4Address ip, IPv4Address &gw_addr) {
typedef std::vector<RouteEntry> entries_type;
entries_type entries;