Skip to contentSkip to conversation

Bypass specific network traffic in COLO

PATCH Superseded Zhang Chen 5 participants 23 messages Dec 24, 2020 – Jan 21, 2021 Networking

v1 of 10 Superseded Latest is v10 →

lore
Share & tools
lore

Zhang Chen

author
#0 lore raw

cover Bypass specific network traffic in COLO

From: Zhang Chen <[email protected]>

Since the real user scenario does not need to monitor all traffic. This series give user ability to bypass kinds of network stream.

Zhang Chen (3):
qapi/net: Add new QMP command for COLO passthrough
hmp-commands: Add new HMP command for COLO passthrough net/colo-compare: Add handler for passthrough connection

 hmp-commands.hx       | 26 +++++++++++++++++++++++
 include/monitor/hmp.h |  2 ++
 monitor/hmp-cmds.c    | 20 ++++++++++++++++++
 net/colo-compare.c    | 49 +++++++++++++++++++++++++++++++++++++++++++
 net/colo-compare.h    |  2 ++
 net/net.c             | 39 ++++++++++++++++++++++++++++++++++
 qapi/net.json         | 46 ++++++++++++++++++++++++++++++++++++++++
 7 files changed, 184 insertions(+)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/3 qapi/net: Add new QMP command for COLO passthrough

From: Zhang Chen <[email protected]>

Since the real user scenario does not need to monitor all traffic. Add colo-passthrough-add and colo-passthrough-del to maintain a COLO network passthrough list.

---
 net/net.c     | 12 ++++++++++++
 qapi/net.json | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)
net/net.c +12 -0
index e1035f21d1..eac7a92618 100644
@@ -1151,6 +1151,18 @@ void qmp_netdev_del(const char *id, Error **errp)
     qemu_del_net_client(nc);
 }
 
+void qmp_colo_passthrough_add(const char *prot, const uint32_t port,
+                              Error **errp)
+{
+    /* Setup passthrough connection */
+}
+
+void qmp_colo_passthrough_del(const char *prot, const uint32_t port,
+                              Error **errp)
+{
+    /* Delete passthrough connection */
+}
+
 static void netfilter_print_info(Monitor *mon, NetFilterState *nf)
 {
     char *str;
qapi/net.json +46 -0

49 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 56 lines · Zhang Chen

From: Zhang Chen <[email protected]>

Since the real user scenario does not need to monitor all traffic. Add colo-passthrough-add and colo-passthrough-del to maintain a COLO network passthrough list.

---
  net/net.c     | 12 ++++++++++++
  qapi/net.json | 46 ++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 58 insertions(+)
net/net.c +12 -0
index e1035f21d1..eac7a92618 100644
@@ -1151,6 +1151,18 @@ void qmp_netdev_del(const char *id, Error **errp)
      qemu_del_net_client(nc);
  }
 
+void qmp_colo_passthrough_add(const char *prot, const uint32_t port,
+                              Error **errp)
+{
+    /* Setup passthrough connection */
+}
+
+void qmp_colo_passthrough_del(const char *prot, const uint32_t port,
+                              Error **errp)
+{
+    /* Delete passthrough connection */
+}
+
  static void netfilter_print_info(Monitor *mon, NetFilterState *nf)
  {
      char *str;
qapi/net.json +13 -0
index c31748c87f..466c29714e 100644
@@ -714,3 +714,49 @@
  ##
  { 'event': 'FAILOVER_NEGOTIATED',
    'data': {'device-id': 'str'} }
+
+##
+# @colo-passthrough-add:
+#
+# Add passthrough entry according to customer's needs in COLO-compare.
+#
+# @protocol: COLO passthrough just support TCP and UDP.
+#
+# @port: TCP or UDP port number.
+#
+# Returns: Nothing on success
+#
+# Since: 5.3

qapi/net.json line 739

Quoted 10 lines
qapi/net.json +10 -0
+#
+# Example:
+#
+# -> { "execute": "colo-passthrough-add",
+#      "arguments": { "protocol": "tcp", "port": 3389 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'colo-passthrough-add',
+     'data': {'protocol': 'str', 'port': 'uint32'} }

Do we plan to support 4-tuple (src ip,src port, dst ip, dst port) in the future? If yes, let's add them now.

And do we plan to support wildcard here?

Thanks

Quoted 23 lines
qapi/net.json +23 -0
+
+##
+# @colo-passthrough-del:
+#
+# Delete passthrough entry according to customer's needs in COLO-compare.
+#
+# @protocol: COLO passthrough just support TCP and UDP.
+#
+# @port: TCP or UDP port number.
+#
+# Returns: Nothing on success
+#
+# Since: 5.3
+#
+# Example:
+#
+# -> { "execute": "colo-passthrough-del",
+#      "arguments": { "protocol": "tcp", "port": 3389 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'colo-passthrough-del',
+     'data': {'protocol': 'str', 'port': 'uint32'} }
#3 lore raw

RE: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 83 lines

-----Original Message-----
From: Jason Wang <[email protected]>
Sent: Friday, December 25, 2020 2:20 PM
To: Zhang, Chen <[email protected]>; qemu-dev <qemu- [email protected]>; Eric Blake <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Markus Armbruster <[email protected]>
Cc: Zhang Chen <[email protected]>
Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 10 lines · Zhang Chen

From: Zhang Chen <[email protected]>

Since the real user scenario does not need to monitor all traffic. Add colo-passthrough-add and colo-passthrough-del to maintain a COLO network passthrough list.

---
  net/net.c     | 12 ++++++++++++
  qapi/net.json | 46

++++++++++++++++++++++++++++++++++++++++++++++

net/net.c void qmp_netdev_del(const char *id, Error

Quoted 7 lines
  2 files changed, 58 insertions(+)
net/net.c +0 -0
index e1035f21d1..eac7a92618 100644
@@ -1151,6 +1151,18 @@ void qmp_netdev_del(const char *id, Error

**errp)

Quoted 35 lines
net/net.c +8 -0
      qemu_del_net_client(nc);
  }
 
+void qmp_colo_passthrough_add(const char *prot, const uint32_t port,
+                              Error **errp) {
+    /* Setup passthrough connection */ }
+
+void qmp_colo_passthrough_del(const char *prot, const uint32_t port,
+                              Error **errp) {
+    /* Delete passthrough connection */ }
+
  static void netfilter_print_info(Monitor *mon, NetFilterState *nf)
  {
      char *str;
qapi/net.json index renamed from qapi/net.json +0 -0

c31748c87f..466c29714e 100644

qapi/net.json +13 -0
@@ -714,3 +714,49 @@
  ##
  { 'event': 'FAILOVER_NEGOTIATED',
    'data': {'device-id': 'str'} }
+
+##
+# @colo-passthrough-add:
+#
+# Add passthrough entry according to customer's needs in COLO-compare.
+#
+# @protocol: COLO passthrough just support TCP and UDP.
+#
+# @port: TCP or UDP port number.
+#
+# Returns: Nothing on success
+#
+# Since: 5.3

qapi/net.json line 739

Quoted 10 lines
qapi/net.json +10 -0
+#
+# Example:
+#
+# -> { "execute": "colo-passthrough-add",
+#      "arguments": { "protocol": "tcp", "port": 3389 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'colo-passthrough-add',
+     'data': {'protocol': 'str', 'port': 'uint32'} }

Do we plan to support 4-tuple (src ip,src port, dst ip, dst port) in the future? If yes, let's add them now.

Quoted 1 line

And do we plan to support wildcard here?

I think just using the port is enough for COLO compare.
Because in this case, users need passthrough some guest services are distinguished by static ports. And for support 4-tuple and wildcard are a good question, do you think we should add some passthrough Mechanism for all Qemu net filter? If yes, we should support that in the future.

Thanks
Chen

Quoted 28 lines

Thanks

qapi/net.json

Quoted 5 lines
qapi/net.json +5 -0
+
+##
+# @colo-passthrough-del:
+#
+# Delete passthrough entry according to customer's needs in COLO-

compare.

Quoted 18 lines
qapi/net.json +18 -0
+#
+# @protocol: COLO passthrough just support TCP and UDP.
+#
+# @port: TCP or UDP port number.
+#
+# Returns: Nothing on success
+#
+# Since: 5.3
+#
+# Example:
+#
+# -> { "execute": "colo-passthrough-del",
+#      "arguments": { "protocol": "tcp", "port": 3389 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'colo-passthrough-del',
+     'data': {'protocol': 'str', 'port': 'uint32'} }
#4 lore raw

Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 81 lines · Chen
Quoted 81 lines

-----Original Message-----
From: Jason Wang <[email protected]>
Sent: Friday, December 25, 2020 2:20 PM
To: Zhang, Chen <[email protected]>; qemu-dev <qemu- [email protected]>; Eric Blake <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Markus Armbruster <[email protected]>
Cc: Zhang Chen <[email protected]>
Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 10 lines · Zhang Chen

From: Zhang Chen <[email protected]>

Since the real user scenario does not need to monitor all traffic. Add colo-passthrough-add and colo-passthrough-del to maintain a COLO network passthrough list.

---
   net/net.c     | 12 ++++++++++++
   qapi/net.json | 46

++++++++++++++++++++++++++++++++++++++++++++++

