aboutsummaryrefslogtreecommitdiff
path: root/slirp/slirp.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-08 19:24:00 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-08 19:24:00 +0000
commita9ba3a856d8e84f4c32bcfa2b92727b7add4996c (patch)
treee45a11e63905d3a231456c272d0e094d7a869974 /slirp/slirp.c
parente1c5a2b33409b9795fa58bf389eac855981330a5 (diff)
Add slirp_restrict option (Gleb Natapov)
Add "slirp firewall" to permit connection only to vmchannel addresses. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6241 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'slirp/slirp.c')
-rw-r--r--slirp/slirp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/slirp/slirp.c b/slirp/slirp.c
index f6f94e49bd..ce4a1b714c 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -46,6 +46,8 @@ static struct in_addr client_ipaddr;
static const uint8_t zero_ethaddr[6] = { 0, 0, 0, 0, 0, 0 };
+char *slirp_special_ip = CTL_SPECIAL;
+int slirp_restrict;
int do_slowtimo;
int link_up;
struct timeval tt;
@@ -164,7 +166,7 @@ static void slirp_cleanup(void)
}
#endif
-void slirp_init(void)
+void slirp_init(int restrict, char *special_ip)
{
// debug_init("/tmp/slirp.log", DEBUG_DEFAULT);
@@ -177,6 +179,7 @@ void slirp_init(void)
#endif
link_up = 1;
+ slirp_restrict = restrict;
if_init();
ip_init();
@@ -192,7 +195,10 @@ void slirp_init(void)
fprintf (stderr, "Warning: No DNS servers found\n");
}
- inet_aton(CTL_SPECIAL, &special_addr);
+ if (special_ip)
+ slirp_special_ip = special_ip;
+
+ inet_aton(slirp_special_ip, &special_addr);
alias_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS);
getouraddr();
}