feat: kernel network statistics reporting, new Network configuration applet
This commit is contained in:
@@ -274,6 +274,7 @@ int32_t ping(uint32_t ip, uint32_t timeoutMs); // Ping, returns RTT in ms (-1
|
||||
uint32_t resolve(const char* hostname); // DNS lookup, returns IPv4 (0 on failure)
|
||||
void get_netcfg(NetCfg* out); // Get network config
|
||||
int set_netcfg(const NetCfg* cfg); // Set network config
|
||||
int net_status(NetStatus* out); // Get link/driver/counter status
|
||||
```
|
||||
|
||||
### Sockets
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace Montauk {
|
||||
static constexpr uint64_t SYS_FMKDIR = 78;
|
||||
static constexpr uint64_t SYS_DRIVELIST = 79;
|
||||
static constexpr uint64_t SYS_DRIVELABEL = 124;
|
||||
static constexpr uint64_t SYS_NETSTATUS = 125;
|
||||
static constexpr uint64_t SYS_TERMSCALE = 43;
|
||||
static constexpr uint64_t SYS_RESOLVE = 44;
|
||||
static constexpr uint64_t SYS_GETRANDOM = 45;
|
||||
@@ -142,6 +143,16 @@ namespace Montauk {
|
||||
uint32_t dnsServer; // network byte order
|
||||
};
|
||||
|
||||
struct NetStatus {
|
||||
uint8_t initialized;
|
||||
uint8_t linkUp;
|
||||
uint8_t polling;
|
||||
uint8_t _pad0;
|
||||
char driver[32];
|
||||
uint64_t rxPackets;
|
||||
uint64_t txPackets;
|
||||
};
|
||||
|
||||
struct DateTime {
|
||||
uint16_t Year;
|
||||
uint8_t Month;
|
||||
|
||||
@@ -185,6 +185,7 @@ namespace montauk {
|
||||
// Network configuration
|
||||
inline void get_netcfg(Montauk::NetCfg* out) { syscall1(Montauk::SYS_GETNETCFG, (uint64_t)out); }
|
||||
inline int set_netcfg(const Montauk::NetCfg* cfg) { return (int)syscall1(Montauk::SYS_SETNETCFG, (uint64_t)cfg); }
|
||||
inline int net_status(Montauk::NetStatus* out) { return (int)syscall1(Montauk::SYS_NETSTATUS, (uint64_t)out); }
|
||||
|
||||
// Sockets
|
||||
inline int socket(int type) {
|
||||
|
||||
Reference in New Issue
Block a user