net/net.c void qmp_netdev_del(const char *id, Error

Quoted 7 lines
   2 files changed, 58 insertions(+)
net/net.c +0 -0
index e1035f21d1..eac7a92618 100644
@@ -1151,6 +1151,18 @@ void qmp_netdev_del(const char *id, Error

**errp)

Quoted 35 lines
net/net.c +8 -0
       qemu_del_net_client(nc);
   }
 
+void qmp_colo_passthrough_add(const char *prot, const uint32_t port,
+                              Error **errp) {
+    /* Setup passthrough connection */ }
+
+void qmp_colo_passthrough_del(const char *prot, const uint32_t port,
+                              Error **errp) {
+    /* Delete passthrough connection */ }
+
   static void netfilter_print_info(Monitor *mon, NetFilterState *nf)
   {
       char *str;
qapi/net.json index renamed from qapi/net.json +0 -0

c31748c87f..466c29714e 100644

qapi/net.json +13 -0
@@ -714,3 +714,49 @@
   ##
   { 'event': 'FAILOVER_NEGOTIATED',
     'data': {'device-id': 'str'} }
+
+##
+# @colo-passthrough-add:
+#
+# Add passthrough entry according to customer's needs in COLO-compare.
+#
+# @protocol: COLO passthrough just support TCP and UDP.
+#
+# @port: TCP or UDP port number.
+#
+# Returns: Nothing on success
+#
+# Since: 5.3

qapi/net.json line 739

Quoted 10 lines
qapi/net.json +10 -0
+#
+# Example:
+#
+# -> { "execute": "colo-passthrough-add",
+#      "arguments": { "protocol": "tcp", "port": 3389 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'colo-passthrough-add',
+     'data': {'protocol': 'str', 'port': 'uint32'} }

Do we plan to support 4-tuple (src ip,src port, dst ip, dst port) in the future? If yes, let's add them now.

Quoted 5 lines
Quoted 1 line

And do we plan to support wildcard here?

I think just using the port is enough for COLO compare.
Because in this case, users need passthrough some guest services are distinguished by static ports. And for support 4-tuple and wildcard are a good question, do you think we should add some passthrough Mechanism for all Qemu net filter? If yes, we should support that in the future.

I think we can start form COLO. To avoid QMP compatibility issues, I would like to add the n tuple and wildcard support now.

Thanks

Quoted 31 lines

Thanks
Chen

Quoted 27 lines

Thanks

qapi/net.json

Quoted 5 lines
qapi/net.json +5 -0
+
+##
+# @colo-passthrough-del:
+#
+# Delete passthrough entry according to customer's needs in COLO-

compare.

Quoted 18 lines
qapi/net.json +18 -0
+#
+# @protocol: COLO passthrough just support TCP and UDP.
+#
+# @port: TCP or UDP port number.
+#
+# Returns: Nothing on success
+#
+# Since: 5.3
+#
+# Example:
+#
+# -> { "execute": "colo-passthrough-del",
+#      "arguments": { "protocol": "tcp", "port": 3389 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'colo-passthrough-del',
+     'data': {'protocol': 'str', 'port': 'uint32'} }
#5 lore raw

RE: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 100 lines

-----Original Message-----
From: Jason Wang <[email protected]>
Sent: Monday, December 28, 2020 3:11 PM
To: Zhang, Chen <[email protected]>; qemu-dev <qemu- [email protected]>; Eric Blake <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Markus Armbruster <[email protected]>
Cc: Zhang Chen <[email protected]>
Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 7 lines · Chen
Quoted 7 lines

-----Original Message-----
From: Jason Wang <[email protected]>
Sent: Friday, December 25, 2020 2:20 PM
To: Zhang, Chen <[email protected]>; qemu-dev <qemu- [email protected]>; Eric Blake <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Markus Armbruster

<[email protected]>

Quoted 44 lines
Quoted 44 lines

Cc: Zhang Chen <[email protected]>
Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 10 lines · Zhang Chen

From: Zhang Chen <[email protected]>

Since the real user scenario does not need to monitor all traffic. Add colo-passthrough-add and colo-passthrough-del to maintain a COLO network passthrough list.

---
   net/net.c     | 12 ++++++++++++
   qapi/net.json | 46

++++++++++++++++++++++++++++++++++++++++++++++

net/net.c void qmp_netdev_del(const char *id, Error

Quoted 7 lines
   2 files changed, 58 insertions(+)
net/net.c +0 -0
index e1035f21d1..eac7a92618 100644
@@ -1151,6 +1151,18 @@ void qmp_netdev_del(const char *id, Error

**errp)

Quoted 19 lines
net/net.c +8 -0
       qemu_del_net_client(nc);
   }
 
+void qmp_colo_passthrough_add(const char *prot, const uint32_t port,
+                              Error **errp) {
+    /* Setup passthrough connection */ }
+
+void qmp_colo_passthrough_del(const char *prot, const uint32_t port,
+                              Error **errp) {
+    /* Delete passthrough connection */ }
+
   static void netfilter_print_info(Monitor *mon, NetFilterState *nf)
   {
       char *str;
qapi/net.json index renamed from qapi/net.json +0 -0

c31748c87f..466c29714e 100644

qapi/net.json +0 -0
@@ -714,3 +714,49 @@
Quoted 8 lines
Quoted 8 lines

qapi/net.json

Quoted 8 lines
qapi/net.json +5 -0
   ##
   { 'event': 'FAILOVER_NEGOTIATED',
     'data': {'device-id': 'str'} }
+
+##
+# @colo-passthrough-add:
+#
+# Add passthrough entry according to customer's needs in COLO-

compare.

Quoted 22 lines
Quoted 22 lines
Quoted 8 lines
qapi/net.json +8 -0
+#
+# @protocol: COLO passthrough just support TCP and UDP.
+#
+# @port: TCP or UDP port number.
+#
+# Returns: Nothing on success
+#
+# Since: 5.3

qapi/net.json line 739

Quoted 10 lines
qapi/net.json +10 -0
+#
+# Example:
+#
+# -> { "execute": "colo-passthrough-add",
+#      "arguments": { "protocol": "tcp", "port": 3389 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'colo-passthrough-add',
+     'data': {'protocol': 'str', 'port': 'uint32'} }

Do we plan to support 4-tuple (src ip,src port, dst ip, dst port) in the future? If yes, let's add them now.

Quoted 3 lines
Quoted 1 line

And do we plan to support wildcard here?

I think just using the port is enough for COLO compare. Because in this case, users need passthrough some guest services are

Quoted 8 lines

distinguished by static ports.

Quoted 2 lines

And for support 4-tuple and wildcard are a good question, do you think we should add some passthrough Mechanism for all Qemu net filter? If yes,

we should support that in the future.

I think we can start form COLO. To avoid QMP compatibility issues, I would like to add the n tuple and wildcard support now.

OK, I will do this job in next version.
For the QMP compatibility issues, please give me a demo of what we want to see, Like some existing commands.

Thanks
Chen

Quoted 35 lines

Thanks

Quoted 31 lines

Thanks
Chen

Quoted 27 lines

Thanks

qapi/net.json

Quoted 5 lines
qapi/net.json +5 -0
+
+##
+# @colo-passthrough-del:
+#
+# Delete passthrough entry according to customer's needs in COLO-

compare.

Quoted 18 lines
qapi/net.json +18 -0
+#
+# @protocol: COLO passthrough just support TCP and UDP.
+#
+# @port: TCP or UDP port number.
+#
+# Returns: Nothing on success
+#
+# Since: 5.3
+#
+# Example:
+#
+# -> { "execute": "colo-passthrough-del",
+#      "arguments": { "protocol": "tcp", "port": 3389 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'colo-passthrough-del',
+     'data': {'protocol': 'str', 'port': 'uint32'} }
#6 lore raw

Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 4 lines · Chen
Quoted 2 lines

I think we can start form COLO. To avoid QMP compatibility issues, I would like to add the n tuple and wildcard support now.

OK, I will do this job in next version.
For the QMP compatibility issues, please give me a demo of what we want to see, Like some existing commands.

I meant if we start from port and then want to add e.g n-tuple support. Do we need to introduce another command? Or is there any introspection that can let management layer know about this?

Thanks

Quoted 4 lines

Thanks
Chen

#7 lore raw

RE: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 16 lines

-----Original Message-----
From: Jason Wang <[email protected]>
Sent: Wednesday, December 30, 2020 11:57 AM
To: Zhang, Chen <[email protected]>; qemu-dev <qemu- [email protected]>; Eric Blake <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Markus Armbruster <[email protected]>
Cc: Zhang Chen <[email protected]>
Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 2 lines · Chen
Quoted 2 lines

I think we can start form COLO. To avoid QMP compatibility issues, I would like to add the n tuple and wildcard support now.

Quoted 8 lines
Quoted 2 lines

OK, I will do this job in next version.
For the QMP compatibility issues, please give me a demo of what we want

to see, Like some existing commands.

I meant if we start from port and then want to add e.g n-tuple support. Do we need to introduce another command? Or is there any introspection that can let management layer know about this?

OK, I will add the n-tuple support.
It looks basic command are add/del connection, Do you think something needs to be introduced?
For the management layer, I don't know the detail process of how to add new Qemu command support for example libvirt. Maybe depend on libvirt community's plan?

Thanks
Chen

Quoted 8 lines

Thanks

Quoted 4 lines

Thanks
Chen

