clang-format
This commit is contained in:
parent
4944a5179c
commit
e309253fc8
@ -1,7 +1,5 @@
|
|||||||
#include "adapters/net.hpp"
|
#include "adapters/net.hpp"
|
||||||
|
|
||||||
#include <iomanip>
|
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <linux/ethtool.h>
|
#include <linux/ethtool.h>
|
||||||
#include <linux/if_link.h>
|
#include <linux/if_link.h>
|
||||||
@ -12,6 +10,8 @@
|
|||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "settings.hpp"
|
#include "settings.hpp"
|
||||||
#include "utils/command.hpp"
|
#include "utils/command.hpp"
|
||||||
@ -88,18 +88,18 @@ namespace net {
|
|||||||
char ip6_buffer[INET6_ADDRSTRLEN];
|
char ip6_buffer[INET6_ADDRSTRLEN];
|
||||||
sa6 = reinterpret_cast<decltype(sa6)>(ifa->ifa_addr);
|
sa6 = reinterpret_cast<decltype(sa6)>(ifa->ifa_addr);
|
||||||
if (IN6_IS_ADDR_LINKLOCAL(&sa6->sin6_addr)) {
|
if (IN6_IS_ADDR_LINKLOCAL(&sa6->sin6_addr)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (IN6_IS_ADDR_SITELOCAL(&sa6->sin6_addr)) {
|
if (IN6_IS_ADDR_SITELOCAL(&sa6->sin6_addr)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((((unsigned char*)sa6->sin6_addr.s6_addr)[0] & 0xFE) == 0xFC) {
|
if ((((unsigned char*)sa6->sin6_addr.s6_addr)[0] & 0xFE) == 0xFC) {
|
||||||
/* Skip Unique Local Addresses (fc00::/7) */
|
/* Skip Unique Local Addresses (fc00::/7) */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (inet_ntop(AF_INET6, &sa6->sin6_addr, ip6_buffer, INET6_ADDRSTRLEN) == 0) {
|
if (inet_ntop(AF_INET6, &sa6->sin6_addr, ip6_buffer, INET6_ADDRSTRLEN) == 0) {
|
||||||
m_log.warn("inet_ntop() " + string(strerror(errno)));
|
m_log.warn("inet_ntop() " + string(strerror(errno)));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
m_status.ip6 = string{ip6_buffer};
|
m_status.ip6 = string{ip6_buffer};
|
||||||
break;
|
break;
|
||||||
@ -209,7 +209,6 @@ namespace net {
|
|||||||
if (strncmp(driver.driver, "bridge", 6) == 0) {
|
if (strncmp(driver.driver, "bridge", 6) == 0) {
|
||||||
m_bridge = true;
|
m_bridge = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -257,7 +256,7 @@ namespace net {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_bridge) {
|
if (m_bridge) {
|
||||||
/* If bridge network then link speed cannot be computed
|
/* If bridge network then link speed cannot be computed
|
||||||
* TODO: Identify the physical network in bridge and compute the link speed
|
* TODO: Identify the physical network in bridge and compute the link speed
|
||||||
*/
|
*/
|
||||||
@ -309,7 +308,9 @@ namespace net {
|
|||||||
* about the current connection
|
* about the current connection
|
||||||
*/
|
*/
|
||||||
string wired_network::linkspeed() const {
|
string wired_network::linkspeed() const {
|
||||||
return m_linkspeed == -1 ? "N/A" : (m_linkspeed < 1000 ? (to_string(m_linkspeed) + " Mbit/s") : (to_string(m_linkspeed / 1000) + " Gbit/s"));
|
return m_linkspeed == -1 ? "N/A"
|
||||||
|
: (m_linkspeed < 1000 ? (to_string(m_linkspeed) + " Mbit/s")
|
||||||
|
: (to_string(m_linkspeed / 1000) + " Gbit/s"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// }}}
|
// }}}
|
||||||
|
Loading…
Reference in New Issue
Block a user