qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v2 4/5] Add "restrict" and "ip" option to "user" net option
Date: Mon, 05 Jan 2009 17:15:20 +0200	[thread overview]
Message-ID: <20090105151520.3819.93912.stgit@dhcp-1-237.tlv.redhat.com> (raw)
In-Reply-To: <20090105151459.3819.79836.stgit@dhcp-1-237.tlv.redhat.com>

Expose new slirp capabilities to user through a command line options.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 net.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/net.c b/net.c
index 3fa8776..6af4255 100644
--- a/net.c
+++ b/net.c
@@ -410,6 +410,8 @@ ssize_t qemu_sendv_packet(VLANClientState *vc1, const struct iovec *iov,
 /* slirp network adapter */
 
 static int slirp_inited;
+static int slirp_restrict;
+static char *slirp_ip;
 static VLANClientState *slirp_vc;
 
 int slirp_can_output(void)
@@ -446,7 +448,7 @@ static int net_slirp_init(VLANState *vlan)
 {
     if (!slirp_inited) {
         slirp_inited = 1;
-        slirp_init(0, NULL);
+        slirp_init(slirp_restrict, slirp_ip);
     }
     slirp_vc = qemu_new_vlan_client(vlan,
                                     slirp_receive, NULL, NULL);
@@ -464,7 +466,7 @@ void net_slirp_redir(const char *redir_str)
 
     if (!slirp_inited) {
         slirp_inited = 1;
-        slirp_init(0, NULL);
+        slirp_init(slirp_restrict, slirp_ip);
     }
 
     p = redir_str;
@@ -550,7 +552,7 @@ void net_slirp_smb(const char *exported_dir)
 
     if (!slirp_inited) {
         slirp_inited = 1;
-        slirp_init(0, NULL);
+        slirp_init(slirp_restrict, slirp_ip);
     }
 
     /* XXX: better tmp dir construction */
@@ -1487,6 +1489,12 @@ int net_client_init(const char *device, const char *p)
         if (get_param_value(buf, sizeof(buf), "hostname", p)) {
             pstrcpy(slirp_hostname, sizeof(slirp_hostname), buf);
         }
+        if (get_param_value(buf, sizeof(buf), "restrict", p)) {
+            slirp_restrict = (buf[0] == 'y') ? 1 : 0;
+        }
+        if (get_param_value(buf, sizeof(buf), "ip", p)) {
+            slirp_ip = strdup(buf);
+        }
         vlan->nb_host_devs++;
         ret = net_slirp_init(vlan);
     } else

  parent reply	other threads:[~2009-01-05 15:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-05 15:14 [Qemu-devel] [PATCH v2 0/5] Marry slirp and qemu character device Gleb Natapov
2009-01-05 15:15 ` [Qemu-devel] [PATCH v2 1/5] Redirect slirp traffic to/from " Gleb Natapov
2009-01-07 16:52   ` Anthony Liguori
2009-01-05 15:15 ` [Qemu-devel] [PATCH v2 2/5] Add vmchannel command line option Gleb Natapov
2009-01-05 15:15 ` [Qemu-devel] [PATCH v2 3/5] Add slirp_restrict option Gleb Natapov
2009-01-05 15:15 ` Gleb Natapov [this message]
2009-01-05 15:15 ` [Qemu-devel] [PATCH v2 5/5] Add support for vmchannel socket migration Gleb Natapov
2009-01-05 15:35 ` [Qemu-devel] [PATCH v2 0/5] Marry slirp and qemu character device Anthony Liguori
2009-01-05 16:21   ` Gleb Natapov
2009-01-05 15:38 ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090105151520.3819.93912.stgit@dhcp-1-237.tlv.redhat.com \
    --to=gleb@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).