#8 lore raw

Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 17 lines · Chen
Quoted 17 lines

-----Original Message-----
From: Jason Wang <[email protected]>
Sent: Wednesday, December 30, 2020 11:57 AM
To: Zhang, Chen <[email protected]>; qemu-dev <qemu- [email protected]>; Eric Blake <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Markus Armbruster <[email protected]>
Cc: Zhang Chen <[email protected]>
Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 4 lines · Chen
Quoted 2 lines

I think we can start form COLO. To avoid QMP compatibility issues, I would like to add the n tuple and wildcard support now.

OK, I will do this job in next version.
For the QMP compatibility issues, please give me a demo of what we want

Quoted 8 lines
Quoted 6 lines

to see, Like some existing commands.

I meant if we start from port and then want to add e.g n-tuple support. Do we need to introduce another command? Or is there any introspection that can let management layer know about this?

OK, I will add the n-tuple support.
It looks basic command are add/del connection, Do you think something needs to be introduced?

It looks to me it's fine to start with them.

Quoted 2 lines

For the management layer, I don't know the detail process of how to add new Qemu command support for example libvirt. Maybe depend on libvirt community's plan?

So a question here, how COLO is being used now. Is it expected to be managed by libvirt or not?

Thanks

Quoted 10 lines

Thanks
Chen

Quoted 6 lines

Thanks

Quoted 3 lines

Thanks
Chen

#9 lore raw

RE: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 47 lines

-----Original Message-----
From: Jason Wang <[email protected]>
Sent: Tuesday, January 5, 2021 12:17 PM
To: Zhang, Chen <[email protected]>; qemu-dev <qemu- [email protected]>; Eric Blake <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Markus Armbruster <[email protected]>
Cc: Zhang Chen <[email protected]>
Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 7 lines · Chen
Quoted 7 lines

-----Original Message-----
From: Jason Wang <[email protected]>
Sent: Wednesday, December 30, 2020 11:57 AM
To: Zhang, Chen <[email protected]>; qemu-dev <qemu- [email protected]>; Eric Blake <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Markus Armbruster

<[email protected]>

Quoted 11 lines
Quoted 11 lines

Cc: Zhang Chen <[email protected]>
Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 5 lines · Chen
Quoted 2 lines

I think we can start form COLO. To avoid QMP compatibility issues, I would like to add the n tuple and wildcard support now.

OK, I will do this job in next version.
For the QMP compatibility issues, please give me a demo of what we want

Quoted 8 lines
Quoted 6 lines

to see, Like some existing commands.

I meant if we start from port and then want to add e.g n-tuple support. Do we need to introduce another command? Or is there any introspection that can let management layer know about this?

OK, I will add the n-tuple support.
It looks basic command are add/del connection, Do you think something

needs to be introduced?

It looks to me it's fine to start with them.

Quoted 7 lines
Quoted 1 line

For the management layer, I don't know the detail process of how to add

new Qemu command support for example libvirt.

Quoted 1 line

Maybe depend on libvirt community's plan?

So a question here, how COLO is being used now. Is it expected to be managed by libvirt or not?

Yes, they use libvirt to manage COLO.
Currently, China CSP integrated COLO on edge computing product, they need change a small part of the code on libvirt, Most of COLO parameter use libvirt bypass mechanism direct input to Qemu.
For our side, we focus on Qemu COLO code.

Thanks
Chen

Quoted 14 lines

Thanks

Quoted 10 lines

Thanks
Chen

Quoted 6 lines

Thanks

Quoted 3 lines

Thanks
Chen

#10 lore raw

Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

In reply to Zhang Chen
Quoted 17 lines · Zhang Chen

From: Zhang Chen <[email protected]>

Since the real user scenario does not need to monitor all traffic. Add colo-passthrough-add and colo-passthrough-del to maintain a COLO network passthrough list.

qapi/net.json +3 -0
@@ -714,3 +714,49 @@
 ##
 { 'event': 'FAILOVER_NEGOTIATED',
   'data': {'device-id': 'str'} }
+
+##
+# @colo-passthrough-add:

qapi/net.json line 729

Quoted 10 lines
qapi/net.json +10 -0
+#
+# Add passthrough entry according to customer's needs in COLO-compare.
+#
+# @protocol: COLO passthrough just support TCP and UDP.
+#
+# @port: TCP or UDP port number.
+#
+# Returns: Nothing on success
+#
+# Since: 5.3

The next release is 6.0, not 5.3.

qapi/net.json line 739

Quoted 10 lines
qapi/net.json +10 -0
+#
+# Example:
+#
+# -> { "execute": "colo-passthrough-add",
+#      "arguments": { "protocol": "tcp", "port": 3389 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'colo-passthrough-add',
+     'data': {'protocol': 'str', 'port': 'uint32'} }

Should 'protocol' be an enum (finite set of values) rather than an open-coded string (infinite number of values, even though you mentioned in the docs above that only 'tcp' or 'udp' make sense)? In fact, do we already have existing QAPI types representing tcp/udp and a port number that could be reused here, rather than open-coding yet another one?

qapi/net.json line 752

Quoted 13 lines
qapi/net.json +13 -0
+
+##
+# @colo-passthrough-del:
+#
+# Delete passthrough entry according to customer's needs in COLO-compare.
+#
+# @protocol: COLO passthrough just support TCP and UDP.
+#
+# @port: TCP or UDP port number.
+#
+# Returns: Nothing on success
+#
+# Since: 5.3

another 6.0 spot

Quoted 11 lines
qapi/net.json +10 -0
+#
+# Example:
+#
+# -> { "execute": "colo-passthrough-del",
+#      "arguments": { "protocol": "tcp", "port": 3389 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'colo-passthrough-del',
+     'data': {'protocol': 'str', 'port': 'uint32'} }
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#11 lore raw

RE: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 35 lines

-----Original Message-----
From: Eric Blake <[email protected]>
Sent: Wednesday, January 20, 2021 3:33 AM
To: Zhang, Chen <[email protected]>; Jason Wang <[email protected]>; qemu-dev <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Markus Armbruster <[email protected]>
Cc: Zhang Chen <[email protected]>
Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO passthrough

Quoted 21 lines · Zhang Chen

From: Zhang Chen <[email protected]>

Since the real user scenario does not need to monitor all traffic. Add colo-passthrough-add and colo-passthrough-del to maintain a COLO network passthrough list.

qapi/net.json +7 -0
@@ -714,3 +714,49 @@
 ##
 { 'event': 'FAILOVER_NEGOTIATED',
   'data': {'device-id': 'str'} }
+
+##
+# @colo-passthrough-add:
+#
+# Add passthrough entry according to customer's needs in COLO-compare.
+#
+# @protocol: COLO passthrough just support TCP and UDP.
Quoted 8 lines

qapi/net.json line 729

Quoted 6 lines
qapi/net.json +6 -0
+#
+# @port: TCP or UDP port number.
+#
+# Returns: Nothing on success
+#
+# Since: 5.3

The next release is 6.0, not 5.3.

Missed the plan, I will fix it in next version.

Quoted 18 lines

qapi/net.json line 739

Quoted 11 lines
qapi/net.json +10 -0
+#
+# Example:
+#
+# -> { "execute": "colo-passthrough-add",
+#      "arguments": { "protocol": "tcp", "port": 3389 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'colo-passthrough-add',
+     'data': {'protocol': 'str', 'port': 'uint32'} }

Should 'protocol' be an enum (finite set of values) rather than an open- coded string (infinite number of values, even though you mentioned in the docs above that only 'tcp' or 'udp' make sense)? In fact, do we already have existing QAPI types representing tcp/udp and a port number that could be reused here, rather than open-coding yet another one?

I checked current QAPI code, looks no existing enum defined. I will add the new general QAPI types in next version.

Thanks
Chen

Quoted 6 lines

qapi/net.json

Quoted 5 lines
qapi/net.json +5 -0
+
+##
+# @colo-passthrough-del:
+#
+# Delete passthrough entry according to customer's needs in COLO-

compare.

Quoted 11 lines

qapi/net.json line 729

Quoted 8 lines
qapi/net.json +8 -0
+#
+# @protocol: COLO passthrough just support TCP and UDP.
+#
+# @port: TCP or UDP port number.
+#
+# Returns: Nothing on success
+#
+# Since: 5.3

another 6.0 spot

OK.

Quoted 16 lines

qapi/net.json line 762

Quoted 11 lines
qapi/net.json +10 -0
+#
+# Example:
+#
+# -> { "execute": "colo-passthrough-del",
+#      "arguments": { "protocol": "tcp", "port": 3389 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'colo-passthrough-del',
+     'data': {'protocol': 'str', 'port': 'uint32'} }

--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org

author
#12 lore raw

PATCH 2/3 hmp-commands: Add new HMP command for COLO passthrough

In reply to Zhang Chen

From: Zhang Chen <[email protected]>

Add hmp_colo_passthrough_add and hmp_colo_passthrough_del make user can maintain COLO network passthrough list in human monitor.

---
 hmp-commands.hx       | 26 ++++++++++++++++++++++++++
 include/monitor/hmp.h |  2 ++
 monitor/hmp-cmds.c    | 20 ++++++++++++++++++++
 3 files changed, 48 insertions(+)
hmp-commands.hx +26 -0
index 470a420c2d..f5790782d6 100644
@@ -1341,6 +1341,32 @@ SRST
   Remove host network device.
 ERST
 
