diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-03-20 12:29:54 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-04-01 17:51:55 +0200 |
commit | 0b11c036620251f8f831ab8f0d9a7280ec1c4813 (patch) | |
tree | c8f390cd7e7cc6986b6a5febcdcaf5c99bc6012f /slirp/slirp.c | |
parent | de1d099a448beb2ec39af4bd9ce4dd6452a18cb5 (diff) | |
download | qemu-0b11c036620251f8f831ab8f0d9a7280ec1c4813.zip |
slirp: Allow disabling IPv4 or IPv6
Add ipv4 and ipv6 boolean options, so the user can setup IPv4-only and
IPv6-only network environments.
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'slirp/slirp.c')
-rw-r--r-- | slirp/slirp.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/slirp/slirp.c b/slirp/slirp.c index 998f27876c..fef526c5ad 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -200,8 +200,9 @@ static void slirp_init_once(void) static void slirp_state_save(QEMUFile *f, void *opaque); static int slirp_state_load(QEMUFile *f, void *opaque, int version_id); -Slirp *slirp_init(int restricted, struct in_addr vnetwork, +Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork, struct in_addr vnetmask, struct in_addr vhost, + bool in6_enabled, struct in6_addr vprefix_addr6, uint8_t vprefix_len, struct in6_addr vhost6, const char *vhostname, const char *tftp_path, const char *bootfile, @@ -216,6 +217,9 @@ Slirp *slirp_init(int restricted, struct in_addr vnetwork, slirp->grand = g_rand_new(); slirp->restricted = restricted; + slirp->in_enabled = in_enabled; + slirp->in6_enabled = in6_enabled; + if_init(slirp); ip_init(slirp); ip6_init(slirp); @@ -694,6 +698,10 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len) int ar_op; struct ex_list *ex_ptr; + if (!slirp->in_enabled) { + return; + } + ar_op = ntohs(ah->ar_op); switch(ar_op) { case ARPOP_REQUEST: |