feat: add NTP; fix networking bugs/regressions
This commit is contained in:
1 parent
a288dee7df
commit
d99dab45e5
26 files changed
+809
-47
No files matched your search
@@ -12,4 +12,4 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define MONTAUK_BUILD_NUMBER 8
|
||||
#define MONTAUK_BUILD_NUMBER 17
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <Timekeeping/ApicTimer.hpp>
|
||||
#include <Net/Icmp.hpp>
|
||||
#include <Net/Dns.hpp>
|
||||
#include <Net/Ipv4.hpp>
|
||||
#include <Net/Socket.hpp>
|
||||
#include <Net/NetConfig.hpp>
|
||||
#include <Drivers/Net/E1000.hpp>
|
||||
@@ -82,6 +83,10 @@ namespace montauk::abi {
|
||||
|
||||
static int Sys_RecvFrom(int fd, uint8_t* buf, uint32_t maxLen,
|
||||
uint32_t* srcIp, uint16_t* srcPort) {
|
||||
// A preceding UDP send may be queued while ARP resolves the next hop.
|
||||
// Drive the pending IPv4 queue on each non-blocking receive so a lost
|
||||
// initial ARP request is retried without unrelated network traffic.
|
||||
Net::Ipv4::FlushPending();
|
||||
return Net::Socket::RecvFrom(fd, buf, maxLen, srcIp, srcPort, Sched::GetCurrentPid());
|
||||
}
|
||||
|
||||
|
||||
@@ -174,6 +174,8 @@ namespace montauk::abi {
|
||||
if (!UserMemory::Writable<DateTime>(frame->arg1)) return -1;
|
||||
Sys_GetTime((DateTime*)frame->arg1);
|
||||
return 0;
|
||||
case SYS_SETUNIXTIME:
|
||||
return Sys_SetUnixTime((int64_t)frame->arg1);
|
||||
case SYS_SOCKET:
|
||||
return (int64_t)Sys_Socket((int)frame->arg1);
|
||||
case SYS_CONNECT:
|
||||
@@ -556,7 +558,7 @@ namespace montauk::abi {
|
||||
Hal::WriteMSR(Hal::IA32_FMASK, 0x200);
|
||||
|
||||
Kt::KernelLogStream(Kt::OK, "Syscall") << "SYSCALL/SYSRET initialized (LSTAR="
|
||||
<< kcp::hex << (uint64_t)SyscallEntry << kcp::dec << ", 124 syscall slots)";
|
||||
<< kcp::hex << (uint64_t)SyscallEntry << kcp::dec << ", 154 syscall slots)";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -287,6 +287,7 @@ namespace montauk::abi {
|
||||
|
||||
// Path metadata (size, timestamps, mode). (const char* path, FileStat* out) -> 0, -1 on error/unsupported.
|
||||
static constexpr uint64_t SYS_STAT = 152;
|
||||
static constexpr uint64_t SYS_SETUNIXTIME = 153;
|
||||
|
||||
// Tunable parameters (for SYS_SDR_SETPARAM / SYS_SDR_GETPARAM).
|
||||
static constexpr int SDR_PARAM_FREQ = 0; // center frequency, Hz
|
||||
|
||||
@@ -38,4 +38,8 @@ namespace montauk::abi {
|
||||
static int64_t Sys_GetTZ() {
|
||||
return (int64_t)Timekeeping::GetTZOffset();
|
||||
}
|
||||
};
|
||||
|
||||
static int64_t Sys_SetUnixTime(int64_t unixSeconds) {
|
||||
return Timekeeping::SetUnixTimestamp(unixSeconds) ? 0 : -1;
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user