All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 1628971] [NEW] -netdev user: guestfwd doesn't work
@ 2016-09-29 15:22 Pas
  2016-10-05  9:28 ` [Qemu-devel] [Bug 1628971] " T. Huth
  2020-11-12 13:12 ` Thomas Huth
  0 siblings, 2 replies; 3+ messages in thread
From: Pas @ 2016-09-29 15:22 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

Hello!

QEMU emulator version 2.6.1 (Debian 1:2.6.1+dfsg-0ubuntu4), Copyright
(c) 2003-2008 Fabrice Bellard

The IP address 192.168.1.46 is assigned to eth0.

qemu-system-x86_64 \
    -no-hpet \
    -nodefconfig \
    -machine accel=kvm \
    -cpu host \
    -smp 2 \
    -drive if=virtio,file=yakkety-server-cloudimg-amd64.img \
    -device virtio-net-pci,netdev=net0 \
    -netdev 'user,id=net0,hostfwd=tcp::2222-:22,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.46 8842' \
    -m 1024 \
    -initrd yakkety-server-cloudimg-amd64-initrd-generic \
    -kernel yakkety-server-cloudimg-amd64-vmlinuz-generic \
    -append 'root=/dev/vda1 modprobe.blacklist=floppy systemd.log_level=debug systemd.journald.forward_to_console=1'

Without the guestfwd=... part everything works nicely. With it I get the
following message.


qemu-system-x86_64: -netdev user,id=net0,hostfwd=tcp::2222-:22,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.46 8842: conflicting/invalid host:port in guest forwarding rule 'tcp:1.2.3.4:1234-cmd:nc 192.168.1.46 8842'
qemu-system-x86_64: -netdev user,id=net0,hostfwd=tcp::2222-:22,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.46 8842: Device 'user' could not be initialized


But I just compiled c640f2849ee8775fe1bbd7a2772610aa77816f9f, and I get the same behavior.

pas@strange:~/qemu/x86_64-softmmu$ ./qemu-system-x86_64 -net 'user,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.48 80'
qemu-system-x86_64: -net user,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.48 80: conflicting/invalid host:port in guest forwarding rule 'tcp:1.2.3.4:1234-cmd:nc 192.168.1.48 80'
qemu-system-x86_64: -net user,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.48 80: Device 'user' could not be initialized


After poking a bit around it seems that this check fails in slirp/slirp.c: (around line 1074)

    if ((guest_addr->s_addr & slirp->vnetwork_mask.s_addr) !=
        slirp->vnetwork_addr.s_addr ||
        guest_addr->s_addr == slirp->vhost_addr.s_addr ||
        guest_addr->s_addr == slirp->vnameserver_addr.s_addr) {
        return -1;
    }

Because guest_addr, and slirp has equivalent s_addr values.

x86_64-softmmu/qemu-system-x86_64 -net
'user,net=10.0.2.0/24,host=10.0.2.2,guestfwd=tcp:12.0.0.2:80-cmd:echo
ok'

guest_addr: 12.0.0.2
vnetwork_mask: 12.0.0.2
vhost_addr: 12.0.0.2
vnameserver_addr: 12.0.0.2
guest_addr & mask: 12.0.0.2


Thanks in advance for looking into this!

** Affects: qemu
     Importance: Undecided
         Status: New

** Summary changed:

- -netdev user: guestfwd doesn't work (and the error message is useless)
+ -netdev user: guestfwd doesn't work

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1628971

Title:
  -netdev user: guestfwd doesn't work

Status in QEMU:
  New