+    {
+        .name       = "colo_passthrough_add",
+        .args_type  = "protocol:s,port:i",
+        .params     = "protocol port",
+        .help       = "Add network stream to colo passthrough list",
+        .cmd        = hmp_colo_passthrough_add,
+    },
+
+SRST
+``colo_passthrough_add``
+  Add network stream to colo passthrough list.
+ERST
+
+    {
+        .name       = "colo_passthrough_del",
+        .args_type  = "protocol:s,port:i",
+        .params     = "protocol port",
+        .help       = "Delete network stream from colo passthrough list",
+        .cmd        = hmp_colo_passthrough_del,
+    },
+
+SRST
+``colo_passthrough_del``
+  Delete network stream from colo passthrough list.
+ERST
+
     {
         .name       = "object_add",
         .args_type  = "object:O",
include/monitor/hmp.h +2 -0
index ed2913fd18..3c4943b09f 100644
@@ -81,6 +81,8 @@ void hmp_device_del(Monitor *mon, const QDict *qdict);
 void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict);
 void hmp_netdev_add(Monitor *mon, const QDict *qdict);
 void hmp_netdev_del(Monitor *mon, const QDict *qdict);
+void hmp_colo_passthrough_add(Monitor *mon, const QDict *qdict);
+void hmp_colo_passthrough_del(Monitor *mon, const QDict *qdict);
 void hmp_getfd(Monitor *mon, const QDict *qdict);
 void hmp_closefd(Monitor *mon, const QDict *qdict);
 void hmp_sendkey(Monitor *mon, const QDict *qdict);
monitor/hmp-cmds.c +20 -0
index 65d8ff4849..ab98a6b77d 100644
@@ -1661,6 +1661,26 @@ void hmp_netdev_del(Monitor *mon, const QDict *qdict)
     hmp_handle_error(mon, err);
 }
 
+void hmp_colo_passthrough_add(Monitor *mon, const QDict *qdict)
+{
+    const char *prot = qdict_get_str(qdict, "protocol");
+    uint32_t port = qdict_get_int(qdict, "port");
+    Error *err = NULL;
+
+    qmp_colo_passthrough_add(prot, port, &err);
+    hmp_handle_error(mon, err);
+}
+
+void hmp_colo_passthrough_del(Monitor *mon, const QDict *qdict)
+{
+    const char *prot = qdict_get_str(qdict, "protocol");
+    uint32_t port = qdict_get_int(qdict, "port");
+    Error *err = NULL;
+
+    qmp_colo_passthrough_del(prot, port, &err);
+    hmp_handle_error(mon, err);
+}
+
 void hmp_object_add(Monitor *mon, const QDict *qdict)
 {
     Error *err = NULL;
Signature · 1 line
2.17.1
author
#13 lore raw

PATCH 3/3 net/colo-compare: Add handler for passthrough connection

In reply to Zhang Chen

From: Zhang Chen <[email protected]>

Currently, we just use guest's TCP/UDP source port as the key to bypass certain network traffic.

---
 net/colo-compare.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++
 net/colo-compare.h |  2 ++
 net/net.c          | 27 +++++++++++++++++++++++++
 3 files changed, 78 insertions(+)
net/colo-compare.c +49 -0
index 337025b44f..11a32caa9b 100644
@@ -46,6 +46,9 @@ static QTAILQ_HEAD(, CompareState) net_compares =
 static NotifierList colo_compare_notifiers =
     NOTIFIER_LIST_INITIALIZER(colo_compare_notifiers);
 
+static QLIST_HEAD(, PassthroughEntry) passthroughlist =
+    QLIST_HEAD_INITIALIZER(passthroughlist);
+
 #define COMPARE_READ_LEN_MAX NET_BUFSIZE
 #define MAX_QUEUE_SIZE 1024
 
@@ -103,6 +106,12 @@ typedef struct SendEntry {
     uint8_t *buf;
 } SendEntry;
 
+typedef struct PassthroughEntry {
+    bool is_tcp;
+    uint16_t port;
+    QLIST_ENTRY(PassthroughEntry) node;
+} PassthroughEntry;
+
 struct CompareState {
     Object parent;
 
@@ -247,6 +256,7 @@ static int packet_enqueue(CompareState *s, int mode, Connection **con)
     ConnectionKey key;
     Packet *pkt = NULL;
     Connection *conn;
+    PassthroughEntry *bypass, *next;
     int ret;
 
     if (mode == PRIMARY_IN) {
@@ -264,8 +274,23 @@ static int packet_enqueue(CompareState *s, int mode, Connection **con)
         pkt = NULL;
         return -1;
     }
+
     fill_connection_key(pkt, &key);
 
+    /* Check COLO passthrough connenction */
+    if (!QLIST_EMPTY(&passthroughlist)) {
+        QLIST_FOREACH_SAFE(bypass, &passthroughlist, node, next) {
+            if (((key.ip_proto == IPPROTO_TCP) && bypass->is_tcp) ||
+                ((key.ip_proto == IPPROTO_UDP) && !bypass->is_tcp)) {
+                if (bypass->port == key.src_port) {
+                    packet_destroy(pkt, NULL);
+                    pkt = NULL;
+                    return -1;
+                }
+            }
+        }
+    }
+
     conn = connection_get(s->connection_track_table,
                           &key,
                           &s->conn_list);
@@ -1373,6 +1398,30 @@ static void colo_flush_packets(void *opaque, void *user_data)
     }
 }
 
+void colo_compare_passthrough_add(bool is_tcp, const uint16_t port)
+{
+    PassthroughEntry *bypass = NULL;
+
+    bypass = g_new0(PassthroughEntry, 1);
+    bypass->is_tcp = is_tcp;
+    bypass->port = port;
+    QLIST_INSERT_HEAD(&passthroughlist, bypass, node);
+}
+
+void colo_compare_passthrough_del(bool is_tcp, const uint16_t port)
+{
+    PassthroughEntry *bypass = NULL, *next = NULL;
+
+    if (!QLIST_EMPTY(&passthroughlist)) {
+        QLIST_FOREACH_SAFE(bypass, &passthroughlist, node, next) {
+            if ((bypass->is_tcp == is_tcp) && (bypass->port == port)) {
+                QLIST_REMOVE(bypass, node);
+                g_free(bypass);
+            }
+        }
+    }
+}
+
 static void colo_compare_class_init(ObjectClass *oc, void *data)
 {
     UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
net/colo-compare.h +2 -0
index 22ddd512e2..1fa026c85e 100644
@@ -20,5 +20,7 @@
 void colo_notify_compares_event(void *opaque, int event, Error **errp);
 void colo_compare_register_notifier(Notifier *notify);
 void colo_compare_unregister_notifier(Notifier *notify);
+void colo_compare_passthrough_add(bool is_tcp, const uint16_t port);
+void colo_compare_passthrough_del(bool is_tcp, const uint16_t port);
 
 #endif /* QEMU_COLO_COMPARE_H */
net/net.c +27 -0
index eac7a92618..1f303e8309 100644
@@ -55,6 +55,7 @@
 #include "sysemu/sysemu.h"
 #include "net/filter.h"
 #include "qapi/string-output-visitor.h"
+#include "net/colo-compare.h"
 
 /* Net bridge is currently not supported for W32. */
 #if !defined(_WIN32)
@@ -1155,12 +1156,38 @@ void qmp_colo_passthrough_add(const char *prot, const uint32_t port,
                               Error **errp)
 {
     /* Setup passthrough connection */
+    if (port > 65536) {
+        error_setg(errp, "COLO pass through get wrong port");
+        return;
+    }
+
+    if (!strcmp(prot, "tcp") || !strcmp(prot, "TCP")) {
+        colo_compare_passthrough_add(true, (uint16_t)port);
+    } else if (!strcmp(prot, "udp") || !strcmp(prot, "UDP")) {
+        colo_compare_passthrough_add(false, (uint16_t)port);
+    } else {
+        error_setg(errp, "COLO pass through just support tcp or udp protocol");
+        return;
+    }
 }
 
 void qmp_colo_passthrough_del(const char *prot, const uint32_t port,
                               Error **errp)
 {
     /* Delete passthrough connection */
+    if (port > 65536) {
+        error_setg(errp, "COLO pass through get wrong port");
+        return;
+    }
+
+    if (!strcmp(prot, "tcp") || !strcmp(prot, "TCP")) {
+        colo_compare_passthrough_del(true, (uint16_t)port);
+    } else if (!strcmp(prot, "udp") || !strcmp(prot, "UDP")) {
+        colo_compare_passthrough_del(false, (uint16_t)port);
+    } else {
+        error_setg(errp, "COLO pass through just support tcp or udp protocol");
+        return;
+    }
 }
 
 static void netfilter_print_info(Monitor *mon, NetFilterState *nf)
Signature · 1 line
2.17.1
#14 lore raw

Re: [PATCH 3/3] net/colo-compare: Add handler for passthrough connection

Quoted 17 lines · On Thu, 24 Dec 2020 09:09:18 +0800 Zhang Chen <[email protected] > wrote:

From: Zhang Chen <[email protected]>

Currently, we just use guest's TCP/UDP source port as the key to bypass certain network traffic.

---
 net/colo-compare.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++
 net/colo-compare.h |  2 ++
 net/net.c          | 27 +++++++++++++++++++++++++
 3 files changed, 78 insertions(+)
net/colo-compare.c +0 -0
index 337025b44f..11a32caa9b 100644

net/colo-compare.c static QTAILQ_HEAD(, CompareState) net_compares = · line 51

Quoted 6 lines
net/colo-compare.c +3 -0
@@ -46,6 +46,9 @@ static QTAILQ_HEAD(, CompareState) net_compares =
 static NotifierList colo_compare_notifiers =
     NOTIFIER_LIST_INITIALIZER(colo_compare_notifiers);
 
+static QLIST_HEAD(, PassthroughEntry) passthroughlist =
+    QLIST_HEAD_INITIALIZER(passthroughlist);
+

Hi,
I think this should be per colo-compare instance e.g. inside 'struct CompareState'.

Quoted 142 lines
net/colo-compare.c +46 -0
 #define COMPARE_READ_LEN_MAX NET_BUFSIZE
 #define MAX_QUEUE_SIZE 1024
 
@@ -103,6 +106,12 @@ typedef struct SendEntry {
     uint8_t *buf;
 } SendEntry;
 
+typedef struct PassthroughEntry {
+    bool is_tcp;
+    uint16_t port;
+    QLIST_ENTRY(PassthroughEntry) node;
+} PassthroughEntry;
+
 struct CompareState {
     Object parent;
 
@@ -247,6 +256,7 @@ static int packet_enqueue(CompareState *s, int mode, Connection **con)
     ConnectionKey key;
     Packet *pkt = NULL;
     Connection *conn;
+    PassthroughEntry *bypass, *next;
     int ret;
 
     if (mode == PRIMARY_IN) {
@@ -264,8 +274,23 @@ static int packet_enqueue(CompareState *s, int mode, Connection **con)
         pkt = NULL;
         return -1;
     }
+
     fill_connection_key(pkt, &key);
 
+    /* Check COLO passthrough connenction */
+    if (!QLIST_EMPTY(&passthroughlist)) {
+        QLIST_FOREACH_SAFE(bypass, &passthroughlist, node, next) {
+            if (((key.ip_proto == IPPROTO_TCP) && bypass->is_tcp) ||
+                ((key.ip_proto == IPPROTO_UDP) && !bypass->is_tcp)) {
+                if (bypass->port == key.src_port) {
+                    packet_destroy(pkt, NULL);
+                    pkt = NULL;
+                    return -1;
+                }
+            }
+        }
+    }
+
     conn = connection_get(s->connection_track_table,
                           &key,
                           &s->conn_list);
@@ -1373,6 +1398,30 @@ static void colo_flush_packets(void *opaque, void *user_data)
     }
 }
 
