* [Qemu-devel] Integrating Dynamips and GNS3 UDP tunnels (Patches)
@ 2011-10-06 17:08 Benjamin Epitech
2011-10-07 8:35 ` Jan Kiszka
0 siblings, 1 reply; 18+ messages in thread
From: Benjamin Epitech @ 2011-10-06 17:08 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1655 bytes --]
GNS3 team developed a GUI in order to inter-connect different emulated
hardware. In order
to achieve a network inter-connection between each hosts, one single
protocol is used: an
UDP tunneling protocol introduced by Dynamips (a cisco hardware emulator).
Since the beginning, GNS3 supports Qemu by providing patches for its users,
these patches
bring to Qemu the implementation of Dynamips UDP tunneling protocol.
As GNS3 improves and now supports VirtualBox, it should be time to free
users of the assle
of having to patch Qemu themselves. FreeBSD integrated our patches in the
ports tree, we
ship a patched Qemu for Windows, and we're now looking forward to integrate
those patches
upstream.
Here are the patches that apply on the latest release of Qemu, I hereby
submit them for your
approval or not.
1) Basic patch in order to build the new source file
http://code.gns3.net/qemu-patches/file/6a927b6cdaf8/Makefile_objs.patch
2) Parse -net udp
http://code.gns3.net/qemu-patches/file/6a927b6cdaf8/net_c.patch
3) New NET_CLIENT_TYPE_UDP macro
http://code.gns3.net/qemu-patches/file/6a927b6cdaf8/net_h.patch
4) New source code file, implementation of the UDP tunneling protocol
http://code.gns3.net/qemu-patches/file/6a927b6cdaf8/net_udp_c.patch
5) Corresponding header file
http://code.gns3.net/qemu-patches/file/6a927b6cdaf8/net_udp_h.patch
The hw_e1000_c.patch is no longer needed, it was a dirty hack that we kept
for too long.
The block_raw-win32_c.patch fixes a minor issue that arises only on Windows,
it may deserve
another topic.
Please include me in the replies as I am not subscribed to the list.
Regards,
Benjamin
GNS3 contributor
[-- Attachment #2: Type: text/html, Size: 2209 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] Integrating Dynamips and GNS3 UDP tunnels (Patches)
2011-10-06 17:08 [Qemu-devel] Integrating Dynamips and GNS3 UDP tunnels (Patches) Benjamin Epitech
@ 2011-10-07 8:35 ` Jan Kiszka
2011-10-08 17:31 ` Benjamin
0 siblings, 1 reply; 18+ messages in thread
From: Jan Kiszka @ 2011-10-07 8:35 UTC (permalink / raw)
To: Benjamin Epitech; +Cc: qemu-devel
On 2011-10-06 19:08, Benjamin Epitech wrote:
> GNS3 team developed a GUI in order to inter-connect different emulated
> hardware. In order
> to achieve a network inter-connection between each hosts, one single
> protocol is used: an
> UDP tunneling protocol introduced by Dynamips (a cisco hardware emulator).
>
> Since the beginning, GNS3 supports Qemu by providing patches for its users,
> these patches
> bring to Qemu the implementation of Dynamips UDP tunneling protocol.
>
> As GNS3 improves and now supports VirtualBox, it should be time to free
> users of the assle
> of having to patch Qemu themselves. FreeBSD integrated our patches in the
> ports tree, we
> ship a patched Qemu for Windows, and we're now looking forward to integrate
> those patches
> upstream.
>
> Here are the patches that apply on the latest release of Qemu, I hereby
> submit them for your
> approval or not.
>
> 1) Basic patch in order to build the new source file
> http://code.gns3.net/qemu-patches/file/6a927b6cdaf8/Makefile_objs.patch
>
> 2) Parse -net udp
> http://code.gns3.net/qemu-patches/file/6a927b6cdaf8/net_c.patch
>
> 3) New NET_CLIENT_TYPE_UDP macro
> http://code.gns3.net/qemu-patches/file/6a927b6cdaf8/net_h.patch
>
> 4) New source code file, implementation of the UDP tunneling protocol
> http://code.gns3.net/qemu-patches/file/6a927b6cdaf8/net_udp_c.patch
>
> 5) Corresponding header file
> http://code.gns3.net/qemu-patches/file/6a927b6cdaf8/net_udp_h.patch
>
> The hw_e1000_c.patch is no longer needed, it was a dirty hack that we kept
> for too long.
> The block_raw-win32_c.patch fixes a minor issue that arises only on Windows,
> it may deserve
> another topic.
>
> Please include me in the replies as I am not subscribed to the list.
>
You should send out the changes as proper patch series, rebased on
current git head. See http://wiki.qemu.org/Contribute/SubmitAPatch for
further requirements. And make sure that no patch breaks the build so
that bisectability is preserved.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] Integrating Dynamips and GNS3 UDP tunnels (Patches)
2011-10-08 17:31 ` Benjamin
@ 2011-10-08 9:29 ` Jan Kiszka
2011-10-09 17:02 ` Benjamin
2011-11-06 20:55 ` [Qemu-devel] [PATCH] Support for UDP unicast network backend Benjamin
2011-10-08 9:37 ` [Qemu-devel] Integrating Dynamips and GNS3 UDP tunnels (Patches) Stefan Weil
1 sibling, 2 replies; 18+ messages in thread
From: Jan Kiszka @ 2011-10-08 9:29 UTC (permalink / raw)
To: Benjamin; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 10339 bytes --]
On 2011-10-08 19:31, Benjamin wrote:
> On 10/07/11 10:35, Jan Kiszka wrote:
>>
>> You should send out the changes as proper patch series, rebased on
>> current git head. See http://wiki.qemu.org/Contribute/SubmitAPatch for
>> further requirements. And make sure that no patch breaks the build so
>> that bisectability is preserved.
>>
>> Jan
>>
>
> Tested and used for several years by GNS3, it doesn't break the build.
If you split the changes into multiple patches, there would have been
the risk that some patch breaks the build until a succeeding one is applied.
>
> I could not access http://git.qemu.org/qemu.git/plain/CODING_STYLE and
> http://git.qemu.org/qemu.git/plain/HACKING (404) so these patches may
> not be 100% conform. The script didn't report any error though.
You also find those files in your local qemu tree.
>
> Signed-off-by: Benjamin MARSILI <marsil_b@epitech.eu>
Patch title and description are missing.
>
> diff --git a/Makefile.objs b/Makefile.objs
> index 8d23fbb..6b4896b 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -45,6 +45,7 @@ net-obj-y = net.o
> net-nested-y = queue.o checksum.o util.o
> net-nested-y += socket.o
> net-nested-y += dump.o
> +net-nested-y += udp.o
> net-nested-$(CONFIG_POSIX) += tap.o
> net-nested-$(CONFIG_LINUX) += tap-linux.o
> net-nested-$(CONFIG_WIN32) += tap-win32.o
> diff --git a/net.c b/net.c
> index d05930c..6a3b2ba 100644
> --- a/net.c
> +++ b/net.c
> @@ -30,6 +30,7 @@
> #include "net/dump.h"
> #include "net/slirp.h"
> #include "net/vde.h"
> +#include "net/udp.h"
> #include "net/util.h"
> #include "monitor.h"
> #include "qemu-common.h"
> @@ -1036,6 +1037,27 @@ static const struct {
> },
> },
> #endif
> + [NET_CLIENT_TYPE_UDP] = {
> + .type = "udp",
> + .init = net_init_udp,
> + .desc = {
> + NET_COMMON_PARAMS_DESC,
> + {
> + .name = "sport",
> + .type = QEMU_OPT_NUMBER,
> + .help = "source port number",
> + }, {
> + .name = "daddr",
> + .type = QEMU_OPT_STRING,
> + .help = "destination IP address",
> + }, {
> + .name = "dport",
> + .type = QEMU_OPT_NUMBER,
> + .help = "destination port number",
> + },
> + { /* end of list */ }
> + },
> + },
> [NET_CLIENT_TYPE_DUMP] = {
> .type = "dump",
> .init = net_init_dump,
> diff --git a/net.h b/net.h
> index 9f633f8..ac6118c 100644
> --- a/net.h
> +++ b/net.h
> @@ -35,6 +35,7 @@ typedef enum {
> NET_CLIENT_TYPE_TAP,
> NET_CLIENT_TYPE_SOCKET,
> NET_CLIENT_TYPE_VDE,
> + NET_CLIENT_TYPE_UDP,
> NET_CLIENT_TYPE_DUMP,
>
> NET_CLIENT_TYPE_MAX
> diff --git a/net/udp.c b/net/udp.c
> new file mode 100644
> index 0000000..7b4b702
> --- /dev/null
> +++ b/net/udp.c
> @@ -0,0 +1,140 @@
> +/*
> + * QEMU System Emulator
> + *
> + * Copyright (c) 2003-2008 Fabrice Bellard
> + *
> + * Permission is hereby granted, free of charge, to any person
> obtaining a copy
> + * of this software and associated documentation files (the
> "Software"), to deal
> + * in the Software without restriction, including without limitation
> the rights
> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or
> sell
> + * copies of the Software, and to permit persons to whom the Software is
> + * furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be
> included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> ARISING FROM,
> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> DEALINGS IN
> + * THE SOFTWARE.
> + */
> +#include "net/udp.h"
> +
> +#include "config-host.h"
> +
> +#ifndef _WIN32
> +#include <arpa/inet.h>
> +#include <netinet/in.h>
> +#include <netinet/udp.h>
> +#endif
> +
> +#include "net.h"
> +#include "qemu-char.h"
> +#include "qemu-common.h"
> +#include "qemu-option.h"
> +#include "qemu_socket.h"
> +#include "sysemu.h"
> +
> +
> +typedef struct UDPState {
> + VLANClientState nc;
> + int rfd;
> + struct sockaddr_in sender;
> +} UDPState;
> +
> +static void udp_to_qemu(void *opaque)
> +{
> + UDPState *s = opaque;
> + uint8_t buf[4096];
> + int size;
> +
> + size = recvfrom(s->rfd, (char *)buf, sizeof(buf), 0, NULL, NULL);
> + if (size > 0) {
> + qemu_send_packet(&s->nc, buf, size);
> + }
> +}
> +
> +static ssize_t udp_receive(VLANClientState *nc, const uint8_t *buf,
> size_t size)
> +{
> + UDPState *s = DO_UPCAST(UDPState, nc, nc);
> + int ret;
> +
> + do {
> + ret = sendto(s->rfd, (const char *)buf, size, 0,
> + (struct sockaddr *)&s->sender, sizeof(s->sender));
> + } while (ret < 0 && errno == EINTR);
> +
> + return ret;
> +}
> +
> +static void udp_cleanup(VLANClientState *nc)
> +{
> + UDPState *s = DO_UPCAST(UDPState, nc, nc);
> + qemu_set_fd_handler(s->rfd, NULL, NULL, NULL);
> + close(s->rfd);
> +}
> +
> +static NetClientInfo net_udp_info = {
> + .type = NET_CLIENT_TYPE_UDP,
> + .size = sizeof(UDPState),
> + .receive = udp_receive,
> + .cleanup = udp_cleanup,
> +};
> +
> +static int net_udp_init(VLANState *vlan, const char *model,
> + const char *name, int sport,
> + const char *daddr, int dport)
> +{
> + VLANClientState *nc;
> + UDPState *s;
> + struct sockaddr_in receiver;
> + int ret;
> +
> + nc = qemu_new_net_client(&net_udp_info, vlan, NULL, model, name);
> +
> + snprintf(nc->info_str, sizeof(nc->info_str), "udp: %i->%s:%i",
> + sport, daddr, dport);
> +
> + s = DO_UPCAST(UDPState, nc, nc);
> +
> + s->rfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
> + receiver.sin_family = AF_INET;
> + receiver.sin_addr.s_addr = INADDR_ANY;
> + receiver.sin_port = htons(sport);
> + ret = bind(s->rfd, (struct sockaddr *)&receiver, sizeof(receiver));
> +
> + if (ret == -1) {
> + fprintf(stderr, "bind error:%s\n", strerror(errno));
> + return ret;
> + }
> +
> + memset((char *)&s->sender, 0, sizeof(s->sender));
> + s->sender.sin_family = AF_INET;
> + s->sender.sin_port = htons(dport);
> + inet_aton(daddr, &s->sender.sin_addr);
> +
> + qemu_set_fd_handler(s->rfd, udp_to_qemu, NULL, s);
> +
> + return 0;
> +}
> +
> +int net_init_udp(QemuOpts *opts, Monitor *mon,
> + const char *name, VLANState *vlan)
> +{
> + const char *daddr;
> + int sport, dport;
> +
> + daddr = qemu_opt_get(opts, "daddr");
> +
> + sport = qemu_opt_get_number(opts, "sport", 0);
> + dport = qemu_opt_get_number(opts, "dport", 0);
> +
> + if (net_udp_init(vlan, "udp", name, sport, daddr, dport) == -1) {
> + return -1;
> + }
> +
> + return 0;
> +}
> diff --git a/net/udp.h b/net/udp.h
> new file mode 100644
> index 0000000..e614077
> --- /dev/null
> +++ b/net/udp.h
> @@ -0,0 +1,32 @@
> +/*
> + * QEMU System Emulator
> + *
> + * Copyright (c) 2003-2008 Fabrice Bellard
> + *
> + * Permission is hereby granted, free of charge, to any person
> obtaining a copy
> + * of this software and associated documentation files (the
> "Software"), to deal
> + * in the Software without restriction, including without limitation
> the rights
> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or
> sell
> + * copies of the Software, and to permit persons to whom the Software is
> + * furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be
> included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> ARISING FROM,
> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> DEALINGS IN
> + * THE SOFTWARE.
> + */
> +#ifndef QEMU_NET_UDP_H
> +#define QEMU_NET_UDP_H
> +
> +#include "qemu-common.h"
> +#include "qemu-option.h"
> +
> +int net_init_udp(QemuOpts*, Monitor*, const char *name, VLANState*);
> +
> +#endif /* QEMU_NET_UDP_H */
> diff --git a/qemu-options.hx b/qemu-options.hx
> index dfbabd0..021d898 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -1145,6 +1145,8 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
> " connect the user mode network stack to VLAN 'n',
> configure its\n"
> " DHCP server and enabled optional services\n"
> #endif
> + "-net udp[,vlan=n],sport=sport,dport=dport,daddr=host\n"
> + " connect the vlan 'n' to a udp host (for
> dynamips/pemu/GNS3)\n"
> #ifdef _WIN32
> "-net tap[,vlan=n][,name=str],ifname=name\n"
> " connect the host TAP network interface to VLAN 'n'\n"
>
>
>
-netdev support is missing.
Can't you extend the existing socket support? It already has SOCK_DGRAM
logic for multicast. Adding something like
-net[dev] socket,udp=host:port[,localport=port]
(with localport=remoteport as default) should fit well into the existing
infrastructure. And it would give you -netdev for free.
Just curious: Do you have setups that depend on vlan support to create
multiple udp backends per NIC?
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] Integrating Dynamips and GNS3 UDP tunnels (Patches)
2011-10-08 17:31 ` Benjamin
2011-10-08 9:29 ` Jan Kiszka
@ 2011-10-08 9:37 ` Stefan Weil
1 sibling, 0 replies; 18+ messages in thread
From: Stefan Weil @ 2011-10-08 9:37 UTC (permalink / raw)
To: Benjamin; +Cc: Jan Kiszka, qemu-devel
Am 08.10.2011 19:31, schrieb Benjamin:
> diff --git a/net/udp.c b/net/udp.c
> new file mode 100644
> index 0000000..7b4b702
> --- /dev/null
> +++ b/net/udp.c
> @@ -0,0 +1,140 @@
> +/*
> + * QEMU System Emulator
What about using a title which matches better?
Maybe 'UDP tunnel' or something like that?
>
> + *
> + * Copyright (c) 2003-2008 Fabrice Bellard
And here you might use your own copyright.
Or did Fabrice start writing this code in 2003?
>
> diff --git a/net/udp.h b/net/udp.h
> new file mode 100644
> index 0000000..e614077
> --- /dev/null
> +++ b/net/udp.h
> @@ -0,0 +1,32 @@
> +/*
> + * QEMU System Emulator
> + *
> + * Copyright (c) 2003-2008 Fabrice Bellard
> + *
See comments given above.
Regards,
Stefan Weil
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] Integrating Dynamips and GNS3 UDP tunnels (Patches)
2011-10-07 8:35 ` Jan Kiszka
@ 2011-10-08 17:31 ` Benjamin
2011-10-08 9:29 ` Jan Kiszka
2011-10-08 9:37 ` [Qemu-devel] Integrating Dynamips and GNS3 UDP tunnels (Patches) Stefan Weil
0 siblings, 2 replies; 18+ messages in thread
From: Benjamin @ 2011-10-08 17:31 UTC (permalink / raw)
To: Jan Kiszka; +Cc: qemu-devel
On 10/07/11 10:35, Jan Kiszka wrote:
>
> You should send out the changes as proper patch series, rebased on
> current git head. See http://wiki.qemu.org/Contribute/SubmitAPatch for
> further requirements. And make sure that no patch breaks the build so
> that bisectability is preserved.
>
> Jan
>
Tested and used for several years by GNS3, it doesn't break the build.
I could not access http://git.qemu.org/qemu.git/plain/CODING_STYLE and
http://git.qemu.org/qemu.git/plain/HACKING (404) so these patches may
not be 100% conform. The script didn't report any error though.
Signed-off-by: Benjamin MARSILI <marsil_b@epitech.eu>
diff --git a/Makefile.objs b/Makefile.objs
index 8d23fbb..6b4896b 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -45,6 +45,7 @@ net-obj-y = net.o
net-nested-y = queue.o checksum.o util.o
net-nested-y += socket.o
net-nested-y += dump.o
+net-nested-y += udp.o
net-nested-$(CONFIG_POSIX) += tap.o
net-nested-$(CONFIG_LINUX) += tap-linux.o
net-nested-$(CONFIG_WIN32) += tap-win32.o
diff --git a/net.c b/net.c
index d05930c..6a3b2ba 100644
--- a/net.c
+++ b/net.c
@@ -30,6 +30,7 @@
#include "net/dump.h"
#include "net/slirp.h"
#include "net/vde.h"
+#include "net/udp.h"
#include "net/util.h"
#include "monitor.h"
#include "qemu-common.h"
@@ -1036,6 +1037,27 @@ static const struct {
},
},
#endif
+ [NET_CLIENT_TYPE_UDP] = {
+ .type = "udp",
+ .init = net_init_udp,
+ .desc = {
+ NET_COMMON_PARAMS_DESC,
+ {
+ .name = "sport",
+ .type = QEMU_OPT_NUMBER,
+ .help = "source port number",
+ }, {
+ .name = "daddr",
+ .type = QEMU_OPT_STRING,
+ .help = "destination IP address",
+ }, {
+ .name = "dport",
+ .type = QEMU_OPT_NUMBER,
+ .help = "destination port number",
+ },
+ { /* end of list */ }
+ },
+ },
[NET_CLIENT_TYPE_DUMP] = {
.type = "dump",
.init = net_init_dump,
diff --git a/net.h b/net.h
index 9f633f8..ac6118c 100644
--- a/net.h
+++ b/net.h
@@ -35,6 +35,7 @@ typedef enum {
NET_CLIENT_TYPE_TAP,
NET_CLIENT_TYPE_SOCKET,
NET_CLIENT_TYPE_VDE,
+ NET_CLIENT_TYPE_UDP,
NET_CLIENT_TYPE_DUMP,
NET_CLIENT_TYPE_MAX
diff --git a/net/udp.c b/net/udp.c
new file mode 100644
index 0000000..7b4b702
--- /dev/null
+++ b/net/udp.c
@@ -0,0 +1,140 @@
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person
obtaining a copy
+ * of this software and associated documentation files (the
"Software"), to deal
+ * in the Software without restriction, including without limitation
the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include "net/udp.h"
+
+#include "config-host.h"
+
+#ifndef _WIN32
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <netinet/udp.h>
+#endif
+
+#include "net.h"
+#include "qemu-char.h"
+#include "qemu-common.h"
+#include "qemu-option.h"
+#include "qemu_socket.h"
+#include "sysemu.h"
+
+
+typedef struct UDPState {
+ VLANClientState nc;
+ int rfd;
+ struct sockaddr_in sender;
+} UDPState;
+
+static void udp_to_qemu(void *opaque)
+{
+ UDPState *s = opaque;
+ uint8_t buf[4096];
+ int size;
+
+ size = recvfrom(s->rfd, (char *)buf, sizeof(buf), 0, NULL, NULL);
+ if (size > 0) {
+ qemu_send_packet(&s->nc, buf, size);
+ }
+}
+
+static ssize_t udp_receive(VLANClientState *nc, const uint8_t *buf,
size_t size)
+{
+ UDPState *s = DO_UPCAST(UDPState, nc, nc);
+ int ret;
+
+ do {
+ ret = sendto(s->rfd, (const char *)buf, size, 0,
+ (struct sockaddr *)&s->sender, sizeof(s->sender));
+ } while (ret < 0 && errno == EINTR);
+
+ return ret;
+}
+
+static void udp_cleanup(VLANClientState *nc)
+{
+ UDPState *s = DO_UPCAST(UDPState, nc, nc);
+ qemu_set_fd_handler(s->rfd, NULL, NULL, NULL);
+ close(s->rfd);
+}
+
+static NetClientInfo net_udp_info = {
+ .type = NET_CLIENT_TYPE_UDP,
+ .size = sizeof(UDPState),
+ .receive = udp_receive,
+ .cleanup = udp_cleanup,
+};
+
+static int net_udp_init(VLANState *vlan, const char *model,
+ const char *name, int sport,
+ const char *daddr, int dport)
+{
+ VLANClientState *nc;
+ UDPState *s;
+ struct sockaddr_in receiver;
+ int ret;
+
+ nc = qemu_new_net_client(&net_udp_info, vlan, NULL, model, name);
+
+ snprintf(nc->info_str, sizeof(nc->info_str), "udp: %i->%s:%i",
+ sport, daddr, dport);
+
+ s = DO_UPCAST(UDPState, nc, nc);
+
+ s->rfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+ receiver.sin_family = AF_INET;
+ receiver.sin_addr.s_addr = INADDR_ANY;
+ receiver.sin_port = htons(sport);
+ ret = bind(s->rfd, (struct sockaddr *)&receiver, sizeof(receiver));
+
+ if (ret == -1) {
+ fprintf(stderr, "bind error:%s\n", strerror(errno));
+ return ret;
+ }
+
+ memset((char *)&s->sender, 0, sizeof(s->sender));
+ s->sender.sin_family = AF_INET;
+ s->sender.sin_port = htons(dport);
+ inet_aton(daddr, &s->sender.sin_addr);
+
+ qemu_set_fd_handler(s->rfd, udp_to_qemu, NULL, s);
+
+ return 0;
+}
+
+int net_init_udp(QemuOpts *opts, Monitor *mon,
+ const char *name, VLANState *vlan)
+{
+ const char *daddr;
+ int sport, dport;
+
+ daddr = qemu_opt_get(opts, "daddr");
+
+ sport = qemu_opt_get_number(opts, "sport", 0);
+ dport = qemu_opt_get_number(opts, "dport", 0);
+
+ if (net_udp_init(vlan, "udp", name, sport, daddr, dport) == -1) {
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/net/udp.h b/net/udp.h
new file mode 100644
index 0000000..e614077
--- /dev/null
+++ b/net/udp.h
@@ -0,0 +1,32 @@
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person
obtaining a copy
+ * of this software and associated documentation files (the
"Software"), to deal
+ * in the Software without restriction, including without limitation
the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef QEMU_NET_UDP_H
+#define QEMU_NET_UDP_H
+
+#include "qemu-common.h"
+#include "qemu-option.h"
+
+int net_init_udp(QemuOpts*, Monitor*, const char *name, VLANState*);
+
+#endif /* QEMU_NET_UDP_H */
diff --git a/qemu-options.hx b/qemu-options.hx
index dfbabd0..021d898 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1145,6 +1145,8 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
" connect the user mode network stack to VLAN 'n',
configure its\n"
" DHCP server and enabled optional services\n"
#endif
+ "-net udp[,vlan=n],sport=sport,dport=dport,daddr=host\n"
+ " connect the vlan 'n' to a udp host (for
dynamips/pemu/GNS3)\n"
#ifdef _WIN32
"-net tap[,vlan=n][,name=str],ifname=name\n"
" connect the host TAP network interface to VLAN 'n'\n"
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] Integrating Dynamips and GNS3 UDP tunnels (Patches)
2011-10-08 9:29 ` Jan Kiszka
@ 2011-10-09 17:02 ` Benjamin
2011-11-06 20:55 ` [Qemu-devel] [PATCH] Support for UDP unicast network backend Benjamin
1 sibling, 0 replies; 18+ messages in thread
From: Benjamin @ 2011-10-09 17:02 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Stefan Weil, qemu-devel
I took your comments into account and I am now making the necessary
changes. I should be able to send you a correct patch with netdev
support during the next coming week.
Thanks you for your time.
On 10/08/11 11:29, Jan Kiszka wrote:
>
> Just curious: Do you have setups that depend on vlan support to create
> multiple udp backends per NIC?
>
Apparently, vlans are here to prevent multicast traffic from the UDP
tunneling protocol to be sent to all NICs. It's probably useless with
the netdev infrastructure.
On 10/08/11 11:37, Stefan Weil wrote:
>> + * Copyright (c) 2003-2008 Fabrice Bellard
>
> And here you might use your own copyright.
> Or did Fabrice start writing this code in 2003?
Yes, Fabrice wrote the code as a GNS3 developer back then.
Regards,
Benjamin
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH] Support for UDP unicast network backend
2011-11-06 20:55 ` [Qemu-devel] [PATCH] Support for UDP unicast network backend Benjamin
@ 2011-11-06 13:54 ` Jan Kiszka
2011-11-07 14:01 ` Benjamin
2011-11-06 14:28 ` [Qemu-devel] [PATCH] " Benjamin Epitech
1 sibling, 1 reply; 18+ messages in thread
From: Jan Kiszka @ 2011-11-06 13:54 UTC (permalink / raw)
To: Benjamin; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1198 bytes --]
On 2011-11-06 21:55, Benjamin wrote:
> Follow-up of:
> http://www.mail-archive.com/qemu-devel@nongnu.org/msg81235.html
>
> This enables connections between Qemu, Dynamips and VirtualBox guests.
>
> Test it with:
>
> qemu-system-i386 -netdev
> socket,id=gns3,udp=127.0.0.1:4243,localport=127.0.0.1:4242 -device
> e1000,netdev=gns3 /path/to/hard/drive/img1
>
> qemu-system-i386 -netdev
> socket,id=gns3,udp=127.0.0.1:4242,localport=127.0.0.1:4243 -device
> e1000,netdev=gns3 /path/to/hard/drive/img2
>
> You should be able to set up a network between these two hosts.
>
> Any thoughts?
Looks good to me. Just one thing: localaddr vs. localport is
unfortunate. localport is actual "local host and port". So localaddr
would be a better fit, even with mcast continuing to expect it without
":port".
>
> I noticed an interesting behavior of Qemu and I'd like to investigate.
> When an IP address is assigned to an interface it sends a who-has ARP
> request with its own address. Which is not what happens on my OS. What
> would be the correct and standard behavior?
That's done by many OSes to discover IP conflicts early. Has nothing to
do with QEMU.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH] Support for UDP unicast network backend
2011-11-06 20:55 ` [Qemu-devel] [PATCH] Support for UDP unicast network backend Benjamin
2011-11-06 13:54 ` Jan Kiszka
@ 2011-11-06 14:28 ` Benjamin Epitech
1 sibling, 0 replies; 18+ messages in thread
From: Benjamin Epitech @ 2011-11-06 14:28 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 6409 bytes --]
Here's the link, replace ' AT ' by '@', the server thought it was an
email address.
http://www.mail-archive.com/qemu-devel AT
nongnu.org/msg81235.html<http://www.mail-archive.com/qemu-devel@nongnu.org/msg81235.html>
As I've been notified, localport should disappear and localaddr should be
used to
specify the local host AND port. I'll update the patch and send it back
tomorrow then.
On Mon, Nov 7, 2011 at 5:55 AM, Benjamin <mlspirat42@gmail.com> wrote:
> Follow-up of: http://www.mail-archive.com/**qemu-devel@nongnu.org/**
> msg81235.html<http://www.mail-archive.com/qemu-devel@nongnu.org/msg81235.html>
>
> This enables connections between Qemu, Dynamips and VirtualBox guests.
>
> Test it with:
>
> qemu-system-i386 -netdev socket,id=gns3,udp=127.0.0.1:**4243<http://127.0.0.1:4243>
> ,localport=127.0.0.1:4242 -device e1000,netdev=gns3
> /path/to/hard/drive/img1
>
> qemu-system-i386 -netdev socket,id=gns3,udp=127.0.0.1:**4242<http://127.0.0.1:4242>
> ,localport=127.0.0.1:4243 -device e1000,netdev=gns3
> /path/to/hard/drive/img2
>
> You should be able to set up a network between these two hosts.
>
> Any thoughts?
>
> I noticed an interesting behavior of Qemu and I'd like to investigate.
> When an IP address is assigned to an interface it sends a who-has ARP
> request with its own address. Which is not what happens on my OS. What
> would be the correct and standard behavior?
>
> Signed-off-by: Benjamin MARSILI <marsil_b@epitech.eu>
> ---
> net.c | 11 ++++++++-
> net/socket.c | 66 ++++++++++++++++++++++++++++++**
> +++++++++++++++++++++++-
> qemu-options.hx | 2 +
> 3 files changed, 76 insertions(+), 3 deletions(-)
>
> diff --git a/net.c b/net.c
> index cb52050..e70f1c8 100644
> --- a/net.c
> +++ b/net.c
> @@ -1000,6 +1000,14 @@ static const struct {
> .name = "localaddr",
> .type = QEMU_OPT_STRING,
> .help = "source address for multicast packets",
> + }, {
> + .name = "udp",
> + .type = QEMU_OPT_STRING,
> + .help = "UDP unicast address and port number",
> + }, {
> + .name = "localport",
> + .type = QEMU_OPT_STRING,
> + .help = "UDP unicast bind address and port number",
> },
> { /* end of list */ }
> },
> @@ -1070,7 +1078,8 @@ int net_client_init(Monitor *mon, QemuOpts *opts,
> int is_netdev)
> #ifdef CONFIG_VDE
> strcmp(type, "vde") != 0 &&
> #endif
> - strcmp(type, "socket") != 0) {
> + strcmp(type, "socket") != 0 &&
> + strcmp(type, "udp") != 0) {
> qerror_report(QERR_INVALID_**PARAMETER_VALUE, "type",
> "a netdev backend type");
> return -1;
> diff --git a/net/socket.c b/net/socket.c
> index e9ef128..306e54b 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -524,6 +524,52 @@ static int net_socket_mcast_init(**VLANState *vlan,
>
> }
>
> +static int net_socket_udp_init(VLANState *vlan,
> + const char *model,
> + const char *name,
> + const char *rhost,
> + const char *lhost)
> +{
> + NetSocketState *s;
> + int fd, val, ret;
> + struct sockaddr_in laddr, raddr;
> +
> + if (parse_host_port(&laddr, lhost) < 0)
> + return -1;
> +
> + if (parse_host_port(&raddr, rhost) < 0)
> + return -1;
> +
> + fd = qemu_socket(PF_INET, SOCK_DGRAM, 0);
> + if (fd < 0) {
> + perror("socket(PF_INET, SOCK_DGRAM)");
> + return -1;
> + }
> + val = 1;
> + ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
> + (const char *)&val, sizeof(val));
> + if (ret < 0) {
> + perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)");
> + return -1;
> + }
> + ret = bind(fd, (struct sockaddr *)&laddr, sizeof(laddr));
> + if (ret < 0) {
> + perror("bind");
> + return -1;
> + }
> +
> + s = net_socket_fd_init(vlan, model, name, fd, 0);
> + if (!s)
> + return -1;
> +
> + s->dgram_dst = raddr;
> +
> + snprintf(s->nc.info_str, sizeof(s->nc.info_str),
> + "socket: udp=%s:%d",
> + inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port));
> + return 0;
> +}
> +
> int net_init_socket(QemuOpts *opts,
> Monitor *mon,
> const char *name,
> @@ -597,10 +643,26 @@ int net_init_socket(QemuOpts *opts,
> if (net_socket_mcast_init(vlan, "socket", name, mcast, localaddr)
> == -1) {
> return -1;
> }
> + } else if (qemu_opt_get(opts, "udp")) {
> + const char *udp, *localport;
> +
> + if (qemu_opt_get(opts, "fd") ||
> + qemu_opt_get(opts, "connect") ||
> + qemu_opt_get(opts, "listen") ||
> + qemu_opt_get(opts, "mcast")) {
> + error_report("fd=, connect=, listen=, mcast=, localaddr= is
> invalid with udp=");
> + return -1;
> + }
> +
> + udp = qemu_opt_get(opts, "udp");
> + localport = qemu_opt_get(opts, "localport");
> +
> + if (net_socket_udp_init(vlan, "udp", name, udp, localport) == -1)
> {
> + return -1;
> + }
> } else {
> - error_report("-socket requires fd=, listen=, connect= or mcast=");
> + error_report("-socket requires fd=, listen=, connect=, mcast= or
> udp=");
> return -1;
> }
> -
> return 0;
> }
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 681eaf1..109feb0 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -1217,6 +1217,8 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
> "-net socket[,vlan=n][,name=str][,**fd=h][,mcast=maddr:port[,**
> localaddr=addr]]\n"
> " connect the vlan 'n' to multicast maddr and port\n"
> " use 'localaddr=addr' to specify the host address to
> send packets from\n"
> + "-net socket[,vlan=n][,name=str][,**fd=h][,udp=host:port][,**
> localport=host:port]\n"
> + " connect the vlan 'n' to another VLAN using an UDP
> tunnel\n"
> #ifdef CONFIG_VDE
> "-net vde[,vlan=n][,name=str][,sock=**socketpath][,port=n][,group=**
> groupname][,mode=octalmode]\n"
> " connect the vlan 'n' to port 'n' of a vde switch
> running\n"
> --
> 1.7.3.5
>
[-- Attachment #2: Type: text/html, Size: 8020 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH] Support for UDP unicast network backend
2011-10-08 9:29 ` Jan Kiszka
2011-10-09 17:02 ` Benjamin
@ 2011-11-06 20:55 ` Benjamin
2011-11-06 13:54 ` Jan Kiszka
2011-11-06 14:28 ` [Qemu-devel] [PATCH] " Benjamin Epitech
1 sibling, 2 replies; 18+ messages in thread
From: Benjamin @ 2011-11-06 20:55 UTC (permalink / raw)
To: qemu-devel; +Cc: Jan Kiszka
Follow-up of:
http://www.mail-archive.com/qemu-devel@nongnu.org/msg81235.html
This enables connections between Qemu, Dynamips and VirtualBox guests.
Test it with:
qemu-system-i386 -netdev
socket,id=gns3,udp=127.0.0.1:4243,localport=127.0.0.1:4242 -device
e1000,netdev=gns3 /path/to/hard/drive/img1
qemu-system-i386 -netdev
socket,id=gns3,udp=127.0.0.1:4242,localport=127.0.0.1:4243 -device
e1000,netdev=gns3 /path/to/hard/drive/img2
You should be able to set up a network between these two hosts.
Any thoughts?
I noticed an interesting behavior of Qemu and I'd like to investigate.
When an IP address is assigned to an interface it sends a who-has ARP
request with its own address. Which is not what happens on my OS. What
would be the correct and standard behavior?
Signed-off-by: Benjamin MARSILI <marsil_b@epitech.eu>
---
net.c | 11 ++++++++-
net/socket.c | 66
+++++++++++++++++++++++++++++++++++++++++++++++++++++-
qemu-options.hx | 2 +
3 files changed, 76 insertions(+), 3 deletions(-)
diff --git a/net.c b/net.c
index cb52050..e70f1c8 100644
--- a/net.c
+++ b/net.c
@@ -1000,6 +1000,14 @@ static const struct {
.name = "localaddr",
.type = QEMU_OPT_STRING,
.help = "source address for multicast packets",
+ }, {
+ .name = "udp",
+ .type = QEMU_OPT_STRING,
+ .help = "UDP unicast address and port number",
+ }, {
+ .name = "localport",
+ .type = QEMU_OPT_STRING,
+ .help = "UDP unicast bind address and port number",
},
{ /* end of list */ }
},
@@ -1070,7 +1078,8 @@ int net_client_init(Monitor *mon, QemuOpts *opts,
int is_netdev)
#ifdef CONFIG_VDE
strcmp(type, "vde") != 0 &&
#endif
- strcmp(type, "socket") != 0) {
+ strcmp(type, "socket") != 0 &&
+ strcmp(type, "udp") != 0) {
qerror_report(QERR_INVALID_PARAMETER_VALUE, "type",
"a netdev backend type");
return -1;
diff --git a/net/socket.c b/net/socket.c
index e9ef128..306e54b 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -524,6 +524,52 @@ static int net_socket_mcast_init(VLANState *vlan,
}
+static int net_socket_udp_init(VLANState *vlan,
+ const char *model,
+ const char *name,
+ const char *rhost,
+ const char *lhost)
+{
+ NetSocketState *s;
+ int fd, val, ret;
+ struct sockaddr_in laddr, raddr;
+
+ if (parse_host_port(&laddr, lhost) < 0)
+ return -1;
+
+ if (parse_host_port(&raddr, rhost) < 0)
+ return -1;
+
+ fd = qemu_socket(PF_INET, SOCK_DGRAM, 0);
+ if (fd < 0) {
+ perror("socket(PF_INET, SOCK_DGRAM)");
+ return -1;
+ }
+ val = 1;
+ ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
+ (const char *)&val, sizeof(val));
+ if (ret < 0) {
+ perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)");
+ return -1;
+ }
+ ret = bind(fd, (struct sockaddr *)&laddr, sizeof(laddr));
+ if (ret < 0) {
+ perror("bind");
+ return -1;
+ }
+
+ s = net_socket_fd_init(vlan, model, name, fd, 0);
+ if (!s)
+ return -1;
+
+ s->dgram_dst = raddr;
+
+ snprintf(s->nc.info_str, sizeof(s->nc.info_str),
+ "socket: udp=%s:%d",
+ inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port));
+ return 0;
+}
+
int net_init_socket(QemuOpts *opts,
Monitor *mon,
const char *name,
@@ -597,10 +643,26 @@ int net_init_socket(QemuOpts *opts,
if (net_socket_mcast_init(vlan, "socket", name, mcast,
localaddr) == -1) {
return -1;
}
+ } else if (qemu_opt_get(opts, "udp")) {
+ const char *udp, *localport;
+
+ if (qemu_opt_get(opts, "fd") ||
+ qemu_opt_get(opts, "connect") ||
+ qemu_opt_get(opts, "listen") ||
+ qemu_opt_get(opts, "mcast")) {
+ error_report("fd=, connect=, listen=, mcast=, localaddr= is
invalid with udp=");
+ return -1;
+ }
+
+ udp = qemu_opt_get(opts, "udp");
+ localport = qemu_opt_get(opts, "localport");
+
+ if (net_socket_udp_init(vlan, "udp", name, udp, localport) == -1) {
+ return -1;
+ }
} else {
- error_report("-socket requires fd=, listen=, connect= or mcast=");
+ error_report("-socket requires fd=, listen=, connect=, mcast=
or udp=");
return -1;
}
-
return 0;
}
diff --git a/qemu-options.hx b/qemu-options.hx
index 681eaf1..109feb0 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1217,6 +1217,8 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
"-net
socket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port[,localaddr=addr]]\n"
" connect the vlan 'n' to multicast maddr and port\n"
" use 'localaddr=addr' to specify the host address
to send packets from\n"
+ "-net
socket[,vlan=n][,name=str][,fd=h][,udp=host:port][,localport=host:port]\n"
+ " connect the vlan 'n' to another VLAN using an UDP
tunnel\n"
#ifdef CONFIG_VDE
"-net
vde[,vlan=n][,name=str][,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n"
" connect the vlan 'n' to port 'n' of a vde switch
running\n"
--
1.7.3.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH] Support for UDP unicast network backend
2011-11-07 14:01 ` Benjamin
@ 2011-11-07 11:23 ` Jan Kiszka
2011-11-07 22:03 ` Benjamin
0 siblings, 1 reply; 18+ messages in thread
From: Jan Kiszka @ 2011-11-07 11:23 UTC (permalink / raw)
To: Benjamin; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 5521 bytes --]
On 2011-11-07 15:01, Benjamin wrote:
> Here is the updated patch, using only localaddr. mcast expects it to be
> addr whereas udp expects addr:port. It's documented in the help output.
>
> I also corrected the error message when checking udp parameters.
Sorry, missed that: please never forget to run your patches through
checkpatch.pl. Once fixed, consider this
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
>
> Signed-off-by: Benjamin MARSILI <marsil_b@epitech.eu>
> ---
> net.c | 9 +++++-
> net/socket.c | 66
> +++++++++++++++++++++++++++++++++++++++++++++++++++++-
> qemu-options.hx | 2 +
> 3 files changed, 73 insertions(+), 4 deletions(-)
>
> diff --git a/net.c b/net.c
> index cb52050..c75be08 100644
> --- a/net.c
> +++ b/net.c
> @@ -999,7 +999,11 @@ static const struct {
> }, {
> .name = "localaddr",
> .type = QEMU_OPT_STRING,
> - .help = "source address for multicast packets",
> + .help = "source address and port for multicast and udp
> packets",
> + }, {
> + .name = "udp",
> + .type = QEMU_OPT_STRING,
> + .help = "UDP unicast address and port number",
> },
> { /* end of list */ }
> },
> @@ -1070,7 +1074,8 @@ int net_client_init(Monitor *mon, QemuOpts *opts,
> int is_netdev)
> #ifdef CONFIG_VDE
> strcmp(type, "vde") != 0 &&
> #endif
> - strcmp(type, "socket") != 0) {
> + strcmp(type, "socket") != 0 &&
> + strcmp(type, "udp") != 0) {
> qerror_report(QERR_INVALID_PARAMETER_VALUE, "type",
> "a netdev backend type");
> return -1;
> diff --git a/net/socket.c b/net/socket.c
> index e9ef128..3601228 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -524,6 +524,52 @@ static int net_socket_mcast_init(VLANState *vlan,
>
> }
>
> +static int net_socket_udp_init(VLANState *vlan,
> + const char *model,
> + const char *name,
> + const char *rhost,
> + const char *lhost)
> +{
> + NetSocketState *s;
> + int fd, val, ret;
> + struct sockaddr_in laddr, raddr;
> +
> + if (parse_host_port(&laddr, lhost) < 0)
> + return -1;
> +
> + if (parse_host_port(&raddr, rhost) < 0)
> + return -1;
> +
> + fd = qemu_socket(PF_INET, SOCK_DGRAM, 0);
> + if (fd < 0) {
> + perror("socket(PF_INET, SOCK_DGRAM)");
> + return -1;
> + }
> + val = 1;
> + ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
> + (const char *)&val, sizeof(val));
> + if (ret < 0) {
> + perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)");
> + return -1;
> + }
> + ret = bind(fd, (struct sockaddr *)&laddr, sizeof(laddr));
> + if (ret < 0) {
> + perror("bind");
> + return -1;
> + }
> +
> + s = net_socket_fd_init(vlan, model, name, fd, 0);
> + if (!s)
> + return -1;
> +
> + s->dgram_dst = raddr;
> +
> + snprintf(s->nc.info_str, sizeof(s->nc.info_str),
> + "socket: udp=%s:%d",
> + inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port));
> + return 0;
> +}
> +
> int net_init_socket(QemuOpts *opts,
> Monitor *mon,
> const char *name,
> @@ -597,10 +643,26 @@ int net_init_socket(QemuOpts *opts,
> if (net_socket_mcast_init(vlan, "socket", name, mcast,
> localaddr) == -1) {
> return -1;
> }
> + } else if (qemu_opt_get(opts, "udp")) {
> + const char *udp, *localaddr;
> +
> + if (qemu_opt_get(opts, "fd") ||
> + qemu_opt_get(opts, "connect") ||
> + qemu_opt_get(opts, "listen") ||
> + qemu_opt_get(opts, "mcast")) {
> + error_report("fd=, connect=, listen= and mcast= is invalid
> with udp=");
> + return -1;
> + }
> +
> + udp = qemu_opt_get(opts, "udp");
> + localaddr = qemu_opt_get(opts, "localaddr");
> +
> + if (net_socket_udp_init(vlan, "udp", name, udp, localaddr) ==
> -1) {
> + return -1;
> + }
> } else {
> - error_report("-socket requires fd=, listen=, connect= or mcast=");
> + error_report("-socket requires fd=, listen=, connect=, mcast=
> or udp=");
> return -1;
> }
> -
> return 0;
> }
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 681eaf1..5495368 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -1217,6 +1217,8 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
> "-net
> socket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port[,localaddr=addr]]\n"
> " connect the vlan 'n' to multicast maddr and port\n"
> " use 'localaddr=addr' to specify the host address
> to send packets from\n"
> + "-net
> socket[,vlan=n][,name=str][,fd=h][,udp=host:port][,localaddr=host:port]\n"
> + " connect the vlan 'n' to another VLAN using an UDP
> tunnel\n"
> #ifdef CONFIG_VDE
> "-net
> vde[,vlan=n][,name=str][,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n"
>
> " connect the vlan 'n' to port 'n' of a vde switch
> running\n"
> --
> 1.7.3.5
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH] Support for UDP unicast network backend
2011-11-06 13:54 ` Jan Kiszka
@ 2011-11-07 14:01 ` Benjamin
2011-11-07 11:23 ` Jan Kiszka
0 siblings, 1 reply; 18+ messages in thread
From: Benjamin @ 2011-11-07 14:01 UTC (permalink / raw)
To: Jan Kiszka; +Cc: qemu-devel
On 11/06/11 14:54, Jan Kiszka wrote:
> On 2011-11-06 21:55, Benjamin wrote:
>> Follow-up of:
>> http://www.mail-archive.com/qemu-devel@nongnu.org/msg81235.html
>>
>> This enables connections between Qemu, Dynamips and VirtualBox guests.
>>
>> Test it with:
>>
>> qemu-system-i386 -netdev
>> socket,id=gns3,udp=127.0.0.1:4243,localport=127.0.0.1:4242 -device
>> e1000,netdev=gns3 /path/to/hard/drive/img1
>>
>> qemu-system-i386 -netdev
>> socket,id=gns3,udp=127.0.0.1:4242,localport=127.0.0.1:4243 -device
>> e1000,netdev=gns3 /path/to/hard/drive/img2
>>
>> You should be able to set up a network between these two hosts.
>>
>> Any thoughts?
>
> Looks good to me. Just one thing: localaddr vs. localport is
> unfortunate. localport is actual "local host and port". So localaddr
> would be a better fit, even with mcast continuing to expect it without
> ":port".
>
>>
>> I noticed an interesting behavior of Qemu and I'd like to investigate.
>> When an IP address is assigned to an interface it sends a who-has ARP
>> request with its own address. Which is not what happens on my OS. What
>> would be the correct and standard behavior?
>
> That's done by many OSes to discover IP conflicts early. Has nothing to
> do with QEMU.
>
> Jan
>
Thanks,
Here is the updated patch, using only localaddr. mcast expects it to be
addr whereas udp expects addr:port. It's documented in the help output.
I also corrected the error message when checking udp parameters.
Signed-off-by: Benjamin MARSILI <marsil_b@epitech.eu>
---
net.c | 9 +++++-
net/socket.c | 66
+++++++++++++++++++++++++++++++++++++++++++++++++++++-
qemu-options.hx | 2 +
3 files changed, 73 insertions(+), 4 deletions(-)
diff --git a/net.c b/net.c
index cb52050..c75be08 100644
--- a/net.c
+++ b/net.c
@@ -999,7 +999,11 @@ static const struct {
}, {
.name = "localaddr",
.type = QEMU_OPT_STRING,
- .help = "source address for multicast packets",
+ .help = "source address and port for multicast and udp
packets",
+ }, {
+ .name = "udp",
+ .type = QEMU_OPT_STRING,
+ .help = "UDP unicast address and port number",
},
{ /* end of list */ }
},
@@ -1070,7 +1074,8 @@ int net_client_init(Monitor *mon, QemuOpts *opts,
int is_netdev)
#ifdef CONFIG_VDE
strcmp(type, "vde") != 0 &&
#endif
- strcmp(type, "socket") != 0) {
+ strcmp(type, "socket") != 0 &&
+ strcmp(type, "udp") != 0) {
qerror_report(QERR_INVALID_PARAMETER_VALUE, "type",
"a netdev backend type");
return -1;
diff --git a/net/socket.c b/net/socket.c
index e9ef128..3601228 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -524,6 +524,52 @@ static int net_socket_mcast_init(VLANState *vlan,
}
+static int net_socket_udp_init(VLANState *vlan,
+ const char *model,
+ const char *name,
+ const char *rhost,
+ const char *lhost)
+{
+ NetSocketState *s;
+ int fd, val, ret;
+ struct sockaddr_in laddr, raddr;
+
+ if (parse_host_port(&laddr, lhost) < 0)
+ return -1;
+
+ if (parse_host_port(&raddr, rhost) < 0)
+ return -1;
+
+ fd = qemu_socket(PF_INET, SOCK_DGRAM, 0);
+ if (fd < 0) {
+ perror("socket(PF_INET, SOCK_DGRAM)");
+ return -1;
+ }
+ val = 1;
+ ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
+ (const char *)&val, sizeof(val));
+ if (ret < 0) {
+ perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)");
+ return -1;
+ }
+ ret = bind(fd, (struct sockaddr *)&laddr, sizeof(laddr));
+ if (ret < 0) {
+ perror("bind");
+ return -1;
+ }
+
+ s = net_socket_fd_init(vlan, model, name, fd, 0);
+ if (!s)
+ return -1;
+
+ s->dgram_dst = raddr;
+
+ snprintf(s->nc.info_str, sizeof(s->nc.info_str),
+ "socket: udp=%s:%d",
+ inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port));
+ return 0;
+}
+
int net_init_socket(QemuOpts *opts,
Monitor *mon,
const char *name,
@@ -597,10 +643,26 @@ int net_init_socket(QemuOpts *opts,
if (net_socket_mcast_init(vlan, "socket", name, mcast,
localaddr) == -1) {
return -1;
}
+ } else if (qemu_opt_get(opts, "udp")) {
+ const char *udp, *localaddr;
+
+ if (qemu_opt_get(opts, "fd") ||
+ qemu_opt_get(opts, "connect") ||
+ qemu_opt_get(opts, "listen") ||
+ qemu_opt_get(opts, "mcast")) {
+ error_report("fd=, connect=, listen= and mcast= is invalid
with udp=");
+ return -1;
+ }
+
+ udp = qemu_opt_get(opts, "udp");
+ localaddr = qemu_opt_get(opts, "localaddr");
+
+ if (net_socket_udp_init(vlan, "udp", name, udp, localaddr) == -1) {
+ return -1;
+ }
} else {
- error_report("-socket requires fd=, listen=, connect= or mcast=");
+ error_report("-socket requires fd=, listen=, connect=, mcast=
or udp=");
return -1;
}
-
return 0;
}
diff --git a/qemu-options.hx b/qemu-options.hx
index 681eaf1..5495368 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1217,6 +1217,8 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
"-net
socket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port[,localaddr=addr]]\n"
" connect the vlan 'n' to multicast maddr and port\n"
" use 'localaddr=addr' to specify the host address
to send packets from\n"
+ "-net
socket[,vlan=n][,name=str][,fd=h][,udp=host:port][,localaddr=host:port]\n"
+ " connect the vlan 'n' to another VLAN using an UDP
tunnel\n"
#ifdef CONFIG_VDE
"-net
vde[,vlan=n][,name=str][,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n"
" connect the vlan 'n' to port 'n' of a vde switch
running\n"
--
1.7.3.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH] Support for UDP unicast network backend
2011-11-07 11:23 ` Jan Kiszka
@ 2011-11-07 22:03 ` Benjamin
2011-11-08 10:52 ` Jan Kiszka
0 siblings, 1 reply; 18+ messages in thread
From: Benjamin @ 2011-11-07 22:03 UTC (permalink / raw)
To: Jan Kiszka; +Cc: qemu-devel
On 11/07/11 12:23, Jan Kiszka wrote:
> On 2011-11-07 15:01, Benjamin wrote:
>> Here is the updated patch, using only localaddr. mcast expects it to be
>> addr whereas udp expects addr:port. It's documented in the help output.
>>
>> I also corrected the error message when checking udp parameters.
>
> Sorry, missed that: please never forget to run your patches through
> checkpatch.pl. Once fixed, consider this
>
> Acked-by: Jan Kiszka<jan.kiszka@siemens.com>
>
Oh, my bad, I happen to have copied some parts from net/socket.c
that do no respect the coding style requirements. Well I guess I know
what my next submission will be.
Fixed, it's my first time submitting a patch here, is this enough?
Support for UDP unicast network backend
Signed-off-by: Benjamin MARSILI <marsil_b@epitech.eu>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
---
net.c | 9 +++++-
net/socket.c | 71
+++++++++++++++++++++++++++++++++++++++++++++++++++++-
qemu-options.hx | 2 +
3 files changed, 78 insertions(+), 4 deletions(-)
diff --git a/net.c b/net.c
index cb52050..c75be08 100644
--- a/net.c
+++ b/net.c
@@ -999,7 +999,11 @@ static const struct {
}, {
.name = "localaddr",
.type = QEMU_OPT_STRING,
- .help = "source address for multicast packets",
+ .help = "source address and port for multicast and udp
packets",
+ }, {
+ .name = "udp",
+ .type = QEMU_OPT_STRING,
+ .help = "UDP unicast address and port number",
},
{ /* end of list */ }
},
@@ -1070,7 +1074,8 @@ int net_client_init(Monitor *mon, QemuOpts *opts,
int is_netdev)
#ifdef CONFIG_VDE
strcmp(type, "vde") != 0 &&
#endif
- strcmp(type, "socket") != 0) {
+ strcmp(type, "socket") != 0 &&
+ strcmp(type, "udp") != 0) {
qerror_report(QERR_INVALID_PARAMETER_VALUE, "type",
"a netdev backend type");
return -1;
diff --git a/net/socket.c b/net/socket.c
index e9ef128..ca183f2 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -524,6 +524,55 @@ static int net_socket_mcast_init(VLANState *vlan,
}
+static int net_socket_udp_init(VLANState *vlan,
+ const char *model,
+ const char *name,
+ const char *rhost,
+ const char *lhost)
+{
+ NetSocketState *s;
+ int fd, val, ret;
+ struct sockaddr_in laddr, raddr;
+
+ if (parse_host_port(&laddr, lhost) < 0) {
+ return -1;
+ }
+
+ if (parse_host_port(&raddr, rhost) < 0) {
+ return -1;
+ }
+
+ fd = qemu_socket(PF_INET, SOCK_DGRAM, 0);
+ if (fd < 0) {
+ perror("socket(PF_INET, SOCK_DGRAM)");
+ return -1;
+ }
+ val = 1;
+ ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
+ (const char *)&val, sizeof(val));
+ if (ret < 0) {
+ perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)");
+ return -1;
+ }
+ ret = bind(fd, (struct sockaddr *)&laddr, sizeof(laddr));
+ if (ret < 0) {
+ perror("bind");
+ return -1;
+ }
+
+ s = net_socket_fd_init(vlan, model, name, fd, 0);
+ if (!s) {
+ return -1;
+ }
+
+ s->dgram_dst = raddr;
+
+ snprintf(s->nc.info_str, sizeof(s->nc.info_str),
+ "socket: udp=%s:%d",
+ inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port));
+ return 0;
+}
+
int net_init_socket(QemuOpts *opts,
Monitor *mon,
const char *name,
@@ -597,10 +646,28 @@ int net_init_socket(QemuOpts *opts,
if (net_socket_mcast_init(vlan, "socket", name, mcast,
localaddr) == -1) {
return -1;
}
+ } else if (qemu_opt_get(opts, "udp")) {
+ const char *udp, *localaddr;
+
+ if (qemu_opt_get(opts, "fd") ||
+ qemu_opt_get(opts, "connect") ||
+ qemu_opt_get(opts, "listen") ||
+ qemu_opt_get(opts, "mcast")) {
+ error_report("fd=, connect=, listen=\
+ and mcast= is invalid with udp=");
+ return -1;
+ }
+
+ udp = qemu_opt_get(opts, "udp");
+ localaddr = qemu_opt_get(opts, "localaddr");
+
+ if (net_socket_udp_init(vlan, "udp", name, udp, localaddr) == -1) {
+ return -1;
+ }
} else {
- error_report("-socket requires fd=, listen=, connect= or mcast=");
+ error_report("-socket requires fd=, listen=, \
+ connect=, mcast= or udp=");
return -1;
}
-
return 0;
}
diff --git a/qemu-options.hx b/qemu-options.hx
index 681eaf1..5495368 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1217,6 +1217,8 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
"-net
socket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port[,localaddr=addr]]\n"
" connect the vlan 'n' to multicast maddr and port\n"
" use 'localaddr=addr' to specify the host address
to send packets from\n"
+ "-net
socket[,vlan=n][,name=str][,fd=h][,udp=host:port][,localaddr=host:port]\n"
+ " connect the vlan 'n' to another VLAN using an UDP
tunnel\n"
#ifdef CONFIG_VDE
"-net
vde[,vlan=n][,name=str][,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n"
" connect the vlan 'n' to port 'n' of a vde switch
running\n"
--
1.7.3.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH] Support for UDP unicast network backend
2011-11-07 22:03 ` Benjamin
@ 2011-11-08 10:52 ` Jan Kiszka
2011-11-09 14:26 ` Benjamin
0 siblings, 1 reply; 18+ messages in thread
From: Jan Kiszka @ 2011-11-08 10:52 UTC (permalink / raw)
To: Benjamin; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 6057 bytes --]
On 2011-11-07 23:03, Benjamin wrote:
> On 11/07/11 12:23, Jan Kiszka wrote:
>> On 2011-11-07 15:01, Benjamin wrote:
>>> Here is the updated patch, using only localaddr. mcast expects it to be
>>> addr whereas udp expects addr:port. It's documented in the help output.
>>>
>>> I also corrected the error message when checking udp parameters.
>>
>> Sorry, missed that: please never forget to run your patches through
>> checkpatch.pl. Once fixed, consider this
>>
>> Acked-by: Jan Kiszka<jan.kiszka@siemens.com>
>>
>
> Oh, my bad, I happen to have copied some parts from net/socket.c
> that do no respect the coding style requirements. Well I guess I know
> what my next submission will be.
>
> Fixed, it's my first time submitting a patch here, is this enough?
Yep.
Jan
>
> Support for UDP unicast network backend
>
> Signed-off-by: Benjamin MARSILI <marsil_b@epitech.eu>
> Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> net.c | 9 +++++-
> net/socket.c | 71
> +++++++++++++++++++++++++++++++++++++++++++++++++++++-
> qemu-options.hx | 2 +
> 3 files changed, 78 insertions(+), 4 deletions(-)
>
> diff --git a/net.c b/net.c
> index cb52050..c75be08 100644
> --- a/net.c
> +++ b/net.c
> @@ -999,7 +999,11 @@ static const struct {
> }, {
> .name = "localaddr",
> .type = QEMU_OPT_STRING,
> - .help = "source address for multicast packets",
> + .help = "source address and port for multicast and udp
> packets",
> + }, {
> + .name = "udp",
> + .type = QEMU_OPT_STRING,
> + .help = "UDP unicast address and port number",
> },
> { /* end of list */ }
> },
> @@ -1070,7 +1074,8 @@ int net_client_init(Monitor *mon, QemuOpts *opts,
> int is_netdev)
> #ifdef CONFIG_VDE
> strcmp(type, "vde") != 0 &&
> #endif
> - strcmp(type, "socket") != 0) {
> + strcmp(type, "socket") != 0 &&
> + strcmp(type, "udp") != 0) {
> qerror_report(QERR_INVALID_PARAMETER_VALUE, "type",
> "a netdev backend type");
> return -1;
> diff --git a/net/socket.c b/net/socket.c
> index e9ef128..ca183f2 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -524,6 +524,55 @@ static int net_socket_mcast_init(VLANState *vlan,
>
> }
>
> +static int net_socket_udp_init(VLANState *vlan,
> + const char *model,
> + const char *name,
> + const char *rhost,
> + const char *lhost)
> +{
> + NetSocketState *s;
> + int fd, val, ret;
> + struct sockaddr_in laddr, raddr;
> +
> + if (parse_host_port(&laddr, lhost) < 0) {
> + return -1;
> + }
> +
> + if (parse_host_port(&raddr, rhost) < 0) {
> + return -1;
> + }
> +
> + fd = qemu_socket(PF_INET, SOCK_DGRAM, 0);
> + if (fd < 0) {
> + perror("socket(PF_INET, SOCK_DGRAM)");
> + return -1;
> + }
> + val = 1;
> + ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
> + (const char *)&val, sizeof(val));
> + if (ret < 0) {
> + perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)");
> + return -1;
> + }
> + ret = bind(fd, (struct sockaddr *)&laddr, sizeof(laddr));
> + if (ret < 0) {
> + perror("bind");
> + return -1;
> + }
> +
> + s = net_socket_fd_init(vlan, model, name, fd, 0);
> + if (!s) {
> + return -1;
> + }
> +
> + s->dgram_dst = raddr;
> +
> + snprintf(s->nc.info_str, sizeof(s->nc.info_str),
> + "socket: udp=%s:%d",
> + inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port));
> + return 0;
> +}
> +
> int net_init_socket(QemuOpts *opts,
> Monitor *mon,
> const char *name,
> @@ -597,10 +646,28 @@ int net_init_socket(QemuOpts *opts,
> if (net_socket_mcast_init(vlan, "socket", name, mcast,
> localaddr) == -1) {
> return -1;
> }
> + } else if (qemu_opt_get(opts, "udp")) {
> + const char *udp, *localaddr;
> +
> + if (qemu_opt_get(opts, "fd") ||
> + qemu_opt_get(opts, "connect") ||
> + qemu_opt_get(opts, "listen") ||
> + qemu_opt_get(opts, "mcast")) {
> + error_report("fd=, connect=, listen=\
> + and mcast= is invalid with udp=");
> + return -1;
> + }
> +
> + udp = qemu_opt_get(opts, "udp");
> + localaddr = qemu_opt_get(opts, "localaddr");
> +
> + if (net_socket_udp_init(vlan, "udp", name, udp, localaddr) ==
> -1) {
> + return -1;
> + }
> } else {
> - error_report("-socket requires fd=, listen=, connect= or mcast=");
> + error_report("-socket requires fd=, listen=, \
> + connect=, mcast= or udp=");
> return -1;
> }
> -
> return 0;
> }
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 681eaf1..5495368 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -1217,6 +1217,8 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
> "-net
> socket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port[,localaddr=addr]]\n"
> " connect the vlan 'n' to multicast maddr and port\n"
> " use 'localaddr=addr' to specify the host address
> to send packets from\n"
> + "-net
> socket[,vlan=n][,name=str][,fd=h][,udp=host:port][,localaddr=host:port]\n"
> + " connect the vlan 'n' to another VLAN using an UDP
> tunnel\n"
> #ifdef CONFIG_VDE
> "-net
> vde[,vlan=n][,name=str][,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n"
>
> " connect the vlan 'n' to port 'n' of a vde switch
> running\n"
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH] Support for UDP unicast network backend
2011-11-09 14:53 ` Benjamin
@ 2011-11-09 10:41 ` Andreas Färber
2011-11-24 1:02 ` [Qemu-devel] [PATCH v2] " Benjamin
0 siblings, 1 reply; 18+ messages in thread
From: Andreas Färber @ 2011-11-09 10:41 UTC (permalink / raw)
To: Benjamin; +Cc: Jan Kiszka, qemu-devel
Am 09.11.2011 15:53, schrieb Benjamin:
> On 11/09/11 15:26, Benjamin wrote:
>> Oh, I forgot to remove a line from the old patch, when I wanted to
>> introduce -netdev udp. Now it's just -net[dev] socket.
>> Here's the updated patch, my apologies.
>> It didn't break anything, it's just useless, use this instead.
>>
>>
>
> I sent the old one again...
> This one is correct.
> Sorry for the noise.
>
> Support for UDP unicast network backend
>
> Signed-off-by: Benjamin MARSILI <marsil_b@epitech.eu>
> Acked-by: Jan Kiszka<jan.kiszka@siemens.com>
>
> ---
Actually, revised patches like any others should be submitted with
git-send-email. That is, make the description commit'able and put all
personal comments, questions, quotations below the --- line. That way it
can be applied with git-am. Also use --subject-prefix="PATCH v2" and so
on to identify different patch versions.
I'd also suggest to prefix your subject with "net: " to make clear which
part it touches.
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH] Support for UDP unicast network backend
2011-11-08 10:52 ` Jan Kiszka
@ 2011-11-09 14:26 ` Benjamin
2011-11-09 14:53 ` Benjamin
0 siblings, 1 reply; 18+ messages in thread
From: Benjamin @ 2011-11-09 14:26 UTC (permalink / raw)
To: Jan Kiszka; +Cc: qemu-devel
On 11/08/11 11:52, Jan Kiszka wrote:
> On 2011-11-07 23:03, Benjamin wrote:
>> On 11/07/11 12:23, Jan Kiszka wrote:
>>> On 2011-11-07 15:01, Benjamin wrote:
>>>> Here is the updated patch, using only localaddr. mcast expects it to be
>>>> addr whereas udp expects addr:port. It's documented in the help output.
>>>>
>>>> I also corrected the error message when checking udp parameters.
>>>
>>> Sorry, missed that: please never forget to run your patches through
>>> checkpatch.pl. Once fixed, consider this
>>>
>>> Acked-by: Jan Kiszka<jan.kiszka@siemens.com>
>>>
>>
>> Oh, my bad, I happen to have copied some parts from net/socket.c
>> that do no respect the coding style requirements. Well I guess I know
>> what my next submission will be.
>>
>> Fixed, it's my first time submitting a patch here, is this enough?
>
> Yep.
>
> Jan
>
Oh, I forgot to remove a line from the old patch, when I wanted to
introduce -netdev udp. Now it's just -net[dev] socket.
Here's the updated patch, my apologies.
It didn't break anything, it's just useless, use this instead.
Support for UDP unicast network backend
Signed-off-by: Benjamin MARSILI <marsil_b@epitech.eu>
Acked-by: Jan Kiszka<jan.kiszka@siemens.com>
---
net.c | 9 +++++-
net/socket.c | 71
+++++++++++++++++++++++++++++++++++++++++++++++++++++-
qemu-options.hx | 2 +
3 files changed, 78 insertions(+), 4 deletions(-)
diff --git a/net.c b/net.c
index cb52050..c75be08 100644
--- a/net.c
+++ b/net.c
@@ -999,7 +999,11 @@ static const struct {
}, {
.name = "localaddr",
.type = QEMU_OPT_STRING,
- .help = "source address for multicast packets",
+ .help = "source address and port for multicast and udp
packets",
+ }, {
+ .name = "udp",
+ .type = QEMU_OPT_STRING,
+ .help = "UDP unicast address and port number",
},
{ /* end of list */ }
},
@@ -1070,7 +1074,8 @@ int net_client_init(Monitor *mon, QemuOpts *opts,
int is_netdev)
#ifdef CONFIG_VDE
strcmp(type, "vde") != 0 &&
#endif
- strcmp(type, "socket") != 0) {
+ strcmp(type, "socket") != 0 &&
+ strcmp(type, "udp") != 0) {
qerror_report(QERR_INVALID_PARAMETER_VALUE, "type",
"a netdev backend type");
return -1;
diff --git a/net/socket.c b/net/socket.c
index e9ef128..ca183f2 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -524,6 +524,55 @@ static int net_socket_mcast_init(VLANState *vlan,
}
+static int net_socket_udp_init(VLANState *vlan,
+ const char *model,
+ const char *name,
+ const char *rhost,
+ const char *lhost)
+{
+ NetSocketState *s;
+ int fd, val, ret;
+ struct sockaddr_in laddr, raddr;
+
+ if (parse_host_port(&laddr, lhost) < 0) {
+ return -1;
+ }
+
+ if (parse_host_port(&raddr, rhost) < 0) {
+ return -1;
+ }
+
+ fd = qemu_socket(PF_INET, SOCK_DGRAM, 0);
+ if (fd < 0) {
+ perror("socket(PF_INET, SOCK_DGRAM)");
+ return -1;
+ }
+ val = 1;
+ ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
+ (const char *)&val, sizeof(val));
+ if (ret < 0) {
+ perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)");
+ return -1;
+ }
+ ret = bind(fd, (struct sockaddr *)&laddr, sizeof(laddr));
+ if (ret < 0) {
+ perror("bind");
+ return -1;
+ }
+
+ s = net_socket_fd_init(vlan, model, name, fd, 0);
+ if (!s) {
+ return -1;
+ }
+
+ s->dgram_dst = raddr;
+
+ snprintf(s->nc.info_str, sizeof(s->nc.info_str),
+ "socket: udp=%s:%d",
+ inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port));
+ return 0;
+}
+
int net_init_socket(QemuOpts *opts,
Monitor *mon,
const char *name,
@@ -597,10 +646,28 @@ int net_init_socket(QemuOpts *opts,
if (net_socket_mcast_init(vlan, "socket", name, mcast,
localaddr) == -1) {
return -1;
}
+ } else if (qemu_opt_get(opts, "udp")) {
+ const char *udp, *localaddr;
+
+ if (qemu_opt_get(opts, "fd") ||
+ qemu_opt_get(opts, "connect") ||
+ qemu_opt_get(opts, "listen") ||
+ qemu_opt_get(opts, "mcast")) {
+ error_report("fd=, connect=, listen=\
+ and mcast= is invalid with udp=");
+ return -1;
+ }
+
+ udp = qemu_opt_get(opts, "udp");
+ localaddr = qemu_opt_get(opts, "localaddr");
+
+ if (net_socket_udp_init(vlan, "udp", name, udp, localaddr) == -1) {
+ return -1;
+ }
} else {
- error_report("-socket requires fd=, listen=, connect= or mcast=");
+ error_report("-socket requires fd=, listen=, \
+ connect=, mcast= or udp=");
return -1;
}
-
return 0;
}
diff --git a/qemu-options.hx b/qemu-options.hx
index 681eaf1..5495368 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1217,6 +1217,8 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
"-net
socket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port[,localaddr=addr]]\n"
" connect the vlan 'n' to multicast maddr and port\n"
" use 'localaddr=addr' to specify the host address
to send packets from\n"
+ "-net
socket[,vlan=n][,name=str][,fd=h][,udp=host:port][,localaddr=host:port]\n"
+ " connect the vlan 'n' to another VLAN using an UDP
tunnel\n"
#ifdef CONFIG_VDE
"-net
vde[,vlan=n][,name=str][,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n"
" connect the vlan 'n' to port 'n' of a vde switch
running\n"
--
1.7.3.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH] Support for UDP unicast network backend
2011-11-09 14:26 ` Benjamin
@ 2011-11-09 14:53 ` Benjamin
2011-11-09 10:41 ` Andreas Färber
0 siblings, 1 reply; 18+ messages in thread
From: Benjamin @ 2011-11-09 14:53 UTC (permalink / raw)
To: Jan Kiszka; +Cc: qemu-devel
On 11/09/11 15:26, Benjamin wrote:
> Oh, I forgot to remove a line from the old patch, when I wanted to
> introduce -netdev udp. Now it's just -net[dev] socket.
> Here's the updated patch, my apologies.
> It didn't break anything, it's just useless, use this instead.
>
>
I sent the old one again...
This one is correct.
Sorry for the noise.
Support for UDP unicast network backend
Signed-off-by: Benjamin MARSILI <marsil_b@epitech.eu>
Acked-by: Jan Kiszka<jan.kiszka@siemens.com>
---
net.c | 6 ++++-
net/socket.c | 71
+++++++++++++++++++++++++++++++++++++++++++++++++++++-
qemu-options.hx | 2 +
3 files changed, 76 insertions(+), 3 deletions(-)
diff --git a/net.c b/net.c
index cb52050..8e957b2 100644
--- a/net.c
+++ b/net.c
@@ -999,7 +999,11 @@ static const struct {
}, {
.name = "localaddr",
.type = QEMU_OPT_STRING,
- .help = "source address for multicast packets",
+ .help = "source address and port for multicast and udp
packets",
+ }, {
+ .name = "udp",
+ .type = QEMU_OPT_STRING,
+ .help = "UDP unicast address and port number",
},
{ /* end of list */ }
},
diff --git a/net/socket.c b/net/socket.c
index e9ef128..ca183f2 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -524,6 +524,55 @@ static int net_socket_mcast_init(VLANState *vlan,
}
+static int net_socket_udp_init(VLANState *vlan,
+ const char *model,
+ const char *name,
+ const char *rhost,
+ const char *lhost)
+{
+ NetSocketState *s;
+ int fd, val, ret;
+ struct sockaddr_in laddr, raddr;
+
+ if (parse_host_port(&laddr, lhost) < 0) {
+ return -1;
+ }
+
+ if (parse_host_port(&raddr, rhost) < 0) {
+ return -1;
+ }
+
+ fd = qemu_socket(PF_INET, SOCK_DGRAM, 0);
+ if (fd < 0) {
+ perror("socket(PF_INET, SOCK_DGRAM)");
+ return -1;
+ }
+ val = 1;
+ ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
+ (const char *)&val, sizeof(val));
+ if (ret < 0) {
+ perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)");
+ return -1;
+ }
+ ret = bind(fd, (struct sockaddr *)&laddr, sizeof(laddr));
+ if (ret < 0) {
+ perror("bind");
+ return -1;
+ }
+
+ s = net_socket_fd_init(vlan, model, name, fd, 0);
+ if (!s) {
+ return -1;
+ }
+
+ s->dgram_dst = raddr;
+
+ snprintf(s->nc.info_str, sizeof(s->nc.info_str),
+ "socket: udp=%s:%d",
+ inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port));
+ return 0;
+}
+
int net_init_socket(QemuOpts *opts,
Monitor *mon,
const char *name,
@@ -597,10 +646,28 @@ int net_init_socket(QemuOpts *opts,
if (net_socket_mcast_init(vlan, "socket", name, mcast,
localaddr) == -1) {
return -1;
}
+ } else if (qemu_opt_get(opts, "udp")) {
+ const char *udp, *localaddr;
+
+ if (qemu_opt_get(opts, "fd") ||
+ qemu_opt_get(opts, "connect") ||
+ qemu_opt_get(opts, "listen") ||
+ qemu_opt_get(opts, "mcast")) {
+ error_report("fd=, connect=, listen=\
+ and mcast= is invalid with udp=");
+ return -1;
+ }
+
+ udp = qemu_opt_get(opts, "udp");
+ localaddr = qemu_opt_get(opts, "localaddr");
+
+ if (net_socket_udp_init(vlan, "udp", name, udp, localaddr) == -1) {
+ return -1;
+ }
} else {
- error_report("-socket requires fd=, listen=, connect= or mcast=");
+ error_report("-socket requires fd=, listen=, \
+ connect=, mcast= or udp=");
return -1;
}
-
return 0;
}
diff --git a/qemu-options.hx b/qemu-options.hx
index 681eaf1..5495368 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1217,6 +1217,8 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
"-net
socket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port[,localaddr=addr]]\n"
" connect the vlan 'n' to multicast maddr and port\n"
" use 'localaddr=addr' to specify the host address
to send packets from\n"
+ "-net
socket[,vlan=n][,name=str][,fd=h][,udp=host:port][,localaddr=host:port]\n"
+ " connect the vlan 'n' to another VLAN using an UDP
tunnel\n"
#ifdef CONFIG_VDE
"-net
vde[,vlan=n][,name=str][,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n"
" connect the vlan 'n' to port 'n' of a vde switch
running\n"
--
1.7.3.5
Benjamin
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH v2] Support for UDP unicast network backend
2011-11-09 10:41 ` Andreas Färber
@ 2011-11-24 1:02 ` Benjamin
2011-11-24 9:13 ` Stefan Hajnoczi
0 siblings, 1 reply; 18+ messages in thread
From: Benjamin @ 2011-11-24 1:02 UTC (permalink / raw)
To: qemu-devel; +Cc: stefanha, n54, Jan Kiszka, Andreas Färber
Signed-off-by: Benjamin MARSILI <marsil_b@epitech.eu>
---
net.c | 6 ++++-
net/socket.c | 71
+++++++++++++++++++++++++++++++++++++++++++++++++++++-
qemu-options.hx | 2 +
3 files changed, 76 insertions(+), 3 deletions(-)
diff --git a/net.c b/net.c
index cb52050..8e957b2 100644
--- a/net.c
+++ b/net.c
@@ -999,7 +999,11 @@ static const struct {
}, {
.name = "localaddr",
.type = QEMU_OPT_STRING,
- .help = "source address for multicast packets",
+ .help = "source address and port for multicast and udp
packets",
+ }, {
+ .name = "udp",
+ .type = QEMU_OPT_STRING,
+ .help = "UDP unicast address and port number",
},
{ /* end of list */ }
},
diff --git a/net/socket.c b/net/socket.c
index e9ef128..ca183f2 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -524,6 +524,55 @@ static int net_socket_mcast_init(VLANState *vlan,
}
+static int net_socket_udp_init(VLANState *vlan,
+ const char *model,
+ const char *name,
+ const char *rhost,
+ const char *lhost)
+{
+ NetSocketState *s;
+ int fd, val, ret;
+ struct sockaddr_in laddr, raddr;
+
+ if (parse_host_port(&laddr, lhost) < 0) {
+ return -1;
+ }
+
+ if (parse_host_port(&raddr, rhost) < 0) {
+ return -1;
+ }
+
+ fd = qemu_socket(PF_INET, SOCK_DGRAM, 0);
+ if (fd < 0) {
+ perror("socket(PF_INET, SOCK_DGRAM)");
+ return -1;
+ }
+ val = 1;
+ ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
+ (const char *)&val, sizeof(val));
+ if (ret < 0) {
+ perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)");
+ return -1;
+ }
+ ret = bind(fd, (struct sockaddr *)&laddr, sizeof(laddr));
+ if (ret < 0) {
+ perror("bind");
+ return -1;
+ }
+
+ s = net_socket_fd_init(vlan, model, name, fd, 0);
+ if (!s) {
+ return -1;
+ }
+
+ s->dgram_dst = raddr;
+
+ snprintf(s->nc.info_str, sizeof(s->nc.info_str),
+ "socket: udp=%s:%d",
+ inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port));
+ return 0;
+}
+
int net_init_socket(QemuOpts *opts,
Monitor *mon,
const char *name,
@@ -597,10 +646,28 @@ int net_init_socket(QemuOpts *opts,
if (net_socket_mcast_init(vlan, "socket", name, mcast,
localaddr) == -1) {
return -1;
}
+ } else if (qemu_opt_get(opts, "udp")) {
+ const char *udp, *localaddr;
+
+ if (qemu_opt_get(opts, "fd") ||
+ qemu_opt_get(opts, "connect") ||
+ qemu_opt_get(opts, "listen") ||
+ qemu_opt_get(opts, "mcast")) {
+ error_report("fd=, connect=, listen=\
+ and mcast= is invalid with udp=");
+ return -1;
+ }
+
+ udp = qemu_opt_get(opts, "udp");
+ localaddr = qemu_opt_get(opts, "localaddr");
+
+ if (net_socket_udp_init(vlan, "udp", name, udp, localaddr) == -1) {
+ return -1;
+ }
} else {
- error_report("-socket requires fd=, listen=, connect= or mcast=");
+ error_report("-socket requires fd=, listen=, \
+ connect=, mcast= or udp=");
return -1;
}
-
return 0;
}
diff --git a/qemu-options.hx b/qemu-options.hx
index 681eaf1..5495368 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1217,6 +1217,8 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
"-net
socket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port[,localaddr=addr]]\n"
" connect the vlan 'n' to multicast maddr and port\n"
" use 'localaddr=addr' to specify the host address
to send packets from\n"
+ "-net
socket[,vlan=n][,name=str][,fd=h][,udp=host:port][,localaddr=host:port]\n"
+ " connect the vlan 'n' to another VLAN using an UDP
tunnel\n"
#ifdef CONFIG_VDE
"-net
vde[,vlan=n][,name=str][,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n"
" connect the vlan 'n' to port 'n' of a vde switch
running\n"
--
1.7.3.5
Is this better? Sent the patch by hand since I didn't configure my mail
client yet. Will do for the next patches.
Thanks for your help,
Benjamin
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH v2] Support for UDP unicast network backend
2011-11-24 1:02 ` [Qemu-devel] [PATCH v2] " Benjamin
@ 2011-11-24 9:13 ` Stefan Hajnoczi
0 siblings, 0 replies; 18+ messages in thread
From: Stefan Hajnoczi @ 2011-11-24 9:13 UTC (permalink / raw)
To: Benjamin; +Cc: n54, Jan Kiszka, qemu-devel, Andreas Färber
On Thu, Nov 24, 2011 at 1:02 AM, Benjamin <mlspirat42@gmail.com> wrote:
>
> Signed-off-by: Benjamin MARSILI <marsil_b@epitech.eu>
> ---
This is the '---' that people typically add comments after. Git will
not include anything from '---' to the next 'diff --git ...' line.
> net.c | 6 ++++-
> net/socket.c | 71
> +++++++++++++++++++++++++++++++++++++++++++++++++++++-
> qemu-options.hx | 2 +
> 3 files changed, 76 insertions(+), 3 deletions(-)
For example, this automatically inserted diffstat will not be part of
the git commit and it gets applied since it is after the '---'.
> diff --git a/net.c b/net.c
> index cb52050..8e957b2 100644
> --- a/net.c
> +++ b/net.c
> @@ -999,7 +999,11 @@ static const struct {
> }, {
> .name = "localaddr",
> .type = QEMU_OPT_STRING,
> - .help = "source address for multicast packets",
> + .help = "source address and port for multicast and udp
> packets",
> + }, {
> + .name = "udp",
> + .type = QEMU_OPT_STRING,
> + .help = "UDP unicast address and port number",
> },
> { /* end of list */ }
> },
> diff --git a/net/socket.c b/net/socket.c
> index e9ef128..ca183f2 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -524,6 +524,55 @@ static int net_socket_mcast_init(VLANState *vlan,
>
> }
>
> +static int net_socket_udp_init(VLANState *vlan,
> + const char *model,
> + const char *name,
> + const char *rhost,
> + const char *lhost)
> +{
> + NetSocketState *s;
> + int fd, val, ret;
> + struct sockaddr_in laddr, raddr;
> +
> + if (parse_host_port(&laddr, lhost) < 0) {
> + return -1;
> + }
> +
> + if (parse_host_port(&raddr, rhost) < 0) {
> + return -1;
> + }
> +
> + fd = qemu_socket(PF_INET, SOCK_DGRAM, 0);
> + if (fd < 0) {
> + perror("socket(PF_INET, SOCK_DGRAM)");
> + return -1;
> + }
> + val = 1;
> + ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
> + (const char *)&val, sizeof(val));
> + if (ret < 0) {
> + perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)");
> + return -1;
> + }
> + ret = bind(fd, (struct sockaddr *)&laddr, sizeof(laddr));
> + if (ret < 0) {
> + perror("bind");
> + return -1;
> + }
> +
> + s = net_socket_fd_init(vlan, model, name, fd, 0);
> + if (!s) {
> + return -1;
> + }
> +
> + s->dgram_dst = raddr;
> +
> + snprintf(s->nc.info_str, sizeof(s->nc.info_str),
> + "socket: udp=%s:%d",
> + inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port));
> + return 0;
> +}
> +
> int net_init_socket(QemuOpts *opts,
> Monitor *mon,
> const char *name,
> @@ -597,10 +646,28 @@ int net_init_socket(QemuOpts *opts,
> if (net_socket_mcast_init(vlan, "socket", name, mcast, localaddr) ==
> -1) {
> return -1;
> }
> + } else if (qemu_opt_get(opts, "udp")) {
> + const char *udp, *localaddr;
> +
> + if (qemu_opt_get(opts, "fd") ||
> + qemu_opt_get(opts, "connect") ||
> + qemu_opt_get(opts, "listen") ||
> + qemu_opt_get(opts, "mcast")) {
> + error_report("fd=, connect=, listen=\
> + and mcast= is invalid with udp=");
> + return -1;
> + }
> +
> + udp = qemu_opt_get(opts, "udp");
> + localaddr = qemu_opt_get(opts, "localaddr");
> +
> + if (net_socket_udp_init(vlan, "udp", name, udp, localaddr) == -1) {
> + return -1;
> + }
> } else {
> - error_report("-socket requires fd=, listen=, connect= or mcast=");
> + error_report("-socket requires fd=, listen=, \
> + connect=, mcast= or udp=");
> return -1;
> }
> -
> return 0;
> }
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 681eaf1..5495368 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -1217,6 +1217,8 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
> "-net
> socket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port[,localaddr=addr]]\n"
> " connect the vlan 'n' to multicast maddr and port\n"
> " use 'localaddr=addr' to specify the host address to
> send packets from\n"
> + "-net
> socket[,vlan=n][,name=str][,fd=h][,udp=host:port][,localaddr=host:port]\n"
The GMail web interface always wraps lines. This breaks the patch and
it cannot be applied without manually fixing it up. There is no way
to disable this in the GMail web interface but you can use SMTP to
send mails directly and they will not be touched.
Configuring git-send-email for GMail is described here:
http://morefedora.blogspot.com/2009/02/configuring-git-send-email-to-use-gmail.html
Also, please send a top-level mail and not a reply to the existing
thread. This makes it easier for reviewers and maintainers to spot
your new patch revision.
Stefan
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2011-11-24 9:13 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-06 17:08 [Qemu-devel] Integrating Dynamips and GNS3 UDP tunnels (Patches) Benjamin Epitech
2011-10-07 8:35 ` Jan Kiszka
2011-10-08 17:31 ` Benjamin
2011-10-08 9:29 ` Jan Kiszka
2011-10-09 17:02 ` Benjamin
2011-11-06 20:55 ` [Qemu-devel] [PATCH] Support for UDP unicast network backend Benjamin
2011-11-06 13:54 ` Jan Kiszka
2011-11-07 14:01 ` Benjamin
2011-11-07 11:23 ` Jan Kiszka
2011-11-07 22:03 ` Benjamin
2011-11-08 10:52 ` Jan Kiszka
2011-11-09 14:26 ` Benjamin
2011-11-09 14:53 ` Benjamin
2011-11-09 10:41 ` Andreas Färber
2011-11-24 1:02 ` [Qemu-devel] [PATCH v2] " Benjamin
2011-11-24 9:13 ` Stefan Hajnoczi
2011-11-06 14:28 ` [Qemu-devel] [PATCH] " Benjamin Epitech
2011-10-08 9:37 ` [Qemu-devel] Integrating Dynamips and GNS3 UDP tunnels (Patches) Stefan Weil
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).