feat: kernel network statistics reporting, new Network configuration applet

This commit is contained in:
2026-05-03 10:45:33 +02:00
parent 017a8a28ac
commit af48ab0e1e
28 changed files with 1167 additions and 115 deletions
+37
View File
@@ -107,6 +107,43 @@ namespace Montauk {
out->dnsServer = Net::GetDnsServer();
}
static void CopyNetStatusDriver(char* dst, const char* src) {
static constexpr uint64_t DriverNameBytes = 32;
if (!dst) return;
uint64_t i = 0;
for (; i < DriverNameBytes - 1 && src && src[i]; i++) {
dst[i] = src[i];
}
dst[i] = '\0';
}
static void Sys_NetStatus(NetStatus* out) {
if (out == nullptr) return;
out->initialized = 0;
out->linkUp = 0;
out->polling = 0;
out->_pad0 = 0;
out->rxPackets = 0;
out->txPackets = 0;
CopyNetStatusDriver(out->driver, "No adapter");
if (Drivers::Net::E1000::IsInitialized()) {
out->initialized = 1;
out->linkUp = Drivers::Net::E1000::IsLinkUp() ? 1 : 0;
out->rxPackets = Drivers::Net::E1000::GetRxPacketCount();
out->txPackets = Drivers::Net::E1000::GetTxPacketCount();
CopyNetStatusDriver(out->driver, "Intel 82540EM");
} else if (Drivers::Net::E1000E::IsInitialized()) {
out->initialized = 1;
out->linkUp = Drivers::Net::E1000E::IsLinkUp() ? 1 : 0;
out->polling = Drivers::Net::E1000E::RequiresPolling() ? 1 : 0;
out->rxPackets = Drivers::Net::E1000E::GetRxPacketCount();
out->txPackets = Drivers::Net::E1000E::GetTxPacketCount();
CopyNetStatusDriver(out->driver, "Intel e1000e");
}
}
static int Sys_SetNetCfg(const NetCfg* in) {
if (in == nullptr) return -1;
Net::SetIpAddress(in->ipAddress);