3 ms·
Slirp is a little like NAT, but implemented differently. It creates what looks like a virtual NIC (literally in qemu's case, indirectly by SLIP in the original
by kijiki 7y ago
Slirp is a little like NAT, but implemented differently.
It creates what looks like a virtual NIC (literally in qemu's case, indirectly by SLIP in the original Slirp), and reassembles the packets it gets coming in from the guest OS or SLIP user. For example, a SYN packet gets turned into a call to connect(), and a data packet gets turned into a write() on the appropriate TCP socket FD. An RST packet gets turned into a call to close(). The reverse happens in the other direction, based on the read() data, fake TCP packets are generated, a closed socket gets mapped to a RST packet, and so forth.
From the outside, it looks like the guest (or SLIP user) is NATed through the host's IP address. But really it is just reassembling the intention of the guest based on the packets it is sending and calling host kernel functions to cause the same effects.
- userbinator 7y agoThanks for the explanation. Given the original purpose of the code, where it would basically see "good" packets exclusively, it's not too surprising that giving it arbitrary "weird" packets could trigger bugs.
- ptman 7y agoIs that similar to what sshuttle does?
- dahfizz 7y agoNot really. Sshuttle is really just a convenient wrapper around plain old ssh. It created an SSH tunnel to the host you specify and forwards all traffic through that. Its more like a VPN