|
@@ -4,7 +4,7 @@
|
|
|
<meta charset="utf-8">
|
|
<meta charset="utf-8">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
<title>Networking | NebOS Architecture</title>
|
|
<title>Networking | NebOS Architecture</title>
|
|
|
-<meta name="description" content="NebOS networking: the netdev registry and NIC drivers, ARP/ICMP/UDP, DHCP, DNS, the TCP client and listener, TLS 1.3, sys_net ownership, netconsole and netkexec.">
|
|
|
|
|
|
|
+<meta name="description" content="NebOS networking: the netdev registry and NIC drivers, ARP/ICMP/UDP, DHCP, DNS, NTP, the TCP client and listener, TLS 1.3, sys_net ownership, netconsole and netkexec.">
|
|
|
<link rel="icon" href="favicon.svg" type="image/svg+xml">
|
|
<link rel="icon" href="favicon.svg" type="image/svg+xml">
|
|
|
<link rel="stylesheet" href="style.css">
|
|
<link rel="stylesheet" href="style.css">
|
|
|
</head>
|
|
</head>
|
|
@@ -42,7 +42,7 @@
|
|
|
</p>
|
|
</p>
|
|
|
<div class="meta">
|
|
<div class="meta">
|
|
|
<span class="pill">ARP · ICMP · UDP · TCP</span>
|
|
<span class="pill">ARP · ICMP · UDP · TCP</span>
|
|
|
- <span class="pill">DHCP · DNS</span>
|
|
|
|
|
|
|
+ <span class="pill">DHCP · DNS · NTP</span>
|
|
|
<span class="pill">TLS 1.3 · X25519</span>
|
|
<span class="pill">TLS 1.3 · X25519</span>
|
|
|
<span class="pill">netconsole + netkexec</span>
|
|
<span class="pill">netconsole + netkexec</span>
|
|
|
</div>
|
|
</div>
|
|
@@ -54,7 +54,7 @@
|
|
|
<li><a href="#stack">Protocol stack</a></li>
|
|
<li><a href="#stack">Protocol stack</a></li>
|
|
|
<li><a href="#netdev">NIC drivers</a></li>
|
|
<li><a href="#netdev">NIC drivers</a></li>
|
|
|
<li><a href="#core">Link & IP layer</a></li>
|
|
<li><a href="#core">Link & IP layer</a></li>
|
|
|
- <li><a href="#dhcp">DHCP & DNS</a></li>
|
|
|
|
|
|
|
+ <li><a href="#dhcp">DHCP, DNS & NTP</a></li>
|
|
|
<li><a href="#tcp">TCP</a></li>
|
|
<li><a href="#tcp">TCP</a></li>
|
|
|
<li><a href="#tls">TLS</a></li>
|
|
<li><a href="#tls">TLS</a></li>
|
|
|
<li><a href="#abi">sys_net ABI</a></li>
|
|
<li><a href="#abi">sys_net ABI</a></li>
|
|
@@ -77,10 +77,10 @@
|
|
|
<figure class="figure">
|
|
<figure class="figure">
|
|
|
<svg viewBox="0 0 920 380" role="img" aria-labelledby="net-title net-desc">
|
|
<svg viewBox="0 0 920 380" role="img" aria-labelledby="net-title net-desc">
|
|
|
<title id="net-title">NebOS network stack</title>
|
|
<title id="net-title">NebOS network stack</title>
|
|
|
- <desc id="net-desc">Ring-3 curl, browser and websrv use uhttp and TLS, then sys_net syscalls, then TCP/DNS/DHCP, IPv4/ARP/ICMP, netdev drivers and the NIC.</desc>
|
|
|
|
|
|
|
+ <desc id="net-desc">Ring-3 curl, browser and websrv use uhttp and TLS, then sys_net syscalls, then TCP/DNS/DHCP/NTP, IPv4/ARP/ICMP, netdev drivers and the NIC.</desc>
|
|
|
|
|
|
|
|
<rect class="svg-box accent" x="70" y="18" width="780" height="58" rx="9"/>
|
|
<rect class="svg-box accent" x="70" y="18" width="780" height="58" rx="9"/>
|
|
|
- <text class="svg-text" x="92" y="43">curl · browser · websrv · ping · dhcp</text>
|
|
|
|
|
|
|
+ <text class="svg-text" x="92" y="43">curl · browser · websrv · ping · dhcp · settime</text>
|
|
|
<text class="svg-sub" x="92" y="63">ring-3 programs</text>
|
|
<text class="svg-sub" x="92" y="63">ring-3 programs</text>
|
|
|
|
|
|
|
|
<path class="svg-line" d="M460 76v20"/>
|
|
<path class="svg-line" d="M460 76v20"/>
|
|
@@ -100,7 +100,7 @@
|
|
|
<path class="svg-line" d="M654 168l6 7 6-7"/>
|
|
<path class="svg-line" d="M654 168l6 7 6-7"/>
|
|
|
|
|
|
|
|
<rect class="svg-box green" x="70" y="176" width="780" height="58" rx="9"/>
|
|
<rect class="svg-box green" x="70" y="176" width="780" height="58" rx="9"/>
|
|
|
- <text class="svg-text" x="92" y="201">SYS_NET_* · SYS_TCP_* · SYS_DNS_RESOLVE · SYS_DHCP_RUN</text>
|
|
|
|
|
|
|
+ <text class="svg-text" x="92" y="201">SYS_NET_* · SYS_TCP_* · SYS_DNS_RESOLVE · SYS_DHCP_RUN · SYS_NTP_SYNC</text>
|
|
|
<text class="svg-sub" x="92" y="221">one receiver owner · interrupt-enabled waits</text>
|
|
<text class="svg-sub" x="92" y="221">one receiver owner · interrupt-enabled waits</text>
|
|
|
|
|
|
|
|
<path class="svg-line green" d="M460 234v20"/>
|
|
<path class="svg-line green" d="M460 234v20"/>
|
|
@@ -165,7 +165,7 @@
|
|
|
<li><strong>ARP</strong> resolves a next hop with three tries, one second apart; <code>net_arp_resolve()</code> polls the active NIC and the caller must own it.</li>
|
|
<li><strong>ARP</strong> resolves a next hop with three tries, one second apart; <code>net_arp_resolve()</code> polls the active NIC and the caller must own it.</li>
|
|
|
<li><strong>Routing</strong> sends off-subnet traffic to the gateway when one is known; <code>net_next_hop()</code> is shared by ping, DNS and TCP.</li>
|
|
<li><strong>Routing</strong> sends off-subnet traffic to the gateway when one is known; <code>net_next_hop()</code> is shared by ping, DNS and TCP.</li>
|
|
|
<li><strong>ICMP echo</strong> backs <code>ping</code>, with ARP resolution and round-trip timing.</li>
|
|
<li><strong>ICMP echo</strong> backs <code>ping</code>, with ARP resolution and round-trip timing.</li>
|
|
|
- <li><strong>UDP</strong> has send and parse helpers; DNS, DHCP and netlog are its users.</li>
|
|
|
|
|
|
|
+ <li><strong>UDP</strong> has send and parse helpers; DNS, DHCP, NTP and netlog are its users.</li>
|
|
|
<li><strong>Checksums</strong> use the Internet one's-complement sum, with a TCP pseudo-header variant.</li>
|
|
<li><strong>Checksums</strong> use the Internet one's-complement sum, with a TCP pseudo-header variant.</li>
|
|
|
</ul>
|
|
</ul>
|
|
|
<p>
|
|
<p>
|
|
@@ -179,7 +179,7 @@
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
|
|
<section id="dhcp">
|
|
<section id="dhcp">
|
|
|
- <h2>DHCP & DNS</h2>
|
|
|
|
|
|
|
+ <h2>DHCP, DNS & NTP</h2>
|
|
|
<h3>DHCP</h3>
|
|
<h3>DHCP</h3>
|
|
|
<p>
|
|
<p>
|
|
|
<span class="file">dhcp.c</span> is a minimal client:
|
|
<span class="file">dhcp.c</span> is a minimal client:
|
|
@@ -195,6 +195,30 @@
|
|
|
shows or sets the server; <code>host <name></code> resolves.
|
|
shows or sets the server; <code>host <name></code> resolves.
|
|
|
Numeric hosts skip DNS entirely.
|
|
Numeric hosts skip DNS entirely.
|
|
|
</p>
|
|
</p>
|
|
|
|
|
+ <h3>NTP</h3>
|
|
|
|
|
+ <p>
|
|
|
|
|
+ <span class="file">ntp.c</span> is a minimal SNTP (RFC 4330)
|
|
|
|
|
+ client: one 48-byte request to UDP port 123, three one-second
|
|
|
|
|
+ tries, DNS unless the server is a dotted address, and the shared
|
|
|
|
|
+ ARP/router path. An empty name uses <code>pool.ntp.org</code>.
|
|
|
|
|
+ A reply is accepted only when it comes from the
|
|
|
|
|
+ resolved server to the ephemeral source port, is a server/broadcast
|
|
|
|
|
+ reply with a valid stratum, and echoes the request's origin
|
|
|
|
|
+ timestamp; the transmit timestamp is converted from NTP's 1900 epoch
|
|
|
|
|
+ to a UTC <code>struct sys_datetime</code> (with the 2036 era wrap
|
|
|
|
|
+ handled). <code>SYS_NTP_SYNC</code> returns that value to ring 3;
|
|
|
|
|
+ the Date & Time editor then writes it through
|
|
|
|
|
+ <code>SYS_RTC_SET</code>. The service owns the receiver for the
|
|
|
|
|
+ duration, so it reports <code>SYS_NTP_EBUSY</code> while another
|
|
|
|
|
+ network command owns the NIC.
|
|
|
|
|
+ </p>
|
|
|
|
|
+ <div class="warn">
|
|
|
|
|
+ <p><strong>NTP is unauthenticated.</strong> The origin-timestamp
|
|
|
|
|
+ check rejects unrelated datagrams but does not authenticate the
|
|
|
|
|
+ server; anyone who can answer for the configured name can set the
|
|
|
|
|
+ board's clock. There is no NTS, no leap-second handling and no
|
|
|
|
|
+ delay/dispersion estimation — the CMOS RTC only resolves seconds.</p>
|
|
|
|
|
+ </div>
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
|
|
<section id="tcp">
|
|
<section id="tcp">
|
|
@@ -247,12 +271,12 @@
|
|
|
<span class="file">sys_net.c</span> exposes NIC info, MAC/IP/mask/
|
|
<span class="file">sys_net.c</span> exposes NIC info, MAC/IP/mask/
|
|
|
gateway/DNS getters and setters, raw frame TX/RX, decode, reply,
|
|
gateway/DNS getters and setters, raw frame TX/RX, decode, reply,
|
|
|
loopback, register dump, reset, speed and MAC overrides. It also
|
|
loopback, register dump, reset, speed and MAC overrides. It also
|
|
|
- exposes the DNS and DHCP clients and the TCP/HTTP helpers.
|
|
|
|
|
|
|
+ exposes the DNS, DHCP and NTP clients and the TCP/HTTP helpers.
|
|
|
</p>
|
|
</p>
|
|
|
<ul>
|
|
<ul>
|
|
|
<li><strong>One owner.</strong> <code>SYS_NET_ACQUIRE</code> takes the receiver for the calling process; the background kexec watcher pauses while a command owns it.</li>
|
|
<li><strong>One owner.</strong> <code>SYS_NET_ACQUIRE</code> takes the receiver for the calling process; the background kexec watcher pauses while a command owns it.</li>
|
|
|
<li><strong>Reaper safety.</strong> If the owner dies, <code>sys_net_reap</code> force-releases the receiver through <code>netdev_release_all()</code>.</li>
|
|
<li><strong>Reaper safety.</strong> If the owner dies, <code>sys_net_reap</code> force-releases the receiver through <code>netdev_release_all()</code>.</li>
|
|
|
- <li><strong>Wait semantics.</strong> ARP, DNS, DHCP and TCP waits re-enable interrupts for their duration and spin on <code>get_ticks_ms()</code>; the syscall stub enters with interrupts off.</li>
|
|
|
|
|
|
|
+ <li><strong>Wait semantics.</strong> ARP, DNS, DHCP, NTP and TCP waits re-enable interrupts for their duration and spin on <code>get_ticks_ms()</code>; the syscall stub enters with interrupts off.</li>
|
|
|
<li><strong>No sockets.</strong> The connection state lives in the kernel, one connection at a time; this is why the browser opens a fresh connection per fetch job.</li>
|
|
<li><strong>No sockets.</strong> The connection state lives in the kernel, one connection at a time; this is why the browser opens a fresh connection per fetch job.</li>
|
|
|
</ul>
|
|
</ul>
|
|
|
</section>
|
|
</section>
|
|
@@ -303,6 +327,7 @@
|
|
|
<tr><td>TLS certificates</td><td>Not verified</td><td>Encryption without authentication; MITM is undetected.</td></tr>
|
|
<tr><td>TLS certificates</td><td>Not verified</td><td>Encryption without authentication; MITM is undetected.</td></tr>
|
|
|
<tr><td>TLS DRBG</td><td>Weak (RDTSC/ticks/MAC)</td><td>Not suitable for high-value secrets.</td></tr>
|
|
<tr><td>TLS DRBG</td><td>Weak (RDTSC/ticks/MAC)</td><td>Not suitable for high-value secrets.</td></tr>
|
|
|
<tr><td>WebDAV</td><td>No authentication</td><td>Anyone on the LAN can read mounts and write <code>/share</code>.</td></tr>
|
|
<tr><td>WebDAV</td><td>No authentication</td><td>Anyone on the LAN can read mounts and write <code>/share</code>.</td></tr>
|
|
|
|
|
+ <tr><td>NTP</td><td>Unauthenticated SNTP</td><td>Anyone who can answer for the server name can set the clock.</td></tr>
|
|
|
<tr><td>NIC ownership</td><td>One process at a time</td><td>Packet-level commands are mutually exclusive; a killed owner is force-released.</td></tr>
|
|
<tr><td>NIC ownership</td><td>One process at a time</td><td>Packet-level commands are mutually exclusive; a killed owner is force-released.</td></tr>
|
|
|
<tr><td>Kernel/user isolation</td><td>None (identity map)</td><td>A ring-3 bug can reach any mapped kernel page.</td></tr>
|
|
<tr><td>Kernel/user isolation</td><td>None (identity map)</td><td>A ring-3 bug can reach any mapped kernel page.</td></tr>
|
|
|
</tbody>
|
|
</tbody>
|
|
@@ -316,7 +341,7 @@
|
|
|
<li><code>netdev.c</code>, <code>netdev.h</code> — registry</li>
|
|
<li><code>netdev.c</code>, <code>netdev.h</code> — registry</li>
|
|
|
<li><code>e1000e.c</code>, <code>r8168.c</code>, <code>ne2000.c</code>, <code>asix.c</code></li>
|
|
<li><code>e1000e.c</code>, <code>r8168.c</code>, <code>ne2000.c</code>, <code>asix.c</code></li>
|
|
|
<li><code>net.c</code>, <code>net.h</code> — ARP/ICMP/UDP/IP</li>
|
|
<li><code>net.c</code>, <code>net.h</code> — ARP/ICMP/UDP/IP</li>
|
|
|
- <li><code>dhcp.c</code>, <code>dns.c</code></li>
|
|
|
|
|
|
|
+ <li><code>dhcp.c</code>, <code>dns.c</code>, <code>ntp.c</code></li>
|
|
|
<li><code>tcp.c</code>, <code>tcp.h</code> — client + listener</li>
|
|
<li><code>tcp.c</code>, <code>tcp.h</code> — client + listener</li>
|
|
|
<li><code>tls.c</code>, <code>tls_*.c</code> — TLS 1.3</li>
|
|
<li><code>tls.c</code>, <code>tls_*.c</code> — TLS 1.3</li>
|
|
|
<li><code>sys_net.c</code> — ring-3 service</li>
|
|
<li><code>sys_net.c</code> — ring-3 service</li>
|