+void colo_compare_passthrough_add(bool is_tcp, const uint16_t port)
+{
+    PassthroughEntry *bypass = NULL;
+
+    bypass = g_new0(PassthroughEntry, 1);
+    bypass->is_tcp = is_tcp;
+    bypass->port = port;
+    QLIST_INSERT_HEAD(&passthroughlist, bypass, node);
+}
+
+void colo_compare_passthrough_del(bool is_tcp, const uint16_t port)
+{
+    PassthroughEntry *bypass = NULL, *next = NULL;
+
+    if (!QLIST_EMPTY(&passthroughlist)) {
+        QLIST_FOREACH_SAFE(bypass, &passthroughlist, node, next) {
+            if ((bypass->is_tcp == is_tcp) && (bypass->port == port)) {
+                QLIST_REMOVE(bypass, node);
+                g_free(bypass);
+            }
+        }
+    }
+}
+
 static void colo_compare_class_init(ObjectClass *oc, void *data)
 {
     UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
net/colo-compare.h +2 -0
index 22ddd512e2..1fa026c85e 100644
@@ -20,5 +20,7 @@
 void colo_notify_compares_event(void *opaque, int event, Error **errp);
 void colo_compare_register_notifier(Notifier *notify);
 void colo_compare_unregister_notifier(Notifier *notify);
+void colo_compare_passthrough_add(bool is_tcp, const uint16_t port);
+void colo_compare_passthrough_del(bool is_tcp, const uint16_t port);
 
 #endif /* QEMU_COLO_COMPARE_H */
net/net.c +27 -0
index eac7a92618..1f303e8309 100644
@@ -55,6 +55,7 @@
 #include "sysemu/sysemu.h"
 #include "net/filter.h"
 #include "qapi/string-output-visitor.h"
+#include "net/colo-compare.h"
 
 /* Net bridge is currently not supported for W32. */
 #if !defined(_WIN32)
@@ -1155,12 +1156,38 @@ void qmp_colo_passthrough_add(const char *prot, const uint32_t port,
                               Error **errp)
 {
     /* Setup passthrough connection */
+    if (port > 65536) {
+        error_setg(errp, "COLO pass through get wrong port");
+        return;
+    }
+
+    if (!strcmp(prot, "tcp") || !strcmp(prot, "TCP")) {
+        colo_compare_passthrough_add(true, (uint16_t)port);
+    } else if (!strcmp(prot, "udp") || !strcmp(prot, "UDP")) {
+        colo_compare_passthrough_add(false, (uint16_t)port);
+    } else {
+        error_setg(errp, "COLO pass through just support tcp or udp protocol");
+        return;
+    }
 }
 
 void qmp_colo_passthrough_del(const char *prot, const uint32_t port,
                               Error **errp)
 {
     /* Delete passthrough connection */
+    if (port > 65536) {
+        error_setg(errp, "COLO pass through get wrong port");
+        return;
+    }
+
+    if (!strcmp(prot, "tcp") || !strcmp(prot, "TCP")) {
+        colo_compare_passthrough_del(true, (uint16_t)port);
+    } else if (!strcmp(prot, "udp") || !strcmp(prot, "UDP")) {
+        colo_compare_passthrough_del(false, (uint16_t)port);
+    } else {
+        error_setg(errp, "COLO pass through just support tcp or udp protocol");
+        return;
+    }
 }
 
 static void netfilter_print_info(Monitor *mon, NetFilterState *nf)
#15 lore raw

RE: [PATCH 3/3] net/colo-compare: Add handler for passthrough connection

Quoted 37 lines

-----Original Message-----
From: Lukas Straub <[email protected]>
Sent: Thursday, January 14, 2021 9:45 PM
To: Zhang, Chen <[email protected]>
Cc: Jason Wang <[email protected]>; qemu-dev <qemu- [email protected]>; Eric Blake <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Markus Armbruster <[email protected]>; Zhang Chen <[email protected]>
Subject: Re: [PATCH 3/3] net/colo-compare: Add handler for passthrough connection

Quoted 21 lines · On Thu, 24 Dec 2020 09:09:18 +0800 Zhang Chen <[email protected] > wrote:

From: Zhang Chen <[email protected]>

Currently, we just use guest's TCP/UDP source port as the key to bypass certain network traffic.

---
 net/colo-compare.c | 49
++++++++++++++++++++++++++++++++++++++++++++++
 net/colo-compare.h |  2 ++
 net/net.c          | 27 +++++++++++++++++++++++++
 3 files changed, 78 insertions(+)
net/colo-compare.c index renamed from net/colo-compare.c +0 -0

337025b44f..11a32caa9b 100644

net/colo-compare.c +0 -0
@@ -46,6 +46,9 @@ static QTAILQ_HEAD(, CompareState) net_compares =

static NotifierList colo_compare_notifiers =

     NOTIFIER_LIST_INITIALIZER(colo_compare_notifiers);
Quoted 7 lines

net/colo-compare.c static QTAILQ_HEAD(, CompareState) net_compares = · line 51

Quoted 3 lines
net/colo-compare.c +3 -0
+static QLIST_HEAD(, PassthroughEntry) passthroughlist =
+    QLIST_HEAD_INITIALIZER(passthroughlist);
+

Hi,
I think this should be per colo-compare instance e.g. inside 'struct CompareState'.

It looks QMP and HMP also need to add colo-compare object ID to control it. Do we need make this command more general?

Thanks
Chen

Quoted 145 lines
Quoted 2 lines

#define COMPARE_READ_LEN_MAX NET_BUFSIZE #define

MAX_QUEUE_SIZE 1024

net/colo-compare.c static int packet_enqueue(CompareState *s, int

Quoted 14 lines
net/colo-compare.c +5 -0
@@ -103,6 +106,12 @@ typedef struct SendEntry {
     uint8_t *buf;
 } SendEntry;
 
+typedef struct PassthroughEntry {
+    bool is_tcp;
+    uint16_t port;
+    QLIST_ENTRY(PassthroughEntry) node; } PassthroughEntry;
+
 struct CompareState {
     Object parent;
 
@@ -247,6 +256,7 @@ static int packet_enqueue(CompareState *s, int

mode, Connection **con)

net/colo-compare.c static int packet_enqueue(CompareState *s, int

Quoted 8 lines
net/colo-compare.c +1 -0
     ConnectionKey key;
     Packet *pkt = NULL;
     Connection *conn;
+    PassthroughEntry *bypass, *next;
     int ret;
 
     if (mode == PRIMARY_IN) {
@@ -264,8 +274,23 @@ static int packet_enqueue(CompareState *s, int

mode, Connection **con)

Quoted 50 lines
net/colo-compare.c +15 -0
         pkt = NULL;
         return -1;
     }
+
     fill_connection_key(pkt, &key);
 
+    /* Check COLO passthrough connenction */
+    if (!QLIST_EMPTY(&passthroughlist)) {
+        QLIST_FOREACH_SAFE(bypass, &passthroughlist, node, next) {
+            if (((key.ip_proto == IPPROTO_TCP) && bypass->is_tcp) ||
+                ((key.ip_proto == IPPROTO_UDP) && !bypass->is_tcp)) {
+                if (bypass->port == key.src_port) {
+                    packet_destroy(pkt, NULL);
+                    pkt = NULL;
+                    return -1;
+                }
+            }
+        }
+    }
+
     conn = connection_get(s->connection_track_table,
                           &key,
                           &s->conn_list); @@ -1373,6 +1398,30 @@

static void colo_flush_packets(void *opaque, void *user_data)

     }

}

net/colo-compare.c +21 -0
+void colo_compare_passthrough_add(bool is_tcp, const uint16_t port) {
+    PassthroughEntry *bypass = NULL;
+
+    bypass = g_new0(PassthroughEntry, 1);
+    bypass->is_tcp = is_tcp;
+    bypass->port = port;
+    QLIST_INSERT_HEAD(&passthroughlist, bypass, node); }
+
+void colo_compare_passthrough_del(bool is_tcp, const uint16_t port) {
+    PassthroughEntry *bypass = NULL, *next = NULL;
+
+    if (!QLIST_EMPTY(&passthroughlist)) {
+        QLIST_FOREACH_SAFE(bypass, &passthroughlist, node, next) {
+            if ((bypass->is_tcp == is_tcp) && (bypass->port == port)) {
+                QLIST_REMOVE(bypass, node);
+                g_free(bypass);
+            }
+        }
+    }
+}
+
 static void colo_compare_class_init(ObjectClass *oc, void *data)  {
     UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc); diff --git
Quoted 1 line

a/net/colo-compare.h b/net/colo-compare.h index

22ddd512e2..1fa026c85e

Quoted 27 lines

100644

net/colo-compare.h +2 -0
@@ -20,5 +20,7 @@
 void colo_notify_compares_event(void *opaque, int event, Error
 **errp);  void colo_compare_register_notifier(Notifier *notify);  void
 colo_compare_unregister_notifier(Notifier *notify);
+void colo_compare_passthrough_add(bool is_tcp, const uint16_t port);
+void colo_compare_passthrough_del(bool is_tcp, const uint16_t port);
 
 #endif /* QEMU_COLO_COMPARE_H */
net/net.c +1 -0
index eac7a92618..1f303e8309 100644
@@ -55,6 +55,7 @@
 #include "sysemu/sysemu.h"
 #include "net/filter.h"
 #include "qapi/string-output-visitor.h"
+#include "net/colo-compare.h"
 
 /* Net bridge is currently not supported for W32. */  #if

!defined(_WIN32) @@ -1155,12 +1156,38 @@ void qmp_colo_passthrough_add(const char *prot, const uint32_t port,

                               Error **errp)  {
     /* Setup passthrough connection */
net/net.c +1 -0
+    if (port > 65536) {

net/net.c void qmp_colo_passthrough_add(const char *prot, const uint32_t port,

Quoted 10 lines
net/net.c +10 -0
+        error_setg(errp, "COLO pass through get wrong port");
+        return;
+    }
+
+    if (!strcmp(prot, "tcp") || !strcmp(prot, "TCP")) {
+        colo_compare_passthrough_add(true, (uint16_t)port);
+    } else if (!strcmp(prot, "udp") || !strcmp(prot, "UDP")) {
+        colo_compare_passthrough_add(false, (uint16_t)port);
+    } else {
+        error_setg(errp, "COLO pass through just support tcp or udp

protocol");

Quoted 8 lines
net/net.c +3 -0
+        return;
+    }
 }
 
 void qmp_colo_passthrough_del(const char *prot, const uint32_t port,
                               Error **errp)  {
     /* Delete passthrough connection */
+    if (port > 65536) {

net/net.c void qmp_colo_passthrough_add(const char *prot, const uint32_t port,

Quoted 10 lines
net/net.c +10 -0
+        error_setg(errp, "COLO pass through get wrong port");
+        return;
+    }
+
+    if (!strcmp(prot, "tcp") || !strcmp(prot, "TCP")) {
+        colo_compare_passthrough_del(true, (uint16_t)port);
+    } else if (!strcmp(prot, "udp") || !strcmp(prot, "UDP")) {
+        colo_compare_passthrough_del(false, (uint16_t)port);
+    } else {
+        error_setg(errp, "COLO pass through just support tcp or udp

protocol");

net/net.c void qmp_colo_passthrough_add(const char *prot, const uint32_t port, · line 1193

Quoted 5 lines
net/net.c +2 -0
+        return;
+    }
 }
 
 static void netfilter_print_info(Monitor *mon, NetFilterState *nf)

--

#16 lore raw

Re: [PATCH 3/3] net/colo-compare: Add handler for passthrough connection

Quoted 43 lines · Chen
Quoted 35 lines

-----Original Message-----
From: Lukas Straub <[email protected]>
Sent: Thursday, January 14, 2021 9:45 PM
To: Zhang, Chen <[email protected]>
Cc: Jason Wang <[email protected]>; qemu-dev <qemu- [email protected]>; Eric Blake <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Markus Armbruster <[email protected]>; Zhang Chen <[email protected]>
Subject: Re: [PATCH 3/3] net/colo-compare: Add handler for passthrough connection

Quoted 21 lines · On Thu, 24 Dec 2020 09:09:18 +0800 Zhang Chen <[email protected] > wrote:

From: Zhang Chen <[email protected]>

Currently, we just use guest's TCP/UDP source port as the key to bypass certain network traffic.

---
 net/colo-compare.c | 49
++++++++++++++++++++++++++++++++++++++++++++++
 net/colo-compare.h |  2 ++
 net/net.c          | 27 +++++++++++++++++++++++++
 3 files changed, 78 insertions(+)
net/colo-compare.c index renamed from net/colo-compare.c +0 -0

337025b44f..11a32caa9b 100644

net/colo-compare.c +0 -0
@@ -46,6 +46,9 @@ static QTAILQ_HEAD(, CompareState) net_compares =

static NotifierList colo_compare_notifiers =

     NOTIFIER_LIST_INITIALIZER(colo_compare_notifiers);
Quoted 7 lines

net/colo-compare.c static QTAILQ_HEAD(, CompareState) net_compares = · line 51

Quoted 3 lines
net/colo-compare.c +3 -0
+static QLIST_HEAD(, PassthroughEntry) passthroughlist =
+    QLIST_HEAD_INITIALIZER(passthroughlist);
+  

Hi,
I think this should be per colo-compare instance e.g. inside 'struct CompareState'.

Quoted 2 lines

It looks QMP and HMP also need to add colo-compare object ID to control it. Do we need make this command more general?

Yes, it gives more flexibility. For example if the VM a "public" and a separate "management" network interface, passthrough can then be enabled just on the "management" interface.

Regards,
Lukas Straub

Quoted 5 lines

Thanks
Chen

Quoted 2 lines
Quoted 2 lines

[...]

#17 lore raw

Re: [PATCH 3/3] net/colo-compare: Add handler for passthrough connection

In reply to Zhang Chen
Quoted 89 lines · On Thu, 24 Dec 2020 09:09:18 +0800 Zhang Chen <[email protected] > wrote:

From: Zhang Chen <[email protected]>

Currently, we just use guest's TCP/UDP source port as the key to bypass certain network traffic.

---
 net/colo-compare.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++
 net/colo-compare.h |  2 ++
 net/net.c          | 27 +++++++++++++++++++++++++
 3 files changed, 78 insertions(+)
net/colo-compare.c +39 -0
index 337025b44f..11a32caa9b 100644
@@ -46,6 +46,9 @@ static QTAILQ_HEAD(, CompareState) net_compares =
 static NotifierList colo_compare_notifiers =
     NOTIFIER_LIST_INITIALIZER(colo_compare_notifiers);
 
+static QLIST_HEAD(, PassthroughEntry) passthroughlist =
+    QLIST_HEAD_INITIALIZER(passthroughlist);
+
 #define COMPARE_READ_LEN_MAX NET_BUFSIZE
 #define MAX_QUEUE_SIZE 1024
 
@@ -103,6 +106,12 @@ typedef struct SendEntry {
     uint8_t *buf;
 } SendEntry;
 
+typedef struct PassthroughEntry {
+    bool is_tcp;
+    uint16_t port;
+    QLIST_ENTRY(PassthroughEntry) node;
+} PassthroughEntry;
+
 struct CompareState {
     Object parent;
 
@@ -247,6 +256,7 @@ static int packet_enqueue(CompareState *s, int mode, Connection **con)
     ConnectionKey key;
     Packet *pkt = NULL;
     Connection *conn;
+    PassthroughEntry *bypass, *next;
     int ret;
 
     if (mode == PRIMARY_IN) {
@@ -264,8 +274,23 @@ static int packet_enqueue(CompareState *s, int mode, Connection **con)
         pkt = NULL;
         return -1;
     }
+
     fill_connection_key(pkt, &key);
 
+    /* Check COLO passthrough connenction */
+    if (!QLIST_EMPTY(&passthroughlist)) {
+        QLIST_FOREACH_SAFE(bypass, &passthroughlist, node, next) {
+            if (((key.ip_proto == IPPROTO_TCP) && bypass->is_tcp) ||
+                ((key.ip_proto == IPPROTO_UDP) && !bypass->is_tcp)) {
+                if (bypass->port == key.src_port) {
+                    packet_destroy(pkt, NULL);
+                    pkt = NULL;
+                    return -1;
+                }
+            }
+        }
+    }
+
     conn = connection_get(s->connection_track_table,
                           &key,
                           &s->conn_list);
@@ -1373,6 +1398,30 @@ static void colo_flush_packets(void *opaque, void *user_data)
     }
 }
 
+void colo_compare_passthrough_add(bool is_tcp, const uint16_t port)
+{
+    PassthroughEntry *bypass = NULL;
+
+    bypass = g_new0(PassthroughEntry, 1);
+    bypass->is_tcp = is_tcp;
+    bypass->port = port;
+    QLIST_INSERT_HEAD(&passthroughlist, bypass, node);
+}
+
+void colo_compare_passthrough_del(bool is_tcp, const uint16_t port)
+{
+    PassthroughEntry *bypass = NULL, *next = NULL;
+

net/colo-compare.c static void colo_flush_packets(void *opaque, void *user_data) · line 1424

Quoted 10 lines
net/colo-compare.c +10 -0
+    if (!QLIST_EMPTY(&passthroughlist)) {
+        QLIST_FOREACH_SAFE(bypass, &passthroughlist, node, next) {
+            if ((bypass->is_tcp == is_tcp) && (bypass->port == port)) {
+                QLIST_REMOVE(bypass, node);
+                g_free(bypass);
+            }
+        }
+    }
+}
+

Access to "passtroughlist" needs to be protected by a lock, as "packet_enqueue" is called from a different iothread.

Quoted 66 lines
net/colo-compare.c +0 -0
 static void colo_compare_class_init(ObjectClass *oc, void *data)
 {
     UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
net/colo-compare.h +2 -0
index 22ddd512e2..1fa026c85e 100644
@@ -20,5 +20,7 @@
 void colo_notify_compares_event(void *opaque, int event, Error **errp);
 void colo_compare_register_notifier(Notifier *notify);
 void colo_compare_unregister_notifier(Notifier *notify);
+void colo_compare_passthrough_add(bool is_tcp, const uint16_t port);
+void colo_compare_passthrough_del(bool is_tcp, const uint16_t port);
 
 #endif /* QEMU_COLO_COMPARE_H */
net/net.c +27 -0
index eac7a92618..1f303e8309 100644
@@ -55,6 +55,7 @@
 #include "sysemu/sysemu.h"
 #include "net/filter.h"
 #include "qapi/string-output-visitor.h"
+#include "net/colo-compare.h"
 
 /* Net bridge is currently not supported for W32. */
 #if !defined(_WIN32)
@@ -1155,12 +1156,38 @@ void qmp_colo_passthrough_add(const char *prot, const uint32_t port,
                               Error **errp)
 {
     /* Setup passthrough connection */
+    if (port > 65536) {
+        error_setg(errp, "COLO pass through get wrong port");
+        return;
+    }
+
+    if (!strcmp(prot, "tcp") || !strcmp(prot, "TCP")) {
+        colo_compare_passthrough_add(true, (uint16_t)port);
+    } else if (!strcmp(prot, "udp") || !strcmp(prot, "UDP")) {
+        colo_compare_passthrough_add(false, (uint16_t)port);
+    } else {
+        error_setg(errp, "COLO pass through just support tcp or udp protocol");
+        return;
+    }
 }
 
 void qmp_colo_passthrough_del(const char *prot, const uint32_t port,
                               Error **errp)
 {
     /* Delete passthrough connection */
+    if (port > 65536) {
+        error_setg(errp, "COLO pass through get wrong port");
+        return;
+    }
+
+    if (!strcmp(prot, "tcp") || !strcmp(prot, "TCP")) {
+        colo_compare_passthrough_del(true, (uint16_t)port);
+    } else if (!strcmp(prot, "udp") || !strcmp(prot, "UDP")) {
+        colo_compare_passthrough_del(false, (uint16_t)port);
+    } else {
+        error_setg(errp, "COLO pass through just support tcp or udp protocol");
+        return;
+    }
 }
 
 static void netfilter_print_info(Monitor *mon, NetFilterState *nf)
#18 lore raw

RE: [PATCH 3/3] net/colo-compare: Add handler for passthrough connection

Quoted 109 lines

-----Original Message-----
From: Lukas Straub <[email protected]>
Sent: Thursday, January 14, 2021 9:51 PM
To: Zhang, Chen <[email protected]>
Cc: Jason Wang <[email protected]>; qemu-dev <qemu- [email protected]>; Eric Blake <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Markus Armbruster <[email protected]>; Zhang Chen <[email protected]>
Subject: Re: [PATCH 3/3] net/colo-compare: Add handler for passthrough connection

Quoted 21 lines · On Thu, 24 Dec 2020 09:09:18 +0800 Zhang Chen <[email protected] > wrote:

From: Zhang Chen <[email protected]>

Currently, we just use guest's TCP/UDP source port as the key to bypass certain network traffic.

---
 net/colo-compare.c | 49
++++++++++++++++++++++++++++++++++++++++++++++
 net/colo-compare.h |  2 ++
 net/net.c          | 27 +++++++++++++++++++++++++
 3 files changed, 78 insertions(+)
net/colo-compare.c index renamed from net/colo-compare.c +0 -0

337025b44f..11a32caa9b 100644

net/colo-compare.c +0 -0
@@ -46,6 +46,9 @@ static QTAILQ_HEAD(, CompareState) net_compares =

static NotifierList colo_compare_notifiers =

     NOTIFIER_LIST_INITIALIZER(colo_compare_notifiers);

net/colo-compare.c static QTAILQ_HEAD(, CompareState) net_compares =

Quoted 4 lines
net/colo-compare.c +3 -0
+static QLIST_HEAD(, PassthroughEntry) passthroughlist =
+    QLIST_HEAD_INITIALIZER(passthroughlist);
+
 #define COMPARE_READ_LEN_MAX NET_BUFSIZE  #define

MAX_QUEUE_SIZE 1024

net/colo-compare.c static int packet_enqueue(CompareState *s, int

Quoted 14 lines
net/colo-compare.c +5 -0
@@ -103,6 +106,12 @@ typedef struct SendEntry {
     uint8_t *buf;
 } SendEntry;
 
+typedef struct PassthroughEntry {
+    bool is_tcp;
+    uint16_t port;
+    QLIST_ENTRY(PassthroughEntry) node; } PassthroughEntry;
+
 struct CompareState {
     Object parent;
 
@@ -247,6 +256,7 @@ static int packet_enqueue(CompareState *s, int

mode, Connection **con)

net/colo-compare.c static int packet_enqueue(CompareState *s, int

Quoted 8 lines
net/colo-compare.c +1 -0
     ConnectionKey key;
     Packet *pkt = NULL;
     Connection *conn;
+    PassthroughEntry *bypass, *next;
     int ret;
 
     if (mode == PRIMARY_IN) {
@@ -264,8 +274,23 @@ static int packet_enqueue(CompareState *s, int

mode, Connection **con)

Quoted 43 lines
net/colo-compare.c +15 -0
         pkt = NULL;
         return -1;
     }
+
     fill_connection_key(pkt, &key);
 
+    /* Check COLO passthrough connenction */
+    if (!QLIST_EMPTY(&passthroughlist)) {
+        QLIST_FOREACH_SAFE(bypass, &passthroughlist, node, next) {
+            if (((key.ip_proto == IPPROTO_TCP) && bypass->is_tcp) ||
+                ((key.ip_proto == IPPROTO_UDP) && !bypass->is_tcp)) {
+                if (bypass->port == key.src_port) {
+                    packet_destroy(pkt, NULL);
+                    pkt = NULL;
+                    return -1;
+                }
+            }
+        }
+    }
+
     conn = connection_get(s->connection_track_table,
                           &key,
                           &s->conn_list); @@ -1373,6 +1398,30 @@

static void colo_flush_packets(void *opaque, void *user_data)

     }

}

net/colo-compare.c +16 -0
+void colo_compare_passthrough_add(bool is_tcp, const uint16_t port) {
+    PassthroughEntry *bypass = NULL;
+
+    bypass = g_new0(PassthroughEntry, 1);
+    bypass->is_tcp = is_tcp;
+    bypass->port = port;
+    QLIST_INSERT_HEAD(&passthroughlist, bypass, node); }
+
+void colo_compare_passthrough_del(bool is_tcp, const uint16_t port) {
+    PassthroughEntry *bypass = NULL, *next = NULL;
+
+    if (!QLIST_EMPTY(&passthroughlist)) {
+        QLIST_FOREACH_SAFE(bypass, &passthroughlist, node, next) {
+            if ((bypass->is_tcp == is_tcp) && (bypass->port == port)) {
+                QLIST_REMOVE(bypass, node);
+                g_free(bypass);
Quoted 8 lines

net/colo-compare.c static int packet_enqueue(CompareState *s, int mode, Connection **con) · line 293

Quoted 5 lines
net/colo-compare.c +5 -0
+            }
+        }
+    }
+}
+

Access to "passtroughlist" needs to be protected by a lock, as "packet_enqueue" is called from a different iothread.

OK, I will add the lock in next version.

Thanks
Chen

Quoted 71 lines
Quoted 4 lines
 static void colo_compare_class_init(ObjectClass *oc, void *data)  {
     UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc); diff --git

a/net/colo-compare.h b/net/colo-compare.h index

22ddd512e2..1fa026c85e

Quoted 27 lines

100644

net/colo-compare.h +2 -0
@@ -20,5 +20,7 @@
 void colo_notify_compares_event(void *opaque, int event, Error
 **errp);  void colo_compare_register_notifier(Notifier *notify);  void
 colo_compare_unregister_notifier(Notifier *notify);
+void colo_compare_passthrough_add(bool is_tcp, const uint16_t port);
+void colo_compare_passthrough_del(bool is_tcp, const uint16_t port);
 
 #endif /* QEMU_COLO_COMPARE_H */
net/net.c +1 -0
index eac7a92618..1f303e8309 100644
@@ -55,6 +55,7 @@
 #include "sysemu/sysemu.h"
 #include "net/filter.h"
 #include "qapi/string-output-visitor.h"
+#include "net/colo-compare.h"
 
 /* Net bridge is currently not supported for W32. */  #if

!defined(_WIN32) @@ -1155,12 +1156,38 @@ void qmp_colo_passthrough_add(const char *prot, const uint32_t port,

                               Error **errp)  {
     /* Setup passthrough connection */
net/net.c +1 -0
+    if (port > 65536) {

net/net.c void qmp_colo_passthrough_add(const char *prot, const uint32_t port,

Quoted 10 lines
net/net.c +10 -0
+        error_setg(errp, "COLO pass through get wrong port");
+        return;
+    }
+
+    if (!strcmp(prot, "tcp") || !strcmp(prot, "TCP")) {
+        colo_compare_passthrough_add(true, (uint16_t)port);
+    } else if (!strcmp(prot, "udp") || !strcmp(prot, "UDP")) {
+        colo_compare_passthrough_add(false, (uint16_t)port);
+    } else {
+        error_setg(errp, "COLO pass through just support tcp or udp

protocol");

Quoted 8 lines
net/net.c +3 -0
+        return;
+    }
 }
 
 void qmp_colo_passthrough_del(const char *prot, const uint32_t port,
                               Error **errp)  {
     /* Delete passthrough connection */
+    if (port > 65536) {

net/net.c void qmp_colo_passthrough_add(const char *prot, const uint32_t port,

Quoted 10 lines
net/net.c +10 -0
+        error_setg(errp, "COLO pass through get wrong port");
+        return;
+    }
+
+    if (!strcmp(prot, "tcp") || !strcmp(prot, "TCP")) {
+        colo_compare_passthrough_del(true, (uint16_t)port);
+    } else if (!strcmp(prot, "udp") || !strcmp(prot, "UDP")) {
+        colo_compare_passthrough_del(false, (uint16_t)port);
+    } else {
+        error_setg(errp, "COLO pass through just support tcp or udp

protocol");

net/net.c void qmp_colo_passthrough_add(const char *prot, const uint32_t port, · line 1193

Quoted 5 lines
net/net.c +2 -0
+        return;
+    }
 }
 
 static void netfilter_print_info(Monitor *mon, NetFilterState *nf)

--

#19 lore raw
In reply to Zhang Chen
Quoted 3 lines · Zhang Chen

From: Zhang Chen <[email protected]>

Since the real user scenario does not need to monitor all traffic.

Hi Chen:

It would be better to elaborate more on this. E.g what scenario and who will use those new QMP/HMP commands.

Thanks

Quoted 16 lines

This series give user ability to bypass kinds of network stream.

Zhang Chen (3):
qapi/net: Add new QMP command for COLO passthrough
hmp-commands: Add new HMP command for COLO passthrough net/colo-compare: Add handler for passthrough connection

  hmp-commands.hx       | 26 +++++++++++++++++++++++
  include/monitor/hmp.h |  2 ++
  monitor/hmp-cmds.c    | 20 ++++++++++++++++++
  net/colo-compare.c    | 49 +++++++++++++++++++++++++++++++++++++++++++
  net/colo-compare.h    |  2 ++
  net/net.c             | 39 ++++++++++++++++++++++++++++++++++
  qapi/net.json         | 46 ++++++++++++++++++++++++++++++++++++++++
  7 files changed, 184 insertions(+)
#20 lore raw
Quoted 15 lines

-----Original Message-----
From: Jason Wang <[email protected]>
Sent: Friday, December 25, 2020 2:23 PM
To: Zhang, Chen <[email protected]>; qemu-dev <qemu- [email protected]>; Eric Blake <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Markus Armbruster <[email protected]>
Cc: Zhang Chen <[email protected]>
Subject: Re: [PATCH 0/3] Bypass specific network traffic in COLO

Quoted 2 lines · Zhang Chen

From: Zhang Chen <[email protected]>

Quoted 7 lines
Quoted 1 line

Since the real user scenario does not need to monitor all traffic.

Hi Chen:

It would be better to elaborate more on this. E.g what scenario and who will use those new QMP/HMP commands.

OK, I will add more commit log in next version.

Thanks
Chen

Quoted 22 lines

Thanks

Quoted 11 lines

This series give user ability to bypass kinds of network stream.

Zhang Chen (3):
qapi/net: Add new QMP command for COLO passthrough
hmp-commands: Add new HMP command for COLO passthrough net/colo-compare: Add handler for passthrough connection

  hmp-commands.hx       | 26 +++++++++++++++++++++++
  include/monitor/hmp.h |  2 ++
  monitor/hmp-cmds.c    | 20 ++++++++++++++++++
  net/colo-compare.c    | 49

+++++++++++++++++++++++++++++++++++++++++++

Quoted 3 lines
  net/colo-compare.h    |  2 ++
  net/net.c             | 39 ++++++++++++++++++++++++++++++++++
  qapi/net.json         | 46

++++++++++++++++++++++++++++++++++++++++

Quoted 2 lines
  7 files changed, 184 insertions(+)
#21 lore raw
In reply to Zhang Chen
Quoted 3 lines · * Zhang Chen ([email protected]) wrote:

From: Zhang Chen <[email protected]>

Since the real user scenario does not need to monitor all traffic.

Can you explain the type of real user case where they only need to compare some connections?

Dave

Quoted 19 lines

This series give user ability to bypass kinds of network stream.

Zhang Chen (3):
qapi/net: Add new QMP command for COLO passthrough
hmp-commands: Add new HMP command for COLO passthrough net/colo-compare: Add handler for passthrough connection

 hmp-commands.hx       | 26 +++++++++++++++++++++++
 include/monitor/hmp.h |  2 ++
 monitor/hmp-cmds.c    | 20 ++++++++++++++++++
 net/colo-compare.c    | 49 +++++++++++++++++++++++++++++++++++++++++++
 net/colo-compare.h    |  2 ++
 net/net.c             | 39 ++++++++++++++++++++++++++++++++++
 qapi/net.json         | 46 ++++++++++++++++++++++++++++++++++++++++
 7 files changed, 184 insertions(+)
Signature · 1 line
2.17.1
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#22 lore raw
Quoted 11 lines

-----Original Message-----
From: Dr. David Alan Gilbert <[email protected]>
Sent: Monday, January 4, 2021 9:07 PM
To: Zhang, Chen <[email protected]>
Cc: Jason Wang <[email protected]>; qemu-dev <qemu- [email protected]>; Eric Blake <[email protected]>; Markus Armbruster <[email protected]>; Zhang Chen <[email protected]>
Subject: Re: [PATCH 0/3] Bypass specific network traffic in COLO

Quoted 7 lines
Quoted 3 lines · * Zhang Chen ([email protected]) wrote:

From: Zhang Chen <[email protected]>

Since the real user scenario does not need to monitor all traffic.

Can you explain the type of real user case where they only need to compare some connections?

Sure.
For example, windows guest user want to enable windows remote desktop to touch guest(UDP/TCP 3389),
This case use UDP and TCP mixed, and the tcp part payload always different caused by real desktop display data(for guest time/ mouse display....). Another case is some real user application will actively transmit information include guest time part, primary guest send data with time 10:01.000, At the same time secondary guest send data with time 10:01.001, it will always trigger COLO checkpoint to drop guest performance.

Thanks
Chen

Quoted 26 lines

Dave

Quoted 11 lines

This series give user ability to bypass kinds of network stream.

Zhang Chen (3):
qapi/net: Add new QMP command for COLO passthrough
hmp-commands: Add new HMP command for COLO passthrough net/colo-compare: Add handler for passthrough connection

 hmp-commands.hx       | 26 +++++++++++++++++++++++
 include/monitor/hmp.h |  2 ++
 monitor/hmp-cmds.c    | 20 ++++++++++++++++++
 net/colo-compare.c    | 49

+++++++++++++++++++++++++++++++++++++++++++

Quoted 3 lines
 net/colo-compare.h    |  2 ++
 net/net.c             | 39 ++++++++++++++++++++++++++++++++++
 qapi/net.json         | 46

++++++++++++++++++++++++++++++++++++++++

Quoted 5 lines
 7 files changed, 184 insertions(+)

--
2.17.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK