2 * COarse-grain LOck-stepping Virtual Machines for Non-stop Service (COLO)
3 * (a.k.a. Fault Tolerance or Continuous Replication)
5 * Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD.
6 * Copyright (c) 2016 FUJITSU LIMITED
7 * Copyright (c) 2016 Intel Corporation
9 * Author: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
11 * This work is licensed under the terms of the GNU GPL, version 2 or
12 * later. See the COPYING file in the top-level directory.
15 #include "qemu/osdep.h"
16 #include "qemu/error-report.h"
18 #include "qemu-common.h"
19 #include "qapi/qmp/qerror.h"
20 #include "qapi/error.h"
23 #include "qom/object_interfaces.h"
25 #include "qom/object.h"
26 #include "qemu/typedefs.h"
27 #include "net/queue.h"
28 #include "sysemu/char.h"
29 #include "qemu/sockets.h"
30 #include "qapi-visit.h"
33 #define TYPE_COLO_COMPARE "colo-compare"
34 #define COLO_COMPARE(obj) \
35 OBJECT_CHECK(CompareState, (obj), TYPE_COLO_COMPARE)
37 #define COMPARE_READ_LEN_MAX NET_BUFSIZE
38 #define MAX_QUEUE_SIZE 1024
40 /* TODO: Should be configurable */
41 #define REGULAR_PACKET_CHECK_MS 3000
46 +---------------+ +---------------+ +---------------+
47 |conn list +--->conn +--------->conn |
48 +---------------+ +---------------+ +---------------+
50 +---------------+ +---v----+ +---v----+ +---v----+ +---v----+
51 |primary | |secondary |primary | |secondary
52 |packet | |packet + |packet | |packet +
53 +--------+ +--------+ +--------+ +--------+
55 +---v----+ +---v----+ +---v----+ +---v----+
56 |primary | |secondary |primary | |secondary
57 |packet | |packet + |packet | |packet +
58 +--------+ +--------+ +--------+ +--------+
60 +---v----+ +---v----+ +---v----+ +---v----+
61 |primary | |secondary |primary | |secondary
62 |packet | |packet + |packet | |packet +
63 +--------+ +--------+ +--------+ +--------+
65 typedef struct CompareState
{
71 CharBackend chr_pri_in
;
72 CharBackend chr_sec_in
;
74 SocketReadState pri_rs
;
75 SocketReadState sec_rs
;
77 /* connection list: the connections belonged to this NIC could be found
79 * element type: Connection
82 /* hashtable to save connection */
83 GHashTable
*connection_track_table
;
84 /* compare thread, a thread for each NIC */
87 GMainContext
*worker_context
;
88 GMainLoop
*compare_loop
;
91 typedef struct CompareClass
{
92 ObjectClass parent_class
;
100 static int compare_chr_send(CharBackend
*out
,
104 static gint
seq_sorter(Packet
*a
, Packet
*b
, gpointer data
)
106 struct tcphdr
*atcp
, *btcp
;
108 atcp
= (struct tcphdr
*)(a
->transport_header
);
109 btcp
= (struct tcphdr
*)(b
->transport_header
);
110 return ntohl(atcp
->th_seq
) - ntohl(btcp
->th_seq
);
114 * Return 0 on success, if return -1 means the pkt
115 * is unsupported(arp and ipv6) and will be sent later
117 static int packet_enqueue(CompareState
*s
, int mode
)
123 if (mode
== PRIMARY_IN
) {
124 pkt
= packet_new(s
->pri_rs
.buf
, s
->pri_rs
.packet_len
);
126 pkt
= packet_new(s
->sec_rs
.buf
, s
->sec_rs
.packet_len
);
129 if (parse_packet_early(pkt
)) {
130 packet_destroy(pkt
, NULL
);
134 fill_connection_key(pkt
, &key
);
136 conn
= connection_get(s
->connection_track_table
,
140 if (!conn
->processing
) {
141 g_queue_push_tail(&s
->conn_list
, conn
);
142 conn
->processing
= true;
145 if (mode
== PRIMARY_IN
) {
146 if (g_queue_get_length(&conn
->primary_list
) <=
148 g_queue_push_tail(&conn
->primary_list
, pkt
);
149 if (conn
->ip_proto
== IPPROTO_TCP
) {
150 g_queue_sort(&conn
->primary_list
,
151 (GCompareDataFunc
)seq_sorter
,
155 error_report("colo compare primary queue size too big,"
159 if (g_queue_get_length(&conn
->secondary_list
) <=
161 g_queue_push_tail(&conn
->secondary_list
, pkt
);
162 if (conn
->ip_proto
== IPPROTO_TCP
) {
163 g_queue_sort(&conn
->secondary_list
,
164 (GCompareDataFunc
)seq_sorter
,
168 error_report("colo compare secondary queue size too big,"
177 * The IP packets sent by primary and secondary
178 * will be compared in here
179 * TODO support ip fragment, Out-Of-Order
180 * return: 0 means packet same
181 * > 0 || < 0 means packet different
183 static int colo_packet_compare_common(Packet
*ppkt
, Packet
*spkt
, int offset
)
185 if (trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE
)) {
186 char pri_ip_src
[20], pri_ip_dst
[20], sec_ip_src
[20], sec_ip_dst
[20];
188 strcpy(pri_ip_src
, inet_ntoa(ppkt
->ip
->ip_src
));
189 strcpy(pri_ip_dst
, inet_ntoa(ppkt
->ip
->ip_dst
));
190 strcpy(sec_ip_src
, inet_ntoa(spkt
->ip
->ip_src
));
191 strcpy(sec_ip_dst
, inet_ntoa(spkt
->ip
->ip_dst
));
193 trace_colo_compare_ip_info(ppkt
->size
, pri_ip_src
,
194 pri_ip_dst
, spkt
->size
,
195 sec_ip_src
, sec_ip_dst
);
198 if (ppkt
->size
== spkt
->size
) {
199 return memcmp(ppkt
->data
+ offset
, spkt
->data
+ offset
,
200 spkt
->size
- offset
);
202 trace_colo_compare_main("Net packet size are not the same");
208 * Called from the compare thread on the primary
209 * for compare tcp packet
210 * compare_tcp copied from Dr. David Alan Gilbert's branch
212 static int colo_packet_compare_tcp(Packet
*spkt
, Packet
*ppkt
)
214 struct tcphdr
*ptcp
, *stcp
;
217 trace_colo_compare_main("compare tcp");
219 ptcp
= (struct tcphdr
*)ppkt
->transport_header
;
220 stcp
= (struct tcphdr
*)spkt
->transport_header
;
223 * The 'identification' field in the IP header is *very* random
224 * it almost never matches. Fudge this by ignoring differences in
225 * unfragmented packets; they'll normally sort themselves out if different
226 * anyway, and it should recover at the TCP level.
227 * An alternative would be to get both the primary and secondary to rewrite
228 * somehow; but that would need some sync traffic to sync the state
230 if (ntohs(ppkt
->ip
->ip_off
) & IP_DF
) {
231 spkt
->ip
->ip_id
= ppkt
->ip
->ip_id
;
232 /* and the sum will be different if the IDs were different */
233 spkt
->ip
->ip_sum
= ppkt
->ip
->ip_sum
;
237 * Check tcp header length for tcp option field.
238 * th_off > 5 means this tcp packet have options field.
239 * The tcp options maybe always different.
242 * TCP Timestamps option (TSopt):
247 * +-------+-------+---------------------+---------------------+
248 * |Kind=8 | 10 | TS Value (TSval) |TS Echo Reply (TSecr)|
249 * +-------+-------+---------------------+---------------------+
252 * In this case the primary guest's timestamp always different with
253 * the secondary guest's timestamp. COLO just focus on payload,
254 * so we just need skip this field.
256 if (ptcp
->th_off
> 5) {
257 ptrdiff_t tcp_offset
;
258 tcp_offset
= ppkt
->transport_header
- (uint8_t *)ppkt
->data
259 + (ptcp
->th_off
* 4);
260 res
= colo_packet_compare_common(ppkt
, spkt
, tcp_offset
);
261 } else if (ptcp
->th_sum
== stcp
->th_sum
) {
262 res
= colo_packet_compare_common(ppkt
, spkt
, ETH_HLEN
);
267 if (res
!= 0 && trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE
)) {
268 trace_colo_compare_pkt_info_src(inet_ntoa(ppkt
->ip
->ip_src
),
274 trace_colo_compare_pkt_info_dst(inet_ntoa(ppkt
->ip
->ip_dst
),
280 qemu_hexdump((char *)ppkt
->data
, stderr
,
281 "colo-compare ppkt", ppkt
->size
);
282 qemu_hexdump((char *)spkt
->data
, stderr
,
283 "colo-compare spkt", spkt
->size
);
290 * Called from the compare thread on the primary
291 * for compare udp packet
293 static int colo_packet_compare_udp(Packet
*spkt
, Packet
*ppkt
)
296 int network_header_length
= ppkt
->ip
->ip_hl
* 4;
298 trace_colo_compare_main("compare udp");
301 * Because of ppkt and spkt are both in the same connection,
302 * The ppkt's src ip, dst ip, src port, dst port, ip_proto all are
303 * same with spkt. In addition, IP header's Identification is a random
304 * field, we can handle it in IP fragmentation function later.
305 * COLO just concern the response net packet payload from primary guest
306 * and secondary guest are same or not, So we ignored all IP header include
307 * other field like TOS,TTL,IP Checksum. we only need to compare
308 * the ip payload here.
310 ret
= colo_packet_compare_common(ppkt
, spkt
,
311 network_header_length
+ ETH_HLEN
);
314 trace_colo_compare_udp_miscompare("primary pkt size", ppkt
->size
);
315 trace_colo_compare_udp_miscompare("Secondary pkt size", spkt
->size
);
316 if (trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE
)) {
317 qemu_hexdump((char *)ppkt
->data
, stderr
, "colo-compare pri pkt",
319 qemu_hexdump((char *)spkt
->data
, stderr
, "colo-compare sec pkt",
328 * Called from the compare thread on the primary
329 * for compare icmp packet
331 static int colo_packet_compare_icmp(Packet
*spkt
, Packet
*ppkt
)
333 int network_header_length
= ppkt
->ip
->ip_hl
* 4;
335 trace_colo_compare_main("compare icmp");
338 * Because of ppkt and spkt are both in the same connection,
339 * The ppkt's src ip, dst ip, src port, dst port, ip_proto all are
340 * same with spkt. In addition, IP header's Identification is a random
341 * field, we can handle it in IP fragmentation function later.
342 * COLO just concern the response net packet payload from primary guest
343 * and secondary guest are same or not, So we ignored all IP header include
344 * other field like TOS,TTL,IP Checksum. we only need to compare
345 * the ip payload here.
347 if (colo_packet_compare_common(ppkt
, spkt
,
348 network_header_length
+ ETH_HLEN
)) {
349 trace_colo_compare_icmp_miscompare("primary pkt size",
351 trace_colo_compare_icmp_miscompare("Secondary pkt size",
353 if (trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE
)) {
354 qemu_hexdump((char *)ppkt
->data
, stderr
, "colo-compare pri pkt",
356 qemu_hexdump((char *)spkt
->data
, stderr
, "colo-compare sec pkt",
366 * Called from the compare thread on the primary
367 * for compare other packet
369 static int colo_packet_compare_other(Packet
*spkt
, Packet
*ppkt
)
371 trace_colo_compare_main("compare other");
372 if (trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE
)) {
373 char pri_ip_src
[20], pri_ip_dst
[20], sec_ip_src
[20], sec_ip_dst
[20];
375 strcpy(pri_ip_src
, inet_ntoa(ppkt
->ip
->ip_src
));
376 strcpy(pri_ip_dst
, inet_ntoa(ppkt
->ip
->ip_dst
));
377 strcpy(sec_ip_src
, inet_ntoa(spkt
->ip
->ip_src
));
378 strcpy(sec_ip_dst
, inet_ntoa(spkt
->ip
->ip_dst
));
380 trace_colo_compare_ip_info(ppkt
->size
, pri_ip_src
,
381 pri_ip_dst
, spkt
->size
,
382 sec_ip_src
, sec_ip_dst
);
385 return colo_packet_compare_common(ppkt
, spkt
, 0);
388 static int colo_old_packet_check_one(Packet
*pkt
, int64_t *check_time
)
390 int64_t now
= qemu_clock_get_ms(QEMU_CLOCK_HOST
);
392 if ((now
- pkt
->creation_ms
) > (*check_time
)) {
393 trace_colo_old_packet_check_found(pkt
->creation_ms
);
400 static int colo_old_packet_check_one_conn(Connection
*conn
,
403 GList
*result
= NULL
;
404 int64_t check_time
= REGULAR_PACKET_CHECK_MS
;
406 result
= g_queue_find_custom(&conn
->primary_list
,
408 (GCompareFunc
)colo_old_packet_check_one
);
411 /* do checkpoint will flush old packet */
412 /* TODO: colo_notify_checkpoint();*/
420 * Look for old packets that the secondary hasn't matched,
421 * if we have some then we have to checkpoint to wake
424 static void colo_old_packet_check(void *opaque
)
426 CompareState
*s
= opaque
;
429 * If we find one old packet, stop finding job and notify
430 * COLO frame do checkpoint.
432 g_queue_find_custom(&s
->conn_list
, NULL
,
433 (GCompareFunc
)colo_old_packet_check_one_conn
);
437 * Called from the compare thread on the primary
438 * for compare connection
440 static void colo_compare_connection(void *opaque
, void *user_data
)
442 CompareState
*s
= user_data
;
443 Connection
*conn
= opaque
;
445 GList
*result
= NULL
;
448 while (!g_queue_is_empty(&conn
->primary_list
) &&
449 !g_queue_is_empty(&conn
->secondary_list
)) {
450 pkt
= g_queue_pop_tail(&conn
->primary_list
);
451 switch (conn
->ip_proto
) {
453 result
= g_queue_find_custom(&conn
->secondary_list
,
454 pkt
, (GCompareFunc
)colo_packet_compare_tcp
);
457 result
= g_queue_find_custom(&conn
->secondary_list
,
458 pkt
, (GCompareFunc
)colo_packet_compare_udp
);
461 result
= g_queue_find_custom(&conn
->secondary_list
,
462 pkt
, (GCompareFunc
)colo_packet_compare_icmp
);
465 result
= g_queue_find_custom(&conn
->secondary_list
,
466 pkt
, (GCompareFunc
)colo_packet_compare_other
);
471 ret
= compare_chr_send(&s
->chr_out
, pkt
->data
, pkt
->size
);
473 error_report("colo_send_primary_packet failed");
475 trace_colo_compare_main("packet same and release packet");
476 g_queue_remove(&conn
->secondary_list
, result
->data
);
477 packet_destroy(pkt
, NULL
);
480 * If one packet arrive late, the secondary_list or
481 * primary_list will be empty, so we can't compare it
482 * until next comparison.
484 trace_colo_compare_main("packet different");
485 g_queue_push_tail(&conn
->primary_list
, pkt
);
486 /* TODO: colo_notify_checkpoint();*/
492 static int compare_chr_send(CharBackend
*out
,
497 uint32_t len
= htonl(size
);
503 ret
= qemu_chr_fe_write_all(out
, (uint8_t *)&len
, sizeof(len
));
504 if (ret
!= sizeof(len
)) {
508 ret
= qemu_chr_fe_write_all(out
, (uint8_t *)buf
, size
);
516 return ret
< 0 ? ret
: -EIO
;
519 static int compare_chr_can_read(void *opaque
)
521 return COMPARE_READ_LEN_MAX
;
525 * Called from the main thread on the primary for packets
526 * arriving over the socket from the primary.
528 static void compare_pri_chr_in(void *opaque
, const uint8_t *buf
, int size
)
530 CompareState
*s
= COLO_COMPARE(opaque
);
533 ret
= net_fill_rstate(&s
->pri_rs
, buf
, size
);
535 qemu_chr_fe_set_handlers(&s
->chr_pri_in
, NULL
, NULL
, NULL
,
537 error_report("colo-compare primary_in error");
542 * Called from the main thread on the primary for packets
543 * arriving over the socket from the secondary.
545 static void compare_sec_chr_in(void *opaque
, const uint8_t *buf
, int size
)
547 CompareState
*s
= COLO_COMPARE(opaque
);
550 ret
= net_fill_rstate(&s
->sec_rs
, buf
, size
);
552 qemu_chr_fe_set_handlers(&s
->chr_sec_in
, NULL
, NULL
, NULL
,
554 error_report("colo-compare secondary_in error");
559 * Check old packet regularly so it can watch for any packets
560 * that the secondary hasn't produced equivalents of.
562 static gboolean
check_old_packet_regular(void *opaque
)
564 CompareState
*s
= opaque
;
566 /* if have old packet we will notify checkpoint */
567 colo_old_packet_check(s
);
572 static void *colo_compare_thread(void *opaque
)
574 CompareState
*s
= opaque
;
575 GSource
*timeout_source
;
577 s
->worker_context
= g_main_context_new();
579 qemu_chr_fe_set_handlers(&s
->chr_pri_in
, compare_chr_can_read
,
580 compare_pri_chr_in
, NULL
, s
, s
->worker_context
, true);
581 qemu_chr_fe_set_handlers(&s
->chr_sec_in
, compare_chr_can_read
,
582 compare_sec_chr_in
, NULL
, s
, s
->worker_context
, true);
584 s
->compare_loop
= g_main_loop_new(s
->worker_context
, FALSE
);
586 /* To kick any packets that the secondary doesn't match */
587 timeout_source
= g_timeout_source_new(REGULAR_PACKET_CHECK_MS
);
588 g_source_set_callback(timeout_source
,
589 (GSourceFunc
)check_old_packet_regular
, s
, NULL
);
590 g_source_attach(timeout_source
, s
->worker_context
);
592 g_main_loop_run(s
->compare_loop
);
594 g_source_unref(timeout_source
);
595 g_main_loop_unref(s
->compare_loop
);
596 g_main_context_unref(s
->worker_context
);
600 static char *compare_get_pri_indev(Object
*obj
, Error
**errp
)
602 CompareState
*s
= COLO_COMPARE(obj
);
604 return g_strdup(s
->pri_indev
);
607 static void compare_set_pri_indev(Object
*obj
, const char *value
, Error
**errp
)
609 CompareState
*s
= COLO_COMPARE(obj
);
611 g_free(s
->pri_indev
);
612 s
->pri_indev
= g_strdup(value
);
615 static char *compare_get_sec_indev(Object
*obj
, Error
**errp
)
617 CompareState
*s
= COLO_COMPARE(obj
);
619 return g_strdup(s
->sec_indev
);
622 static void compare_set_sec_indev(Object
*obj
, const char *value
, Error
**errp
)
624 CompareState
*s
= COLO_COMPARE(obj
);
626 g_free(s
->sec_indev
);
627 s
->sec_indev
= g_strdup(value
);
630 static char *compare_get_outdev(Object
*obj
, Error
**errp
)
632 CompareState
*s
= COLO_COMPARE(obj
);
634 return g_strdup(s
->outdev
);
637 static void compare_set_outdev(Object
*obj
, const char *value
, Error
**errp
)
639 CompareState
*s
= COLO_COMPARE(obj
);
642 s
->outdev
= g_strdup(value
);
645 static void compare_pri_rs_finalize(SocketReadState
*pri_rs
)
647 CompareState
*s
= container_of(pri_rs
, CompareState
, pri_rs
);
649 if (packet_enqueue(s
, PRIMARY_IN
)) {
650 trace_colo_compare_main("primary: unsupported packet in");
651 compare_chr_send(&s
->chr_out
, pri_rs
->buf
, pri_rs
->packet_len
);
653 /* compare connection */
654 g_queue_foreach(&s
->conn_list
, colo_compare_connection
, s
);
658 static void compare_sec_rs_finalize(SocketReadState
*sec_rs
)
660 CompareState
*s
= container_of(sec_rs
, CompareState
, sec_rs
);
662 if (packet_enqueue(s
, SECONDARY_IN
)) {
663 trace_colo_compare_main("secondary: unsupported packet in");
665 /* compare connection */
666 g_queue_foreach(&s
->conn_list
, colo_compare_connection
, s
);
672 * Return 0 is success.
673 * Return 1 is failed.
675 static int find_and_check_chardev(Chardev
**chr
,
679 *chr
= qemu_chr_find(chr_name
);
681 error_setg(errp
, "Device '%s' not found",
686 if (!qemu_chr_has_feature(*chr
, QEMU_CHAR_FEATURE_RECONNECTABLE
)) {
687 error_setg(errp
, "chardev \"%s\" is not reconnectable",
696 * Called from the main thread on the primary
697 * to setup colo-compare.
699 static void colo_compare_complete(UserCreatable
*uc
, Error
**errp
)
701 CompareState
*s
= COLO_COMPARE(uc
);
703 char thread_name
[64];
704 static int compare_id
;
706 if (!s
->pri_indev
|| !s
->sec_indev
|| !s
->outdev
) {
707 error_setg(errp
, "colo compare needs 'primary_in' ,"
708 "'secondary_in','outdev' property set");
710 } else if (!strcmp(s
->pri_indev
, s
->outdev
) ||
711 !strcmp(s
->sec_indev
, s
->outdev
) ||
712 !strcmp(s
->pri_indev
, s
->sec_indev
)) {
713 error_setg(errp
, "'indev' and 'outdev' could not be same "
714 "for compare module");
718 if (find_and_check_chardev(&chr
, s
->pri_indev
, errp
) ||
719 !qemu_chr_fe_init(&s
->chr_pri_in
, chr
, errp
)) {
723 if (find_and_check_chardev(&chr
, s
->sec_indev
, errp
) ||
724 !qemu_chr_fe_init(&s
->chr_sec_in
, chr
, errp
)) {
728 if (find_and_check_chardev(&chr
, s
->outdev
, errp
) ||
729 !qemu_chr_fe_init(&s
->chr_out
, chr
, errp
)) {
733 net_socket_rs_init(&s
->pri_rs
, compare_pri_rs_finalize
);
734 net_socket_rs_init(&s
->sec_rs
, compare_sec_rs_finalize
);
736 g_queue_init(&s
->conn_list
);
738 s
->connection_track_table
= g_hash_table_new_full(connection_key_hash
,
739 connection_key_equal
,
743 sprintf(thread_name
, "colo-compare %d", compare_id
);
744 qemu_thread_create(&s
->thread
, thread_name
,
745 colo_compare_thread
, s
,
746 QEMU_THREAD_JOINABLE
);
752 static void colo_flush_packets(void *opaque
, void *user_data
)
754 CompareState
*s
= user_data
;
755 Connection
*conn
= opaque
;
758 while (!g_queue_is_empty(&conn
->primary_list
)) {
759 pkt
= g_queue_pop_head(&conn
->primary_list
);
760 compare_chr_send(&s
->chr_out
, pkt
->data
, pkt
->size
);
761 packet_destroy(pkt
, NULL
);
763 while (!g_queue_is_empty(&conn
->secondary_list
)) {
764 pkt
= g_queue_pop_head(&conn
->secondary_list
);
765 packet_destroy(pkt
, NULL
);
769 static void colo_compare_class_init(ObjectClass
*oc
, void *data
)
771 UserCreatableClass
*ucc
= USER_CREATABLE_CLASS(oc
);
773 ucc
->complete
= colo_compare_complete
;
776 static void colo_compare_init(Object
*obj
)
778 object_property_add_str(obj
, "primary_in",
779 compare_get_pri_indev
, compare_set_pri_indev
,
781 object_property_add_str(obj
, "secondary_in",
782 compare_get_sec_indev
, compare_set_sec_indev
,
784 object_property_add_str(obj
, "outdev",
785 compare_get_outdev
, compare_set_outdev
,
789 static void colo_compare_finalize(Object
*obj
)
791 CompareState
*s
= COLO_COMPARE(obj
);
793 qemu_chr_fe_set_handlers(&s
->chr_pri_in
, NULL
, NULL
, NULL
, NULL
,
794 s
->worker_context
, true);
795 qemu_chr_fe_set_handlers(&s
->chr_sec_in
, NULL
, NULL
, NULL
, NULL
,
796 s
->worker_context
, true);
797 qemu_chr_fe_deinit(&s
->chr_out
);
799 g_main_loop_quit(s
->compare_loop
);
800 qemu_thread_join(&s
->thread
);
802 /* Release all unhandled packets after compare thead exited */
803 g_queue_foreach(&s
->conn_list
, colo_flush_packets
, s
);
805 g_queue_clear(&s
->conn_list
);
807 g_hash_table_destroy(s
->connection_track_table
);
808 g_free(s
->pri_indev
);
809 g_free(s
->sec_indev
);
813 static const TypeInfo colo_compare_info
= {
814 .name
= TYPE_COLO_COMPARE
,
815 .parent
= TYPE_OBJECT
,
816 .instance_size
= sizeof(CompareState
),
817 .instance_init
= colo_compare_init
,
818 .instance_finalize
= colo_compare_finalize
,
819 .class_size
= sizeof(CompareClass
),
820 .class_init
= colo_compare_class_init
,
821 .interfaces
= (InterfaceInfo
[]) {
822 { TYPE_USER_CREATABLE
},
827 static void register_types(void)
829 type_register_static(&colo_compare_info
);
832 type_init(register_types
);