summaryrefslogtreecommitdiff
path: root/slirp/ip_icmp.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/ip_icmp.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/ip_icmp.c')
-rw-r--r--slirp/ip_icmp.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c
index 61dcaf821b..6e93ee3eb4 100644
--- a/slirp/ip_icmp.c
+++ b/slirp/ip_icmp.c
@@ -110,7 +110,7 @@ icmp_input(struct mbuf *m, int hlen)
case ICMP_ECHO:
icp->icmp_type = ICMP_ECHOREPLY;
ip->ip_len += hlen; /* since ip_input subtracts this */
- if (ip->ip_dst.s_addr == alias_addr.s_addr) {
+ if (ip->ip_dst.s_addr == vhost_addr.s_addr) {
icmp_reflect(m);
} else {
struct socket *so;
@@ -134,16 +134,13 @@ icmp_input(struct mbuf *m, int hlen)
/* Send the packet */
addr.sin_family = AF_INET;
- if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) {
+ if ((so->so_faddr.s_addr & vnetwork_mask.s_addr) ==
+ vnetwork_addr.s_addr) {
/* It's an alias */
- switch(ntohl(so->so_faddr.s_addr) & 0xff) {
- case CTL_DNS:
+ if (so->so_faddr.s_addr == vnameserver_addr.s_addr) {
addr.sin_addr = dns_addr;
- break;
- case CTL_ALIAS:
- default:
+ } else {
addr.sin_addr = loopback_addr;
- break;
}
} else {
addr.sin_addr = so->so_faddr;
@@ -302,7 +299,7 @@ icmp_error(struct mbuf *msrc, u_char type, u_char code, int minsize,
ip->ip_ttl = MAXTTL;
ip->ip_p = IPPROTO_ICMP;
ip->ip_dst = ip->ip_src; /* ip adresses */
- ip->ip_src = alias_addr;
+ ip->ip_src = vhost_addr;
(void ) ip_output((struct socket *)NULL, m);