aboutsummaryrefslogtreecommitdiff
path: root/slirp/tcp_input.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2009-06-24 14:42:28 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-06-29 08:52:45 -0500
commita13a4126c8b94355bbe43e47275b97ce5bef003c (patch)
treebe9f257c4e3956047481cbb2756813be3d023a94 /slirp/tcp_input.c
parentad196a9d0c14f681f010bb4b979030ec125ba976 (diff)
slirp: Rework internal configuration
The user mode IP stack is currently only minimally configurable /wrt to its virtual IP addresses. This is unfortunate if some guest has a fixed idea of which IP addresses to use. Therefore this patch prepares the stack for fully configurable IP addresses and masks. The user interface and default addresses remain untouched in this step, they will be enhanced in the following patch. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'slirp/tcp_input.c')
-rw-r--r--slirp/tcp_input.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c
index effedfc966..ab0840d8dd 100644
--- a/slirp/tcp_input.c
+++ b/slirp/tcp_input.c
@@ -359,11 +359,12 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso)
m->m_len -= sizeof(struct tcpiphdr)+off-sizeof(struct tcphdr);
if (slirp_restrict) {
- for (ex_ptr = exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next)
+ for (ex_ptr = exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
if (ex_ptr->ex_fport == ti->ti_dport &&
- (ntohl(ti->ti_dst.s_addr) & 0xff) == ex_ptr->ex_addr)
+ ti->ti_dst.s_addr == ex_ptr->ex_addr.s_addr) {
break;
-
+ }
+ }
if (!ex_ptr)
goto drop;
}
@@ -639,9 +640,10 @@ findso:
* If this is destined for the control address, then flag to
* tcp_ctl once connected, otherwise connect
*/
- if ((so->so_faddr.s_addr&htonl(0xffffff00)) == special_addr.s_addr) {
- int lastbyte=ntohl(so->so_faddr.s_addr) & 0xff;
- if (lastbyte!=CTL_ALIAS && lastbyte!=CTL_DNS) {
+ if ((so->so_faddr.s_addr & vnetwork_mask.s_addr) ==
+ vnetwork_addr.s_addr) {
+ if (so->so_faddr.s_addr != vhost_addr.s_addr &&
+ so->so_faddr.s_addr != vnameserver_addr.s_addr) {
#if 0
if(lastbyte==CTL_CMD || lastbyte==CTL_EXEC) {
/* Command or exec adress */
@@ -652,7 +654,7 @@ findso:
/* May be an add exec */
for(ex_ptr = exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
if(ex_ptr->ex_fport == so->so_fport &&
- lastbyte == ex_ptr->ex_addr) {
+ so->so_faddr.s_addr == ex_ptr->ex_addr.s_addr) {
so->so_state |= SS_CTL;
break;
}