Bug description:
  Hello!

  QEMU emulator version 2.6.1 (Debian 1:2.6.1+dfsg-0ubuntu4), Copyright
  (c) 2003-2008 Fabrice Bellard

  The IP address 192.168.1.46 is assigned to eth0.

  qemu-system-x86_64 \
      -no-hpet \
      -nodefconfig \
      -machine accel=kvm \
      -cpu host \
      -smp 2 \
      -drive if=virtio,file=yakkety-server-cloudimg-amd64.img \
      -device virtio-net-pci,netdev=net0 \
      -netdev 'user,id=net0,hostfwd=tcp::2222-:22,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.46 8842' \
      -m 1024 \
      -initrd yakkety-server-cloudimg-amd64-initrd-generic \
      -kernel yakkety-server-cloudimg-amd64-vmlinuz-generic \
      -append 'root=/dev/vda1 modprobe.blacklist=floppy systemd.log_level=debug systemd.journald.forward_to_console=1'

  Without the guestfwd=... part everything works nicely. With it I get
  the following message.

  
  qemu-system-x86_64: -netdev user,id=net0,hostfwd=tcp::2222-:22,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.46 8842: conflicting/invalid host:port in guest forwarding rule 'tcp:1.2.3.4:1234-cmd:nc 192.168.1.46 8842'
  qemu-system-x86_64: -netdev user,id=net0,hostfwd=tcp::2222-:22,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.46 8842: Device 'user' could not be initialized

  
  But I just compiled c640f2849ee8775fe1bbd7a2772610aa77816f9f, and I get the same behavior.

  pas@strange:~/qemu/x86_64-softmmu$ ./qemu-system-x86_64 -net 'user,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.48 80'
  qemu-system-x86_64: -net user,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.48 80: conflicting/invalid host:port in guest forwarding rule 'tcp:1.2.3.4:1234-cmd:nc 192.168.1.48 80'
  qemu-system-x86_64: -net user,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.48 80: Device 'user' could not be initialized

  
  After poking a bit around it seems that this check fails in slirp/slirp.c: (around line 1074)

      if ((guest_addr->s_addr & slirp->vnetwork_mask.s_addr) !=
          slirp->vnetwork_addr.s_addr ||
          guest_addr->s_addr == slirp->vhost_addr.s_addr ||
          guest_addr->s_addr == slirp->vnameserver_addr.s_addr) {
          return -1;
      }

  Because guest_addr, and slirp has equivalent s_addr values.

  x86_64-softmmu/qemu-system-x86_64 -net
  'user,net=10.0.2.0/24,host=10.0.2.2,guestfwd=tcp:12.0.0.2:80-cmd:echo
  ok'

  guest_addr: 12.0.0.2
  vnetwork_mask: 12.0.0.2
  vhost_addr: 12.0.0.2
  vnameserver_addr: 12.0.0.2
  guest_addr & mask: 12.0.0.2

  
  Thanks in advance for looking into this!

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1628971/+subscriptions

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] [Bug 1628971] Re: -netdev user: guestfwd doesn't work
  2016-09-29 15:22 [Qemu-devel] [Bug 1628971] [NEW] -netdev user: guestfwd doesn't work Pas
@ 2016-10-05  9:28 ` T. Huth
  2020-11-12 13:12 ` Thomas Huth
  1 sibling, 0 replies; 3+ messages in thread
From: T. Huth @ 2016-10-05  9:28 UTC (permalink / raw)
  To: qemu-devel

Not sure whether this is really a bug or working as intended - but
apparently, the server IP address from the guest point of view (before
the NAT) has to be in the same subnet as the guest itself. So everything
should work fine if you use something like this in your first example:

 -netdev
'user,id=net0,hostfwd=tcp::2222-:22,guestfwd=tcp:10.0.2.200:1234-cmd:nc
192.168.1.46 8842'

(i.e. just replace the 1.2.3.4 with 10.0.2.200)

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1628971

Title:
  -netdev user: guestfwd doesn't work

Status in QEMU:
  New

Bug description:
  Hello!

  QEMU emulator version 2.6.1 (Debian 1:2.6.1+dfsg-0ubuntu4), Copyright
  (c) 2003-2008 Fabrice Bellard

  The IP address 192.168.1.46 is assigned to eth0.

  qemu-system-x86_64 \
      -no-hpet \
      -nodefconfig \
      -machine accel=kvm \
      -cpu host \
      -smp 2 \
      -drive if=virtio,file=yakkety-server-cloudimg-amd64.img \
      -device virtio-net-pci,netdev=net0 \
      -netdev 'user,id=net0,hostfwd=tcp::2222-:22,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.46 8842' \
      -m 1024 \
      -initrd yakkety-server-cloudimg-amd64-initrd-generic \
      -kernel yakkety-server-cloudimg-amd64-vmlinuz-generic \
      -append 'root=/dev/vda1 modprobe.blacklist=floppy systemd.log_level=debug systemd.journald.forward_to_console=1'

  Without the guestfwd=... part everything works nicely. With it I get
  the following message.

  
  qemu-system-x86_64: -netdev user,id=net0,hostfwd=tcp::2222-:22,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.46 8842: conflicting/invalid host:port in guest forwarding rule 'tcp:1.2.3.4:1234-cmd:nc 192.168.1.46 8842'
  qemu-system-x86_64: -netdev user,id=net0,hostfwd=tcp::2222-:22,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.46 8842: Device 'user' could not be initialized

  
  But I just compiled c640f2849ee8775fe1bbd7a2772610aa77816f9f, and I get the same behavior.

  pas@strange:~/qemu/x86_64-softmmu$ ./qemu-system-x86_64 -net 'user,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.48 80'
  qemu-system-x86_64: -net user,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.48 80: conflicting/invalid host:port in guest forwarding rule 'tcp:1.2.3.4:1234-cmd:nc 192.168.1.48 80'
  qemu-system-x86_64: -net user,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.48 80: Device 'user' could not be initialized

  
  After poking a bit around it seems that this check fails in slirp/slirp.c: (around line 1074)

      if ((guest_addr->s_addr & slirp->vnetwork_mask.s_addr) !=
          slirp->vnetwork_addr.s_addr ||
          guest_addr->s_addr == slirp->vhost_addr.s_addr ||
          guest_addr->s_addr == slirp->vnameserver_addr.s_addr) {
          return -1;
      }

  Because guest_addr, and slirp has equivalent s_addr values.

  x86_64-softmmu/qemu-system-x86_64 -net
  'user,net=10.0.2.0/24,host=10.0.2.2,guestfwd=tcp:12.0.0.2:80-cmd:echo
  ok'

  guest_addr: 12.0.0.2
  vnetwork_mask: 12.0.0.2
  vhost_addr: 12.0.0.2
  vnameserver_addr: 12.0.0.2
  guest_addr & mask: 12.0.0.2

  
  Thanks in advance for looking into this!

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1628971/+subscriptions

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug 1628971] Re: -netdev user: guestfwd doesn't work
  2016-09-29 15:22 [Qemu-devel] [Bug 1628971] [NEW] -netdev user: guestfwd doesn't work Pas
  2016-10-05  9:28 ` [Qemu-devel] [Bug 1628971] " T. Huth
@ 2020-11-12 13:12 ` Thomas Huth
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2020-11-12 13:12 UTC (permalink / raw)
  To: qemu-devel

** Changed in: qemu
       Status: New => Invalid

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1628971

Title:
  -netdev user: guestfwd doesn't work

Status in QEMU:
  Invalid

Bug description:
  Hello!

  QEMU emulator version 2.6.1 (Debian 1:2.6.1+dfsg-0ubuntu4), Copyright
  (c) 2003-2008 Fabrice Bellard

  The IP address 192.168.1.46 is assigned to eth0.

  qemu-system-x86_64 \
      -no-hpet \
      -nodefconfig \
      -machine accel=kvm \
      -cpu host \
      -smp 2 \
      -drive if=virtio,file=yakkety-server-cloudimg-amd64.img \
      -device virtio-net-pci,netdev=net0 \
      -netdev 'user,id=net0,hostfwd=tcp::2222-:22,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.46 8842' \
      -m 1024 \
      -initrd yakkety-server-cloudimg-amd64-initrd-generic \
      -kernel yakkety-server-cloudimg-amd64-vmlinuz-generic \
      -append 'root=/dev/vda1 modprobe.blacklist=floppy systemd.log_level=debug systemd.journald.forward_to_console=1'

  Without the guestfwd=... part everything works nicely. With it I get
  the following message.

  
  qemu-system-x86_64: -netdev user,id=net0,hostfwd=tcp::2222-:22,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.46 8842: conflicting/invalid host:port in guest forwarding rule 'tcp:1.2.3.4:1234-cmd:nc 192.168.1.46 8842'
  qemu-system-x86_64: -netdev user,id=net0,hostfwd=tcp::2222-:22,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.46 8842: Device 'user' could not be initialized

  
  But I just compiled c640f2849ee8775fe1bbd7a2772610aa77816f9f, and I get the same behavior.

  pas@strange:~/qemu/x86_64-softmmu$ ./qemu-system-x86_64 -net 'user,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.48 80'
  qemu-system-x86_64: -net user,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.48 80: conflicting/invalid host:port in guest forwarding rule 'tcp:1.2.3.4:1234-cmd:nc 192.168.1.48 80'
  qemu-system-x86_64: -net user,guestfwd=tcp:1.2.3.4:1234-cmd:nc 192.168.1.48 80: Device 'user' could not be initialized

  
  After poking a bit around it seems that this check fails in slirp/slirp.c: (around line 1074)

      if ((guest_addr->s_addr & slirp->vnetwork_mask.s_addr) !=
          slirp->vnetwork_addr.s_addr ||
          guest_addr->s_addr == slirp->vhost_addr.s_addr ||
          guest_addr->s_addr == slirp->vnameserver_addr.s_addr) {
          return -1;
      }

  Because guest_addr, and slirp has equivalent s_addr values.

  x86_64-softmmu/qemu-system-x86_64 -net
  'user,net=10.0.2.0/24,host=10.0.2.2,guestfwd=tcp:12.0.0.2:80-cmd:echo
  ok'

  guest_addr: 12.0.0.2
  vnetwork_mask: 12.0.0.2
  vhost_addr: 12.0.0.2
  vnameserver_addr: 12.0.0.2
  guest_addr & mask: 12.0.0.2

  
  Thanks in advance for looking into this!

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1628971/+subscriptions


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-12 13:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-29 15:22 [Qemu-devel] [Bug 1628971] [NEW] -netdev user: guestfwd doesn't work Pas
2016-10-05  9:28 ` [Qemu-devel] [Bug 1628971] " T. Huth
2020-11-12 13:12 ` Thomas Huth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.