~/bend-docscommunity

src/net/nat.bend checks

raw source on the hub · import 0x53d84b18be53da049fb18b7759d158da/src/net/nat.bend as MNat

5 imports
import Base
import ../lib/bytes.bend as B
import ../vmm/abi.bend as V
import ./wire.bend as W
import ./dhcp.bend as D

Types

type Flow source · line 174 · raw

Data

The flow toward the guest, in sequence numbers: the guest acknowledged everything before una and takes what lies before wnd (its last ACK plus its window); the host's data so far ends at dend. Data stays until the guest acknowledges it, so it can be sent again: on the byte path (TcpData) as queue, the bytes from una on; on the held path (TcpReady) as the host's hold of hlen bytes from sequence number hbase, released (TcpRelease) once acknowledged. eof: the host finished, so a FIN follows its data. scale: the guest's window shift when its SYN offered window scaling (the NAT then answers with its own, Tcp.our_scale), else 4294967295 (no scaling either way). dack, dwin: the guest's last ACK and window field, to tell a duplicate ACK. back: una when data was last sent again (one go-back per acknowledged point, so the guest's ACKs of duplicates do not set off more).

type Conn source · line 186 · raw

Data

type Slirp source · line 189 · raw

Data

type SlirpOut source · line 194 · raw

Data

A step's result: the new state, frames for the guest in order, and host commands in order.

type Key source · line 253 · raw

Data

A connection is found by its id (host events) or its addresses (guest segments: guest port, remote address, remote port).

type Found source · line 267 · raw

Data

The connection for a key (if any), and the table without it.

type Payload source · line 293 · raw

Data

A guest segment's data: its bytes, or len bytes staged on the host (a staged frame, W.Wire.staged_frame).

type Acked source · line 530 · raw

Data

What an ACK did: the connection, and the commands it adds (a release).

type Sent source · line 565 · raw

Data

What sending what the window has room for gave: the connection after it, and its segments for the guest in order.

type HostTcp source · line 906 · raw

Data

What the host reported on a TCP connection.

Definitions

def Slirp.guest_ip source · line 87 · raw

U32

def Slirp.gateway_ip source · line 90 · raw

U32

def Slirp.dns_ip source · line 93 · raw

U32

def Slirp.guest_mac source · line 96 · raw

List<&2, U32>

def Slirp.gateway_mac source · line 99 · raw

List<&2, U32>

def Conn.syn_sent source · line 103 · raw

U32

Connection states.

def Conn.established source · line 105 · raw

U32

def Conn.guest_fin source · line 107 · raw

U32

def Conn.host_fin source · line 109 · raw

U32

def Conn.incoming source · line 114 · raw

U32

A forwarded connection (TcpIncoming) whose SYN went to the guest, sent 1 + (phase - incoming) times.

def Tcp.syn_tries source · line 118 · raw

U32

How many SYNs a forwarded connection sends before it gives up.

def Conn.is_incoming_phase source · line 122 · raw

@+p:U32 -> Bool

Whether phase p is Incoming.

def Conn.blocked source · line 127 · raw

U32

The blocked mark (V.TcpBlocked), a bit above the state's own values: Conn and Flow are pinned by the snapshot format, so it shares the state word.

def Conn.phase source · line 131 · raw

@+state:U32 -> U32

A state word's state, its blocked mark dropped.

def Conn.with_phase source · line 135 · raw

@+state:U32 -> @p:U32 -> U32

The state word with phase p, its blocked mark and MSS kept.

def Conn.with_mss source · line 141 · raw

@+state:U32 -> @+mss:U32 -> U32

The guest's MSS (the option of its SYN, or its SYN|ACK to a forwarded connection) shares the state word as well, in its top 16 bits: 0 when the segment had none.

def Tcp.seg_size source · line 149 · raw

@+mss:U32 -> U32

The most payload a segment toward the guest carries: the guest's MSS, at most 1460 (what the NAT's Ethernet takes) and at least 64; 1460 when the guest sent none. A guest that forwards to a smaller MTU (a pod network behind a VXLAN, MTU 1450) announces so in its MSS, and gets no segment its path cannot take.

def Slirp.max_conns source · line 154 · raw

Nat

The most connections the NAT keeps open: a SYN past them gets a RST.

def Slirp.queue_cap source · line 159 · raw

U32

The most bytes a connection queues for the guest (TcpData waiting for the guest's ACK): past them the host reads no more of its socket.

def Tcp.our_scale source · line 180 · raw

U32

The NAT's window shift when the guest scales: its window field (always 65535) then offers 8 MiB. Guest data goes straight to the host's socket, so the NAT holds none of it.

def Tcp.no_scale source · line 183 · raw

U32

def Slirp.new source · line 197 · raw

Slirp

def Slirp.ip_frame source · line 203 · raw

@src:U32 -> @proto:U32 -> @payload:List<&2, U32> -> List<&2, U32>

An IPv4 packet from src to the guest, in an Ethernet frame.

def Slirp.tcp_frame source · line 207 · raw

@+rip:U32 -> @rport:U32 -> @gport:U32 -> @seq:U32 -> @ack:U32 -> @flags:U32 -> @mss:U32 -> @data:List<&2, U32> -> List<&2, U32>

A TCP segment from rip:rport to the guest's gport.

def Conn.frame source · line 211 · raw

@+c:Conn -> @flags:U32 -> @seq:U32 -> @ack:U32 -> @mss:U32 -> @data:List<&2, U32> -> List<&2, U32>

A TCP segment on connection c.

def Conn.ack source · line 217 · raw

@+c:Conn -> List<&2, U32>

The ACK of everything the guest sent (seq hseq, ack gseq).

def Conn.id source · line 222 · raw

@+c:Conn -> U32

def Conn.seg source · line 228 · raw

@+c:Conn -> U32

The most payload a segment toward the guest on c carries (Tcp.seg_size).

def Conn.state source · line 233 · raw

@+c:Conn -> U32

def Conn.is_blocked source · line 238 · raw

@+c:Conn -> Bool

def Conn.ack_zero source · line 244 · raw

@+c:Conn -> List<&2, U32>

The ACK of everything the guest sent, with a zero window (blocked).

def Conn.hit source · line 257 · raw

@+c:Conn -> @+k:Key -> Bool

def Found.cons source · line 270 · raw

@hit:Bool -> @c:Conn -> @f:Found -> Found

def Conns.take source · line 281 · raw

@cs:List<&2, Conn> -> @+k:Key -> Found

def Slirp.none source · line 288 · raw

@n:Slirp -> SlirpOut

def Payload.len source · line 297 · raw

@+p:Payload -> U32

def Payload.send source · line 305 · raw

@id:U32 -> @p:Payload -> List<&2, 0x53d84b18be53da049fb18b7759d158da/src/vmm/abi.NetCmd>

The command that sends the data on connection id (none for no bytes).

def Payload.drop source · line 313 · raw

@p:Payload -> List<&2, 0x53d84b18be53da049fb18b7759d158da/src/vmm/abi.NetCmd>

The command that frees data the NAT does not send (none for bytes).

def Tcp.flag source · line 321 · raw

@+flags:U32 -> @f:U32 -> Bool

TCP flags.

def Tcp.is_open source · line 325 · raw

@+flags:U32 -> Bool

A SYN without ACK opens a connection.

def Slirp.dst_ok source · line 332 · raw

@+dst:U32 -> @+port:U32 -> Bool

Where the guest may go (TCP and UDP): not 0.0.0.0/8, 127.0.0.0/8 (the host's loopback is 10.0.2.2), 169.254.0.0/16 (link-local: cloud metadata), 224.0.0.0/4 (multicast) or 255.255.255.255, and 10.0.2.3 (the host's resolver) on port 53 only.

def Tcp.open source · line 340 · raw

@ok:Bool -> @rest:List<&2, Conn> -> @+next_id:U32 -> @+rip:U32 -> @+gport:U32 -> @+rport:U32 -> @+seq:U32 -> @win:U32 -> @ws:U32 -> @mss:U32 -> @pl:Payload -> SlirpOut

A SYN opens a connection (the guest's window counts from 2, the first sequence number after the SYN|ACK) when ok: below Slirp.max_conns and to an address Slirp.dst_ok; else a RST|ACK refuses it.

def Tcp.unknown source · line 350 · raw

@syn:Bool -> @+rest:List<&2, Conn> -> @+next_id:U32 -> @+rip:U32 -> @+gport:U32 -> @+rport:U32 -> @+seq:U32 -> @ack:U32 -> @win:U32 -> @ws:U32 -> @mss:U32 -> @pl:Payload -> SlirpOut

Guest segments for an unknown connection: a SYN may open it (Tcp.open), anything else gets a RST.

def Tcp.guest_fin source · line 360 · raw

@closing:Bool -> @c:Conn -> @rest:List<&2, Conn> -> @cmds:List<&2, 0x53d84b18be53da049fb18b7759d158da/src/vmm/abi.NetCmd> -> Pair(List<&2, Conn>, List<&2, 0x53d84b18be53da049fb18b7759d158da/src/vmm/abi.NetCmd>)

The guest's FIN on c (gseq already past its data): c's new table and the commands it adds.

def Conn.fin_seq source · line 371 · raw

@c:Conn -> Conn

c with gseq advanced by one.

def Tcp.result source · line 376 · raw

@answer:Bool -> @+c:Conn -> @next_id:U32 -> @t:Pair(List<&2, Conn>, List<&2, 0x53d84b18be53da049fb18b7759d158da/src/vmm/abi.NetCmd>) -> SlirpOut

def Tcp.after_data source · line 388 · raw

@fin:Bool -> @sent:Bool -> @+c:Conn -> @rest:List<&2, Conn> -> @next_id:U32 -> @cmds:List<&2, 0x53d84b18be53da049fb18b7759d158da/src/vmm/abi.NetCmd> -> SlirpOut

After in-order data (already in c's gseq), a FIN or not.

def Tcp.in_order source · line 397 · raw

@c:Conn -> @rest:List<&2, Conn> -> @next_id:U32 -> @+pl:Payload -> @fin:Bool -> SlirpOut

An in-order segment on a known connection.

def Tcp.in_take source · line 406 · raw

@held:Bool -> @+c:Conn -> @rest:List<&2, Conn> -> @next_id:U32 -> @pl:Payload -> @fin:Bool -> SlirpOut

An in-order segment; held (data while blocked): dropped, answered with a zero window.

def Tcp.in_seq source · line 414 · raw

@ok:Bool -> @+c:Conn -> @rest:List<&2, Conn> -> @next_id:U32 -> @+pl:Payload -> @fin:Bool -> SlirpOut

A segment on a known connection that is neither a SYN nor a RST.

def Conn.gseq source · line 421 · raw

@+c:Conn -> U32

def Tcp.mss source · line 430 · raw

Nat

Host data, cut into segments of at most 1460 bytes (fuel: the byte count).

def Tcp.chunks source · line 433 · raw

@fuel:Nat -> @bs:List<&2, U32> -> List<&2, List<&2, U32>>

def Tcp.chunks_of source · line 444 · raw

@fuel:Nat -> @+size:Nat -> @bs:List<&2, U32> -> List<&2, List<&2, U32>>

Host data, cut into segments of at most size bytes (fuel: the byte count).

def Tcp.segs source · line 455 · raw

@chunks:List<&2, List<&2, U32>> -> @+c:Conn -> @+seq:U32 -> @+ack:U32 -> List<&2, List<&2, U32>>

The PSH|ACK segments of chunks on c, the first with sequence seq.

def Tcp.small source · line 463 · raw

@+n:Nat -> Bool

At most two chunks are built sequentially.

def Tcp.par source · line 469 · raw

@d:Nat -> @small:Bool -> @+c:Conn -> @+size:U32 -> @+seq:U32 -> @+ack:U32 -> @+n:Nat -> @+chunks:List<&2, List<&2, U32>> -> List<&2, List<&2, U32>>

The segments of n chunks as a balanced parallel build: every chunk but the last is full (size bytes), so the right half starts size bytes per left chunk later. d bounds the depth.

def Tcp.data_frames source · line 486 · raw

@+c:Conn -> @+seq:U32 -> @+ack:U32 -> @+bytes:List<&2, U32> -> List<&2, List<&2, U32>>

def Tcp.host_frame_of source · line 495 · raw

@+size:U32 -> @+id:U32 -> @+rip:U32 -> @rport:U32 -> @gport:U32 -> @seq:U32 -> @ack:U32 -> @+off:U32 -> @+len:U32 -> List<&2, U32>

The host frame of a PSH|ACK segment of len bytes at offset off of the hold for connection id: Ethernet, IPv4 and TCP headers (TCP checksum 0); the guest cuts it into segments of size bytes (W.Wire.host_frame_of).

def Tcp.host_frame source · line 502 · raw

@+id:U32 -> @+rip:U32 -> @rport:U32 -> @gport:U32 -> @seq:U32 -> @ack:U32 -> @+off:U32 -> @+len:U32 -> List<&2, U32>

The same, in 1460-byte segments.

def Conn.hseq source · line 505 · raw

@+c:Conn -> U32

def Tcp.scaled source · line 511 · raw

@+sc:U32 -> @+win:U32 -> U32

A window field from the guest, scaled by its shift (when it scales).

def Flow.room source · line 515 · raw

@+wnd:U32 -> @+seq:U32 -> U32

The room left before wnd from seq on (0 once seq is at or past it).

def Seq.after source · line 520 · raw

@+a:U32 -> @+b:U32 -> Bool

Whether a lies strictly after b (modulo 2^32).

def Conn.with_seq source · line 524 · raw

@c:Conn -> @+hseq:U32 -> Conn

def Acked.go source · line 533 · raw

@+id:U32 -> @gport:U32 -> @rip:U32 -> @rport:U32 -> @state:U32 -> @gseq:U32 -> @+hseq:U32 -> @+wnd:U32 -> @+una:U32 -> @+dend:U32 -> @+hbase:U32 -> @+hlen:U32 -> @+queue:List<&2, U32> -> @+eof:Bool -> @+sc:U32 -> @+ack:U32 -> @+win:U32 -> @+pure:Bool -> @+dack:U32 -> @+dwin:U32 -> @+bk:U32 -> Acked

def Conn.acked source · line 554 · raw

@acked:Bool -> @c:Conn -> @+ack:U32 -> @+win:U32 -> @+pure:Bool -> Acked

c after a guest segment: with ACK set, acknowledged data goes, the window ends at ack + window, and data that may have been dropped is sent again from una (go-back): when the window shrank before it, or on a duplicate ACK (pure: the segment carries no data and no SYN or FIN).

def Sent.more source · line 568 · raw

@fs:List<&2, List<&2, U32>> -> @s:Sent -> Sent

def Conn.next_n source · line 576 · raw

@+c:Conn -> @+cap:U32 -> U32

How many bytes the next segment carries: what the window has room for, of the data not yet sent, at most 65495 (one IPv4 packet) from the hold, 1460 per segment from the queue (Tcp.data_frames cuts them).

def Conn.held_frame source · line 581 · raw

@+c:Conn -> @+n:U32 -> List<&2, U32>

def Tcp.send_held source · line 588 · raw

@f:Nat -> @+c:Conn -> Sent

Held bytes as host frames while the window has room (f bounds the segments: a hold is at most one host read, 65495 bytes).

def Tcp.send_queue.go source · line 596 · raw

@+c:Conn -> @+n:U32 -> Sent

def Tcp.send_queue source · line 605 · raw

@+c:Conn -> Sent

Queued bytes not yet sent, as many as the window has room for, as segments of at most 1460 bytes.

def Conn.flow source · line 608 · raw

@+c:Conn -> Flow

def Conn.fin_sent source · line 614 · raw

@c:Conn -> Conn

c after its FIN: hseq one past the data, state HostFin.

def Tcp.fin.done source · line 619 · raw

@closing:Bool -> @+c:Conn -> @rest:List<&2, Conn> -> @next_id:U32 -> @fs:List<&2, List<&2, U32>> -> SlirpOut

def Tcp.fin source · line 630 · raw

@go:Bool -> @closing:Bool -> @+c:Conn -> @rest:List<&2, Conn> -> @next_id:U32 -> @fs:List<&2, List<&2, U32>> -> SlirpOut

The FIN after the host's EOF, once its data is all sent: FIN|ACK (seq dend, ack gseq), state HostFin; after GuestFin the connection closes (V.TcpClose) and is forgotten. A FIN sent again (go-back) changes nothing else.

def Flow.fin_due source · line 638 · raw

@f:Flow -> @+hseq:U32 -> Bool

Whether the FIN goes now: the host finished and its data is all sent.

def Tcp.push.sent source · line 643 · raw

@s:Sent -> @rest:List<&2, Conn> -> @next_id:U32 -> SlirpOut

def Tcp.push source · line 651 · raw

@c:Conn -> @rest:List<&2, Conn> -> @next_id:U32 -> SlirpOut

Sends what the guest's window has room for: held bytes as host frames, else queued bytes; then the FIN, when the host finished and nothing is left to send.

def Tcp.after source · line 658 · raw

@fs:List<&2, List<&2, U32>> -> @cs:List<&2, 0x53d84b18be53da049fb18b7759d158da/src/vmm/abi.NetCmd> -> @o:SlirpOut -> SlirpOut

o's frames and commands after fs and cs.

def Tcp.push_found source · line 663 · raw

@f:Found -> @next_id:U32 -> @fs:List<&2, List<&2, U32>> -> @cs:List<&2, 0x53d84b18be53da049fb18b7759d158da/src/vmm/abi.NetCmd> -> SlirpOut

def Tcp.push_id source · line 674 · raw

@o:SlirpOut -> @+id:U32 -> SlirpOut

After a step that may have opened the window: sends what it now has room for on connection id, after the step's own frames and commands.

def Tcp.known source · line 680 · raw

@syn:Bool -> @rst:Bool -> @+c:Conn -> @rest:List<&2, Conn> -> @next_id:U32 -> @+seq:U32 -> @pl:Payload -> @fin:Bool -> SlirpOut

Guest segments for a known connection: a SYN is dropped, a RST closes it.

def Tcp.segment.acked source · line 689 · raw

@a:Acked -> @+id:U32 -> @rest:List<&2, Conn> -> @next_id:U32 -> @+seq:U32 -> @+flags:U32 -> @pl:Payload -> SlirpOut

def Tcp.segment.known source · line 696 · raw

@early:Bool -> @+c:Conn -> @rest:List<&2, Conn> -> @next_id:U32 -> @+seq:U32 -> @+ack:U32 -> @+flags:U32 -> @+window:U32 -> @+pl:Payload -> SlirpOut

A guest segment on known connection c. In SynSent (early) only a RST counts: anything else is dropped and changes nothing.

def Conn.is_incoming source · line 704 · raw

@+c:Conn -> Bool

def Tcp.accepted source · line 709 · raw

@c:Conn -> @rest:List<&2, Conn> -> @next_id:U32 -> @+seq:U32 -> @+ack:U32 -> @+window:U32 -> @ws:U32 -> @mss:U32 -> SlirpOut

The guest's SYN|ACK to a forwarded connection's SYN: established, its window (unscaled in a SYN) and scale from the segment.

def Tcp.segment.incoming source · line 717 · raw

@rst:Bool -> @synack:Bool -> @+c:Conn -> @rest:List<&2, Conn> -> @next_id:U32 -> @+seq:U32 -> @+ack:U32 -> @+window:U32 -> @pl:Payload -> @ws:U32 -> @mss:U32 -> SlirpOut

A guest segment on an Incoming connection: a RST aborts it, a SYN|ACK of the SYN establishes it, anything else is dropped.

def Tcp.segment.on source · line 727 · raw

@incoming:Bool -> @+c:Conn -> @rest:List<&2, Conn> -> @next_id:U32 -> @+seq:U32 -> @+ack:U32 -> @+flags:U32 -> @+window:U32 -> @+pl:Payload -> @ws:U32 -> @mss:U32 -> SlirpOut

A guest segment on known connection c: Incoming, or any other state.

def Tcp.segment source · line 736 · raw

@f:Found -> @next_id:U32 -> @rip:U32 -> @t:0x53d84b18be53da049fb18b7759d158da/src/net/wire.Tcp -> @+pl:Payload -> @ws:U32 -> SlirpOut

A guest segment t, its data pl (t's own bytes, or staged on the host).

def Payload.of source · line 750 · raw

@staged:Maybe<&2, Payload> -> @+t:0x53d84b18be53da049fb18b7759d158da/src/net/wire.Tcp -> Payload

A segment's own bytes, or the staged data when there is a slot.

def Slirp.tcp source · line 758 · raw

@n:Slirp -> @+rip:U32 -> @m:Maybe<&2, 0x53d84b18be53da049fb18b7759d158da/src/net/wire.Tcp> -> @staged:Maybe<&2, Payload> -> @ws:U32 -> SlirpOut

ws: the window scale option of the segment's header (W.Tcp.wscale).

def Slirp.dhcp source · line 770 · raw

@n:Slirp -> @m:Maybe<&2, List<&2, U32>> -> SlirpOut

The DHCP reply, broadcast from 10.0.2.2:67 to port 68.

def Slirp.udp_to source · line 780 · raw

@dhcp:Bool -> @n:Slirp -> @sport:U32 -> @+dst:U32 -> @+dport:U32 -> @data:List<&2, U32> -> SlirpOut

def Slirp.udp source · line 787 · raw

@n:Slirp -> @dst:U32 -> @m:Maybe<&2, 0x53d84b18be53da049fb18b7759d158da/src/net/wire.Udp> -> SlirpOut

def Slirp.echo source · line 795 · raw

@ok:Bool -> @n:Slirp -> @dst:U32 -> @rest:List<&2, U32> -> SlirpOut

An echo request to the gateway or the DNS address gets an echo reply.

def Slirp.icmp source · line 802 · raw

@n:Slirp -> @+dst:U32 -> @m:Maybe<&2, 0x53d84b18be53da049fb18b7759d158da/src/net/wire.Icmp> -> SlirpOut

def Slirp.proto source · line 810 · raw

@icmp:Bool -> @tcp:Bool -> @udp:Bool -> @n:Slirp -> @+dst:U32 -> @+payload:List<&2, U32> -> SlirpOut

def Slirp.ip source · line 821 · raw

@n:Slirp -> @m:Maybe<&2, 0x53d84b18be53da049fb18b7759d158da/src/net/wire.Ipv4> -> SlirpOut

def Slirp.arp_reply source · line 829 · raw

@ok:Bool -> @n:Slirp -> @sha:List<&2, U32> -> @spa:U32 -> @tpa:U32 -> SlirpOut

An ARP request for any address but the guest's gets the gateway MAC.

def Slirp.arp source · line 837 · raw

@n:Slirp -> @m:Maybe<&2, 0x53d84b18be53da049fb18b7759d158da/src/net/wire.Arp> -> SlirpOut

def Slirp.ethertype source · line 845 · raw

@arp:Bool -> @ip:Bool -> @n:Slirp -> @+payload:List<&2, U32> -> SlirpOut

def Slirp.eth source · line 854 · raw

@n:Slirp -> @m:Maybe<&2, 0x53d84b18be53da049fb18b7759d158da/src/net/wire.Eth> -> SlirpOut

def Slirp.staged_tcp source · line 863 · raw

@tcp:Bool -> @n:Slirp -> @+dst:U32 -> @+payload:List<&2, U32> -> @st:Payload -> SlirpOut

A staged frame (W.Wire.staged_frame): a TCP segment whose payload waits on the host; anything else in one has its slot freed.

def Slirp.staged_ip source · line 870 · raw

@n:Slirp -> @st:Payload -> @m:Maybe<&2, 0x53d84b18be53da049fb18b7759d158da/src/net/wire.Ipv4> -> SlirpOut

def Slirp.staged_eth source · line 877 · raw

@n:Slirp -> @st:Payload -> @m:Maybe<&2, 0x53d84b18be53da049fb18b7759d158da/src/net/wire.Eth> -> SlirpOut

def Slirp.staged source · line 886 · raw

@n:Slirp -> @frame:List<&2, U32> -> SlirpOut

A staged frame's headers parse as a packet without its payload: the IPv4 total length is set to the headers' own.

def Slirp.guest_frame.go source · line 895 · raw

@staged:Bool -> @n:Slirp -> @frame:List<&2, U32> -> SlirpOut

def Slirp.guest_frame source · line 902 · raw

@n:Slirp -> @+frame:List<&2, U32> -> SlirpOut

def Tcp.synack source · line 917 · raw

@plain:Bool -> @+c:Conn -> @seq:U32 -> @ack:U32 -> List<&2, U32>

The SYN|ACK (MSS 1460): with the window scale option (Tcp.our_scale) when the guest's SYN had one.

def Tcp.blocked source · line 928 · raw

@+on:Bool -> @c:Conn -> @rest:List<&2, Conn> -> @next_id:U32 -> SlirpOut

c blocked (on) or not; once unblocked, an ACK opens the guest's window.

def Tcp.host source · line 939 · raw

@+c:Conn -> @rest:List<&2, Conn> -> @next_id:U32 -> @h:HostTcp -> SlirpOut

A host event on c. Data joins the flow (queued bytes, or a new hold that starts where the data so far ends) and goes out as the guest's window allows; the EOF marks the flow finished.

def Tcp.host_event source · line 961 · raw

@f:Found -> @next_id:U32 -> @h:HostTcp -> SlirpOut

def Conns.has source · line 971 · raw

@cs:List<&2, Conn> -> @+k:Key -> Bool

Whether a connection with key k is in the table.

def Tcp.fwd_port source · line 979 · raw

@+id:U32 -> U32

The gateway's port for forwarded connection id: 49152 up, by id.

def Tcp.fwd_syn source · line 983 · raw

@+c:Conn -> List<&2, U32>

The SYN of forwarded connection c (seq 1), with the SYN|ACK's options.

def Tcp.incoming source · line 991 · raw

@ok:Bool -> @conns:List<&2, Conn> -> @next_id:U32 -> @+id:U32 -> @+gport:U32 -> SlirpOut

The host accepted connection id for guest port gport: a connection from the gateway (when ok: room, and no connection on its addresses), its SYN.

def Tcp.syn_again source · line 1001 · raw

@more:Bool -> @c:Conn -> @rest:List<&2, Conn> -> @next_id:U32 -> SlirpOut

A forwarded connection's SYN timed out: again (phase + 1) while tries are left, else the host's socket is aborted and the connection forgotten.

def Tcp.syn_timeout.on source · line 1011 · raw

@incoming:Bool -> @+c:Conn -> @rest:List<&2, Conn> -> @next_id:U32 -> SlirpOut

def Tcp.syn_timeout source · line 1018 · raw

@f:Found -> @next_id:U32 -> SlirpOut

def Slirp.host_event source · line 1027 · raw

@n:Slirp -> @ev:0x53d84b18be53da049fb18b7759d158da/src/vmm/abi.NetEvent -> SlirpOut

def Conns.queued source · line 1062 · raw

@cs:List<&2, Conn> -> U32

The bytes queued for the guest on every connection (TcpData waiting for room in the guest's window).

def Slirp.queued source · line 1070 · raw

@n:Slirp -> U32

def Conn.queue_len source · line 1076 · raw

@+c:Conn -> U32

The bytes connection c queues for the guest, sent or not.

def Conns.queue_len source · line 1081 · raw

@cs:List<&2, Conn> -> @+id:U32 -> U32

def Slirp.may_read source · line 1090 · raw

@n:Slirp -> @+id:U32 -> Bool

Whether the host may read connection id on: its queue for the guest holds less than Slirp.queue_cap bytes (an unknown connection: yes).

def Conns.syn_pending source · line 1097 · raw

@cs:List<&2, Conn> -> @+id:U32 -> Bool

Whether connection id is a forwarded one still waiting for the guest's SYN|ACK (the host's SYN timer stops once it is not).

def Slirp.syn_pending source · line 1104 · raw

@n:Slirp -> @+id:U32 -> Bool

def Conn.show source · line 1111 · raw

@c:Conn -> String

A connection, for the control socket's net command: its addresses, state, sequence numbers and flow toward the guest.

def Conns.show source · line 1116 · raw

@cs:List<&2, Conn> -> String

def Slirp.show source · line 1123 · raw

@n:Slirp -> String