diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-08-25 22:12:49 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-08-25 22:12:49 +0000 |
commit | 9bf05444b24f10616b9e9b9f296bcfdcba4ff0df (patch) | |
tree | fa571208d3a955ff6fc96a0c2343ad2b113dbf36 /slirp/slirp.c | |
parent | a3504c87cac0248996bc07d732761ad37ba45f34 (diff) |
port redirection support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1054 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'slirp/slirp.c')
-rw-r--r-- | slirp/slirp.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/slirp/slirp.c b/slirp/slirp.c index 405647b48c..bc2b15509a 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -617,3 +617,18 @@ void if_encap(const uint8_t *ip_data, int ip_data_len) memcpy(buf + sizeof(struct ethhdr), ip_data, ip_data_len); slirp_output(buf, ip_data_len + ETH_HLEN); } + +int slirp_redir(int is_udp, int host_port, + struct in_addr guest_addr, int guest_port) +{ + if (is_udp) { + if (!udp_listen(htons(host_port), guest_addr.s_addr, + htons(guest_port), 0)) + return -1; + } else { + if (!solisten(htons(host_port), guest_addr.s_addr, + htons(guest_port), 0)) + return -1; + } + return 0; +} |