r11887: reorder some tests
[kai/samba.git] / source4 / torture / nbt / winsreplication.c
1 /* 
2    Unix SMB/CIFS implementation.
3
4    WINS replication testing
5
6    Copyright (C) Andrew Tridgell        2005
7    Copyright (C) Stefan Metzmacher      2005
8    
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24 #include "includes.h"
25 #include "libcli/nbt/libnbt.h"
26 #include "libcli/wrepl/winsrepl.h"
27 #include "lib/events/events.h"
28 #include "lib/socket/socket.h"
29 #include "system/time.h"
30
31 #define CHECK_STATUS(status, correct) do { \
32         if (!NT_STATUS_EQUAL(status, correct)) { \
33                 printf("(%s) Incorrect status %s - should be %s\n", \
34                        __location__, nt_errstr(status), nt_errstr(correct)); \
35                 ret = False; \
36                 goto done; \
37         }} while (0)
38
39 #define CHECK_VALUE(v, correct) do { \
40         if ((v) != (correct)) { \
41                 printf("(%s) Incorrect value %s=%d - should be %d\n", \
42                        __location__, #v, v, correct); \
43                 ret = False; \
44                 goto done; \
45         }} while (0)
46
47 #define CHECK_VALUE_UINT64(v, correct) do { \
48         if ((v) != (correct)) { \
49                 printf("(%s) Incorrect value %s=%llu - should be %llu\n", \
50                        __location__, #v, v, correct); \
51                 ret = False; \
52                 goto done; \
53         }} while (0)
54
55 #define CHECK_VALUE_STRING(v, correct) do { \
56         if ( ((!v) && (correct)) || \
57              ((v) && (!correct)) || \
58              ((v) && (correct) && strcmp(v,correct) != 0)) { \
59                 printf("(%s) Incorrect value %s='%s' - should be '%s'\n", \
60                        __location__, #v, v, correct); \
61                 ret = False; \
62                 goto done; \
63         }} while (0)
64
65 #define _NBT_NAME(n,t,s) {\
66         .name   = n,\
67         .type   = t,\
68         .scope  = s\
69 }
70
71 static const char *wrepl_name_type_string(enum wrepl_name_type type)
72 {
73         switch (type) {
74         case WREPL_TYPE_UNIQUE: return "UNIQUE";
75         case WREPL_TYPE_GROUP: return "GROUP";
76         case WREPL_TYPE_SGROUP: return "SGROUP";
77         case WREPL_TYPE_MHOMED: return "MHOMED";
78         }
79         return "UNKNOWN_TYPE";
80 }
81
82 static const char *wrepl_name_state_string(enum wrepl_name_state state)
83 {
84         switch (state) {
85         case WREPL_STATE_ACTIVE: return "ACTIVE";
86         case WREPL_STATE_RELEASED: return "RELEASED";
87         case WREPL_STATE_TOMBSTONE: return "TOMBSTONE";
88         case WREPL_STATE_RESERVED: return "RESERVED";
89         }
90         return "UNKNOWN_STATE";
91 }
92
93 /*
94   test how assoc_ctx's are only usable on the connection
95   they are created on.
96 */
97 static BOOL test_assoc_ctx1(TALLOC_CTX *mem_ctx, const char *address)
98 {
99         BOOL ret = True;
100         struct wrepl_request *req;
101         struct wrepl_socket *wrepl_socket1;
102         struct wrepl_associate associate1;
103         struct wrepl_socket *wrepl_socket2;
104         struct wrepl_associate associate2;
105         struct wrepl_pull_table pull_table;
106         struct wrepl_packet *rep_packet;
107         struct wrepl_associate_stop assoc_stop;
108         NTSTATUS status;
109
110         if (!lp_parm_bool(-1, "torture", "dangerous", False)) {
111                 printf("winsrepl: cross connection assoc_ctx usage disabled - enable dangerous tests to use\n");
112                 return True;
113         }
114
115         printf("Test if assoc_ctx is only valid on the conection it was created on\n");
116
117         wrepl_socket1 = wrepl_socket_init(mem_ctx, NULL);
118         wrepl_socket2 = wrepl_socket_init(mem_ctx, NULL);
119
120         printf("Setup 2 wrepl connections\n");
121         status = wrepl_connect(wrepl_socket1, NULL, address);
122         CHECK_STATUS(status, NT_STATUS_OK);
123
124         status = wrepl_connect(wrepl_socket2, NULL, address);
125         CHECK_STATUS(status, NT_STATUS_OK);
126
127         printf("Send a start association request (conn1)\n");
128         status = wrepl_associate(wrepl_socket1, &associate1);
129         CHECK_STATUS(status, NT_STATUS_OK);
130
131         printf("association context (conn1): 0x%x\n", associate1.out.assoc_ctx);
132
133         printf("Send a start association request (conn2)\n");
134         status = wrepl_associate(wrepl_socket2, &associate2);
135         CHECK_STATUS(status, NT_STATUS_OK);
136
137         printf("association context (conn2): 0x%x\n", associate2.out.assoc_ctx);
138
139         printf("Send a replication table query, with assoc 1 (conn2), the anwser should be on conn1\n");
140         pull_table.in.assoc_ctx = associate1.out.assoc_ctx;
141         req = wrepl_pull_table_send(wrepl_socket2, &pull_table);
142         req->send_only = True;
143         status = wrepl_request_recv(req, mem_ctx, &rep_packet);
144         CHECK_STATUS(status, NT_STATUS_OK);
145
146         printf("Send a association request (conn2), to make sure the last request was ignored\n");
147         status = wrepl_associate(wrepl_socket2, &associate2);
148         CHECK_STATUS(status, NT_STATUS_OK);
149
150         printf("Send a replication table query, with invalid assoc (conn1), receive answer from conn2\n");
151         pull_table.in.assoc_ctx = 0;
152         req = wrepl_pull_table_send(wrepl_socket1, &pull_table);
153         status = wrepl_request_recv(req, mem_ctx, &rep_packet);
154         CHECK_STATUS(status, NT_STATUS_OK);
155
156         printf("Send a association request (conn1), to make sure the last request was handled correct\n");
157         status = wrepl_associate(wrepl_socket1, &associate2);
158         CHECK_STATUS(status, NT_STATUS_OK);
159
160         assoc_stop.in.assoc_ctx = associate1.out.assoc_ctx;
161         assoc_stop.in.reason    = 4;
162         printf("Send a association stop request (conn1), reson: %u\n", assoc_stop.in.reason);
163         status = wrepl_associate_stop(wrepl_socket1, &assoc_stop);
164         CHECK_STATUS(status, NT_STATUS_END_OF_FILE);
165
166         assoc_stop.in.assoc_ctx = associate2.out.assoc_ctx;
167         assoc_stop.in.reason    = 0;
168         printf("Send a association stop request (conn2), reson: %u\n", assoc_stop.in.reason);
169         status = wrepl_associate_stop(wrepl_socket2, &assoc_stop);
170         CHECK_STATUS(status, NT_STATUS_OK);
171
172 done:
173         printf("Close 2 wrepl connections\n");
174         talloc_free(wrepl_socket1);
175         talloc_free(wrepl_socket2);
176         return ret;
177 }
178
179 /*
180   test if we always get back the same assoc_ctx
181 */
182 static BOOL test_assoc_ctx2(TALLOC_CTX *mem_ctx, const char *address)
183 {
184         BOOL ret = True;
185         struct wrepl_socket *wrepl_socket;
186         struct wrepl_associate associate;
187         uint32_t assoc_ctx1;
188         NTSTATUS status;
189
190         printf("Test if we always get back the same assoc_ctx\n");
191
192         wrepl_socket = wrepl_socket_init(mem_ctx, NULL);
193         
194         printf("Setup wrepl connections\n");
195         status = wrepl_connect(wrepl_socket, NULL, address);
196         CHECK_STATUS(status, NT_STATUS_OK);
197
198
199         printf("Send 1st start association request\n");
200         status = wrepl_associate(wrepl_socket, &associate);
201         CHECK_STATUS(status, NT_STATUS_OK);
202         assoc_ctx1 = associate.out.assoc_ctx;
203         printf("1st association context: 0x%x\n", associate.out.assoc_ctx);
204
205         printf("Send 2nd start association request\n");
206         status = wrepl_associate(wrepl_socket, &associate);
207         CHECK_VALUE(associate.out.assoc_ctx, assoc_ctx1);
208         CHECK_STATUS(status, NT_STATUS_OK);
209         printf("2nd association context: 0x%x\n", associate.out.assoc_ctx);
210
211         printf("Send 3rd start association request\n");
212         status = wrepl_associate(wrepl_socket, &associate);
213         CHECK_VALUE(associate.out.assoc_ctx, assoc_ctx1);
214         CHECK_STATUS(status, NT_STATUS_OK);
215         printf("3rd association context: 0x%x\n", associate.out.assoc_ctx);
216
217 done:
218         printf("Close wrepl connections\n");
219         talloc_free(wrepl_socket);
220         return ret;
221 }
222
223
224 /*
225   display a replication entry
226 */
227 static void display_entry(TALLOC_CTX *mem_ctx, struct wrepl_name *name)
228 {
229         int i;
230
231         printf("%s\n", nbt_name_string(mem_ctx, &name->name));
232         printf("\tTYPE:%u STATE:%u NODE:%u STATIC:%u VERSION_ID: %llu\n",
233                 name->type, name->state, name->node, name->is_static, name->version_id);
234         printf("\tRAW_FLAGS: 0x%08X OWNER: %-15s\n",
235                 name->raw_flags, name->owner);
236         for (i=0;i<name->num_addresses;i++) {
237                 printf("\tADDR: %-15s OWNER: %-15s\n", 
238                         name->addresses[i].address, name->addresses[i].owner);
239         }
240 }
241
242 /*
243   test a full replication dump from a WINS server
244 */
245 static BOOL test_wins_replication(TALLOC_CTX *mem_ctx, const char *address)
246 {
247         BOOL ret = True;
248         struct wrepl_socket *wrepl_socket;
249         NTSTATUS status;
250         int i, j;
251         struct wrepl_associate associate;
252         struct wrepl_pull_table pull_table;
253         struct wrepl_pull_names pull_names;
254
255         printf("Test one pull replication cycle\n");
256
257         wrepl_socket = wrepl_socket_init(mem_ctx, NULL);
258         
259         printf("Setup wrepl connections\n");
260         status = wrepl_connect(wrepl_socket, NULL, address);
261         CHECK_STATUS(status, NT_STATUS_OK);
262
263         printf("Send a start association request\n");
264
265         status = wrepl_associate(wrepl_socket, &associate);
266         CHECK_STATUS(status, NT_STATUS_OK);
267
268         printf("association context: 0x%x\n", associate.out.assoc_ctx);
269
270         printf("Send a replication table query\n");
271         pull_table.in.assoc_ctx = associate.out.assoc_ctx;
272
273         status = wrepl_pull_table(wrepl_socket, mem_ctx, &pull_table);
274         if (NT_STATUS_EQUAL(NT_STATUS_NETWORK_ACCESS_DENIED,status)) {
275                 struct wrepl_packet packet;
276                 struct wrepl_request *req;
277
278                 ZERO_STRUCT(packet);
279                 packet.opcode                      = WREPL_OPCODE_BITS;
280                 packet.assoc_ctx                   = associate.out.assoc_ctx;
281                 packet.mess_type                   = WREPL_STOP_ASSOCIATION;
282                 packet.message.stop.reason         = 0;
283
284                 req = wrepl_request_send(wrepl_socket, &packet);
285                 talloc_free(req);
286
287                 printf("failed - We are not a valid pull partner for the server\n");
288                 ret = False;
289                 goto done;
290         }
291         CHECK_STATUS(status, NT_STATUS_OK);
292
293         printf("Found %d replication partners\n", pull_table.out.num_partners);
294
295         for (i=0;i<pull_table.out.num_partners;i++) {
296                 struct wrepl_wins_owner *partner = &pull_table.out.partners[i];
297                 printf("%s   max_version=%6llu   min_version=%6llu type=%d\n",
298                        partner->address, 
299                        partner->max_version, 
300                        partner->min_version, 
301                        partner->type);
302
303                 pull_names.in.assoc_ctx = associate.out.assoc_ctx;
304                 pull_names.in.partner = *partner;
305                 
306                 status = wrepl_pull_names(wrepl_socket, mem_ctx, &pull_names);
307                 CHECK_STATUS(status, NT_STATUS_OK);
308
309                 printf("Received %d names\n", pull_names.out.num_names);
310
311                 for (j=0;j<pull_names.out.num_names;j++) {
312                         display_entry(mem_ctx, &pull_names.out.names[j]);
313                 }
314         }
315
316 done:
317         printf("Close wrepl connections\n");
318         talloc_free(wrepl_socket);
319         return ret;
320 }
321
322 struct test_wrepl_conflict_conn {
323         const char *address;
324         struct wrepl_socket *pull;
325         uint32_t pull_assoc;
326
327 #define TEST_OWNER_A_ADDRESS "127.65.65.1"
328 #define TEST_ADDRESS_A_PREFIX "127.0.65"
329 #define TEST_OWNER_B_ADDRESS "127.66.66.1"
330 #define TEST_ADDRESS_B_PREFIX "127.0.66"
331 #define TEST_OWNER_X_ADDRESS "127.88.88.1"
332 #define TEST_ADDRESS_X_PREFIX "127.0.88"
333
334         struct wrepl_wins_owner a, b, c, x;
335
336         const char *myaddr;
337         const char *myaddr2;
338         struct nbt_name_socket *nbtsock;
339         struct nbt_name_socket *nbtsock2;
340
341         struct nbt_name_socket *nbtsock_srv;
342         struct nbt_name_socket *nbtsock_srv2;
343
344         uint32_t addresses_best_num;
345         struct wrepl_ip *addresses_best;
346
347         uint32_t addresses_best2_num;
348         struct wrepl_ip *addresses_best2;
349
350         uint32_t addresses_all_num;
351         struct wrepl_ip *addresses_all;
352
353         uint32_t addresses_mhomed_num;
354         struct wrepl_ip *addresses_mhomed;
355 };
356
357 static const struct wrepl_ip addresses_A_1[] = {
358         {
359         .owner  = TEST_OWNER_A_ADDRESS,
360         .ip     = TEST_ADDRESS_A_PREFIX".1"
361         }
362 };
363 static const struct wrepl_ip addresses_A_2[] = {
364         {
365         .owner  = TEST_OWNER_A_ADDRESS,
366         .ip     = TEST_ADDRESS_A_PREFIX".2"
367         }
368 };
369 static const struct wrepl_ip addresses_A_3_4[] = {
370         {
371         .owner  = TEST_OWNER_A_ADDRESS,
372         .ip     = TEST_ADDRESS_A_PREFIX".3"
373         },
374         {
375         .owner  = TEST_OWNER_A_ADDRESS,
376         .ip     = TEST_ADDRESS_A_PREFIX".4"
377         }
378 };
379 static const struct wrepl_ip addresses_A_3_4_X_3_4[] = {
380         {
381         .owner  = TEST_OWNER_A_ADDRESS,
382         .ip     = TEST_ADDRESS_A_PREFIX".3"
383         },
384         {
385         .owner  = TEST_OWNER_A_ADDRESS,
386         .ip     = TEST_ADDRESS_A_PREFIX".4"
387         },
388         {
389         .owner  = TEST_OWNER_X_ADDRESS,
390         .ip     = TEST_ADDRESS_X_PREFIX".3"
391         },
392         {
393         .owner  = TEST_OWNER_X_ADDRESS,
394         .ip     = TEST_ADDRESS_X_PREFIX".4"
395         }
396 };
397 static const struct wrepl_ip addresses_A_3_4_OWNER_B[] = {
398         {
399         .owner  = TEST_OWNER_B_ADDRESS,
400         .ip     = TEST_ADDRESS_A_PREFIX".3"
401         },
402         {
403         .owner  = TEST_OWNER_B_ADDRESS,
404         .ip     = TEST_ADDRESS_A_PREFIX".4"
405         }
406 };
407 static const struct wrepl_ip addresses_A_3_4_X_3_4_OWNER_B[] = {
408         {
409         .owner  = TEST_OWNER_B_ADDRESS,
410         .ip     = TEST_ADDRESS_A_PREFIX".3"
411         },
412         {
413         .owner  = TEST_OWNER_B_ADDRESS,
414         .ip     = TEST_ADDRESS_A_PREFIX".4"
415         },
416         {
417         .owner  = TEST_OWNER_B_ADDRESS,
418         .ip     = TEST_ADDRESS_X_PREFIX".3"
419         },
420         {
421         .owner  = TEST_OWNER_B_ADDRESS,
422         .ip     = TEST_ADDRESS_X_PREFIX".4"
423         }
424 };
425
426 static const struct wrepl_ip addresses_A_3_4_X_1_2[] = {
427         {
428         .owner  = TEST_OWNER_A_ADDRESS,
429         .ip     = TEST_ADDRESS_A_PREFIX".3"
430         },
431         {
432         .owner  = TEST_OWNER_A_ADDRESS,
433         .ip     = TEST_ADDRESS_A_PREFIX".4"
434         },
435         {
436         .owner  = TEST_OWNER_X_ADDRESS,
437         .ip     = TEST_ADDRESS_X_PREFIX".1"
438         },
439         {
440         .owner  = TEST_OWNER_X_ADDRESS,
441         .ip     = TEST_ADDRESS_X_PREFIX".2"
442         }
443 };
444
445 static const struct wrepl_ip addresses_B_1[] = {
446         {
447         .owner  = TEST_OWNER_B_ADDRESS,
448         .ip     = TEST_ADDRESS_B_PREFIX".1"
449         }
450 };
451 static const struct wrepl_ip addresses_B_2[] = {
452         {
453         .owner  = TEST_OWNER_B_ADDRESS,
454         .ip     = TEST_ADDRESS_B_PREFIX".2"
455         }
456 };
457 static const struct wrepl_ip addresses_B_3_4[] = {
458         {
459         .owner  = TEST_OWNER_B_ADDRESS,
460         .ip     = TEST_ADDRESS_B_PREFIX".3"
461         },
462         {
463         .owner  = TEST_OWNER_B_ADDRESS,
464         .ip     = TEST_ADDRESS_B_PREFIX".4"
465         }
466 };
467 static const struct wrepl_ip addresses_B_3_4_X_3_4[] = {
468         {
469         .owner  = TEST_OWNER_B_ADDRESS,
470         .ip     = TEST_ADDRESS_B_PREFIX".3"
471         },
472         {
473         .owner  = TEST_OWNER_B_ADDRESS,
474         .ip     = TEST_ADDRESS_B_PREFIX".4"
475         },
476         {
477         .owner  = TEST_OWNER_X_ADDRESS,
478         .ip     = TEST_ADDRESS_X_PREFIX".3"
479         },
480         {
481         .owner  = TEST_OWNER_X_ADDRESS,
482         .ip     = TEST_ADDRESS_X_PREFIX".4"
483         }
484 };
485 static const struct wrepl_ip addresses_B_3_4_X_1_2[] = {
486         {
487         .owner  = TEST_OWNER_B_ADDRESS,
488         .ip     = TEST_ADDRESS_B_PREFIX".3"
489         },
490         {
491         .owner  = TEST_OWNER_B_ADDRESS,
492         .ip     = TEST_ADDRESS_B_PREFIX".4"
493         },
494         {
495         .owner  = TEST_OWNER_X_ADDRESS,
496         .ip     = TEST_ADDRESS_X_PREFIX".1"
497         },
498         {
499         .owner  = TEST_OWNER_X_ADDRESS,
500         .ip     = TEST_ADDRESS_X_PREFIX".2"
501         }
502 };
503
504 static const struct wrepl_ip addresses_X_1_2[] = {
505         {
506         .owner  = TEST_OWNER_X_ADDRESS,
507         .ip     = TEST_ADDRESS_X_PREFIX".1"
508         },
509         {
510         .owner  = TEST_OWNER_X_ADDRESS,
511         .ip     = TEST_ADDRESS_X_PREFIX".2"
512         }
513 };
514 static const struct wrepl_ip addresses_X_3_4[] = {
515         {
516         .owner  = TEST_OWNER_X_ADDRESS,
517         .ip     = TEST_ADDRESS_X_PREFIX".3"
518         },
519         {
520         .owner  = TEST_OWNER_X_ADDRESS,
521         .ip     = TEST_ADDRESS_X_PREFIX".4"
522         }
523 };
524
525 static struct test_wrepl_conflict_conn *test_create_conflict_ctx(TALLOC_CTX *mem_ctx,
526                                                                  const char *address)
527 {
528         struct test_wrepl_conflict_conn *ctx;
529         struct wrepl_associate associate;
530         struct wrepl_pull_table pull_table;
531         NTSTATUS status;
532         uint32_t i;
533
534         ctx = talloc_zero(mem_ctx, struct test_wrepl_conflict_conn);
535         if (!ctx) return NULL;
536
537         ctx->address    = address;
538         ctx->pull       = wrepl_socket_init(ctx, NULL);
539         if (!ctx->pull) return NULL;
540
541         printf("Setup wrepl conflict pull connection\n");
542         status = wrepl_connect(ctx->pull, NULL, ctx->address);
543         if (!NT_STATUS_IS_OK(status)) return NULL;
544
545         status = wrepl_associate(ctx->pull, &associate);
546         if (!NT_STATUS_IS_OK(status)) return NULL;
547
548         ctx->pull_assoc = associate.out.assoc_ctx;
549
550         ctx->a.address          = TEST_OWNER_A_ADDRESS;
551         ctx->a.max_version      = 0;
552         ctx->a.min_version      = 0;
553         ctx->a.type             = 1;
554
555         ctx->b.address          = TEST_OWNER_B_ADDRESS;
556         ctx->b.max_version      = 0;
557         ctx->b.min_version      = 0;
558         ctx->b.type             = 1;
559
560         ctx->x.address          = TEST_OWNER_X_ADDRESS;
561         ctx->x.max_version      = 0;
562         ctx->x.min_version      = 0;
563         ctx->x.type             = 1;
564
565         ctx->c.address          = address;
566         ctx->c.max_version      = 0;
567         ctx->c.min_version      = 0;
568         ctx->c.type             = 1;
569
570         pull_table.in.assoc_ctx = ctx->pull_assoc;
571         status = wrepl_pull_table(ctx->pull, ctx->pull, &pull_table);
572         if (!NT_STATUS_IS_OK(status)) return NULL;
573
574         for (i=0; i < pull_table.out.num_partners; i++) {
575                 if (strcmp(TEST_OWNER_A_ADDRESS,pull_table.out.partners[i].address)==0) {
576                         ctx->a.max_version      = pull_table.out.partners[i].max_version;
577                         ctx->a.min_version      = pull_table.out.partners[i].min_version;
578                 }
579                 if (strcmp(TEST_OWNER_B_ADDRESS,pull_table.out.partners[i].address)==0) {
580                         ctx->b.max_version      = pull_table.out.partners[i].max_version;
581                         ctx->b.min_version      = pull_table.out.partners[i].min_version;
582                 }
583                 if (strcmp(TEST_OWNER_X_ADDRESS,pull_table.out.partners[i].address)==0) {
584                         ctx->x.max_version      = pull_table.out.partners[i].max_version;
585                         ctx->x.min_version      = pull_table.out.partners[i].min_version;
586                 }
587                 if (strcmp(address,pull_table.out.partners[i].address)==0) {
588                         ctx->c.max_version      = pull_table.out.partners[i].max_version;
589                         ctx->c.min_version      = pull_table.out.partners[i].min_version;
590                 }
591         }
592
593         talloc_free(pull_table.out.partners);
594
595         ctx->myaddr = talloc_strdup(mem_ctx, iface_best_ip(address));
596         if (!ctx->myaddr) return NULL;
597
598         for (i = 0; i < iface_count(); i++) {
599                 if (strcmp(ctx->myaddr, iface_n_ip(i)) == 0) continue;
600                 ctx->myaddr2 = talloc_strdup(mem_ctx, iface_n_ip(i));
601                 if (!ctx->myaddr2) return NULL;
602                 break;
603         }
604
605         ctx->nbtsock = nbt_name_socket_init(ctx, NULL);
606         if (!ctx->nbtsock) return NULL;
607
608         status = socket_listen(ctx->nbtsock->sock, ctx->myaddr, 0, 0, 0);
609         if (!NT_STATUS_IS_OK(status)) return NULL;
610
611         ctx->nbtsock_srv = nbt_name_socket_init(ctx, NULL);
612         if (!ctx->nbtsock_srv) return NULL;
613
614         status = socket_listen(ctx->nbtsock_srv->sock, ctx->myaddr, lp_nbt_port(), 0, 0);
615         if (!NT_STATUS_IS_OK(status)) {
616                 talloc_free(ctx->nbtsock_srv);
617                 ctx->nbtsock_srv = NULL;
618         }
619
620         if (ctx->myaddr2 && ctx->nbtsock_srv) {
621                 ctx->nbtsock2 = nbt_name_socket_init(ctx, NULL);
622                 if (!ctx->nbtsock2) return NULL;
623
624                 status = socket_listen(ctx->nbtsock2->sock, ctx->myaddr2, 0, 0, 0);
625                 if (!NT_STATUS_IS_OK(status)) return NULL;
626
627                 ctx->nbtsock_srv2 = nbt_name_socket_init(ctx, ctx->nbtsock_srv->event_ctx);
628                 if (!ctx->nbtsock_srv2) return NULL;
629
630                 status = socket_listen(ctx->nbtsock_srv2->sock, ctx->myaddr2, lp_nbt_port(), 0, 0);
631                 if (!NT_STATUS_IS_OK(status)) {
632                         talloc_free(ctx->nbtsock_srv2);
633                         ctx->nbtsock_srv2 = NULL;
634                 }
635         }
636
637         ctx->addresses_best_num = 1;
638         ctx->addresses_best = talloc_array(ctx, struct wrepl_ip, ctx->addresses_best_num);
639         if (!ctx->addresses_best) return NULL;
640         ctx->addresses_best[0].owner    = ctx->b.address;
641         ctx->addresses_best[0].ip       = ctx->myaddr;
642
643         ctx->addresses_all_num = iface_count();
644         ctx->addresses_all = talloc_array(ctx, struct wrepl_ip, ctx->addresses_all_num);
645         if (!ctx->addresses_all) return NULL;
646         for (i=0; i < ctx->addresses_all_num; i++) {
647                 ctx->addresses_all[i].owner     = ctx->b.address;
648                 ctx->addresses_all[i].ip        = talloc_strdup(ctx->addresses_all, iface_n_ip(i));
649                 if (!ctx->addresses_all[i].ip) return NULL;
650         }
651
652         if (ctx->nbtsock_srv2) {
653                 ctx->addresses_best2_num = 1;
654                 ctx->addresses_best2 = talloc_array(ctx, struct wrepl_ip, ctx->addresses_best2_num);
655                 if (!ctx->addresses_best2) return NULL;
656                 ctx->addresses_best2[0].owner   = ctx->b.address;
657                 ctx->addresses_best2[0].ip      = ctx->myaddr2;
658
659                 ctx->addresses_mhomed_num = 2;
660                 ctx->addresses_mhomed = talloc_array(ctx, struct wrepl_ip, ctx->addresses_mhomed_num);
661                 if (!ctx->addresses_mhomed) return NULL;
662                 ctx->addresses_mhomed[0].owner  = ctx->b.address;
663                 ctx->addresses_mhomed[0].ip     = ctx->myaddr;
664                 ctx->addresses_mhomed[1].owner  = ctx->b.address;
665                 ctx->addresses_mhomed[1].ip     = ctx->myaddr2;
666         }
667
668         return ctx;
669 }
670
671 static BOOL test_wrepl_update_one(struct test_wrepl_conflict_conn *ctx,
672                                   const struct wrepl_wins_owner *owner,
673                                   const struct wrepl_wins_name *name)
674 {
675         BOOL ret = True;
676         struct wrepl_socket *wrepl_socket;
677         struct wrepl_associate associate;
678         struct wrepl_packet update_packet, repl_send;
679         struct wrepl_table *update;
680         struct wrepl_wins_owner wrepl_wins_owners[1];
681         struct wrepl_packet *repl_recv;
682         struct wrepl_wins_owner *send_request;
683         struct wrepl_send_reply *send_reply;
684         struct wrepl_wins_name wrepl_wins_names[1];
685         uint32_t assoc_ctx;
686         NTSTATUS status;
687
688         wrepl_socket = wrepl_socket_init(ctx, NULL);
689
690         status = wrepl_connect(wrepl_socket, NULL, ctx->address);
691         CHECK_STATUS(status, NT_STATUS_OK);
692
693         status = wrepl_associate(wrepl_socket, &associate);
694         CHECK_STATUS(status, NT_STATUS_OK);
695         assoc_ctx = associate.out.assoc_ctx;
696
697         /* now send a WREPL_REPL_UPDATE message */
698         ZERO_STRUCT(update_packet);
699         update_packet.opcode                    = WREPL_OPCODE_BITS;
700         update_packet.assoc_ctx                 = assoc_ctx;
701         update_packet.mess_type                 = WREPL_REPLICATION;
702         update_packet.message.replication.command       = WREPL_REPL_UPDATE;
703         update  = &update_packet.message.replication.info.table;
704
705         update->partner_count   = ARRAY_SIZE(wrepl_wins_owners);
706         update->partners        = wrepl_wins_owners;
707         update->initiator       = "0.0.0.0";
708
709         wrepl_wins_owners[0]    = *owner;
710
711         status = wrepl_request(wrepl_socket, wrepl_socket,
712                                &update_packet, &repl_recv);
713         CHECK_STATUS(status, NT_STATUS_OK);
714         CHECK_VALUE(repl_recv->mess_type, WREPL_REPLICATION);
715         CHECK_VALUE(repl_recv->message.replication.command, WREPL_REPL_SEND_REQUEST);
716         send_request = &repl_recv->message.replication.info.owner;
717
718         ZERO_STRUCT(repl_send);
719         repl_send.opcode                        = WREPL_OPCODE_BITS;
720         repl_send.assoc_ctx                     = assoc_ctx;
721         repl_send.mess_type                     = WREPL_REPLICATION;
722         repl_send.message.replication.command   = WREPL_REPL_SEND_REPLY;
723         send_reply = &repl_send.message.replication.info.reply;
724
725         send_reply->num_names   = ARRAY_SIZE(wrepl_wins_names);
726         send_reply->names       = wrepl_wins_names;
727
728         wrepl_wins_names[0]     = *name;
729
730         status = wrepl_request(wrepl_socket, wrepl_socket,
731                                &repl_send, &repl_recv);
732         CHECK_STATUS(status, NT_STATUS_OK);
733         CHECK_VALUE(repl_recv->mess_type, WREPL_STOP_ASSOCIATION);
734         CHECK_VALUE(repl_recv->message.stop.reason, 0);
735
736 done:
737         talloc_free(wrepl_socket);
738         return ret;
739 }
740
741 static BOOL test_wrepl_is_applied(struct test_wrepl_conflict_conn *ctx,
742                                   const struct wrepl_wins_owner *owner,
743                                   const struct wrepl_wins_name *name,
744                                   BOOL expected)
745 {
746         BOOL ret = True;
747         NTSTATUS status;
748         struct wrepl_pull_names pull_names;
749         struct wrepl_name *names;
750
751         pull_names.in.assoc_ctx = ctx->pull_assoc;
752         pull_names.in.partner   = *owner;
753         pull_names.in.partner.min_version = pull_names.in.partner.max_version;
754                 
755         status = wrepl_pull_names(ctx->pull, ctx->pull, &pull_names);
756         CHECK_STATUS(status, NT_STATUS_OK);
757         CHECK_VALUE(pull_names.out.num_names, (expected?1:0));
758
759         names = pull_names.out.names;
760
761         if (expected) {
762                 uint32_t flags = WREPL_NAME_FLAGS(names[0].type,
763                                                   names[0].state,
764                                                   names[0].node,
765                                                   names[0].is_static);
766                 CHECK_VALUE(names[0].name.type, name->name->type);
767                 CHECK_VALUE_STRING(names[0].name.name, name->name->name);
768                 CHECK_VALUE_STRING(names[0].name.scope, name->name->scope);
769                 CHECK_VALUE(flags, name->flags);
770                 CHECK_VALUE_UINT64(names[0].version_id, name->id);
771
772                 if (flags & 2) {
773                         CHECK_VALUE(names[0].num_addresses,
774                                     name->addresses.addresses.num_ips);
775                 } else {
776                         CHECK_VALUE(names[0].num_addresses, 1);
777                         CHECK_VALUE_STRING(names[0].addresses[0].address,
778                                            name->addresses.ip);
779                 }
780         }
781 done:
782         talloc_free(pull_names.out.names);
783         return ret;
784 }
785
786 static BOOL test_wrepl_mhomed_merged(struct test_wrepl_conflict_conn *ctx,
787                                      const struct wrepl_wins_owner *owner1,
788                                      uint32_t num_ips1, const struct wrepl_ip *ips1,
789                                      const struct wrepl_wins_owner *owner2,
790                                      uint32_t num_ips2, const struct wrepl_ip *ips2,
791                                      const struct wrepl_wins_name *name2)
792 {
793         BOOL ret = True;
794         NTSTATUS status;
795         struct wrepl_pull_names pull_names;
796         struct wrepl_name *names;
797         uint32_t flags;
798         uint32_t i, j;
799         uint32_t num_ips = num_ips1 + num_ips2;
800
801         for (i = 0; i < num_ips2; i++) {
802                 for (j = 0; j < num_ips1; j++) {
803                         if (strcmp(ips2[i].ip,ips1[j].ip) == 0) {
804                                 num_ips--;
805                                 break;
806                         }
807                 } 
808         }
809
810         pull_names.in.assoc_ctx = ctx->pull_assoc;
811         pull_names.in.partner   = *owner2;
812         pull_names.in.partner.min_version = pull_names.in.partner.max_version;
813
814         status = wrepl_pull_names(ctx->pull, ctx->pull, &pull_names);
815         CHECK_STATUS(status, NT_STATUS_OK);
816         CHECK_VALUE(pull_names.out.num_names, 1);
817
818         names = pull_names.out.names;
819
820         flags = WREPL_NAME_FLAGS(names[0].type,
821                                  names[0].state,
822                                  names[0].node,
823                                  names[0].is_static);
824         CHECK_VALUE(names[0].name.type, name2->name->type);
825         CHECK_VALUE_STRING(names[0].name.name, name2->name->name);
826         CHECK_VALUE_STRING(names[0].name.scope, name2->name->scope);
827         CHECK_VALUE(flags, name2->flags | WREPL_TYPE_MHOMED);
828         CHECK_VALUE_UINT64(names[0].version_id, name2->id);
829
830         CHECK_VALUE(names[0].num_addresses, num_ips);
831
832         for (i = 0; i < names[0].num_addresses; i++) {
833                 const char *addr = names[0].addresses[i].address; 
834                 const char *owner = names[0].addresses[i].owner;
835                 BOOL found = False;
836
837                 for (j = 0; j < num_ips2; j++) {
838                         if (strcmp(addr, ips2[j].ip) == 0) {
839                                 found = True;
840                                 CHECK_VALUE_STRING(owner, owner2->address);
841                                 break;
842                         }
843                 }
844
845                 if (found) continue;
846
847                 for (j = 0; j < num_ips1; j++) {
848                         if (strcmp(addr, ips1[j].ip) == 0) {
849                                 found = True;
850                                 CHECK_VALUE_STRING(owner, owner1->address);
851                                 break;
852                         }
853                 }
854
855                 if (found) continue;
856
857                 CHECK_VALUE_STRING(addr, "not found in address list");
858         }
859 done:
860         talloc_free(pull_names.out.names);
861         return ret;
862 }
863
864 static BOOL test_wrepl_sgroup_merged(struct test_wrepl_conflict_conn *ctx,
865                                      struct wrepl_wins_owner *merge_owner,
866                                      struct wrepl_wins_owner *owner1,
867                                      uint32_t num_ips1, const struct wrepl_ip *ips1,
868                                      struct wrepl_wins_owner *owner2,
869                                      uint32_t num_ips2, const struct wrepl_ip *ips2,
870                                      const struct wrepl_wins_name *name2)
871 {
872         BOOL ret = True;
873         NTSTATUS status;
874         struct wrepl_pull_names pull_names;
875         struct wrepl_name *names;
876         struct wrepl_name *name = NULL;
877         uint32_t flags;
878         uint32_t i, j;
879         uint32_t num_ips = num_ips1 + num_ips2;
880
881         if (!merge_owner) {
882                 merge_owner = &ctx->c;
883         }
884
885         for (i = 0; i < num_ips1; i++) {
886                 if (owner1 != &ctx->c && strcmp(ips1[i].owner,owner2->address) == 0) {
887                         num_ips--;
888                         continue;
889                 }
890                 for (j = 0; j < num_ips2; j++) {
891                         if (strcmp(ips1[i].ip,ips2[j].ip) == 0) {
892                                 num_ips--;
893                                 break;
894                         }
895                 }
896         }
897
898
899         pull_names.in.assoc_ctx = ctx->pull_assoc;
900         pull_names.in.partner   = *merge_owner;
901         pull_names.in.partner.min_version = pull_names.in.partner.max_version;
902         pull_names.in.partner.max_version = 0;
903
904         status = wrepl_pull_names(ctx->pull, ctx->pull, &pull_names);
905         CHECK_STATUS(status, NT_STATUS_OK);
906
907         names = pull_names.out.names;
908         
909         for (i = 0; i < pull_names.out.num_names; i++) {
910                 if (names[i].name.type != name2->name->type)    continue;
911                 if (!names[i].name.name) continue;
912                 if (strcmp(names[i].name.name, name2->name->name) != 0) continue;
913                 if (names[i].name.scope) continue;
914
915                 name = &names[i];
916         }
917
918         if (pull_names.out.num_names > 0) {
919                 merge_owner->max_version        = names[pull_names.out.num_names-1].version_id;
920         }
921
922         if (!name) {
923                 printf("%s: Name '%s' not found\n", __location__, nbt_name_string(ctx, name2->name));
924                 return False;
925         }
926
927         flags = WREPL_NAME_FLAGS(name->type,
928                                  name->state,
929                                  name->node,
930                                  name->is_static);
931         CHECK_VALUE(name->name.type, name2->name->type);
932         CHECK_VALUE_STRING(name->name.name, name2->name->name);
933         CHECK_VALUE_STRING(name->name.scope, name2->name->scope);
934         CHECK_VALUE(flags, name2->flags);
935
936         CHECK_VALUE(name->num_addresses, num_ips);
937
938         for (i = 0; i < name->num_addresses; i++) {
939                 const char *addr = name->addresses[i].address; 
940                 const char *owner = name->addresses[i].owner;
941                 BOOL found = False;
942
943                 for (j = 0; j < num_ips2; j++) {
944                         if (strcmp(addr, ips2[j].ip) == 0) {
945                                 found = True;
946                                 CHECK_VALUE_STRING(owner, ips2[j].owner);
947                                 break;
948                         }
949                 }
950
951                 if (found) continue;
952
953                 for (j = 0; j < num_ips1; j++) {
954                         if (strcmp(addr, ips1[j].ip) == 0) {
955                                 found = True;
956                                 if (owner1 == &ctx->c) {
957                                         CHECK_VALUE_STRING(owner, owner1->address);
958                                 } else {
959                                         CHECK_VALUE_STRING(owner, ips1[j].owner);
960                                 }
961                                 break;
962                         }
963                 }
964
965                 if (found) continue;
966
967                 CHECK_VALUE_STRING(addr, "not found in address list");
968         }
969 done:
970         talloc_free(pull_names.out.names);
971         return ret;
972 }
973
974 static BOOL test_conflict_same_owner(struct test_wrepl_conflict_conn *ctx)
975 {
976         BOOL ret = True;
977         struct nbt_name name;
978         struct wrepl_wins_name wins_name1;
979         struct wrepl_wins_name wins_name2;
980         struct wrepl_wins_name *wins_name_tmp;
981         struct wrepl_wins_name *wins_name_last;
982         struct wrepl_wins_name *wins_name_cur;
983         uint32_t i,j;
984         uint8_t types[] = { 0x00, 0x1C };
985         struct {
986                 enum wrepl_name_type type;
987                 enum wrepl_name_state state;
988                 enum wrepl_name_node node;
989                 BOOL is_static;
990                 uint32_t num_ips;
991                 const struct wrepl_ip *ips;
992         } records[] = {
993                 {
994                 .type           = WREPL_TYPE_GROUP,
995                 .state          = WREPL_STATE_ACTIVE,
996                 .node           = WREPL_NODE_B,
997                 .is_static      = False,
998                 .num_ips        = ARRAY_SIZE(addresses_A_1),
999                 .ips            = addresses_A_1,
1000                 },{
1001                 .type           = WREPL_TYPE_UNIQUE,
1002                 .state          = WREPL_STATE_ACTIVE,
1003                 .node           = WREPL_NODE_B,
1004                 .is_static      = False,
1005                 .num_ips        = ARRAY_SIZE(addresses_A_1),
1006                 .ips            = addresses_A_1,
1007                 },{
1008                 .type           = WREPL_TYPE_UNIQUE,
1009                 .state          = WREPL_STATE_ACTIVE,
1010                 .node           = WREPL_NODE_B,
1011                 .is_static      = False,
1012                 .num_ips        = ARRAY_SIZE(addresses_A_2),
1013                 .ips            = addresses_A_2,
1014                 },{
1015                 .type           = WREPL_TYPE_UNIQUE,
1016                 .state          = WREPL_STATE_ACTIVE,
1017                 .node           = WREPL_NODE_B,
1018                 .is_static      = True,
1019                 .num_ips        = ARRAY_SIZE(addresses_A_1),
1020                 .ips            = addresses_A_1,
1021                 },{
1022                 .type           = WREPL_TYPE_UNIQUE,
1023                 .state          = WREPL_STATE_ACTIVE,
1024                 .node           = WREPL_NODE_B,
1025                 .is_static      = False,
1026                 .num_ips        = ARRAY_SIZE(addresses_A_2),
1027                 .ips            = addresses_A_2,
1028                 },{
1029                 .type           = WREPL_TYPE_SGROUP,
1030                 .state          = WREPL_STATE_TOMBSTONE,
1031                 .node           = WREPL_NODE_B,
1032                 .is_static      = False,
1033                 .num_ips        = ARRAY_SIZE(addresses_A_2),
1034                 .ips            = addresses_A_2,
1035                 },{
1036                 .type           = WREPL_TYPE_MHOMED,
1037                 .state          = WREPL_STATE_TOMBSTONE,
1038                 .node           = WREPL_NODE_B,
1039                 .is_static      = False,
1040                 .num_ips        = ARRAY_SIZE(addresses_A_1),
1041                 .ips            = addresses_A_1,
1042                 },{
1043                 .type           = WREPL_TYPE_MHOMED,
1044                 .state          = WREPL_STATE_RELEASED,
1045                 .node           = WREPL_NODE_B,
1046                 .is_static      = False,
1047                 .num_ips        = ARRAY_SIZE(addresses_A_2),
1048                 .ips            = addresses_A_2,
1049                 },{
1050                 .type           = WREPL_TYPE_SGROUP,
1051                 .state          = WREPL_STATE_ACTIVE,
1052                 .node           = WREPL_NODE_B,
1053                 .is_static      = False,
1054                 .num_ips        = ARRAY_SIZE(addresses_A_1),
1055                 .ips            = addresses_A_1,
1056                 },{
1057                 .type           = WREPL_TYPE_SGROUP,
1058                 .state          = WREPL_STATE_ACTIVE,
1059                 .node           = WREPL_NODE_B,
1060                 .is_static      = False,
1061                 .num_ips        = ARRAY_SIZE(addresses_A_3_4),
1062                 .ips            = addresses_A_3_4,
1063                 },{
1064                 .type           = WREPL_TYPE_SGROUP,
1065                 .state          = WREPL_STATE_TOMBSTONE,
1066                 .node           = WREPL_NODE_B,
1067                 .is_static      = False,
1068                 .num_ips        = ARRAY_SIZE(addresses_B_3_4),
1069                 .ips            = addresses_B_3_4,
1070                 },{
1071                 /* the last one should always be a unique,tomstone record! */
1072                 .type           = WREPL_TYPE_UNIQUE,
1073                 .state          = WREPL_STATE_TOMBSTONE,
1074                 .node           = WREPL_NODE_B,
1075                 .is_static      = False,
1076                 .num_ips        = ARRAY_SIZE(addresses_A_1),
1077                 .ips            = addresses_A_1,
1078                 }
1079         };
1080
1081         if (!ctx) return False;
1082
1083         name.name       = "_SAME_OWNER_A";
1084         name.type       = 0;
1085         name.scope      = NULL;
1086
1087         wins_name_tmp   = NULL;
1088         wins_name_last  = &wins_name2;
1089         wins_name_cur   = &wins_name1;
1090
1091         for (j=0; ret && j < ARRAY_SIZE(types); j++) {
1092                 name.type = types[j];
1093                 printf("Test Replica Conflicts with same owner[%s] for %s\n",
1094                         nbt_name_string(ctx, &name), ctx->a.address);
1095
1096                 for(i=0; ret && i < ARRAY_SIZE(records); i++) {
1097                         wins_name_tmp   = wins_name_last;
1098                         wins_name_last  = wins_name_cur;
1099                         wins_name_cur   = wins_name_tmp;
1100
1101                         if (i > 0) {
1102                                 printf("%s,%s%s vs. %s,%s%s with %s ip(s) => %s\n",
1103                                         wrepl_name_type_string(records[i-1].type),
1104                                         wrepl_name_state_string(records[i-1].state),
1105                                         (records[i-1].is_static?",static":""),
1106                                         wrepl_name_type_string(records[i].type),
1107                                         wrepl_name_state_string(records[i].state),
1108                                         (records[i].is_static?",static":""),
1109                                         (records[i-1].ips==records[i].ips?"same":"different"),
1110                                         "REPLACE");
1111                         }
1112
1113                         wins_name_cur->name     = &name;
1114                         wins_name_cur->flags    = WREPL_NAME_FLAGS(records[i].type,
1115                                                                    records[i].state,
1116                                                                    records[i].node,
1117                                                                    records[i].is_static);
1118                         wins_name_cur->id       = ++ctx->a.max_version;
1119                         if (wins_name_cur->flags & 2) {
1120                                 wins_name_cur->addresses.addresses.num_ips = records[i].num_ips;
1121                                 wins_name_cur->addresses.addresses.ips     = discard_const(records[i].ips);
1122                         } else {
1123                                 wins_name_cur->addresses.ip = records[i].ips[0].ip;
1124                         }
1125                         wins_name_cur->unknown  = "255.255.255.255";
1126
1127                         ret &= test_wrepl_update_one(ctx, &ctx->a,wins_name_cur);
1128                         if (records[i].state == WREPL_STATE_RELEASED) {
1129                                 ret &= test_wrepl_is_applied(ctx, &ctx->a, wins_name_last, False);
1130                                 ret &= test_wrepl_is_applied(ctx, &ctx->a, wins_name_cur, False);
1131                         } else {
1132                                 ret &= test_wrepl_is_applied(ctx, &ctx->a, wins_name_cur, True);
1133                         }
1134
1135                         /* the first one is a cleanup run */
1136                         if (!ret && i == 0) ret = True;
1137
1138                         if (!ret) {
1139                                 printf("conflict handled wrong or record[%u]: %s\n", i, __location__);
1140                                 return ret;
1141                         }
1142                 }
1143         }
1144         return ret;
1145 }
1146
1147 static BOOL test_conflict_different_owner(struct test_wrepl_conflict_conn *ctx)
1148 {
1149         BOOL ret = True;
1150         struct wrepl_wins_name wins_name1;
1151         struct wrepl_wins_name wins_name2;
1152         struct wrepl_wins_name *wins_name_r1;
1153         struct wrepl_wins_name *wins_name_r2;
1154         uint32_t i;
1155         struct {
1156                 const char *line; /* just better debugging */
1157                 struct nbt_name name;
1158                 const char *comment;
1159                 BOOL extra; /* not the worst case, this is an extra test */
1160                 BOOL cleanup;
1161                 struct {
1162                         struct wrepl_wins_owner *owner;
1163                         enum wrepl_name_type type;
1164                         enum wrepl_name_state state;
1165                         enum wrepl_name_node node;
1166                         BOOL is_static;
1167                         uint32_t num_ips;
1168                         const struct wrepl_ip *ips;
1169                         BOOL apply_expected;
1170                         BOOL sgroup_merge;
1171                         struct wrepl_wins_owner *merge_owner;
1172                         BOOL sgroup_cleanup;
1173                 } r1, r2, result;
1174         } records[] = {
1175         /* 
1176          * NOTE: the first record and the last applied one
1177          *       needs to be from the same owner,
1178          *       to not conflict in the next smbtorture run!!!
1179          */
1180         {
1181                 .line   = __location__,
1182                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1183                 .cleanup= True,
1184                 .r1     = {
1185                         .owner          = &ctx->b,
1186                         .type           = WREPL_TYPE_UNIQUE,
1187                         .state          = WREPL_STATE_TOMBSTONE,
1188                         .node           = WREPL_NODE_B,
1189                         .is_static      = False,
1190                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1191                         .ips            = addresses_B_1,
1192                         .apply_expected = True /* ignored */
1193                 },
1194                 .r2     = {
1195                         .owner          = &ctx->a,
1196                         .type           = WREPL_TYPE_UNIQUE,
1197                         .state          = WREPL_STATE_TOMBSTONE,
1198                         .node           = WREPL_NODE_B,
1199                         .is_static      = False,
1200                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1201                         .ips            = addresses_A_1,
1202                         .apply_expected = True /* ignored */
1203                 }
1204         },
1205
1206 /*
1207  * unique vs unique section
1208  */
1209         /* 
1210          * unique,active vs. unique,active
1211          * => should be replaced
1212          */
1213         {
1214                 .line   = __location__,
1215                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1216                 .r1     = {
1217                         .owner          = &ctx->a,
1218                         .type           = WREPL_TYPE_UNIQUE,
1219                         .state          = WREPL_STATE_ACTIVE,
1220                         .node           = WREPL_NODE_B,
1221                         .is_static      = False,
1222                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1223                         .ips            = addresses_A_1,
1224                         .apply_expected = True
1225                 },
1226                 .r2     = {
1227                         .owner          = &ctx->b,
1228                         .type           = WREPL_TYPE_UNIQUE,
1229                         .state          = WREPL_STATE_ACTIVE,
1230                         .node           = WREPL_NODE_B,
1231                         .is_static      = False,
1232                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1233                         .ips            = addresses_B_1,
1234                         .apply_expected = True
1235                 }
1236         },
1237
1238         /* 
1239          * unique,active vs. unique,tombstone
1240          * => should NOT be replaced
1241          */
1242         {
1243                 .line   = __location__,
1244                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1245                 .r1     = {
1246                         .owner          = &ctx->b,
1247                         .type           = WREPL_TYPE_UNIQUE,
1248                         .state          = WREPL_STATE_ACTIVE,
1249                         .node           = WREPL_NODE_B,
1250                         .is_static      = False,
1251                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1252                         .ips            = addresses_B_1,
1253                         .apply_expected = True
1254                 },
1255                 .r2     = {
1256                         .owner          = &ctx->a,
1257                         .type           = WREPL_TYPE_UNIQUE,
1258                         .state          = WREPL_STATE_TOMBSTONE,
1259                         .node           = WREPL_NODE_B,
1260                         .is_static      = False,
1261                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1262                         .ips            = addresses_B_1,
1263                         .apply_expected = False
1264                 }
1265         },
1266
1267         /* 
1268          * unique,released vs. unique,active
1269          * => should be replaced
1270          */
1271         {
1272                 .line   = __location__,
1273                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1274                 .r1     = {
1275                         .owner          = &ctx->b,
1276                         .type           = WREPL_TYPE_UNIQUE,
1277                         .state          = WREPL_STATE_RELEASED,
1278                         .node           = WREPL_NODE_B,
1279                         .is_static      = False,
1280                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1281                         .ips            = addresses_B_1,
1282                         .apply_expected = False
1283                 },
1284                 .r2     = {
1285                         .owner          = &ctx->a,
1286                         .type           = WREPL_TYPE_UNIQUE,
1287                         .state          = WREPL_STATE_ACTIVE,
1288                         .node           = WREPL_NODE_B,
1289                         .is_static      = False,
1290                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1291                         .ips            = addresses_A_1,
1292                         .apply_expected = True
1293                 }
1294         },
1295
1296         /* 
1297          * unique,released vs. unique,tombstone
1298          * => should be replaced
1299          */
1300         {
1301                 .line   = __location__,
1302                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1303                 .r1     = {
1304                         .owner          = &ctx->a,
1305                         .type           = WREPL_TYPE_UNIQUE,
1306                         .state          = WREPL_STATE_RELEASED,
1307                         .node           = WREPL_NODE_B,
1308                         .is_static      = False,
1309                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1310                         .ips            = addresses_A_1,
1311                         .apply_expected = False
1312                 },
1313                 .r2     = {
1314                         .owner          = &ctx->b,
1315                         .type           = WREPL_TYPE_UNIQUE,
1316                         .state          = WREPL_STATE_TOMBSTONE,
1317                         .node           = WREPL_NODE_B,
1318                         .is_static      = False,
1319                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1320                         .ips            = addresses_B_1,
1321                         .apply_expected = True
1322                 }
1323         },
1324
1325         /* 
1326          * unique,tombstone vs. unique,active
1327          * => should be replaced
1328          */
1329         {
1330                 .line   = __location__,
1331                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1332                 .r1     = {
1333                         .owner          = &ctx->b,
1334                         .type           = WREPL_TYPE_UNIQUE,
1335                         .state          = WREPL_STATE_TOMBSTONE,
1336                         .node           = WREPL_NODE_B,
1337                         .is_static      = False,
1338                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1339                         .ips            = addresses_B_1,
1340                         .apply_expected = True
1341                 },
1342                 .r2     = {
1343                         .owner          = &ctx->a,
1344                         .type           = WREPL_TYPE_UNIQUE,
1345                         .state          = WREPL_STATE_ACTIVE,
1346                         .node           = WREPL_NODE_B,
1347                         .is_static      = False,
1348                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1349                         .ips            = addresses_A_1,
1350                         .apply_expected = True
1351                 }
1352         },
1353
1354         /* 
1355          * unique,tombstone vs. unique,tombstone
1356          * => should be replaced
1357          */
1358         {
1359                 .line   = __location__,
1360                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1361                 .r1     = {
1362                         .owner          = &ctx->a,
1363                         .type           = WREPL_TYPE_UNIQUE,
1364                         .state          = WREPL_STATE_TOMBSTONE,
1365                         .node           = WREPL_NODE_B,
1366                         .is_static      = False,
1367                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1368                         .ips            = addresses_A_1,
1369                         .apply_expected = True
1370                 },
1371                 .r2     = {
1372                         .owner          = &ctx->b,
1373                         .type           = WREPL_TYPE_UNIQUE,
1374                         .state          = WREPL_STATE_TOMBSTONE,
1375                         .node           = WREPL_NODE_B,
1376                         .is_static      = False,
1377                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1378                         .ips            = addresses_B_1,
1379                         .apply_expected = True
1380                 }
1381         },
1382
1383
1384 /*
1385  * unique vs normal groups section,
1386  */
1387         /* 
1388          * unique,active vs. group,active
1389          * => should be replaced
1390          */
1391         {
1392                 .line   = __location__,
1393                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1394                 .r1     = {
1395                         .owner          = &ctx->b,
1396                         .type           = WREPL_TYPE_UNIQUE,
1397                         .state          = WREPL_STATE_ACTIVE,
1398                         .node           = WREPL_NODE_B,
1399                         .is_static      = False,
1400                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1401                         .ips            = addresses_B_1,
1402                         .apply_expected = True
1403                 },
1404                 .r2     = {
1405                         .owner          = &ctx->a,
1406                         .type           = WREPL_TYPE_GROUP,
1407                         .state          = WREPL_STATE_ACTIVE,
1408                         .node           = WREPL_NODE_B,
1409                         .is_static      = False,
1410                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1411                         .ips            = addresses_A_1,
1412                         .apply_expected = True
1413                 }
1414         },
1415
1416         /* 
1417          * unique,active vs. group,tombstone
1418          * => should NOT be replaced
1419          */
1420         {
1421                 .line   = __location__,
1422                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1423                 .r1     = {
1424                         .owner          = &ctx->a,
1425                         .type           = WREPL_TYPE_UNIQUE,
1426                         .state          = WREPL_STATE_ACTIVE,
1427                         .node           = WREPL_NODE_B,
1428                         .is_static      = False,
1429                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1430                         .ips            = addresses_A_1,
1431                         .apply_expected = True
1432                 },
1433                 .r2     = {
1434                         .owner          = &ctx->b,
1435                         .type           = WREPL_TYPE_GROUP,
1436                         .state          = WREPL_STATE_TOMBSTONE,
1437                         .node           = WREPL_NODE_B,
1438                         .is_static      = False,
1439                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1440                         .ips            = addresses_A_1,
1441                         .apply_expected = False
1442                 }
1443         },
1444
1445         /* 
1446          * unique,released vs. group,active
1447          * => should be replaced
1448          */
1449         {
1450                 .line   = __location__,
1451                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1452                 .r1     = {
1453                         .owner          = &ctx->a,
1454                         .type           = WREPL_TYPE_UNIQUE,
1455                         .state          = WREPL_STATE_RELEASED,
1456                         .node           = WREPL_NODE_B,
1457                         .is_static      = False,
1458                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1459                         .ips            = addresses_A_1,
1460                         .apply_expected = False
1461                 },
1462                 .r2     = {
1463                         .owner          = &ctx->b,
1464                         .type           = WREPL_TYPE_GROUP,
1465                         .state          = WREPL_STATE_ACTIVE,
1466                         .node           = WREPL_NODE_B,
1467                         .is_static      = False,
1468                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1469                         .ips            = addresses_B_1,
1470                         .apply_expected = True
1471                 }
1472         },
1473
1474         /* 
1475          * unique,released vs. group,tombstone
1476          * => should be replaced
1477          */
1478         {
1479                 .line   = __location__,
1480                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1481                 .r1     = {
1482                         .owner          = &ctx->b,
1483                         .type           = WREPL_TYPE_UNIQUE,
1484                         .state          = WREPL_STATE_RELEASED,
1485                         .node           = WREPL_NODE_B,
1486                         .is_static      = False,
1487                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1488                         .ips            = addresses_B_1,
1489                         .apply_expected = False
1490                 },
1491                 .r2     = {
1492                         .owner          = &ctx->a,
1493                         .type           = WREPL_TYPE_GROUP,
1494                         .state          = WREPL_STATE_TOMBSTONE,
1495                         .node           = WREPL_NODE_B,
1496                         .is_static      = False,
1497                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1498                         .ips            = addresses_A_1,
1499                         .apply_expected = True
1500                 }
1501         },
1502
1503         /* 
1504          * unique,tombstone vs. group,active
1505          * => should be replaced
1506          */
1507         {
1508                 .line   = __location__,
1509                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1510                 .r1     = {
1511                         .owner          = &ctx->a,
1512                         .type           = WREPL_TYPE_UNIQUE,
1513                         .state          = WREPL_STATE_TOMBSTONE,
1514                         .node           = WREPL_NODE_B,
1515                         .is_static      = False,
1516                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1517                         .ips            = addresses_A_1,
1518                         .apply_expected = True
1519                 },
1520                 .r2     = {
1521                         .owner          = &ctx->b,
1522                         .type           = WREPL_TYPE_GROUP,
1523                         .state          = WREPL_STATE_ACTIVE,
1524                         .node           = WREPL_NODE_B,
1525                         .is_static      = False,
1526                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1527                         .ips            = addresses_B_1,
1528                         .apply_expected = True
1529                 }
1530         },
1531
1532         /* 
1533          * unique,tombstone vs. group,tombstone
1534          * => should be replaced
1535          */
1536         {
1537                 .line   = __location__,
1538                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1539                 .r1     = {
1540                         .owner          = &ctx->b,
1541                         .type           = WREPL_TYPE_UNIQUE,
1542                         .state          = WREPL_STATE_TOMBSTONE,
1543                         .node           = WREPL_NODE_B,
1544                         .is_static      = False,
1545                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1546                         .ips            = addresses_B_1,
1547                         .apply_expected = True
1548                 },
1549                 .r2     = {
1550                         .owner          = &ctx->a,
1551                         .type           = WREPL_TYPE_GROUP,
1552                         .state          = WREPL_STATE_TOMBSTONE,
1553                         .node           = WREPL_NODE_B,
1554                         .is_static      = False,
1555                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1556                         .ips            = addresses_A_1,
1557                         .apply_expected = True
1558                 }
1559         },
1560
1561 /*
1562  * unique vs special groups section,
1563  */
1564         /* 
1565          * unique,active vs. sgroup,active
1566          * => should NOT be replaced
1567          */
1568         {
1569                 .line   = __location__,
1570                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1571                 .r1     = {
1572                         .owner          = &ctx->a,
1573                         .type           = WREPL_TYPE_UNIQUE,
1574                         .state          = WREPL_STATE_ACTIVE,
1575                         .node           = WREPL_NODE_B,
1576                         .is_static      = False,
1577                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1578                         .ips            = addresses_A_1,
1579                         .apply_expected = True
1580                 },
1581                 .r2     = {
1582                         .owner          = &ctx->b,
1583                         .type           = WREPL_TYPE_SGROUP,
1584                         .state          = WREPL_STATE_ACTIVE,
1585                         .node           = WREPL_NODE_B,
1586                         .is_static      = False,
1587                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1588                         .ips            = addresses_A_1,
1589                         .apply_expected = False
1590                 }
1591         },
1592
1593         /* 
1594          * unique,active vs. sgroup,tombstone
1595          * => should NOT be replaced
1596          */
1597         {
1598                 .line   = __location__,
1599                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1600                 .r1     = {
1601                         .owner          = &ctx->a,
1602                         .type           = WREPL_TYPE_UNIQUE,
1603                         .state          = WREPL_STATE_ACTIVE,
1604                         .node           = WREPL_NODE_B,
1605                         .is_static      = False,
1606                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1607                         .ips            = addresses_A_1,
1608                         .apply_expected = True
1609                 },
1610                 .r2     = {
1611                         .owner          = &ctx->b,
1612                         .type           = WREPL_TYPE_SGROUP,
1613                         .state          = WREPL_STATE_TOMBSTONE,
1614                         .node           = WREPL_NODE_B,
1615                         .is_static      = False,
1616                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1617                         .ips            = addresses_A_1,
1618                         .apply_expected = False
1619                 }
1620         },
1621
1622         /* 
1623          * unique,released vs. sgroup,active
1624          * => should be replaced
1625          */
1626         {
1627                 .line   = __location__,
1628                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1629                 .r1     = {
1630                         .owner          = &ctx->a,
1631                         .type           = WREPL_TYPE_UNIQUE,
1632                         .state          = WREPL_STATE_RELEASED,
1633                         .node           = WREPL_NODE_B,
1634                         .is_static      = False,
1635                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1636                         .ips            = addresses_A_1,
1637                         .apply_expected = False
1638                 },
1639                 .r2     = {
1640                         .owner          = &ctx->b,
1641                         .type           = WREPL_TYPE_SGROUP,
1642                         .state          = WREPL_STATE_ACTIVE,
1643                         .node           = WREPL_NODE_B,
1644                         .is_static      = False,
1645                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
1646                         .ips            = addresses_B_3_4,
1647                         .apply_expected = True
1648                 }
1649         },
1650
1651         /* 
1652          * unique,released vs. sgroup,tombstone
1653          * => should be replaced
1654          */
1655         {
1656                 .line   = __location__,
1657                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1658                 .r1     = {
1659                         .owner          = &ctx->b,
1660                         .type           = WREPL_TYPE_UNIQUE,
1661                         .state          = WREPL_STATE_RELEASED,
1662                         .node           = WREPL_NODE_B,
1663                         .is_static      = False,
1664                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1665                         .ips            = addresses_B_1,
1666                         .apply_expected = False
1667                 },
1668                 .r2     = {
1669                         .owner          = &ctx->a,
1670                         .type           = WREPL_TYPE_SGROUP,
1671                         .state          = WREPL_STATE_TOMBSTONE,
1672                         .node           = WREPL_NODE_B,
1673                         .is_static      = False,
1674                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
1675                         .ips            = addresses_A_3_4,
1676                         .apply_expected = True
1677                 }
1678         },
1679
1680         /* 
1681          * unique,tombstone vs. sgroup,active
1682          * => should be replaced
1683          */
1684         {
1685                 .line   = __location__,
1686                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1687                 .r1     = {
1688                         .owner          = &ctx->a,
1689                         .type           = WREPL_TYPE_UNIQUE,
1690                         .state          = WREPL_STATE_TOMBSTONE,
1691                         .node           = WREPL_NODE_B,
1692                         .is_static      = False,
1693                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1694                         .ips            = addresses_A_1,
1695                         .apply_expected = True
1696                 },
1697                 .r2     = {
1698                         .owner          = &ctx->b,
1699                         .type           = WREPL_TYPE_SGROUP,
1700                         .state          = WREPL_STATE_ACTIVE,
1701                         .node           = WREPL_NODE_B,
1702                         .is_static      = False,
1703                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
1704                         .ips            = addresses_B_3_4,
1705                         .apply_expected = True
1706                 }
1707         },
1708
1709         /* 
1710          * unique,tombstone vs. sgroup,tombstone
1711          * => should be replaced
1712          */
1713         {
1714                 .line   = __location__,
1715                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1716                 .r1     = {
1717                         .owner          = &ctx->b,
1718                         .type           = WREPL_TYPE_UNIQUE,
1719                         .state          = WREPL_STATE_TOMBSTONE,
1720                         .node           = WREPL_NODE_B,
1721                         .is_static      = False,
1722                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1723                         .ips            = addresses_B_1,
1724                         .apply_expected = True
1725                 },
1726                 .r2     = {
1727                         .owner          = &ctx->a,
1728                         .type           = WREPL_TYPE_SGROUP,
1729                         .state          = WREPL_STATE_TOMBSTONE,
1730                         .node           = WREPL_NODE_B,
1731                         .is_static      = False,
1732                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
1733                         .ips            = addresses_A_3_4,
1734                         .apply_expected = True
1735                 }
1736         },
1737
1738 /*
1739  * unique vs multi homed section,
1740  */
1741         /* 
1742          * unique,active vs. mhomed,active
1743          * => should be replaced
1744          */
1745         {
1746                 .line   = __location__,
1747                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1748                 .r1     = {
1749                         .owner          = &ctx->a,
1750                         .type           = WREPL_TYPE_UNIQUE,
1751                         .state          = WREPL_STATE_ACTIVE,
1752                         .node           = WREPL_NODE_B,
1753                         .is_static      = False,
1754                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1755                         .ips            = addresses_A_1,
1756                         .apply_expected = True
1757                 },
1758                 .r2     = {
1759                         .owner          = &ctx->b,
1760                         .type           = WREPL_TYPE_MHOMED,
1761                         .state          = WREPL_STATE_ACTIVE,
1762                         .node           = WREPL_NODE_B,
1763                         .is_static      = False,
1764                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
1765                         .ips            = addresses_B_3_4,
1766                         .apply_expected = True
1767                 }
1768         },
1769
1770         /* 
1771          * unique,active vs. mhomed,tombstone
1772          * => should NOT be replaced
1773          */
1774         {
1775                 .line   = __location__,
1776                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1777                 .r1     = {
1778                         .owner          = &ctx->b,
1779                         .type           = WREPL_TYPE_UNIQUE,
1780                         .state          = WREPL_STATE_ACTIVE,
1781                         .node           = WREPL_NODE_B,
1782                         .is_static      = False,
1783                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
1784                         .ips            = addresses_B_3_4,
1785                         .apply_expected = True
1786                 },
1787                 .r2     = {
1788                         .owner          = &ctx->a,
1789                         .type           = WREPL_TYPE_MHOMED,
1790                         .state          = WREPL_STATE_TOMBSTONE,
1791                         .node           = WREPL_NODE_B,
1792                         .is_static      = False,
1793                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
1794                         .ips            = addresses_B_3_4,
1795                         .apply_expected = False
1796                 }
1797         },
1798
1799         /* 
1800          * unique,released vs. mhomed,active
1801          * => should be replaced
1802          */
1803         {
1804                 .line   = __location__,
1805                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1806                 .r1     = {
1807                         .owner          = &ctx->b,
1808                         .type           = WREPL_TYPE_UNIQUE,
1809                         .state          = WREPL_STATE_RELEASED,
1810                         .node           = WREPL_NODE_B,
1811                         .is_static      = False,
1812                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1813                         .ips            = addresses_B_1,
1814                         .apply_expected = False
1815                 },
1816                 .r2     = {
1817                         .owner          = &ctx->a,
1818                         .type           = WREPL_TYPE_MHOMED,
1819                         .state          = WREPL_STATE_ACTIVE,
1820                         .node           = WREPL_NODE_B,
1821                         .is_static      = False,
1822                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
1823                         .ips            = addresses_A_3_4,
1824                         .apply_expected = True
1825                 }
1826         },
1827
1828         /* 
1829          * unique,released vs. mhomed,tombstone
1830          * => should be replaced
1831          */
1832         {
1833                 .line   = __location__,
1834                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1835                 .r1     = {
1836                         .owner          = &ctx->a,
1837                         .type           = WREPL_TYPE_UNIQUE,
1838                         .state          = WREPL_STATE_RELEASED,
1839                         .node           = WREPL_NODE_B,
1840                         .is_static      = False,
1841                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1842                         .ips            = addresses_A_1,
1843                         .apply_expected = False
1844                 },
1845                 .r2     = {
1846                         .owner          = &ctx->b,
1847                         .type           = WREPL_TYPE_MHOMED,
1848                         .state          = WREPL_STATE_TOMBSTONE,
1849                         .node           = WREPL_NODE_B,
1850                         .is_static      = False,
1851                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
1852                         .ips            = addresses_B_3_4,
1853                         .apply_expected = True
1854                 }
1855         },
1856
1857         /* 
1858          * unique,tombstone vs. mhomed,active
1859          * => should be replaced
1860          */
1861         {
1862                 .line   = __location__,
1863                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1864                 .r1     = {
1865                         .owner          = &ctx->b,
1866                         .type           = WREPL_TYPE_UNIQUE,
1867                         .state          = WREPL_STATE_TOMBSTONE,
1868                         .node           = WREPL_NODE_B,
1869                         .is_static      = False,
1870                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1871                         .ips            = addresses_B_1,
1872                         .apply_expected = True
1873                 },
1874                 .r2     = {
1875                         .owner          = &ctx->a,
1876                         .type           = WREPL_TYPE_MHOMED,
1877                         .state          = WREPL_STATE_ACTIVE,
1878                         .node           = WREPL_NODE_B,
1879                         .is_static      = False,
1880                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
1881                         .ips            = addresses_A_3_4,
1882                         .apply_expected = True
1883                 }
1884         },
1885
1886         /* 
1887          * unique,tombstone vs. mhomed,tombstone
1888          * => should be replaced
1889          */
1890         {
1891                 .line   = __location__,
1892                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1893                 .r1     = {
1894                         .owner          = &ctx->a,
1895                         .type           = WREPL_TYPE_UNIQUE,
1896                         .state          = WREPL_STATE_TOMBSTONE,
1897                         .node           = WREPL_NODE_B,
1898                         .is_static      = False,
1899                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1900                         .ips            = addresses_A_1,
1901                         .apply_expected = True
1902                 },
1903                 .r2     = {
1904                         .owner          = &ctx->b,
1905                         .type           = WREPL_TYPE_MHOMED,
1906                         .state          = WREPL_STATE_TOMBSTONE,
1907                         .node           = WREPL_NODE_B,
1908                         .is_static      = False,
1909                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
1910                         .ips            = addresses_B_3_4,
1911                         .apply_expected = True
1912                 }
1913         },
1914
1915 /*
1916  * normal groups vs unique section,
1917  */
1918         /* 
1919          * group,active vs. unique,active
1920          * => should NOT be replaced
1921          */
1922         {
1923                 .line   = __location__,
1924                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1925                 .r1     = {
1926                         .owner          = &ctx->a,
1927                         .type           = WREPL_TYPE_GROUP,
1928                         .state          = WREPL_STATE_ACTIVE,
1929                         .node           = WREPL_NODE_B,
1930                         .is_static      = False,
1931                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1932                         .ips            = addresses_A_1,
1933                         .apply_expected = True
1934                 },
1935                 .r2     = {
1936                         .owner          = &ctx->b,
1937                         .type           = WREPL_TYPE_UNIQUE,
1938                         .state          = WREPL_STATE_ACTIVE,
1939                         .node           = WREPL_NODE_B,
1940                         .is_static      = False,
1941                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1942                         .ips            = addresses_A_1,
1943                         .apply_expected = False
1944                 }
1945         },
1946
1947         /* 
1948          * group,active vs. unique,tombstone
1949          * => should NOT be replaced
1950          */
1951         {
1952                 .line   = __location__,
1953                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1954                 .r1     = {
1955                         .owner          = &ctx->a,
1956                         .type           = WREPL_TYPE_GROUP,
1957                         .state          = WREPL_STATE_ACTIVE,
1958                         .node           = WREPL_NODE_B,
1959                         .is_static      = False,
1960                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1961                         .ips            = addresses_A_1,
1962                         .apply_expected = True
1963                 },
1964                 .r2     = {
1965                         .owner          = &ctx->b,
1966                         .type           = WREPL_TYPE_UNIQUE,
1967                         .state          = WREPL_STATE_TOMBSTONE,
1968                         .node           = WREPL_NODE_B,
1969                         .is_static      = False,
1970                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1971                         .ips            = addresses_A_1,
1972                         .apply_expected = False
1973                 }
1974         },
1975
1976         /* 
1977          * group,released vs. unique,active
1978          * => should NOT be replaced
1979          */
1980         {
1981                 .line   = __location__,
1982                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1983                 .r1     = {
1984                         .owner          = &ctx->a,
1985                         .type           = WREPL_TYPE_GROUP,
1986                         .state          = WREPL_STATE_RELEASED,
1987                         .node           = WREPL_NODE_B,
1988                         .is_static      = False,
1989                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1990                         .ips            = addresses_A_1,
1991                         .apply_expected = False
1992                 },
1993                 .r2     = {
1994                         .owner          = &ctx->b,
1995                         .type           = WREPL_TYPE_UNIQUE,
1996                         .state          = WREPL_STATE_ACTIVE,
1997                         .node           = WREPL_NODE_B,
1998                         .is_static      = False,
1999                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2000                         .ips            = addresses_A_1,
2001                         .apply_expected = False
2002                 }
2003         },
2004
2005         /* 
2006          * group,released vs. unique,tombstone
2007          * => should NOT be replaced
2008          */
2009         {
2010                 .line   = __location__,
2011                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2012                 .r1     = {
2013                         .owner          = &ctx->a,
2014                         .type           = WREPL_TYPE_GROUP,
2015                         .state          = WREPL_STATE_RELEASED,
2016                         .node           = WREPL_NODE_B,
2017                         .is_static      = False,
2018                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2019                         .ips            = addresses_A_1,
2020                         .apply_expected = False
2021                 },
2022                 .r2     = {
2023                         .owner          = &ctx->b,
2024                         .type           = WREPL_TYPE_UNIQUE,
2025                         .state          = WREPL_STATE_TOMBSTONE,
2026                         .node           = WREPL_NODE_B,
2027                         .is_static      = False,
2028                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2029                         .ips            = addresses_A_1,
2030                         .apply_expected = False
2031                 }
2032         },
2033
2034         /* 
2035          * group,tombstone vs. unique,active
2036          * => should NOT be replaced
2037          */
2038         {
2039                 .line   = __location__,
2040                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2041                 .r1     = {
2042                         .owner          = &ctx->a,
2043                         .type           = WREPL_TYPE_GROUP,
2044                         .state          = WREPL_STATE_TOMBSTONE,
2045                         .node           = WREPL_NODE_B,
2046                         .is_static      = False,
2047                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2048                         .ips            = addresses_A_1,
2049                         .apply_expected = True
2050                 },
2051                 .r2     = {
2052                         .owner          = &ctx->b,
2053                         .type           = WREPL_TYPE_UNIQUE,
2054                         .state          = WREPL_STATE_ACTIVE,
2055                         .node           = WREPL_NODE_B,
2056                         .is_static      = False,
2057                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2058                         .ips            = addresses_A_1,
2059                         .apply_expected = False
2060                 }
2061         },
2062
2063         /* 
2064          * group,tombstone vs. unique,tombstone
2065          * => should NOT be replaced
2066          */
2067         {
2068                 .line   = __location__,
2069                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2070                 .r1     = {
2071                         .owner          = &ctx->a,
2072                         .type           = WREPL_TYPE_GROUP,
2073                         .state          = WREPL_STATE_TOMBSTONE,
2074                         .node           = WREPL_NODE_B,
2075                         .is_static      = False,
2076                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2077                         .ips            = addresses_A_1,
2078                         .apply_expected = True
2079                 },
2080                 .r2     = {
2081                         .owner          = &ctx->b,
2082                         .type           = WREPL_TYPE_UNIQUE,
2083                         .state          = WREPL_STATE_TOMBSTONE,
2084                         .node           = WREPL_NODE_B,
2085                         .is_static      = False,
2086                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2087                         .ips            = addresses_A_1,
2088                         .apply_expected = False
2089                 }
2090         },
2091
2092 /*
2093  * normal groups vs normal groups section,
2094  */
2095         /* 
2096          * group,active vs. group,active
2097          * => should NOT be replaced
2098          */
2099         {
2100                 .line   = __location__,
2101                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2102                 .r1     = {
2103                         .owner          = &ctx->a,
2104                         .type           = WREPL_TYPE_GROUP,
2105                         .state          = WREPL_STATE_ACTIVE,
2106                         .node           = WREPL_NODE_B,
2107                         .is_static      = False,
2108                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2109                         .ips            = addresses_A_1,
2110                         .apply_expected = True
2111                 },
2112                 .r2     = {
2113                         .owner          = &ctx->b,
2114                         .type           = WREPL_TYPE_GROUP,
2115                         .state          = WREPL_STATE_ACTIVE,
2116                         .node           = WREPL_NODE_B,
2117                         .is_static      = False,
2118                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2119                         .ips            = addresses_A_1,
2120                         .apply_expected = False
2121                 }
2122         },
2123
2124         /* 
2125          * group,active vs. group,tombstone
2126          * => should NOT be replaced
2127          */
2128         {
2129                 .line   = __location__,
2130                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2131                 .r1     = {
2132                         .owner          = &ctx->a,
2133                         .type           = WREPL_TYPE_GROUP,
2134                         .state          = WREPL_STATE_ACTIVE,
2135                         .node           = WREPL_NODE_B,
2136                         .is_static      = False,
2137                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2138                         .ips            = addresses_A_1,
2139                         .apply_expected = True
2140                 },
2141                 .r2     = {
2142                         .owner          = &ctx->b,
2143                         .type           = WREPL_TYPE_GROUP,
2144                         .state          = WREPL_STATE_TOMBSTONE,
2145                         .node           = WREPL_NODE_B,
2146                         .is_static      = False,
2147                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2148                         .ips            = addresses_A_1,
2149                         .apply_expected = False
2150                 }
2151         },
2152
2153         /* 
2154          * group,released vs. group,active
2155          * => should be replaced
2156          */
2157         {
2158                 .line   = __location__,
2159                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2160                 .r1     = {
2161                         .owner          = &ctx->a,
2162                         .type           = WREPL_TYPE_GROUP,
2163                         .state          = WREPL_STATE_RELEASED,
2164                         .node           = WREPL_NODE_B,
2165                         .is_static      = False,
2166                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2167                         .ips            = addresses_A_1,
2168                         .apply_expected = False
2169                 },
2170                 .r2     = {
2171                         .owner          = &ctx->b,
2172                         .type           = WREPL_TYPE_GROUP,
2173                         .state          = WREPL_STATE_ACTIVE,
2174                         .node           = WREPL_NODE_B,
2175                         .is_static      = False,
2176                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2177                         .ips            = addresses_B_1,
2178                         .apply_expected = True
2179                 }
2180         },
2181
2182         /* 
2183          * group,released vs. group,tombstone
2184          * => should be replaced
2185          */
2186         {
2187                 .line   = __location__,
2188                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2189                 .r1     = {
2190                         .owner          = &ctx->a,
2191                         .type           = WREPL_TYPE_GROUP,
2192                         .state          = WREPL_STATE_RELEASED,
2193                         .node           = WREPL_NODE_B,
2194                         .is_static      = False,
2195                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2196                         .ips            = addresses_A_1,
2197                         .apply_expected = False
2198                 },
2199                 .r2     = {
2200                         .owner          = &ctx->b,
2201                         .type           = WREPL_TYPE_GROUP,
2202                         .state          = WREPL_STATE_TOMBSTONE,
2203                         .node           = WREPL_NODE_B,
2204                         .is_static      = False,
2205                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2206                         .ips            = addresses_B_1,
2207                         .apply_expected = True
2208                 }
2209         },
2210
2211         /* 
2212          * group,tombstone vs. group,active
2213          * => should be replaced
2214          */
2215         {
2216                 .line   = __location__,
2217                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2218                 .r1     = {
2219                         .owner          = &ctx->b,
2220                         .type           = WREPL_TYPE_GROUP,
2221                         .state          = WREPL_STATE_TOMBSTONE,
2222                         .node           = WREPL_NODE_B,
2223                         .is_static      = False,
2224                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2225                         .ips            = addresses_B_1,
2226                         .apply_expected = True
2227                 },
2228                 .r2     = {
2229                         .owner          = &ctx->a,
2230                         .type           = WREPL_TYPE_GROUP,
2231                         .state          = WREPL_STATE_ACTIVE,
2232                         .node           = WREPL_NODE_B,
2233                         .is_static      = False,
2234                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2235                         .ips            = addresses_A_1,
2236                         .apply_expected = True
2237                 }
2238         },
2239
2240         /* 
2241          * group,tombstone vs. group,tombstone
2242          * => should be replaced
2243          */
2244         {
2245                 .line   = __location__,
2246                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2247                 .r1     = {
2248                         .owner          = &ctx->a,
2249                         .type           = WREPL_TYPE_GROUP,
2250                         .state          = WREPL_STATE_TOMBSTONE,
2251                         .node           = WREPL_NODE_B,
2252                         .is_static      = False,
2253                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2254                         .ips            = addresses_A_1,
2255                         .apply_expected = True
2256                 },
2257                 .r2     = {
2258                         .owner          = &ctx->b,
2259                         .type           = WREPL_TYPE_GROUP,
2260                         .state          = WREPL_STATE_TOMBSTONE,
2261                         .node           = WREPL_NODE_B,
2262                         .is_static      = False,
2263                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2264                         .ips            = addresses_B_1,
2265                         .apply_expected = True
2266                 }
2267         },
2268
2269 /*
2270  * normal groups vs special groups section,
2271  */
2272         /* 
2273          * group,active vs. sgroup,active
2274          * => should NOT be replaced
2275          */
2276         {
2277                 .line   = __location__,
2278                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2279                 .r1     = {
2280                         .owner          = &ctx->b,
2281                         .type           = WREPL_TYPE_GROUP,
2282                         .state          = WREPL_STATE_ACTIVE,
2283                         .node           = WREPL_NODE_B,
2284                         .is_static      = False,
2285                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2286                         .ips            = addresses_B_1,
2287                         .apply_expected = True
2288                 },
2289                 .r2     = {
2290                         .owner          = &ctx->a,
2291                         .type           = WREPL_TYPE_SGROUP,
2292                         .state          = WREPL_STATE_ACTIVE,
2293                         .node           = WREPL_NODE_B,
2294                         .is_static      = False,
2295                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2296                         .ips            = addresses_B_1,
2297                         .apply_expected = False
2298                 }
2299         },
2300
2301         /* 
2302          * group,active vs. sgroup,tombstone
2303          * => should NOT be replaced
2304          */
2305         {
2306                 .line   = __location__,
2307                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2308                 .r1     = {
2309                         .owner          = &ctx->b,
2310                         .type           = WREPL_TYPE_GROUP,
2311                         .state          = WREPL_STATE_ACTIVE,
2312                         .node           = WREPL_NODE_B,
2313                         .is_static      = False,
2314                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2315                         .ips            = addresses_B_1,
2316                         .apply_expected = True
2317                 },
2318                 .r2     = {
2319                         .owner          = &ctx->a,
2320                         .type           = WREPL_TYPE_SGROUP,
2321                         .state          = WREPL_STATE_TOMBSTONE,
2322                         .node           = WREPL_NODE_B,
2323                         .is_static      = False,
2324                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2325                         .ips            = addresses_B_1,
2326                         .apply_expected = False
2327                 }
2328         },
2329
2330         /* 
2331          * group,released vs. sgroup,active
2332          * => should be replaced
2333          */
2334         {
2335                 .line   = __location__,
2336                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2337                 .r1     = {
2338                         .owner          = &ctx->a,
2339                         .type           = WREPL_TYPE_GROUP,
2340                         .state          = WREPL_STATE_RELEASED,
2341                         .node           = WREPL_NODE_B,
2342                         .is_static      = False,
2343                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2344                         .ips            = addresses_A_1,
2345                         .apply_expected = False
2346                 },
2347                 .r2     = {
2348                         .owner          = &ctx->b,
2349                         .type           = WREPL_TYPE_SGROUP,
2350                         .state          = WREPL_STATE_ACTIVE,
2351                         .node           = WREPL_NODE_B,
2352                         .is_static      = False,
2353                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2354                         .ips            = addresses_B_1,
2355                         .apply_expected = True
2356                 }
2357         },
2358
2359         /* 
2360          * group,released vs. sgroup,tombstone
2361          * => should NOT be replaced
2362          */
2363         {
2364                 .line   = __location__,
2365                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2366                 .r1     = {
2367                         .owner          = &ctx->b,
2368                         .type           = WREPL_TYPE_GROUP,
2369                         .state          = WREPL_STATE_RELEASED,
2370                         .node           = WREPL_NODE_B,
2371                         .is_static      = False,
2372                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2373                         .ips            = addresses_B_1,
2374                         .apply_expected = False
2375                 },
2376                 .r2     = {
2377                         .owner          = &ctx->a,
2378                         .type           = WREPL_TYPE_SGROUP,
2379                         .state          = WREPL_STATE_TOMBSTONE,
2380                         .node           = WREPL_NODE_B,
2381                         .is_static      = False,
2382                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2383                         .ips            = addresses_B_1,
2384                         .apply_expected = False
2385                 }
2386         },
2387
2388         /* 
2389          * group,tombstone vs. sgroup,active
2390          * => should be replaced
2391          */
2392         {
2393                 .line   = __location__,
2394                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2395                 .r1     = {
2396                         .owner          = &ctx->b,
2397                         .type           = WREPL_TYPE_GROUP,
2398                         .state          = WREPL_STATE_TOMBSTONE,
2399                         .node           = WREPL_NODE_B,
2400                         .is_static      = False,
2401                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2402                         .ips            = addresses_B_1,
2403                         .apply_expected = True
2404                 },
2405                 .r2     = {
2406                         .owner          = &ctx->a,
2407                         .type           = WREPL_TYPE_SGROUP,
2408                         .state          = WREPL_STATE_ACTIVE,
2409                         .node           = WREPL_NODE_B,
2410                         .is_static      = False,
2411                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2412                         .ips            = addresses_A_1,
2413                         .apply_expected = True
2414                 }
2415         },
2416
2417         /* 
2418          * group,tombstone vs. sgroup,tombstone
2419          * => should be replaced
2420          */
2421         {
2422                 .line   = __location__,
2423                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2424                 .r1     = {
2425                         .owner          = &ctx->a,
2426                         .type           = WREPL_TYPE_GROUP,
2427                         .state          = WREPL_STATE_TOMBSTONE,
2428                         .node           = WREPL_NODE_B,
2429                         .is_static      = False,
2430                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2431                         .ips            = addresses_A_1,
2432                         .apply_expected = True
2433                 },
2434                 .r2     = {
2435                         .owner          = &ctx->b,
2436                         .type           = WREPL_TYPE_SGROUP,
2437                         .state          = WREPL_STATE_TOMBSTONE,
2438                         .node           = WREPL_NODE_B,
2439                         .is_static      = False,
2440                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2441                         .ips            = addresses_B_1,
2442                         .apply_expected = True
2443                 }
2444         },
2445
2446 /*
2447  * normal groups vs multi homed section,
2448  */
2449         /* 
2450          * group,active vs. mhomed,active
2451          * => should NOT be replaced
2452          */
2453         {
2454                 .line   = __location__,
2455                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2456                 .r1     = {
2457                         .owner          = &ctx->b,
2458                         .type           = WREPL_TYPE_GROUP,
2459                         .state          = WREPL_STATE_ACTIVE,
2460                         .node           = WREPL_NODE_B,
2461                         .is_static      = False,
2462                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2463                         .ips            = addresses_B_1,
2464                         .apply_expected = True
2465                 },
2466                 .r2     = {
2467                         .owner          = &ctx->a,
2468                         .type           = WREPL_TYPE_MHOMED,
2469                         .state          = WREPL_STATE_ACTIVE,
2470                         .node           = WREPL_NODE_B,
2471                         .is_static      = False,
2472                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2473                         .ips            = addresses_B_1,
2474                         .apply_expected = False
2475                 }
2476         },
2477
2478         /* 
2479          * group,active vs. mhomed,tombstone
2480          * => should NOT be replaced
2481          */
2482         {
2483                 .line   = __location__,
2484                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2485                 .r1     = {
2486                         .owner          = &ctx->b,
2487                         .type           = WREPL_TYPE_GROUP,
2488                         .state          = WREPL_STATE_ACTIVE,
2489                         .node           = WREPL_NODE_B,
2490                         .is_static      = False,
2491                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2492                         .ips            = addresses_B_1,
2493                         .apply_expected = True
2494                 },
2495                 .r2     = {
2496                         .owner          = &ctx->a,
2497                         .type           = WREPL_TYPE_MHOMED,
2498                         .state          = WREPL_STATE_TOMBSTONE,
2499                         .node           = WREPL_NODE_B,
2500                         .is_static      = False,
2501                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2502                         .ips            = addresses_B_1,
2503                         .apply_expected = False
2504                 }
2505         },
2506
2507         /* 
2508          * group,released vs. mhomed,active
2509          * => should NOT be replaced
2510          */
2511         {
2512                 .line   = __location__,
2513                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2514                 .r1     = {
2515                         .owner          = &ctx->b,
2516                         .type           = WREPL_TYPE_GROUP,
2517                         .state          = WREPL_STATE_RELEASED,
2518                         .node           = WREPL_NODE_B,
2519                         .is_static      = False,
2520                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2521                         .ips            = addresses_B_1,
2522                         .apply_expected = False
2523                 },
2524                 .r2     = {
2525                         .owner          = &ctx->a,
2526                         .type           = WREPL_TYPE_MHOMED,
2527                         .state          = WREPL_STATE_ACTIVE,
2528                         .node           = WREPL_NODE_B,
2529                         .is_static      = False,
2530                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2531                         .ips            = addresses_B_1,
2532                         .apply_expected = False
2533                 }
2534         },
2535
2536         /* 
2537          * group,released vs. mhomed,tombstone
2538          * => should NOT be replaced
2539          */
2540         {
2541                 .line   = __location__,
2542                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2543                 .r1     = {
2544                         .owner          = &ctx->b,
2545                         .type           = WREPL_TYPE_GROUP,
2546                         .state          = WREPL_STATE_RELEASED,
2547                         .node           = WREPL_NODE_B,
2548                         .is_static      = False,
2549                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2550                         .ips            = addresses_B_1,
2551                         .apply_expected = False
2552                 },
2553                 .r2     = {
2554                         .owner          = &ctx->a,
2555                         .type           = WREPL_TYPE_MHOMED,
2556                         .state          = WREPL_STATE_TOMBSTONE,
2557                         .node           = WREPL_NODE_B,
2558                         .is_static      = False,
2559                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2560                         .ips            = addresses_B_1,
2561                         .apply_expected = False
2562                 }
2563         },
2564
2565         /* 
2566          * group,tombstone vs. mhomed,active
2567          * => should be replaced
2568          */
2569         {
2570                 .line   = __location__,
2571                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2572                 .r1     = {
2573                         .owner          = &ctx->b,
2574                         .type           = WREPL_TYPE_GROUP,
2575                         .state          = WREPL_STATE_TOMBSTONE,
2576                         .node           = WREPL_NODE_B,
2577                         .is_static      = False,
2578                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2579                         .ips            = addresses_B_1,
2580                         .apply_expected = True
2581                 },
2582                 .r2     = {
2583                         .owner          = &ctx->a,
2584                         .type           = WREPL_TYPE_MHOMED,
2585                         .state          = WREPL_STATE_ACTIVE,
2586                         .node           = WREPL_NODE_B,
2587                         .is_static      = False,
2588                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2589                         .ips            = addresses_A_1,
2590                         .apply_expected = True
2591                 }
2592         },
2593
2594         /* 
2595          * group,tombstone vs. mhomed,tombstone
2596          * => should be replaced
2597          */
2598         {
2599                 .line   = __location__,
2600                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2601                 .r1     = {
2602                         .owner          = &ctx->a,
2603                         .type           = WREPL_TYPE_GROUP,
2604                         .state          = WREPL_STATE_TOMBSTONE,
2605                         .node           = WREPL_NODE_B,
2606                         .is_static      = False,
2607                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2608                         .ips            = addresses_A_1,
2609                         .apply_expected = True
2610                 },
2611                 .r2     = {
2612                         .owner          = &ctx->b,
2613                         .type           = WREPL_TYPE_MHOMED,
2614                         .state          = WREPL_STATE_TOMBSTONE,
2615                         .node           = WREPL_NODE_B,
2616                         .is_static      = False,
2617                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2618                         .ips            = addresses_B_1,
2619                         .apply_expected = True
2620                 }
2621         },
2622
2623 /*
2624  * special groups vs unique section,
2625  */
2626         /* 
2627          * sgroup,active vs. unique,active
2628          * => should NOT be replaced
2629          */
2630         {
2631                 .line   = __location__,
2632                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2633                 .r1     = {
2634                         .owner          = &ctx->b,
2635                         .type           = WREPL_TYPE_SGROUP,
2636                         .state          = WREPL_STATE_ACTIVE,
2637                         .node           = WREPL_NODE_B,
2638                         .is_static      = False,
2639                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2640                         .ips            = addresses_B_1,
2641                         .apply_expected = True
2642                 },
2643                 .r2     = {
2644                         .owner          = &ctx->a,
2645                         .type           = WREPL_TYPE_UNIQUE,
2646                         .state          = WREPL_STATE_ACTIVE,
2647                         .node           = WREPL_NODE_B,
2648                         .is_static      = False,
2649                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2650                         .ips            = addresses_B_1,
2651                         .apply_expected = False
2652                 }
2653         },
2654
2655         /* 
2656          * sgroup,active vs. unique,tombstone
2657          * => should NOT be replaced
2658          */
2659         {
2660                 .line   = __location__,
2661                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2662                 .r1     = {
2663                         .owner          = &ctx->b,
2664                         .type           = WREPL_TYPE_SGROUP,
2665                         .state          = WREPL_STATE_ACTIVE,
2666                         .node           = WREPL_NODE_B,
2667                         .is_static      = False,
2668                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2669                         .ips            = addresses_B_1,
2670                         .apply_expected = True
2671                 },
2672                 .r2     = {
2673                         .owner          = &ctx->a,
2674                         .type           = WREPL_TYPE_UNIQUE,
2675                         .state          = WREPL_STATE_TOMBSTONE,
2676                         .node           = WREPL_NODE_B,
2677                         .is_static      = False,
2678                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2679                         .ips            = addresses_B_1,
2680                         .apply_expected = False
2681                 }
2682         },
2683
2684         /* 
2685          * sgroup,released vs. unique,active
2686          * => should be replaced
2687          */
2688         {
2689                 .line   = __location__,
2690                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2691                 .r1     = {
2692                         .owner          = &ctx->b,
2693                         .type           = WREPL_TYPE_SGROUP,
2694                         .state          = WREPL_STATE_RELEASED,
2695                         .node           = WREPL_NODE_B,
2696                         .is_static      = False,
2697                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2698                         .ips            = addresses_B_1,
2699                         .apply_expected = False
2700                 },
2701                 .r2     = {
2702                         .owner          = &ctx->a,
2703                         .type           = WREPL_TYPE_UNIQUE,
2704                         .state          = WREPL_STATE_ACTIVE,
2705                         .node           = WREPL_NODE_B,
2706                         .is_static      = False,
2707                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2708                         .ips            = addresses_A_1,
2709                         .apply_expected = True
2710                 }
2711         },
2712
2713         /* 
2714          * sgroup,released vs. unique,tombstone
2715          * => should be replaced
2716          */
2717         {
2718                 .line   = __location__,
2719                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2720                 .r1     = {
2721                         .owner          = &ctx->a,
2722                         .type           = WREPL_TYPE_SGROUP,
2723                         .state          = WREPL_STATE_RELEASED,
2724                         .node           = WREPL_NODE_B,
2725                         .is_static      = False,
2726                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2727                         .ips            = addresses_A_1,
2728                         .apply_expected = False
2729                 },
2730                 .r2     = {
2731                         .owner          = &ctx->b,
2732                         .type           = WREPL_TYPE_UNIQUE,
2733                         .state          = WREPL_STATE_TOMBSTONE,
2734                         .node           = WREPL_NODE_B,
2735                         .is_static      = False,
2736                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2737                         .ips            = addresses_B_1,
2738                         .apply_expected = True
2739                 }
2740         },
2741
2742         /* 
2743          * sgroup,tombstone vs. unique,active
2744          * => should be replaced
2745          */
2746         {
2747                 .line   = __location__,
2748                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2749                 .r1     = {
2750                         .owner          = &ctx->a,
2751                         .type           = WREPL_TYPE_SGROUP,
2752                         .state          = WREPL_STATE_TOMBSTONE,
2753                         .node           = WREPL_NODE_B,
2754                         .is_static      = False,
2755                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2756                         .ips            = addresses_A_1,
2757                         .apply_expected = True
2758                 },
2759                 .r2     = {
2760                         .owner          = &ctx->b,
2761                         .type           = WREPL_TYPE_UNIQUE,
2762                         .state          = WREPL_STATE_ACTIVE,
2763                         .node           = WREPL_NODE_B,
2764                         .is_static      = False,
2765                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2766                         .ips            = addresses_B_1,
2767                         .apply_expected = True
2768                 }
2769         },
2770
2771         /* 
2772          * sgroup,tombstone vs. unique,tombstone
2773          * => should be replaced
2774          */
2775         {
2776                 .line   = __location__,
2777                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2778                 .r1     = {
2779                         .owner          = &ctx->b,
2780                         .type           = WREPL_TYPE_SGROUP,
2781                         .state          = WREPL_STATE_TOMBSTONE,
2782                         .node           = WREPL_NODE_B,
2783                         .is_static      = False,
2784                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2785                         .ips            = addresses_B_1,
2786                         .apply_expected = True
2787                 },
2788                 .r2     = {
2789                         .owner          = &ctx->a,
2790                         .type           = WREPL_TYPE_UNIQUE,
2791                         .state          = WREPL_STATE_TOMBSTONE,
2792                         .node           = WREPL_NODE_B,
2793                         .is_static      = False,
2794                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2795                         .ips            = addresses_A_1,
2796                         .apply_expected = True
2797                 }
2798         },
2799
2800 /*
2801  * special groups vs normal group section,
2802  */
2803         /* 
2804          * sgroup,active vs. group,active
2805          * => should NOT be replaced
2806          */
2807         {
2808                 .line   = __location__,
2809                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2810                 .r1     = {
2811                         .owner          = &ctx->a,
2812                         .type           = WREPL_TYPE_SGROUP,
2813                         .state          = WREPL_STATE_ACTIVE,
2814                         .node           = WREPL_NODE_B,
2815                         .is_static      = False,
2816                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2817                         .ips            = addresses_A_1,
2818                         .apply_expected = True
2819                 },
2820                 .r2     = {
2821                         .owner          = &ctx->b,
2822                         .type           = WREPL_TYPE_GROUP,
2823                         .state          = WREPL_STATE_ACTIVE,
2824                         .node           = WREPL_NODE_B,
2825                         .is_static      = False,
2826                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2827                         .ips            = addresses_A_1,
2828                         .apply_expected = False
2829                 }
2830         },
2831
2832         /* 
2833          * sgroup,active vs. group,tombstone
2834          * => should NOT be replaced
2835          */
2836         {
2837                 .line   = __location__,
2838                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2839                 .r1     = {
2840                         .owner          = &ctx->a,
2841                         .type           = WREPL_TYPE_SGROUP,
2842                         .state          = WREPL_STATE_ACTIVE,
2843                         .node           = WREPL_NODE_B,
2844                         .is_static      = False,
2845                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2846                         .ips            = addresses_A_1,
2847                         .apply_expected = True
2848                 },
2849                 .r2     = {
2850                         .owner          = &ctx->b,
2851                         .type           = WREPL_TYPE_GROUP,
2852                         .state          = WREPL_STATE_TOMBSTONE,
2853                         .node           = WREPL_NODE_B,
2854                         .is_static      = False,
2855                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2856                         .ips            = addresses_A_1,
2857                         .apply_expected = False
2858                 }
2859         },
2860
2861         /* 
2862          * sgroup,released vs. group,active
2863          * => should be replaced
2864          */
2865         {
2866                 .line   = __location__,
2867                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2868                 .r1     = {
2869                         .owner          = &ctx->a,
2870                         .type           = WREPL_TYPE_SGROUP,
2871                         .state          = WREPL_STATE_RELEASED,
2872                         .node           = WREPL_NODE_B,
2873                         .is_static      = False,
2874                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2875                         .ips            = addresses_A_1,
2876                         .apply_expected = False
2877                 },
2878                 .r2     = {
2879                         .owner          = &ctx->b,
2880                         .type           = WREPL_TYPE_GROUP,
2881                         .state          = WREPL_STATE_ACTIVE,
2882                         .node           = WREPL_NODE_B,
2883                         .is_static      = False,
2884                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2885                         .ips            = addresses_B_1,
2886                         .apply_expected = True
2887                 }
2888         },
2889
2890         /* 
2891          * sgroup,released vs. group,tombstone
2892          * => should be replaced
2893          */
2894         {
2895                 .line   = __location__,
2896                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2897                 .r1     = {
2898                         .owner          = &ctx->b,
2899                         .type           = WREPL_TYPE_SGROUP,
2900                         .state          = WREPL_STATE_RELEASED,
2901                         .node           = WREPL_NODE_B,
2902                         .is_static      = False,
2903                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2904                         .ips            = addresses_B_1,
2905                         .apply_expected = False
2906                 },
2907                 .r2     = {
2908                         .owner          = &ctx->a,
2909                         .type           = WREPL_TYPE_GROUP,
2910                         .state          = WREPL_STATE_TOMBSTONE,
2911                         .node           = WREPL_NODE_B,
2912                         .is_static      = False,
2913                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2914                         .ips            = addresses_A_1,
2915                         .apply_expected = True
2916                 }
2917         },
2918
2919         /* 
2920          * sgroup,tombstone vs. group,active
2921          * => should NOT be replaced
2922          */
2923         {
2924                 .line   = __location__,
2925                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2926                 .r1     = {
2927                         .owner          = &ctx->a,
2928                         .type           = WREPL_TYPE_SGROUP,
2929                         .state          = WREPL_STATE_TOMBSTONE,
2930                         .node           = WREPL_NODE_B,
2931                         .is_static      = False,
2932                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2933                         .ips            = addresses_A_1,
2934                         .apply_expected = True
2935                 },
2936                 .r2     = {
2937                         .owner          = &ctx->b,
2938                         .type           = WREPL_TYPE_GROUP,
2939                         .state          = WREPL_STATE_ACTIVE,
2940                         .node           = WREPL_NODE_B,
2941                         .is_static      = False,
2942                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2943                         .ips            = addresses_B_1,
2944                         .apply_expected = True
2945                 }
2946         },
2947
2948         /* 
2949          * sgroup,tombstone vs. group,tombstone
2950          * => should NOT be replaced
2951          */
2952         {
2953                 .line   = __location__,
2954                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2955                 .r1     = {
2956                         .owner          = &ctx->b,
2957                         .type           = WREPL_TYPE_SGROUP,
2958                         .state          = WREPL_STATE_TOMBSTONE,
2959                         .node           = WREPL_NODE_B,
2960                         .is_static      = False,
2961                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2962                         .ips            = addresses_B_1,
2963                         .apply_expected = True
2964                 },
2965                 .r2     = {
2966                         .owner          = &ctx->a,
2967                         .type           = WREPL_TYPE_GROUP,
2968                         .state          = WREPL_STATE_TOMBSTONE,
2969                         .node           = WREPL_NODE_B,
2970                         .is_static      = False,
2971                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2972                         .ips            = addresses_A_1,
2973                         .apply_expected = True
2974                 }
2975         },
2976
2977 /*
2978  * special groups (not active) vs special group section,
2979  */
2980         /* 
2981          * sgroup,released vs. sgroup,active
2982          * => should be replaced
2983          */
2984         {
2985                 .line   = __location__,
2986                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2987                 .r1     = {
2988                         .owner          = &ctx->a,
2989                         .type           = WREPL_TYPE_SGROUP,
2990                         .state          = WREPL_STATE_RELEASED,
2991                         .node           = WREPL_NODE_B,
2992                         .is_static      = False,
2993                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2994                         .ips            = addresses_A_1,
2995                         .apply_expected = False
2996                 },
2997                 .r2     = {
2998                         .owner          = &ctx->b,
2999                         .type           = WREPL_TYPE_SGROUP,
3000                         .state          = WREPL_STATE_ACTIVE,
3001                         .node           = WREPL_NODE_B,
3002                         .is_static      = False,
3003                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3004                         .ips            = addresses_B_1,
3005                         .apply_expected = True
3006                 }
3007         },
3008
3009         /* 
3010          * sgroup,released vs. sgroup,tombstone
3011          * => should be replaced
3012          */
3013         {
3014                 .line   = __location__,
3015                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3016                 .r1     = {
3017                         .owner          = &ctx->b,
3018                         .type           = WREPL_TYPE_SGROUP,
3019                         .state          = WREPL_STATE_RELEASED,
3020                         .node           = WREPL_NODE_B,
3021                         .is_static      = False,
3022                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3023                         .ips            = addresses_B_1,
3024                         .apply_expected = False
3025                 },
3026                 .r2     = {
3027                         .owner          = &ctx->a,
3028                         .type           = WREPL_TYPE_SGROUP,
3029                         .state          = WREPL_STATE_TOMBSTONE,
3030                         .node           = WREPL_NODE_B,
3031                         .is_static      = False,
3032                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3033                         .ips            = addresses_A_1,
3034                         .apply_expected = True
3035                 }
3036         },
3037
3038         /* 
3039          * sgroup,tombstone vs. sgroup,active
3040          * => should NOT be replaced
3041          */
3042         {
3043                 .line   = __location__,
3044                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3045                 .r1     = {
3046                         .owner          = &ctx->a,
3047                         .type           = WREPL_TYPE_SGROUP,
3048                         .state          = WREPL_STATE_TOMBSTONE,
3049                         .node           = WREPL_NODE_B,
3050                         .is_static      = False,
3051                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3052                         .ips            = addresses_A_1,
3053                         .apply_expected = True
3054                 },
3055                 .r2     = {
3056                         .owner          = &ctx->b,
3057                         .type           = WREPL_TYPE_SGROUP,
3058                         .state          = WREPL_STATE_ACTIVE,
3059                         .node           = WREPL_NODE_B,
3060                         .is_static      = False,
3061                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3062                         .ips            = addresses_B_1,
3063                         .apply_expected = True
3064                 }
3065         },
3066
3067         /* 
3068          * sgroup,tombstone vs. sgroup,tombstone
3069          * => should NOT be replaced
3070          */
3071         {
3072                 .line   = __location__,
3073                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3074                 .r1     = {
3075                         .owner          = &ctx->b,
3076                         .type           = WREPL_TYPE_SGROUP,
3077                         .state          = WREPL_STATE_TOMBSTONE,
3078                         .node           = WREPL_NODE_B,
3079                         .is_static      = False,
3080                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3081                         .ips            = addresses_B_1,
3082                         .apply_expected = True
3083                 },
3084                 .r2     = {
3085                         .owner          = &ctx->a,
3086                         .type           = WREPL_TYPE_SGROUP,
3087                         .state          = WREPL_STATE_TOMBSTONE,
3088                         .node           = WREPL_NODE_B,
3089                         .is_static      = False,
3090                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3091                         .ips            = addresses_A_1,
3092                         .apply_expected = True
3093                 }
3094         },
3095
3096 /*
3097  * special groups vs multi homed section,
3098  */
3099         /* 
3100          * sgroup,active vs. mhomed,active
3101          * => should NOT be replaced
3102          */
3103         {
3104                 .line   = __location__,
3105                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3106                 .r1     = {
3107                         .owner          = &ctx->a,
3108                         .type           = WREPL_TYPE_SGROUP,
3109                         .state          = WREPL_STATE_ACTIVE,
3110                         .node           = WREPL_NODE_B,
3111                         .is_static      = False,
3112                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3113                         .ips            = addresses_A_1,
3114                         .apply_expected = True
3115                 },
3116                 .r2     = {
3117                         .owner          = &ctx->b,
3118                         .type           = WREPL_TYPE_MHOMED,
3119                         .state          = WREPL_STATE_ACTIVE,
3120                         .node           = WREPL_NODE_B,
3121                         .is_static      = False,
3122                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3123                         .ips            = addresses_A_1,
3124                         .apply_expected = False
3125                 }
3126         },
3127
3128         /* 
3129          * sgroup,active vs. mhomed,tombstone
3130          * => should NOT be replaced
3131          */
3132         {
3133                 .line   = __location__,
3134                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3135                 .r1     = {
3136                         .owner          = &ctx->a,
3137                         .type           = WREPL_TYPE_SGROUP,
3138                         .state          = WREPL_STATE_ACTIVE,
3139                         .node           = WREPL_NODE_B,
3140                         .is_static      = False,
3141                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3142                         .ips            = addresses_A_1,
3143                         .apply_expected = True
3144                 },
3145                 .r2     = {
3146                         .owner          = &ctx->b,
3147                         .type           = WREPL_TYPE_MHOMED,
3148                         .state          = WREPL_STATE_TOMBSTONE,
3149                         .node           = WREPL_NODE_B,
3150                         .is_static      = False,
3151                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3152                         .ips            = addresses_A_1,
3153                         .apply_expected = False
3154                 }
3155         },
3156
3157         /* 
3158          * sgroup,released vs. mhomed,active
3159          * => should be replaced
3160          */
3161         {
3162                 .line   = __location__,
3163                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3164                 .r1     = {
3165                         .owner          = &ctx->a,
3166                         .type           = WREPL_TYPE_SGROUP,
3167                         .state          = WREPL_STATE_RELEASED,
3168                         .node           = WREPL_NODE_B,
3169                         .is_static      = False,
3170                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3171                         .ips            = addresses_A_1,
3172                         .apply_expected = False
3173                 },
3174                 .r2     = {
3175                         .owner          = &ctx->b,
3176                         .type           = WREPL_TYPE_MHOMED,
3177                         .state          = WREPL_STATE_ACTIVE,
3178                         .node           = WREPL_NODE_B,
3179                         .is_static      = False,
3180                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3181                         .ips            = addresses_B_1,
3182                         .apply_expected = True
3183                 }
3184         },
3185
3186         /* 
3187          * sgroup,released vs. mhomed,tombstone
3188          * => should be replaced
3189          */
3190         {
3191                 .line   = __location__,
3192                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3193                 .r1     = {
3194                         .owner          = &ctx->b,
3195                         .type           = WREPL_TYPE_SGROUP,
3196                         .state          = WREPL_STATE_RELEASED,
3197                         .node           = WREPL_NODE_B,
3198                         .is_static      = False,
3199                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3200                         .ips            = addresses_B_1,
3201                         .apply_expected = False
3202                 },
3203                 .r2     = {
3204                         .owner          = &ctx->a,
3205                         .type           = WREPL_TYPE_MHOMED,
3206                         .state          = WREPL_STATE_TOMBSTONE,
3207                         .node           = WREPL_NODE_B,
3208                         .is_static      = False,
3209                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3210                         .ips            = addresses_A_1,
3211                         .apply_expected = True
3212                 }
3213         },
3214
3215         /* 
3216          * sgroup,tombstone vs. mhomed,active
3217          * => should be replaced
3218          */
3219         {
3220                 .line   = __location__,
3221                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3222                 .r1     = {
3223                         .owner          = &ctx->a,
3224                         .type           = WREPL_TYPE_SGROUP,
3225                         .state          = WREPL_STATE_TOMBSTONE,
3226                         .node           = WREPL_NODE_B,
3227                         .is_static      = False,
3228                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3229                         .ips            = addresses_A_1,
3230                         .apply_expected = True
3231                 },
3232                 .r2     = {
3233                         .owner          = &ctx->b,
3234                         .type           = WREPL_TYPE_MHOMED,
3235                         .state          = WREPL_STATE_ACTIVE,
3236                         .node           = WREPL_NODE_B,
3237                         .is_static      = False,
3238                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3239                         .ips            = addresses_B_1,
3240                         .apply_expected = True
3241                 }
3242         },
3243
3244         /* 
3245          * sgroup,tombstone vs. mhomed,tombstone
3246          * => should be replaced
3247          */
3248         {
3249                 .line   = __location__,
3250                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3251                 .r1     = {
3252                         .owner          = &ctx->b,
3253                         .type           = WREPL_TYPE_SGROUP,
3254                         .state          = WREPL_STATE_TOMBSTONE,
3255                         .node           = WREPL_NODE_B,
3256                         .is_static      = False,
3257                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3258                         .ips            = addresses_B_1,
3259                         .apply_expected = True
3260                 },
3261                 .r2     = {
3262                         .owner          = &ctx->a,
3263                         .type           = WREPL_TYPE_MHOMED,
3264                         .state          = WREPL_STATE_TOMBSTONE,
3265                         .node           = WREPL_NODE_B,
3266                         .is_static      = False,
3267                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3268                         .ips            = addresses_A_1,
3269                         .apply_expected = True
3270                 }
3271         },
3272
3273 /*
3274  * multi homed vs. unique section,
3275  */
3276         /* 
3277          * mhomed,active vs. unique,active
3278          * => should be replaced
3279          */
3280         {
3281                 .line   = __location__,
3282                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3283                 .r1     = {
3284                         .owner          = &ctx->a,
3285                         .type           = WREPL_TYPE_MHOMED,
3286                         .state          = WREPL_STATE_ACTIVE,
3287                         .node           = WREPL_NODE_B,
3288                         .is_static      = False,
3289                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
3290                         .ips            = addresses_A_3_4,
3291                         .apply_expected = True
3292                 },
3293                 .r2     = {
3294                         .owner          = &ctx->b,
3295                         .type           = WREPL_TYPE_UNIQUE,
3296                         .state          = WREPL_STATE_ACTIVE,
3297                         .node           = WREPL_NODE_B,
3298                         .is_static      = False,
3299                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3300                         .ips            = addresses_B_1,
3301                         .apply_expected = True
3302                 }
3303         },
3304
3305         /* 
3306          * mhomed,active vs. unique,tombstone
3307          * => should NOT be replaced
3308          */
3309         {
3310                 .line   = __location__,
3311                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3312                 .r1     = {
3313                         .owner          = &ctx->b,
3314                         .type           = WREPL_TYPE_MHOMED,
3315                         .state          = WREPL_STATE_ACTIVE,
3316                         .node           = WREPL_NODE_B,
3317                         .is_static      = False,
3318                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3319                         .ips            = addresses_B_1,
3320                         .apply_expected = True
3321                 },
3322                 .r2     = {
3323                         .owner          = &ctx->a,
3324                         .type           = WREPL_TYPE_UNIQUE,
3325                         .state          = WREPL_STATE_TOMBSTONE,
3326                         .node           = WREPL_NODE_B,
3327                         .is_static      = False,
3328                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3329                         .ips            = addresses_B_1,
3330                         .apply_expected = False
3331                 }
3332         },
3333
3334         /* 
3335          * mhomed,released vs. unique,active
3336          * => should be replaced
3337          */
3338         {
3339                 .line   = __location__,
3340                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3341                 .r1     = {
3342                         .owner          = &ctx->a,
3343                         .type           = WREPL_TYPE_MHOMED,
3344                         .state          = WREPL_STATE_RELEASED,
3345                         .node           = WREPL_NODE_B,
3346                         .is_static      = False,
3347                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3348                         .ips            = addresses_A_1,
3349                         .apply_expected = False
3350                 },
3351                 .r2     = {
3352                         .owner          = &ctx->b,
3353                         .type           = WREPL_TYPE_UNIQUE,
3354                         .state          = WREPL_STATE_ACTIVE,
3355                         .node           = WREPL_NODE_B,
3356                         .is_static      = False,
3357                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3358                         .ips            = addresses_B_1,
3359                         .apply_expected = True
3360                 }
3361         },
3362
3363         /* 
3364          * mhomed,released vs. uinique,tombstone
3365          * => should be replaced
3366          */
3367         {
3368                 .line   = __location__,
3369                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3370                 .r1     = {
3371                         .owner          = &ctx->b,
3372                         .type           = WREPL_TYPE_MHOMED,
3373                         .state          = WREPL_STATE_RELEASED,
3374                         .node           = WREPL_NODE_B,
3375                         .is_static      = False,
3376                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3377                         .ips            = addresses_B_1,
3378                         .apply_expected = False
3379                 },
3380                 .r2     = {
3381                         .owner          = &ctx->a,
3382                         .type           = WREPL_TYPE_UNIQUE,
3383                         .state          = WREPL_STATE_TOMBSTONE,
3384                         .node           = WREPL_NODE_B,
3385                         .is_static      = False,
3386                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3387                         .ips            = addresses_A_1,
3388                         .apply_expected = True
3389                 }
3390         },
3391
3392         /* 
3393          * mhomed,tombstone vs. unique,active
3394          * => should be replaced
3395          */
3396         {
3397                 .line   = __location__,
3398                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3399                 .r1     = {
3400                         .owner          = &ctx->a,
3401                         .type           = WREPL_TYPE_MHOMED,
3402                         .state          = WREPL_STATE_TOMBSTONE,
3403                         .node           = WREPL_NODE_B,
3404                         .is_static      = False,
3405                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3406                         .ips            = addresses_A_1,
3407                         .apply_expected = True
3408                 },
3409                 .r2     = {
3410                         .owner          = &ctx->b,
3411                         .type           = WREPL_TYPE_UNIQUE,
3412                         .state          = WREPL_STATE_ACTIVE,
3413                         .node           = WREPL_NODE_B,
3414                         .is_static      = False,
3415                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3416                         .ips            = addresses_B_1,
3417                         .apply_expected = True
3418                 }
3419         },
3420
3421         /* 
3422          * mhomed,tombstone vs. uinique,tombstone
3423          * => should be replaced
3424          */
3425         {
3426                 .line   = __location__,
3427                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3428                 .r1     = {
3429                         .owner          = &ctx->b,
3430                         .type           = WREPL_TYPE_MHOMED,
3431                         .state          = WREPL_STATE_TOMBSTONE,
3432                         .node           = WREPL_NODE_B,
3433                         .is_static      = False,
3434                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3435                         .ips            = addresses_B_1,
3436                         .apply_expected = True
3437                 },
3438                 .r2     = {
3439                         .owner          = &ctx->a,
3440                         .type           = WREPL_TYPE_UNIQUE,
3441                         .state          = WREPL_STATE_TOMBSTONE,
3442                         .node           = WREPL_NODE_B,
3443                         .is_static      = False,
3444                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3445                         .ips            = addresses_A_1,
3446                         .apply_expected = True
3447                 }
3448         },
3449
3450 /*
3451  * multi homed vs. normal group section,
3452  */
3453         /* 
3454          * mhomed,active vs. group,active
3455          * => should be replaced
3456          */
3457         {
3458                 .line   = __location__,
3459                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3460                 .r1     = {
3461                         .owner          = &ctx->a,
3462                         .type           = WREPL_TYPE_MHOMED,
3463                         .state          = WREPL_STATE_ACTIVE,
3464                         .node           = WREPL_NODE_B,
3465                         .is_static      = False,
3466                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3467                         .ips            = addresses_A_1,
3468                         .apply_expected = True
3469                 },
3470                 .r2     = {
3471                         .owner          = &ctx->b,
3472                         .type           = WREPL_TYPE_GROUP,
3473                         .state          = WREPL_STATE_ACTIVE,
3474                         .node           = WREPL_NODE_B,
3475                         .is_static      = False,
3476                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3477                         .ips            = addresses_B_1,
3478                         .apply_expected = True
3479                 }
3480         },
3481
3482         /* 
3483          * mhomed,active vs. group,tombstone
3484          * => should NOT be replaced
3485          */
3486         {
3487                 .line   = __location__,
3488                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3489                 .r1     = {
3490                         .owner          = &ctx->b,
3491                         .type           = WREPL_TYPE_MHOMED,
3492                         .state          = WREPL_STATE_ACTIVE,
3493                         .node           = WREPL_NODE_B,
3494                         .is_static      = False,
3495                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3496                         .ips            = addresses_B_1,
3497                         .apply_expected = True
3498                 },
3499                 .r2     = {
3500                         .owner          = &ctx->a,
3501                         .type           = WREPL_TYPE_GROUP,
3502                         .state          = WREPL_STATE_TOMBSTONE,
3503                         .node           = WREPL_NODE_B,
3504                         .is_static      = False,
3505                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3506                         .ips            = addresses_B_1,
3507                         .apply_expected = False
3508                 }
3509         },
3510
3511         /* 
3512          * mhomed,released vs. group,active
3513          * => should be replaced
3514          */
3515         {
3516                 .line   = __location__,
3517                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3518                 .r1     = {
3519                         .owner          = &ctx->b,
3520                         .type           = WREPL_TYPE_MHOMED,
3521                         .state          = WREPL_STATE_RELEASED,
3522                         .node           = WREPL_NODE_B,
3523                         .is_static      = False,
3524                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3525                         .ips            = addresses_B_1,
3526                         .apply_expected = False
3527                 },
3528                 .r2     = {
3529                         .owner          = &ctx->a,
3530                         .type           = WREPL_TYPE_GROUP,
3531                         .state          = WREPL_STATE_ACTIVE,
3532                         .node           = WREPL_NODE_B,
3533                         .is_static      = False,
3534                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3535                         .ips            = addresses_A_1,
3536                         .apply_expected = True
3537                 }
3538         },
3539
3540         /* 
3541          * mhomed,released vs. group,tombstone
3542          * => should be replaced
3543          */
3544         {
3545                 .line   = __location__,
3546                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3547                 .r1     = {
3548                         .owner          = &ctx->a,
3549                         .type           = WREPL_TYPE_MHOMED,
3550                         .state          = WREPL_STATE_RELEASED,
3551                         .node           = WREPL_NODE_B,
3552                         .is_static      = False,
3553                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3554                         .ips            = addresses_A_1,
3555                         .apply_expected = False
3556                 },
3557                 .r2     = {
3558                         .owner          = &ctx->b,
3559                         .type           = WREPL_TYPE_GROUP,
3560                         .state          = WREPL_STATE_TOMBSTONE,
3561                         .node           = WREPL_NODE_B,
3562                         .is_static      = False,
3563                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3564                         .ips            = addresses_B_1,
3565                         .apply_expected = True
3566                 }
3567         },
3568
3569         /* 
3570          * mhomed,tombstone vs. group,active
3571          * => should be replaced
3572          */
3573         {
3574                 .line   = __location__,
3575                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3576                 .r1     = {
3577                         .owner          = &ctx->b,
3578                         .type           = WREPL_TYPE_MHOMED,
3579                         .state          = WREPL_STATE_TOMBSTONE,
3580                         .node           = WREPL_NODE_B,
3581                         .is_static      = False,
3582                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3583                         .ips            = addresses_B_1,
3584                         .apply_expected = True
3585                 },
3586                 .r2     = {
3587                         .owner          = &ctx->a,
3588                         .type           = WREPL_TYPE_GROUP,
3589                         .state          = WREPL_STATE_ACTIVE,
3590                         .node           = WREPL_NODE_B,
3591                         .is_static      = False,
3592                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3593                         .ips            = addresses_A_1,
3594                         .apply_expected = True
3595                 }
3596         },
3597
3598         /* 
3599          * mhomed,tombstone vs. group,tombstone
3600          * => should be replaced
3601          */
3602         {
3603                 .line   = __location__,
3604                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3605                 .r1     = {
3606                         .owner          = &ctx->a,
3607                         .type           = WREPL_TYPE_MHOMED,
3608                         .state          = WREPL_STATE_TOMBSTONE,
3609                         .node           = WREPL_NODE_B,
3610                         .is_static      = False,
3611                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3612                         .ips            = addresses_A_1,
3613                         .apply_expected = True
3614                 },
3615                 .r2     = {
3616                         .owner          = &ctx->b,
3617                         .type           = WREPL_TYPE_GROUP,
3618                         .state          = WREPL_STATE_TOMBSTONE,
3619                         .node           = WREPL_NODE_B,
3620                         .is_static      = False,
3621                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3622                         .ips            = addresses_B_1,
3623                         .apply_expected = True
3624                 }
3625         },
3626
3627 /*
3628  * multi homed vs. special group section,
3629  */
3630         /* 
3631          * mhomed,active vs. sgroup,active
3632          * => should NOT be replaced
3633          */
3634         {
3635                 .line   = __location__,
3636                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3637                 .r1     = {
3638                         .owner          = &ctx->a,
3639                         .type           = WREPL_TYPE_MHOMED,
3640                         .state          = WREPL_STATE_ACTIVE,
3641                         .node           = WREPL_NODE_B,
3642                         .is_static      = False,
3643                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3644                         .ips            = addresses_A_1,
3645                         .apply_expected = True
3646                 },
3647                 .r2     = {
3648                         .owner          = &ctx->b,
3649                         .type           = WREPL_TYPE_SGROUP,
3650                         .state          = WREPL_STATE_ACTIVE,
3651                         .node           = WREPL_NODE_B,
3652                         .is_static      = False,
3653                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3654                         .ips            = addresses_A_1,
3655                         .apply_expected = False
3656                 }
3657         },
3658
3659         /* 
3660          * mhomed,active vs. sgroup,tombstone
3661          * => should NOT be replaced
3662          */
3663         {
3664                 .line   = __location__,
3665                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3666                 .r1     = {
3667                         .owner          = &ctx->a,
3668                         .type           = WREPL_TYPE_MHOMED,
3669                         .state          = WREPL_STATE_ACTIVE,
3670                         .node           = WREPL_NODE_B,
3671                         .is_static      = False,
3672                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3673                         .ips            = addresses_A_1,
3674                         .apply_expected = True
3675                 },
3676                 .r2     = {
3677                         .owner          = &ctx->b,
3678                         .type           = WREPL_TYPE_SGROUP,
3679                         .state          = WREPL_STATE_TOMBSTONE,
3680                         .node           = WREPL_NODE_B,
3681                         .is_static      = False,
3682                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3683                         .ips            = addresses_A_1,
3684                         .apply_expected = False
3685                 }
3686         },
3687
3688         /* 
3689          * mhomed,released vs. sgroup,active
3690          * => should be replaced
3691          */
3692         {
3693                 .line   = __location__,
3694                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3695                 .r1     = {
3696                         .owner          = &ctx->a,
3697                         .type           = WREPL_TYPE_MHOMED,
3698                         .state          = WREPL_STATE_RELEASED,
3699                         .node           = WREPL_NODE_B,
3700                         .is_static      = False,
3701                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3702                         .ips            = addresses_A_1,
3703                         .apply_expected = False
3704                 },
3705                 .r2     = {
3706                         .owner          = &ctx->b,
3707                         .type           = WREPL_TYPE_SGROUP,
3708                         .state          = WREPL_STATE_ACTIVE,
3709                         .node           = WREPL_NODE_B,
3710                         .is_static      = False,
3711                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3712                         .ips            = addresses_B_1,
3713                         .apply_expected = True
3714                 }
3715         },
3716
3717         /* 
3718          * mhomed,released vs. sgroup,tombstone
3719          * => should be replaced
3720          */
3721         {
3722                 .line   = __location__,
3723                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3724                 .r1     = {
3725                         .owner          = &ctx->b,
3726                         .type           = WREPL_TYPE_MHOMED,
3727                         .state          = WREPL_STATE_RELEASED,
3728                         .node           = WREPL_NODE_B,
3729                         .is_static      = False,
3730                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3731                         .ips            = addresses_B_1,
3732                         .apply_expected = False
3733                 },
3734                 .r2     = {
3735                         .owner          = &ctx->a,
3736                         .type           = WREPL_TYPE_SGROUP,
3737                         .state          = WREPL_STATE_TOMBSTONE,
3738                         .node           = WREPL_NODE_B,
3739                         .is_static      = False,
3740                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3741                         .ips            = addresses_A_1,
3742                         .apply_expected = True
3743                 }
3744         },
3745
3746         /* 
3747          * mhomed,tombstone vs. sgroup,active
3748          * => should be replaced
3749          */
3750         {
3751                 .line   = __location__,
3752                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3753                 .r1     = {
3754                         .owner          = &ctx->a,
3755                         .type           = WREPL_TYPE_MHOMED,
3756                         .state          = WREPL_STATE_TOMBSTONE,
3757                         .node           = WREPL_NODE_B,
3758                         .is_static      = False,
3759                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3760                         .ips            = addresses_A_1,
3761                         .apply_expected = True
3762                 },
3763                 .r2     = {
3764                         .owner          = &ctx->b,
3765                         .type           = WREPL_TYPE_SGROUP,
3766                         .state          = WREPL_STATE_ACTIVE,
3767                         .node           = WREPL_NODE_B,
3768                         .is_static      = False,
3769                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3770                         .ips            = addresses_B_1,
3771                         .apply_expected = True
3772                 }
3773         },
3774
3775         /* 
3776          * mhomed,tombstone vs. sgroup,tombstone
3777          * => should be replaced
3778          */
3779         {
3780                 .line   = __location__,
3781                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3782                 .r1     = {
3783                         .owner          = &ctx->b,
3784                         .type           = WREPL_TYPE_MHOMED,
3785                         .state          = WREPL_STATE_TOMBSTONE,
3786                         .node           = WREPL_NODE_B,
3787                         .is_static      = False,
3788                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3789                         .ips            = addresses_B_1,
3790                         .apply_expected = True
3791                 },
3792                 .r2     = {
3793                         .owner          = &ctx->a,
3794                         .type           = WREPL_TYPE_SGROUP,
3795                         .state          = WREPL_STATE_TOMBSTONE,
3796                         .node           = WREPL_NODE_B,
3797                         .is_static      = False,
3798                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3799                         .ips            = addresses_A_1,
3800                         .apply_expected = True
3801                 }
3802         },
3803
3804 /*
3805  * multi homed vs. mlti homed section,
3806  */
3807         /* 
3808          * mhomed,active vs. mhomed,active
3809          * => should be replaced
3810          */
3811         {
3812                 .line   = __location__,
3813                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3814                 .r1     = {
3815                         .owner          = &ctx->a,
3816                         .type           = WREPL_TYPE_MHOMED,
3817                         .state          = WREPL_STATE_ACTIVE,
3818                         .node           = WREPL_NODE_B,
3819                         .is_static      = False,
3820                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
3821                         .ips            = addresses_A_3_4,
3822                         .apply_expected = True
3823                 },
3824                 .r2     = {
3825                         .owner          = &ctx->b,
3826                         .type           = WREPL_TYPE_MHOMED,
3827                         .state          = WREPL_STATE_ACTIVE,
3828                         .node           = WREPL_NODE_B,
3829                         .is_static      = False,
3830                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
3831                         .ips            = addresses_B_3_4,
3832                         .apply_expected = True
3833                 }
3834         },
3835
3836         /* 
3837          * mhomed,active vs. mhomed,tombstone
3838          * => should NOT be replaced
3839          */
3840         {
3841                 .line   = __location__,
3842                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3843                 .r1     = {
3844                         .owner          = &ctx->b,
3845                         .type           = WREPL_TYPE_MHOMED,
3846                         .state          = WREPL_STATE_ACTIVE,
3847                         .node           = WREPL_NODE_B,
3848                         .is_static      = False,
3849                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
3850                         .ips            = addresses_B_3_4,
3851                         .apply_expected = True
3852                 },
3853                 .r2     = {
3854                         .owner          = &ctx->a,
3855                         .type           = WREPL_TYPE_MHOMED,
3856                         .state          = WREPL_STATE_TOMBSTONE,
3857                         .node           = WREPL_NODE_B,
3858                         .is_static      = False,
3859                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
3860                         .ips            = addresses_B_3_4,
3861                         .apply_expected = False
3862                 }
3863         },
3864
3865         /* 
3866          * mhomed,released vs. mhomed,active
3867          * => should be replaced
3868          */
3869         {
3870                 .line   = __location__,
3871                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3872                 .r1     = {
3873                         .owner          = &ctx->b,
3874                         .type           = WREPL_TYPE_MHOMED,
3875                         .state          = WREPL_STATE_RELEASED,
3876                         .node           = WREPL_NODE_B,
3877                         .is_static      = False,
3878                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
3879                         .ips            = addresses_B_3_4,
3880                         .apply_expected = False
3881                 },
3882                 .r2     = {
3883                         .owner          = &ctx->a,
3884                         .type           = WREPL_TYPE_MHOMED,
3885                         .state          = WREPL_STATE_ACTIVE,
3886                         .node           = WREPL_NODE_B,
3887                         .is_static      = False,
3888                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
3889                         .ips            = addresses_A_3_4,
3890                         .apply_expected = True
3891                 }
3892         },
3893
3894         /* 
3895          * mhomed,released vs. mhomed,tombstone
3896          * => should be replaced
3897          */
3898         {
3899                 .line   = __location__,
3900                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3901                 .r1     = {
3902                         .owner          = &ctx->a,
3903                         .type           = WREPL_TYPE_MHOMED,
3904                         .state          = WREPL_STATE_RELEASED,
3905                         .node           = WREPL_NODE_B,
3906                         .is_static      = False,
3907                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
3908                         .ips            = addresses_A_3_4,
3909                         .apply_expected = False
3910                 },
3911                 .r2     = {
3912                         .owner          = &ctx->b,
3913                         .type           = WREPL_TYPE_MHOMED,
3914                         .state          = WREPL_STATE_TOMBSTONE,
3915                         .node           = WREPL_NODE_B,
3916                         .is_static      = False,
3917                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
3918                         .ips            = addresses_B_3_4,
3919                         .apply_expected = True
3920                 }
3921         },
3922
3923         /* 
3924          * mhomed,tombstone vs. mhomed,active
3925          * => should be replaced
3926          */
3927         {
3928                 .line   = __location__,
3929                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3930                 .r1     = {
3931                         .owner          = &ctx->b,
3932                         .type           = WREPL_TYPE_MHOMED,
3933                         .state          = WREPL_STATE_TOMBSTONE,
3934                         .node           = WREPL_NODE_B,
3935                         .is_static      = False,
3936                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
3937                         .ips            = addresses_B_3_4,
3938                         .apply_expected = True
3939                 },
3940                 .r2     = {
3941                         .owner          = &ctx->a,
3942                         .type           = WREPL_TYPE_MHOMED,
3943                         .state          = WREPL_STATE_ACTIVE,
3944                         .node           = WREPL_NODE_B,
3945                         .is_static      = False,
3946                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
3947                         .ips            = addresses_A_3_4,
3948                         .apply_expected = True
3949                 }
3950         },
3951
3952         /* 
3953          * mhomed,tombstone vs. mhomed,tombstone
3954          * => should be replaced
3955          */
3956         {
3957                 .line   = __location__,
3958                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3959                 .r1     = {
3960                         .owner          = &ctx->a,
3961                         .type           = WREPL_TYPE_MHOMED,
3962                         .state          = WREPL_STATE_TOMBSTONE,
3963                         .node           = WREPL_NODE_B,
3964                         .is_static      = False,
3965                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
3966                         .ips            = addresses_A_3_4,
3967                         .apply_expected = True
3968                 },
3969                 .r2     = {
3970                         .owner          = &ctx->b,
3971                         .type           = WREPL_TYPE_MHOMED,
3972                         .state          = WREPL_STATE_TOMBSTONE,
3973                         .node           = WREPL_NODE_B,
3974                         .is_static      = False,
3975                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
3976                         .ips            = addresses_B_3_4,
3977                         .apply_expected = True
3978                 }
3979         },
3980         {
3981                 .line   = __location__,
3982                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3983                 .cleanup= True,
3984                 .r1     = {
3985                         .owner          = &ctx->b,
3986                         .type           = WREPL_TYPE_UNIQUE,
3987                         .state          = WREPL_STATE_TOMBSTONE,
3988                         .node           = WREPL_NODE_B,
3989                         .is_static      = False,
3990                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3991                         .ips            = addresses_B_1,
3992                         .apply_expected = True,
3993                 },
3994                 .r2     = {
3995                         .owner          = &ctx->a,
3996                         .type           = WREPL_TYPE_UNIQUE,
3997                         .state          = WREPL_STATE_TOMBSTONE,
3998                         .node           = WREPL_NODE_B,
3999                         .is_static      = False,
4000                         .num_ips        = ARRAY_SIZE(addresses_A_1),
4001                         .ips            = addresses_A_1,
4002                         .apply_expected = True,
4003                 }
4004         },
4005 /*
4006  * special group vs special group section,
4007  */
4008         /* 
4009          * sgroup,active vs. sgroup,active same addresses
4010          * => should be NOT replaced
4011          */
4012         {
4013                 .line   = __location__,
4014                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4015                 .comment= "A:A_3_4 vs. B:A_3_4",
4016                 .extra  = True,
4017                 .r1     = {
4018                         .owner          = &ctx->a,
4019                         .type           = WREPL_TYPE_SGROUP,
4020                         .state          = WREPL_STATE_ACTIVE,
4021                         .node           = WREPL_NODE_B,
4022                         .is_static      = False,
4023                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
4024                         .ips            = addresses_A_3_4,
4025                         .apply_expected = True
4026                 },
4027                 .r2     = {
4028                         .owner          = &ctx->b,
4029                         .type           = WREPL_TYPE_SGROUP,
4030                         .state          = WREPL_STATE_ACTIVE,
4031                         .node           = WREPL_NODE_B,
4032                         .is_static      = False,
4033                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
4034                         .ips            = addresses_A_3_4,
4035                         .apply_expected = False,
4036                         .sgroup_cleanup = True
4037                 }
4038         },
4039         /* 
4040          * sgroup,active vs. sgroup,active subset addresses, special case...
4041          * => should NOT be replaced
4042          */
4043         {
4044                 .line   = __location__,
4045                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4046                 .comment= "A:A_3_4_X_3_4 vs. B:A_3_4",
4047                 .extra  = True,
4048                 .r1     = {
4049                         .owner          = &ctx->a,
4050                         .type           = WREPL_TYPE_SGROUP,
4051                         .state          = WREPL_STATE_ACTIVE,
4052                         .node           = WREPL_NODE_B,
4053                         .is_static      = False,
4054                         .num_ips        = ARRAY_SIZE(addresses_A_3_4_X_3_4),
4055                         .ips            = addresses_A_3_4_X_3_4,
4056                         .apply_expected = True,
4057                 },
4058                 .r2     = {
4059                         .owner          = &ctx->b,
4060                         .type           = WREPL_TYPE_SGROUP,
4061                         .state          = WREPL_STATE_ACTIVE,
4062                         .node           = WREPL_NODE_B,
4063                         .is_static      = False,
4064                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
4065                         .ips            = addresses_A_3_4,
4066                         .apply_expected = False,
4067                 }
4068         },
4069         {
4070                 .line   = __location__,
4071                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4072                 .cleanup= True,
4073                 .r1     = {
4074                         .owner          = &ctx->a,
4075                         .type           = WREPL_TYPE_SGROUP,
4076                         .state          = WREPL_STATE_ACTIVE,
4077                         .node           = WREPL_NODE_B,
4078                         .is_static      = False,
4079                         .num_ips        = 0,
4080                         .ips            = NULL,
4081                         .apply_expected = False,
4082                 },
4083                 .r2     = {
4084                         .owner          = &ctx->x,
4085                         .type           = WREPL_TYPE_SGROUP,
4086                         .state          = WREPL_STATE_ACTIVE,
4087                         .node           = WREPL_NODE_B,
4088                         .is_static      = False,
4089                         .num_ips        = 0,
4090                         .ips            = NULL,
4091                         .apply_expected = False,
4092                 }
4093         },
4094         /* 
4095          * sgroup,active vs. sgroup,active different addresses, but owner changed
4096          * => should be replaced
4097          */
4098         {
4099                 .line   = __location__,
4100                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4101                 .comment= "A:B_3_4 vs. B:A_3_4",
4102                 .extra  = True,
4103                 .r1     = {
4104                         .owner          = &ctx->a,
4105                         .type           = WREPL_TYPE_SGROUP,
4106                         .state          = WREPL_STATE_ACTIVE,
4107                         .node           = WREPL_NODE_B,
4108                         .is_static      = False,
4109                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
4110                         .ips            = addresses_B_3_4,
4111                         .apply_expected = True,
4112                 },
4113                 .r2     = {
4114                         .owner          = &ctx->b,
4115                         .type           = WREPL_TYPE_SGROUP,
4116                         .state          = WREPL_STATE_ACTIVE,
4117                         .node           = WREPL_NODE_B,
4118                         .is_static      = False,
4119                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
4120                         .ips            = addresses_A_3_4,
4121                         .apply_expected = True,
4122                         .sgroup_cleanup = True
4123                 }
4124         },
4125         /* 
4126          * sgroup,active vs. sgroup,active different addresses, but owner changed
4127          * => should be replaced
4128          */
4129         {
4130                 .line   = __location__,
4131                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4132                 .comment= "A:A_3_4 vs. B:A_3_4_OWNER_B",
4133                 .extra  = True,
4134                 .r1     = {
4135                         .owner          = &ctx->a,
4136                         .type           = WREPL_TYPE_SGROUP,
4137                         .state          = WREPL_STATE_ACTIVE,
4138                         .node           = WREPL_NODE_B,
4139                         .is_static      = False,
4140                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
4141                         .ips            = addresses_A_3_4,
4142                         .apply_expected = True,
4143                 },
4144                 .r2     = {
4145                         .owner          = &ctx->b,
4146                         .type           = WREPL_TYPE_SGROUP,
4147                         .state          = WREPL_STATE_ACTIVE,
4148                         .node           = WREPL_NODE_B,
4149                         .is_static      = False,
4150                         .num_ips        = ARRAY_SIZE(addresses_A_3_4_OWNER_B),
4151                         .ips            = addresses_A_3_4_OWNER_B,
4152                         .apply_expected = True,
4153                         .sgroup_cleanup = True
4154                 }
4155         },
4156         /* 
4157          * sgroup,active vs. sgroup,active different addresses, but owner changed
4158          * => should be replaced
4159          */
4160         {
4161                 .line   = __location__,
4162                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4163                 .comment= "A:A_3_4_OWNER_B vs. B:A_3_4",
4164                 .extra  = True,
4165                 .r1     = {
4166                         .owner          = &ctx->a,
4167                         .type           = WREPL_TYPE_SGROUP,
4168                         .state          = WREPL_STATE_ACTIVE,
4169                         .node           = WREPL_NODE_B,
4170                         .is_static      = False,
4171                         .num_ips        = ARRAY_SIZE(addresses_A_3_4_OWNER_B),
4172                         .ips            = addresses_A_3_4_OWNER_B,
4173                         .apply_expected = True,
4174                 },
4175                 .r2     = {
4176                         .owner          = &ctx->b,
4177                         .type           = WREPL_TYPE_SGROUP,
4178                         .state          = WREPL_STATE_ACTIVE,
4179                         .node           = WREPL_NODE_B,
4180                         .is_static      = False,
4181                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
4182                         .ips            = addresses_A_3_4,
4183                         .apply_expected = True,
4184                         .sgroup_cleanup = True
4185                 }
4186         },
4187         /* 
4188          * sgroup,active vs. sgroup,active different addresses
4189          * => should be merged
4190          */
4191         {
4192                 .line   = __location__,
4193                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4194                 .comment= "A:A_3_4 vs. B:B_3_4 => C:A_3_4_B_3_4",
4195                 .extra  = True,
4196                 .r1     = {
4197                         .owner          = &ctx->a,
4198                         .type           = WREPL_TYPE_SGROUP,
4199                         .state          = WREPL_STATE_ACTIVE,
4200                         .node           = WREPL_NODE_B,
4201                         .is_static      = False,
4202                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
4203                         .ips            = addresses_A_3_4,
4204                         .apply_expected = True,
4205                 },
4206                 .r2     = {
4207                         .owner          = &ctx->b,
4208                         .type           = WREPL_TYPE_SGROUP,
4209                         .state          = WREPL_STATE_ACTIVE,
4210                         .node           = WREPL_NODE_B,
4211                         .is_static      = False,
4212                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
4213                         .ips            = addresses_B_3_4,
4214                         .sgroup_merge   = True,
4215                         .sgroup_cleanup = True,
4216                 }
4217         },
4218         /* 
4219          * sgroup,active vs. sgroup,active different addresses, special case...
4220          * => should be merged
4221          */
4222         {
4223                 .line   = __location__,
4224                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4225                 .comment= "A:B_3_4_X_3_4 vs. B:A_3_4 => B:A_3_4_X_3_4",
4226                 .extra  = True,
4227                 .r1     = {
4228                         .owner          = &ctx->a,
4229                         .type           = WREPL_TYPE_SGROUP,
4230                         .state          = WREPL_STATE_ACTIVE,
4231                         .node           = WREPL_NODE_B,
4232                         .is_static      = False,
4233                         .num_ips        = ARRAY_SIZE(addresses_B_3_4_X_3_4),
4234                         .ips            = addresses_B_3_4_X_3_4,
4235                         .apply_expected = True,
4236                 },
4237                 .r2     = {
4238                         .owner          = &ctx->b,
4239                         .type           = WREPL_TYPE_SGROUP,
4240                         .state          = WREPL_STATE_ACTIVE,
4241                         .node           = WREPL_NODE_B,
4242                         .is_static      = False,
4243                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
4244                         .ips            = addresses_A_3_4,
4245                         .sgroup_merge   = True,
4246                         .merge_owner    = &ctx->b,
4247                         .sgroup_cleanup = False
4248                 }
4249         },
4250         {
4251                 .line   = __location__,
4252                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4253                 .cleanup= True,
4254                 .r1     = {
4255                         .owner          = &ctx->b,
4256                         .type           = WREPL_TYPE_SGROUP,
4257                         .state          = WREPL_STATE_ACTIVE,
4258                         .node           = WREPL_NODE_B,
4259                         .is_static      = False,
4260                         .num_ips        = ARRAY_SIZE(addresses_A_3_4_X_3_4_OWNER_B),
4261                         .ips            = addresses_A_3_4_X_3_4_OWNER_B,
4262                         .apply_expected = True,
4263                 },
4264                 .r2     = {
4265                         .owner          = &ctx->b,
4266                         .type           = WREPL_TYPE_SGROUP,
4267                         .state          = WREPL_STATE_ACTIVE,
4268                         .node           = WREPL_NODE_B,
4269                         .is_static      = False,
4270                         .num_ips        = 0,
4271                         .ips            = NULL,
4272                         .apply_expected = False,
4273                 }
4274         },
4275         /* 
4276          * sgroup,active vs. sgroup,active different addresses, special case...
4277          * => should be merged
4278          */
4279         {
4280                 .line   = __location__,
4281                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4282                 .comment= "A:X_3_4 vs. B:A_3_4 => C:A_3_4_X_3_4",
4283                 .extra  = True,
4284                 .r1     = {
4285                         .owner          = &ctx->a,
4286                         .type           = WREPL_TYPE_SGROUP,
4287                         .state          = WREPL_STATE_ACTIVE,
4288                         .node           = WREPL_NODE_B,
4289                         .is_static      = False,
4290                         .num_ips        = ARRAY_SIZE(addresses_X_3_4),
4291                         .ips            = addresses_X_3_4,
4292                         .apply_expected = True,
4293                 },
4294                 .r2     = {
4295                         .owner          = &ctx->b,
4296                         .type           = WREPL_TYPE_SGROUP,
4297                         .state          = WREPL_STATE_ACTIVE,
4298                         .node           = WREPL_NODE_B,
4299                         .is_static      = False,
4300                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
4301                         .ips            = addresses_A_3_4,
4302                         .sgroup_merge   = True,
4303                         .sgroup_cleanup = False
4304                 }
4305         },
4306         {
4307                 .line   = __location__,
4308                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4309                 .cleanup= True,
4310                 .r1     = {
4311                         .owner          = &ctx->a,
4312                         .type           = WREPL_TYPE_SGROUP,
4313                         .state          = WREPL_STATE_ACTIVE,
4314                         .node           = WREPL_NODE_B,
4315                         .is_static      = False,
4316                         .num_ips        = 0,
4317                         .ips            = NULL,
4318                         .apply_expected = False,
4319                 },
4320                 .r2     = {
4321                         .owner          = &ctx->x,
4322                         .type           = WREPL_TYPE_SGROUP,
4323                         .state          = WREPL_STATE_ACTIVE,
4324                         .node           = WREPL_NODE_B,
4325                         .is_static      = False,
4326                         .num_ips        = 0,
4327                         .ips            = NULL,
4328                         .apply_expected = False,
4329                 }
4330         },
4331         /* 
4332          * sgroup,active vs. sgroup,active different addresses, special case...
4333          * => should be merged
4334          */
4335         {
4336                 .line   = __location__,
4337                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4338                 .comment= "A:A_3_4_X_3_4 vs. B:A_3_4_OWNER_B => B:A_3_4_OWNER_B_X_3_4",
4339                 .extra  = True,
4340                 .r1     = {
4341                         .owner          = &ctx->a,
4342                         .type           = WREPL_TYPE_SGROUP,
4343                         .state          = WREPL_STATE_ACTIVE,
4344                         .node           = WREPL_NODE_B,
4345                         .is_static      = False,
4346                         .num_ips        = ARRAY_SIZE(addresses_A_3_4_X_3_4),
4347                         .ips            = addresses_A_3_4_X_3_4,
4348                         .apply_expected = True,
4349                 },
4350                 .r2     = {
4351                         .owner          = &ctx->b,
4352                         .type           = WREPL_TYPE_SGROUP,
4353                         .state          = WREPL_STATE_ACTIVE,
4354                         .node           = WREPL_NODE_B,
4355                         .is_static      = False,
4356                         .num_ips        = ARRAY_SIZE(addresses_A_3_4_OWNER_B),
4357                         .ips            = addresses_A_3_4_OWNER_B,
4358                         .sgroup_merge   = True,
4359                         .merge_owner    = &ctx->b,
4360                 }
4361         },
4362         {
4363                 .line   = __location__,
4364                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4365                 .cleanup= True,
4366                 .r1     = {
4367                         .owner          = &ctx->b,
4368                         .type           = WREPL_TYPE_SGROUP,
4369                         .state          = WREPL_STATE_ACTIVE,
4370                         .node           = WREPL_NODE_B,
4371                         .is_static      = False,
4372                         .num_ips        = 0,
4373                         .ips            = NULL,
4374                         .apply_expected = False,
4375                 },
4376                 .r2     = {
4377                         .owner          = &ctx->x,
4378                         .type           = WREPL_TYPE_SGROUP,
4379                         .state          = WREPL_STATE_ACTIVE,
4380                         .node           = WREPL_NODE_B,
4381                         .is_static      = False,
4382                         .num_ips        = 0,
4383                         .ips            = NULL,
4384                         .apply_expected = False,
4385                 }
4386         },
4387         /* 
4388          * sgroup,active vs. sgroup,active partly different addresses, special case...
4389          * => should be merged
4390          */
4391         {
4392                 .line   = __location__,
4393                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4394                 .comment= "A:B_3_4_X_3_4 vs. B:B_3_4_X_1_2 => C:B_3_4_X_1_2_3_4",
4395                 .extra  = True,
4396                 .r1     = {
4397                         .owner          = &ctx->a,
4398                         .type           = WREPL_TYPE_SGROUP,
4399                         .state          = WREPL_STATE_ACTIVE,
4400                         .node           = WREPL_NODE_B,
4401                         .is_static      = False,
4402                         .num_ips        = ARRAY_SIZE(addresses_B_3_4_X_3_4),
4403                         .ips            = addresses_B_3_4_X_3_4,
4404                         .apply_expected = True,
4405                 },
4406                 .r2     = {
4407                         .owner          = &ctx->b,
4408                         .type           = WREPL_TYPE_SGROUP,
4409                         .state          = WREPL_STATE_ACTIVE,
4410                         .node           = WREPL_NODE_B,
4411                         .is_static      = False,
4412                         .num_ips        = ARRAY_SIZE(addresses_B_3_4_X_1_2),
4413                         .ips            = addresses_B_3_4_X_1_2,
4414                         .sgroup_merge   = True,
4415                         .sgroup_cleanup = False
4416                 }
4417         },
4418         {
4419                 .line   = __location__,
4420                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4421                 .cleanup= True,
4422                 .r1     = {
4423                         .owner          = &ctx->b,
4424                         .type           = WREPL_TYPE_SGROUP,
4425                         .state          = WREPL_STATE_ACTIVE,
4426                         .node           = WREPL_NODE_B,
4427                         .is_static      = False,
4428                         .num_ips        = 0,
4429                         .ips            = NULL,
4430                         .apply_expected = False,
4431                 },
4432                 .r2     = {
4433                         .owner          = &ctx->x,
4434                         .type           = WREPL_TYPE_SGROUP,
4435                         .state          = WREPL_STATE_ACTIVE,
4436                         .node           = WREPL_NODE_B,
4437                         .is_static      = False,
4438                         .num_ips        = 0,
4439                         .ips            = NULL,
4440                         .apply_expected = False,
4441                 }
4442         },
4443         /* 
4444          * sgroup,active vs. sgroup,active different addresses, special case...
4445          * => should be merged
4446          */
4447         {
4448                 .line   = __location__,
4449                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4450                 .comment= "A:B_3_4_X_3_4 vs. B:NULL => B:X_3_4",
4451                 .extra  = True,
4452                 .r1     = {
4453                         .owner          = &ctx->a,
4454                         .type           = WREPL_TYPE_SGROUP,
4455                         .state          = WREPL_STATE_ACTIVE,
4456                         .node           = WREPL_NODE_B,
4457                         .is_static      = False,
4458                         .num_ips        = ARRAY_SIZE(addresses_B_3_4_X_3_4),
4459                         .ips            = addresses_B_3_4_X_3_4,
4460                         .apply_expected = True,
4461                 },
4462                 .r2     = {
4463                         .owner          = &ctx->b,
4464                         .type           = WREPL_TYPE_SGROUP,
4465                         .state          = WREPL_STATE_ACTIVE,
4466                         .node           = WREPL_NODE_B,
4467                         .is_static      = False,
4468                         .num_ips        = 0,
4469                         .ips            = NULL,
4470                         .sgroup_merge   = True,
4471                         .merge_owner    = &ctx->b,
4472                         .sgroup_cleanup = True
4473                 }
4474         },
4475         {
4476                 .line   = __location__,
4477                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4478                 .cleanup= True,
4479                 .r1     = {
4480                         .owner          = &ctx->x,
4481                         .type           = WREPL_TYPE_SGROUP,
4482                         .state          = WREPL_STATE_ACTIVE,
4483                         .node           = WREPL_NODE_B,
4484                         .is_static      = False,
4485                         .num_ips        = 0,
4486                         .ips            = NULL,
4487                         .apply_expected = False,
4488                 },
4489                 .r2     = {
4490                         .owner          = &ctx->x,
4491                         .type           = WREPL_TYPE_UNIQUE,
4492                         .state          = WREPL_STATE_TOMBSTONE,
4493                         .node           = WREPL_NODE_B,
4494                         .is_static      = False,
4495                         .num_ips        = ARRAY_SIZE(addresses_A_1),
4496                         .ips            = addresses_A_1,
4497                         .apply_expected = True,
4498                 }
4499         },
4500         /* 
4501          * This should be the last record in this array,
4502          * we need to make sure the we leave a tombstoned unique entry
4503          * owned by OWNER_A
4504          */
4505         {
4506                 .line   = __location__,
4507                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
4508                 .cleanup= True,
4509                 .r1     = {
4510                         .owner          = &ctx->a,
4511                         .type           = WREPL_TYPE_UNIQUE,
4512                         .state          = WREPL_STATE_TOMBSTONE,
4513                         .node           = WREPL_NODE_B,
4514                         .is_static      = False,
4515                         .num_ips        = ARRAY_SIZE(addresses_A_1),
4516                         .ips            = addresses_A_1,
4517                         .apply_expected = True
4518                 },
4519                 .r2     = {
4520                         .owner          = &ctx->a,
4521                         .type           = WREPL_TYPE_UNIQUE,
4522                         .state          = WREPL_STATE_TOMBSTONE,
4523                         .node           = WREPL_NODE_B,
4524                         .is_static      = False,
4525                         .num_ips        = ARRAY_SIZE(addresses_A_1),
4526                         .ips            = addresses_A_1,
4527                         .apply_expected = True
4528                 }
4529         }}; /* do not add entries here, this should be the last record! */
4530
4531         if (!ctx) return False;
4532
4533         wins_name_r1    = &wins_name1;
4534         wins_name_r2    = &wins_name2;
4535
4536         printf("Test Replica Conflicts with different owners\n");
4537
4538         for(i=0; ret && i < ARRAY_SIZE(records); i++) {
4539         
4540                 if (!records[i].extra && !records[i].cleanup) {
4541                         /* we should test the worst cases */
4542                         if (records[i].r2.apply_expected && records[i].r1.ips==records[i].r2.ips) {
4543                                 printf("(%s) Programmer error, invalid record[%u]: %s\n",
4544                                         __location__, i, records[i].line);
4545                                 return False;
4546                         } else if (!records[i].r2.apply_expected && records[i].r1.ips!=records[i].r2.ips) {
4547                                 printf("(%s) Programmer error, invalid record[%u]: %s\n",
4548                                         __location__, i, records[i].line);
4549                                 return False;
4550                         }
4551                 }
4552
4553                 if (!records[i].cleanup) {
4554                         const char *expected;
4555                         const char *ips;
4556
4557                         if (records[i].r2.sgroup_merge) {
4558                                 expected = "SGROUP_MERGE";
4559                         } else if (records[i].r2.apply_expected) {
4560                                 expected = "REPLACE";
4561                         } else {
4562                                 expected = "NOT REPLACE";
4563                         }
4564
4565                         if (!records[i].r1.ips && !records[i].r2.ips) {
4566                                 ips = "with no ip(s)";
4567                         } else if (records[i].r1.ips==records[i].r2.ips) {
4568                                 ips = "with same ip(s)";
4569                         } else {
4570                                 ips = "with different ip(s)";
4571                         }
4572
4573                         printf("%s,%s%s vs. %s,%s%s %s => %s\n",
4574                                 wrepl_name_type_string(records[i].r1.type),
4575                                 wrepl_name_state_string(records[i].r1.state),
4576                                 (records[i].r1.is_static?",static":""),
4577                                 wrepl_name_type_string(records[i].r2.type),
4578                                 wrepl_name_state_string(records[i].r2.state),
4579                                 (records[i].r2.is_static?",static":""),
4580                                 (records[i].comment?records[i].comment:ips),
4581                                 expected);
4582                 }
4583
4584                 /*
4585                  * Setup R1
4586                  */
4587                 wins_name_r1->name      = &records[i].name;
4588                 wins_name_r1->flags     = WREPL_NAME_FLAGS(records[i].r1.type,
4589                                                            records[i].r1.state,
4590                                                            records[i].r1.node,
4591                                                            records[i].r1.is_static);
4592                 wins_name_r1->id        = ++records[i].r1.owner->max_version;
4593                 if (wins_name_r1->flags & 2) {
4594                         wins_name_r1->addresses.addresses.num_ips = records[i].r1.num_ips;
4595                         wins_name_r1->addresses.addresses.ips     = discard_const(records[i].r1.ips);
4596                 } else {
4597                         wins_name_r1->addresses.ip = records[i].r1.ips[0].ip;
4598                 }
4599                 wins_name_r1->unknown   = "255.255.255.255";
4600
4601                 /* now apply R1 */
4602                 ret &= test_wrepl_update_one(ctx, records[i].r1.owner, wins_name_r1);
4603                 ret &= test_wrepl_is_applied(ctx, records[i].r1.owner,
4604                                              wins_name_r1, records[i].r1.apply_expected);
4605
4606                 /*
4607                  * Setup R2
4608                  */
4609                 wins_name_r2->name      = &records[i].name;
4610                 wins_name_r2->flags     = WREPL_NAME_FLAGS(records[i].r2.type,
4611                                                            records[i].r2.state,
4612                                                            records[i].r2.node,
4613                                                            records[i].r2.is_static);
4614                 wins_name_r2->id        = ++records[i].r2.owner->max_version;
4615                 if (wins_name_r2->flags & 2) {
4616                         wins_name_r2->addresses.addresses.num_ips = records[i].r2.num_ips;
4617                         wins_name_r2->addresses.addresses.ips     = discard_const(records[i].r2.ips);
4618                 } else {
4619                         wins_name_r2->addresses.ip = records[i].r2.ips[0].ip;
4620                 }
4621                 wins_name_r2->unknown   = "255.255.255.255";
4622
4623                 /* now apply R2 */
4624                 ret &= test_wrepl_update_one(ctx, records[i].r2.owner, wins_name_r2);
4625                 if (records[i].r1.state == WREPL_STATE_RELEASED) {
4626                         ret &= test_wrepl_is_applied(ctx, records[i].r1.owner,
4627                                                      wins_name_r1, False);
4628                 } else if (records[i].r2.sgroup_merge) {
4629                         ret &= test_wrepl_sgroup_merged(ctx, records[i].r2.merge_owner,
4630                                                         records[i].r1.owner,
4631                                                         records[i].r1.num_ips, records[i].r1.ips,
4632                                                         records[i].r2.owner,
4633                                                         records[i].r2.num_ips, records[i].r2.ips,
4634                                                         wins_name_r2);
4635                 } else if (records[i].r1.owner != records[i].r2.owner) {
4636                         BOOL _expected;
4637                         _expected = (records[i].r1.apply_expected && !records[i].r2.apply_expected);
4638                         ret &= test_wrepl_is_applied(ctx, records[i].r1.owner,
4639                                                      wins_name_r1, _expected);
4640                 }
4641                 if (records[i].r2.state == WREPL_STATE_RELEASED) {
4642                         ret &= test_wrepl_is_applied(ctx, records[i].r2.owner,
4643                                                      wins_name_r2, False);
4644                 } else if (!records[i].r2.sgroup_merge) {
4645                         ret &= test_wrepl_is_applied(ctx, records[i].r2.owner,
4646                                                      wins_name_r2, records[i].r2.apply_expected);
4647                 }
4648
4649                 if (records[i].r2.sgroup_cleanup) {
4650                         /* clean up the SGROUP record */
4651                         wins_name_r1->name      = &records[i].name;
4652                         wins_name_r1->flags     = WREPL_NAME_FLAGS(WREPL_TYPE_SGROUP,
4653                                                                    WREPL_STATE_ACTIVE,
4654                                                                    WREPL_NODE_B, False);
4655                         wins_name_r1->id        = ++records[i].r1.owner->max_version;
4656                         wins_name_r1->addresses.addresses.num_ips = 0;
4657                         wins_name_r1->addresses.addresses.ips     = NULL;
4658                         wins_name_r1->unknown   = "255.255.255.255";
4659                         ret &= test_wrepl_update_one(ctx, records[i].r1.owner, wins_name_r1);
4660
4661                         /* here we test how names from an owner are deleted */
4662                         if (records[i].r2.sgroup_merge && records[i].r2.num_ips) {
4663                                 ret &= test_wrepl_sgroup_merged(ctx, NULL,
4664                                                                 records[i].r2.owner,
4665                                                                 records[i].r2.num_ips, records[i].r2.ips,
4666                                                                 records[i].r1.owner,
4667                                                                 0, NULL,
4668                                                                 wins_name_r2);
4669                         }
4670
4671                         /* clean up the SGROUP record */
4672                         wins_name_r2->name      = &records[i].name;
4673                         wins_name_r2->flags     = WREPL_NAME_FLAGS(WREPL_TYPE_SGROUP,
4674                                                                    WREPL_STATE_ACTIVE,
4675                                                                    WREPL_NODE_B, False);
4676                         wins_name_r2->id        = ++records[i].r2.owner->max_version;
4677                         wins_name_r2->addresses.addresses.num_ips = 0;
4678                         wins_name_r2->addresses.addresses.ips     = NULL;
4679                         wins_name_r2->unknown   = "255.255.255.255";
4680                         ret &= test_wrepl_update_one(ctx, records[i].r2.owner, wins_name_r2);
4681
4682                         /* take ownership of the SGROUP record */
4683                         wins_name_r2->name      = &records[i].name;
4684                         wins_name_r2->flags     = WREPL_NAME_FLAGS(WREPL_TYPE_SGROUP,
4685                                                                    WREPL_STATE_ACTIVE,
4686                                                                    WREPL_NODE_B, False);
4687                         wins_name_r2->id        = ++records[i].r2.owner->max_version;
4688                         wins_name_r2->addresses.addresses.num_ips = ARRAY_SIZE(addresses_B_1);
4689                         wins_name_r2->addresses.addresses.ips     = discard_const(addresses_B_1);
4690                         wins_name_r2->unknown   = "255.255.255.255";
4691                         ret &= test_wrepl_update_one(ctx, records[i].r2.owner, wins_name_r2);
4692                         ret &= test_wrepl_is_applied(ctx, records[i].r2.owner, wins_name_r2, True);
4693
4694                         /* overwrite the SGROUP record with unique,tombstone */
4695                         wins_name_r2->name      = &records[i].name;
4696                         wins_name_r2->flags     = WREPL_NAME_FLAGS(WREPL_TYPE_SGROUP,
4697                                                                    WREPL_STATE_TOMBSTONE,
4698                                                                    WREPL_NODE_B, False);
4699                         wins_name_r2->id        = ++records[i].r2.owner->max_version;
4700                         wins_name_r2->addresses.addresses.num_ips = ARRAY_SIZE(addresses_B_1);
4701                         wins_name_r2->addresses.addresses.ips     = discard_const(addresses_B_1);
4702                         wins_name_r2->unknown   = "255.255.255.255";
4703                         ret &= test_wrepl_update_one(ctx, records[i].r2.owner, wins_name_r2);
4704                         ret &= test_wrepl_is_applied(ctx, records[i].r2.owner, wins_name_r2, True);
4705                 }
4706
4707                 /* the first one is a cleanup run */
4708                 if (!ret && i == 0) ret = True;
4709
4710                 if (!ret) {
4711                         printf("conflict handled wrong or record[%u]: %s\n", i, records[i].line);
4712                         return ret;
4713                 }
4714         }
4715
4716         return ret;
4717 }
4718
4719 static BOOL test_conflict_owned_released_vs_replica(struct test_wrepl_conflict_conn *ctx)
4720 {
4721         BOOL ret = True;
4722         NTSTATUS status;
4723         struct wrepl_wins_name wins_name_;
4724         struct wrepl_wins_name *wins_name = &wins_name_;
4725         struct nbt_name_register name_register_;
4726         struct nbt_name_register *name_register = &name_register_;
4727         struct nbt_name_release release_;
4728         struct nbt_name_release *release = &release_;
4729         uint32_t i;
4730         struct {
4731                 const char *line; /* just better debugging */
4732                 struct nbt_name name;
4733                 struct {
4734                         uint32_t nb_flags;
4735                         BOOL mhomed;
4736                         uint32_t num_ips;
4737                         const struct wrepl_ip *ips;
4738                         BOOL apply_expected;
4739                 } wins;
4740                 struct {
4741                         enum wrepl_name_type type;
4742                         enum wrepl_name_state state;
4743                         enum wrepl_name_node node;
4744                         BOOL is_static;
4745                         uint32_t num_ips;
4746                         const struct wrepl_ip *ips;
4747                         BOOL apply_expected;
4748                 } replica;
4749         } records[] = {
4750 /* 
4751  * unique vs. unique section
4752  */
4753         /*
4754          * unique,released vs. unique,active with same ip(s)
4755          */
4756         {
4757                 .line   = __location__,
4758                 .name   = _NBT_NAME("_UR_UA_SI", 0x00, NULL),
4759                 .wins   = {
4760                         .nb_flags       = 0,
4761                         .mhomed         = False,
4762                         .num_ips        = ctx->addresses_best_num,
4763                         .ips            = ctx->addresses_best,
4764                         .apply_expected = True
4765                 },
4766                 .replica= {
4767                         .type           = WREPL_TYPE_UNIQUE,
4768                         .state          = WREPL_STATE_ACTIVE,
4769                         .node           = WREPL_NODE_B,
4770                         .is_static      = False,
4771                         .num_ips        = ctx->addresses_best_num,
4772                         .ips            = ctx->addresses_best,
4773                         .apply_expected = True
4774                 },
4775         },
4776         /*
4777          * unique,released vs. unique,active with different ip(s)
4778          */
4779         {
4780                 .line   = __location__,
4781                 .name   = _NBT_NAME("_UR_UA_DI", 0x00, NULL),
4782                 .wins   = {
4783                         .nb_flags       = 0,
4784                         .mhomed         = False,
4785                         .num_ips        = ctx->addresses_best_num,
4786                         .ips            = ctx->addresses_best,
4787                         .apply_expected = True
4788                 },
4789                 .replica= {
4790                         .type           = WREPL_TYPE_UNIQUE,
4791                         .state          = WREPL_STATE_ACTIVE,
4792                         .node           = WREPL_NODE_B,
4793                         .is_static      = False,
4794                         .num_ips        = ARRAY_SIZE(addresses_B_1),
4795                         .ips            = addresses_B_1,
4796                         .apply_expected = True
4797                 },
4798         },
4799         /*
4800          * unique,released vs. unique,tombstone with same ip(s)
4801          */
4802         {
4803                 .line   = __location__,
4804                 .name   = _NBT_NAME("_UR_UT_SI", 0x00, NULL),
4805                 .wins   = {
4806                         .nb_flags       = 0,
4807                         .mhomed         = False,
4808                         .num_ips        = ctx->addresses_best_num,
4809                         .ips            = ctx->addresses_best,
4810                         .apply_expected = True
4811                 },
4812                 .replica= {
4813                         .type           = WREPL_TYPE_UNIQUE,
4814                         .state          = WREPL_STATE_TOMBSTONE,
4815                         .node           = WREPL_NODE_B,
4816                         .is_static      = False,
4817                         .num_ips        = ctx->addresses_best_num,
4818                         .ips            = ctx->addresses_best,
4819                         .apply_expected = True
4820                 },
4821         },
4822         /*
4823          * unique,released vs. unique,tombstone with different ip(s)
4824          */
4825         {
4826                 .line   = __location__,
4827                 .name   = _NBT_NAME("_UR_UT_DI", 0x00, NULL),
4828                 .wins   = {
4829                         .nb_flags       = 0,
4830                         .mhomed         = False,
4831                         .num_ips        = ctx->addresses_best_num,
4832                         .ips            = ctx->addresses_best,
4833                         .apply_expected = True
4834                 },
4835                 .replica= {
4836                         .type           = WREPL_TYPE_UNIQUE,
4837                         .state          = WREPL_STATE_TOMBSTONE,
4838                         .node           = WREPL_NODE_B,
4839                         .is_static      = False,
4840                         .num_ips        = ARRAY_SIZE(addresses_B_1),
4841                         .ips            = addresses_B_1,
4842                         .apply_expected = True
4843                 },
4844         },
4845 /* 
4846  * unique vs. group section
4847  */
4848         /*
4849          * unique,released vs. group,active with same ip(s)
4850          */
4851         {
4852                 .line   = __location__,
4853                 .name   = _NBT_NAME("_UR_GA_SI", 0x00, NULL),
4854                 .wins   = {
4855                         .nb_flags       = 0,
4856                         .mhomed         = False,
4857                         .num_ips        = ctx->addresses_best_num,
4858                         .ips            = ctx->addresses_best,
4859                         .apply_expected = True
4860                 },
4861                 .replica= {
4862                         .type           = WREPL_TYPE_GROUP,
4863                         .state          = WREPL_STATE_ACTIVE,
4864                         .node           = WREPL_NODE_B,
4865                         .is_static      = False,
4866                         .num_ips        = ctx->addresses_best_num,
4867                         .ips            = ctx->addresses_best,
4868                         .apply_expected = True
4869                 },
4870         },
4871         /*
4872          * unique,released vs. group,active with different ip(s)
4873          */
4874         {
4875                 .line   = __location__,
4876                 .name   = _NBT_NAME("_UR_GA_DI", 0x00, NULL),
4877                 .wins   = {
4878                         .nb_flags       = 0,
4879                         .mhomed         = False,
4880                         .num_ips        = ctx->addresses_best_num,
4881                         .ips            = ctx->addresses_best,
4882                         .apply_expected = True
4883                 },
4884                 .replica= {
4885                         .type           = WREPL_TYPE_GROUP,
4886                         .state          = WREPL_STATE_ACTIVE,
4887                         .node           = WREPL_NODE_B,
4888                         .is_static      = False,
4889                         .num_ips        = ARRAY_SIZE(addresses_B_1),
4890                         .ips            = addresses_B_1,
4891                         .apply_expected = True
4892                 },
4893         },
4894         /*
4895          * unique,released vs. group,tombstone with same ip(s)
4896          */
4897         {
4898                 .line   = __location__,
4899                 .name   = _NBT_NAME("_UR_GT_SI", 0x00, NULL),
4900                 .wins   = {
4901                         .nb_flags       = 0,
4902                         .mhomed         = False,
4903                         .num_ips        = ctx->addresses_best_num,
4904                         .ips            = ctx->addresses_best,
4905                         .apply_expected = True
4906                 },
4907                 .replica= {
4908                         .type           = WREPL_TYPE_GROUP,
4909                         .state          = WREPL_STATE_TOMBSTONE,
4910                         .node           = WREPL_NODE_B,
4911                         .is_static      = False,
4912                         .num_ips        = ctx->addresses_best_num,
4913                         .ips            = ctx->addresses_best,
4914                         .apply_expected = True
4915                 },
4916         },
4917         /*
4918          * unique,released vs. group,tombstone with different ip(s)
4919          */
4920         {
4921                 .line   = __location__,
4922                 .name   = _NBT_NAME("_UR_GT_DI", 0x00, NULL),
4923                 .wins   = {
4924                         .nb_flags       = 0,
4925                         .mhomed         = False,
4926                         .num_ips        = ctx->addresses_best_num,
4927                         .ips            = ctx->addresses_best,
4928                         .apply_expected = True
4929                 },
4930                 .replica= {
4931                         .type           = WREPL_TYPE_GROUP,
4932                         .state          = WREPL_STATE_TOMBSTONE,
4933                         .node           = WREPL_NODE_B,
4934                         .is_static      = False,
4935                         .num_ips        = ARRAY_SIZE(addresses_B_1),
4936                         .ips            = addresses_B_1,
4937                         .apply_expected = True
4938                 },
4939         },
4940 /* 
4941  * unique vs. special group section
4942  */
4943         /*
4944          * unique,released vs. sgroup,active with same ip(s)
4945          */
4946         {
4947                 .line   = __location__,
4948                 .name   = _NBT_NAME("_UR_SA_SI", 0x00, NULL),
4949                 .wins   = {
4950                         .nb_flags       = 0,
4951                         .mhomed         = False,
4952                         .num_ips        = ctx->addresses_best_num,
4953                         .ips            = ctx->addresses_best,
4954                         .apply_expected = True
4955                 },
4956                 .replica= {
4957                         .type           = WREPL_TYPE_SGROUP,
4958                         .state          = WREPL_STATE_ACTIVE,
4959                         .node           = WREPL_NODE_B,
4960                         .is_static      = False,
4961                         .num_ips        = ctx->addresses_best_num,
4962                         .ips            = ctx->addresses_best,
4963                         .apply_expected = True
4964                 },
4965         },
4966         /*
4967          * unique,released vs. sgroup,active with different ip(s)
4968          */
4969         {
4970                 .line   = __location__,
4971                 .name   = _NBT_NAME("_UR_SA_DI", 0x00, NULL),
4972                 .wins   = {
4973                         .nb_flags       = 0,
4974                         .mhomed         = False,
4975                         .num_ips        = ctx->addresses_best_num,
4976                         .ips            = ctx->addresses_best,
4977                         .apply_expected = True
4978                 },
4979                 .replica= {
4980                         .type           = WREPL_TYPE_SGROUP,
4981                         .state          = WREPL_STATE_ACTIVE,
4982                         .node           = WREPL_NODE_B,
4983                         .is_static      = False,
4984                         .num_ips        = ARRAY_SIZE(addresses_B_1),
4985                         .ips            = addresses_B_1,
4986                         .apply_expected = True
4987                 },
4988         },
4989         /*
4990          * unique,released vs. sgroup,tombstone with same ip(s)
4991          */
4992         {
4993                 .line   = __location__,
4994                 .name   = _NBT_NAME("_UR_ST_SI", 0x00, NULL),
4995                 .wins   = {
4996                         .nb_flags       = 0,
4997                         .mhomed         = False,
4998                         .num_ips        = ctx->addresses_best_num,
4999                         .ips            = ctx->addresses_best,
5000                         .apply_expected = True
5001                 },
5002                 .replica= {
5003                         .type           = WREPL_TYPE_SGROUP,
5004                         .state          = WREPL_STATE_TOMBSTONE,
5005                         .node           = WREPL_NODE_B,
5006                         .is_static      = False,
5007                         .num_ips        = ctx->addresses_best_num,
5008                         .ips            = ctx->addresses_best,
5009                         .apply_expected = True
5010                 },
5011         },
5012         /*
5013          * unique,released vs. sgroup,tombstone with different ip(s)
5014          */
5015         {
5016                 .line   = __location__,
5017                 .name   = _NBT_NAME("_UR_ST_DI", 0x00, NULL),
5018                 .wins   = {
5019                         .nb_flags       = 0,
5020                         .mhomed         = False,
5021                         .num_ips        = ctx->addresses_best_num,
5022                         .ips            = ctx->addresses_best,
5023                         .apply_expected = True
5024                 },
5025                 .replica= {
5026                         .type           = WREPL_TYPE_SGROUP,
5027                         .state          = WREPL_STATE_TOMBSTONE,
5028                         .node           = WREPL_NODE_B,
5029                         .is_static      = False,
5030                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5031                         .ips            = addresses_B_1,
5032                         .apply_expected = True
5033                 },
5034         },
5035 /* 
5036  * unique vs. multi homed section
5037  */
5038         /*
5039          * unique,released vs. mhomed,active with same ip(s)
5040          */
5041         {
5042                 .line   = __location__,
5043                 .name   = _NBT_NAME("_UR_MA_SI", 0x00, NULL),
5044                 .wins   = {
5045                         .nb_flags       = 0,
5046                         .mhomed         = False,
5047                         .num_ips        = ctx->addresses_best_num,
5048                         .ips            = ctx->addresses_best,
5049                         .apply_expected = True
5050                 },
5051                 .replica= {
5052                         .type           = WREPL_TYPE_MHOMED,
5053                         .state          = WREPL_STATE_ACTIVE,
5054                         .node           = WREPL_NODE_B,
5055                         .is_static      = False,
5056                         .num_ips        = ctx->addresses_best_num,
5057                         .ips            = ctx->addresses_best,
5058                         .apply_expected = True
5059                 },
5060         },
5061         /*
5062          * unique,released vs. mhomed,active with different ip(s)
5063          */
5064         {
5065                 .line   = __location__,
5066                 .name   = _NBT_NAME("_UR_MA_DI", 0x00, NULL),
5067                 .wins   = {
5068                         .nb_flags       = 0,
5069                         .mhomed         = False,
5070                         .num_ips        = ctx->addresses_best_num,
5071                         .ips            = ctx->addresses_best,
5072                         .apply_expected = True
5073                 },
5074                 .replica= {
5075                         .type           = WREPL_TYPE_MHOMED,
5076                         .state          = WREPL_STATE_ACTIVE,
5077                         .node           = WREPL_NODE_B,
5078                         .is_static      = False,
5079                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5080                         .ips            = addresses_B_1,
5081                         .apply_expected = True
5082                 },
5083         },
5084         /*
5085          * unique,released vs. mhomed,tombstone with same ip(s)
5086          */
5087         {
5088                 .line   = __location__,
5089                 .name   = _NBT_NAME("_UR_MT_SI", 0x00, NULL),
5090                 .wins   = {
5091                         .nb_flags       = 0,
5092                         .mhomed         = False,
5093                         .num_ips        = ctx->addresses_best_num,
5094                         .ips            = ctx->addresses_best,
5095                         .apply_expected = True
5096                 },
5097                 .replica= {
5098                         .type           = WREPL_TYPE_MHOMED,
5099                         .state          = WREPL_STATE_TOMBSTONE,
5100                         .node           = WREPL_NODE_B,
5101                         .is_static      = False,
5102                         .num_ips        = ctx->addresses_best_num,
5103                         .ips            = ctx->addresses_best,
5104                         .apply_expected = True
5105                 },
5106         },
5107         /*
5108          * unique,released vs. mhomed,tombstone with different ip(s)
5109          */
5110         {
5111                 .line   = __location__,
5112                 .name   = _NBT_NAME("_UR_MT_DI", 0x00, NULL),
5113                 .wins   = {
5114                         .nb_flags       = 0,
5115                         .mhomed         = False,
5116                         .num_ips        = ctx->addresses_best_num,
5117                         .ips            = ctx->addresses_best,
5118                         .apply_expected = True
5119                 },
5120                 .replica= {
5121                         .type           = WREPL_TYPE_MHOMED,
5122                         .state          = WREPL_STATE_TOMBSTONE,
5123                         .node           = WREPL_NODE_B,
5124                         .is_static      = False,
5125                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5126                         .ips            = addresses_B_1,
5127                         .apply_expected = True
5128                 },
5129         },
5130 /* 
5131  * group vs. unique section
5132  */
5133         /*
5134          * group,released vs. unique,active with same ip(s)
5135          */
5136         {
5137                 .line   = __location__,
5138                 .name   = _NBT_NAME("_GR_UA_SI", 0x00, NULL),
5139                 .wins   = {
5140                         .nb_flags       = NBT_NM_GROUP,
5141                         .mhomed         = False,
5142                         .num_ips        = ctx->addresses_best_num,
5143                         .ips            = ctx->addresses_best,
5144                         .apply_expected = True
5145                 },
5146                 .replica= {
5147                         .type           = WREPL_TYPE_UNIQUE,
5148                         .state          = WREPL_STATE_ACTIVE,
5149                         .node           = WREPL_NODE_B,
5150                         .is_static      = False,
5151                         .num_ips        = ctx->addresses_best_num,
5152                         .ips            = ctx->addresses_best,
5153                         .apply_expected = False
5154                 },
5155         },
5156         /*
5157          * group,released vs. unique,active with different ip(s)
5158          */
5159         {
5160                 .line   = __location__,
5161                 .name   = _NBT_NAME("_GR_UA_DI", 0x00, NULL),
5162                 .wins   = {
5163                         .nb_flags       = NBT_NM_GROUP,
5164                         .mhomed         = False,
5165                         .num_ips        = ctx->addresses_best_num,
5166                         .ips            = ctx->addresses_best,
5167                         .apply_expected = True
5168                 },
5169                 .replica= {
5170                         .type           = WREPL_TYPE_UNIQUE,
5171                         .state          = WREPL_STATE_ACTIVE,
5172                         .node           = WREPL_NODE_B,
5173                         .is_static      = False,
5174                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5175                         .ips            = addresses_B_1,
5176                         .apply_expected = False
5177                 },
5178         },
5179         /*
5180          * group,released vs. unique,tombstone with same ip(s)
5181          */
5182         {
5183                 .line   = __location__,
5184                 .name   = _NBT_NAME("_GR_UT_SI", 0x00, NULL),
5185                 .wins   = {
5186                         .nb_flags       = NBT_NM_GROUP,
5187                         .mhomed         = False,
5188                         .num_ips        = ctx->addresses_best_num,
5189                         .ips            = ctx->addresses_best,
5190                         .apply_expected = True
5191                 },
5192                 .replica= {
5193                         .type           = WREPL_TYPE_UNIQUE,
5194                         .state          = WREPL_STATE_TOMBSTONE,
5195                         .node           = WREPL_NODE_B,
5196                         .is_static      = False,
5197                         .num_ips        = ctx->addresses_best_num,
5198                         .ips            = ctx->addresses_best,
5199                         .apply_expected = False
5200                 },
5201         },
5202         /*
5203          * group,released vs. unique,tombstone with different ip(s)
5204          */
5205         {
5206                 .line   = __location__,
5207                 .name   = _NBT_NAME("_GR_UT_DI", 0x00, NULL),
5208                 .wins   = {
5209                         .nb_flags       = NBT_NM_GROUP,
5210                         .mhomed         = False,
5211                         .num_ips        = ctx->addresses_best_num,
5212                         .ips            = ctx->addresses_best,
5213                         .apply_expected = True
5214                 },
5215                 .replica= {
5216                         .type           = WREPL_TYPE_UNIQUE,
5217                         .state          = WREPL_STATE_TOMBSTONE,
5218                         .node           = WREPL_NODE_B,
5219                         .is_static      = False,
5220                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5221                         .ips            = addresses_B_1,
5222                         .apply_expected = False
5223                 },
5224         },
5225 /* 
5226  * group vs. group section
5227  */
5228         /*
5229          * group,released vs. group,active with same ip(s)
5230          */
5231         {
5232                 .line   = __location__,
5233                 .name   = _NBT_NAME("_GR_GA_SI", 0x00, NULL),
5234                 .wins   = {
5235                         .nb_flags       = NBT_NM_GROUP,
5236                         .mhomed         = False,
5237                         .num_ips        = ctx->addresses_best_num,
5238                         .ips            = ctx->addresses_best,
5239                         .apply_expected = True
5240                 },
5241                 .replica= {
5242                         .type           = WREPL_TYPE_GROUP,
5243                         .state          = WREPL_STATE_ACTIVE,
5244                         .node           = WREPL_NODE_B,
5245                         .is_static      = False,
5246                         .num_ips        = ctx->addresses_best_num,
5247                         .ips            = ctx->addresses_best,
5248                         .apply_expected = True
5249                 },
5250         },
5251         /*
5252          * group,released vs. group,active with different ip(s)
5253          */
5254         {
5255                 .line   = __location__,
5256                 .name   = _NBT_NAME("_GR_GA_DI", 0x00, NULL),
5257                 .wins   = {
5258                         .nb_flags       = NBT_NM_GROUP,
5259                         .mhomed         = False,
5260                         .num_ips        = ctx->addresses_best_num,
5261                         .ips            = ctx->addresses_best,
5262                         .apply_expected = True
5263                 },
5264                 .replica= {
5265                         .type           = WREPL_TYPE_GROUP,
5266                         .state          = WREPL_STATE_ACTIVE,
5267                         .node           = WREPL_NODE_B,
5268                         .is_static      = False,
5269                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5270                         .ips            = addresses_B_1,
5271                         .apply_expected = True
5272                 },
5273         },
5274         /*
5275          * group,released vs. group,tombstone with same ip(s)
5276          */
5277         {
5278                 .line   = __location__,
5279                 .name   = _NBT_NAME("_GR_GT_SI", 0x00, NULL),
5280                 .wins   = {
5281                         .nb_flags       = NBT_NM_GROUP,
5282                         .mhomed         = False,
5283                         .num_ips        = ctx->addresses_best_num,
5284                         .ips            = ctx->addresses_best,
5285                         .apply_expected = True
5286                 },
5287                 .replica= {
5288                         .type           = WREPL_TYPE_GROUP,
5289                         .state          = WREPL_STATE_TOMBSTONE,
5290                         .node           = WREPL_NODE_B,
5291                         .is_static      = False,
5292                         .num_ips        = ctx->addresses_best_num,
5293                         .ips            = ctx->addresses_best,
5294                         .apply_expected = True
5295                 },
5296         },
5297         /*
5298          * group,released vs. group,tombstone with different ip(s)
5299          */
5300         {
5301                 .line   = __location__,
5302                 .name   = _NBT_NAME("_GR_GT_DI", 0x00, NULL),
5303                 .wins   = {
5304                         .nb_flags       = NBT_NM_GROUP,
5305                         .mhomed         = False,
5306                         .num_ips        = ctx->addresses_best_num,
5307                         .ips            = ctx->addresses_best,
5308                         .apply_expected = True
5309                 },
5310                 .replica= {
5311                         .type           = WREPL_TYPE_GROUP,
5312                         .state          = WREPL_STATE_TOMBSTONE,
5313                         .node           = WREPL_NODE_B,
5314                         .is_static      = False,
5315                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5316                         .ips            = addresses_B_1,
5317                         .apply_expected = True
5318                 },
5319         },
5320 /* 
5321  * group vs. special group section
5322  */
5323         /*
5324          * group,released vs. sgroup,active with same ip(s)
5325          */
5326         {
5327                 .line   = __location__,
5328                 .name   = _NBT_NAME("_GR_SA_SI", 0x00, NULL),
5329                 .wins   = {
5330                         .nb_flags       = NBT_NM_GROUP,
5331                         .mhomed         = False,
5332                         .num_ips        = ctx->addresses_best_num,
5333                         .ips            = ctx->addresses_best,
5334                         .apply_expected = True
5335                 },
5336                 .replica= {
5337                         .type           = WREPL_TYPE_SGROUP,
5338                         .state          = WREPL_STATE_ACTIVE,
5339                         .node           = WREPL_NODE_B,
5340                         .is_static      = False,
5341                         .num_ips        = ctx->addresses_best_num,
5342                         .ips            = ctx->addresses_best,
5343                         .apply_expected = False
5344                 },
5345         },
5346         /*
5347          * group,released vs. sgroup,active with different ip(s)
5348          */
5349         {
5350                 .line   = __location__,
5351                 .name   = _NBT_NAME("_GR_SA_DI", 0x00, NULL),
5352                 .wins   = {
5353                         .nb_flags       = NBT_NM_GROUP,
5354                         .mhomed         = False,
5355                         .num_ips        = ctx->addresses_best_num,
5356                         .ips            = ctx->addresses_best,
5357                         .apply_expected = True
5358                 },
5359                 .replica= {
5360                         .type           = WREPL_TYPE_SGROUP,
5361                         .state          = WREPL_STATE_ACTIVE,
5362                         .node           = WREPL_NODE_B,
5363                         .is_static      = False,
5364                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5365                         .ips            = addresses_B_1,
5366                         .apply_expected = False
5367                 },
5368         },
5369         /*
5370          * group,released vs. sgroup,tombstone with same ip(s)
5371          */
5372         {
5373                 .line   = __location__,
5374                 .name   = _NBT_NAME("_GR_ST_SI", 0x00, NULL),
5375                 .wins   = {
5376                         .nb_flags       = NBT_NM_GROUP,
5377                         .mhomed         = False,
5378                         .num_ips        = ctx->addresses_best_num,
5379                         .ips            = ctx->addresses_best,
5380                         .apply_expected = True
5381                 },
5382                 .replica= {
5383                         .type           = WREPL_TYPE_SGROUP,
5384                         .state          = WREPL_STATE_TOMBSTONE,
5385                         .node           = WREPL_NODE_B,
5386                         .is_static      = False,
5387                         .num_ips        = ctx->addresses_best_num,
5388                         .ips            = ctx->addresses_best,
5389                         .apply_expected = False
5390                 },
5391         },
5392         /*
5393          * group,released vs. sgroup,tombstone with different ip(s)
5394          */
5395         {
5396                 .line   = __location__,
5397                 .name   = _NBT_NAME("_GR_ST_DI", 0x00, NULL),
5398                 .wins   = {
5399                         .nb_flags       = NBT_NM_GROUP,
5400                         .mhomed         = False,
5401                         .num_ips        = ctx->addresses_best_num,
5402                         .ips            = ctx->addresses_best,
5403                         .apply_expected = True
5404                 },
5405                 .replica= {
5406                         .type           = WREPL_TYPE_SGROUP,
5407                         .state          = WREPL_STATE_TOMBSTONE,
5408                         .node           = WREPL_NODE_B,
5409                         .is_static      = False,
5410                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5411                         .ips            = addresses_B_1,
5412                         .apply_expected = False
5413                 },
5414         },
5415 /* 
5416  * group vs. multi homed section
5417  */
5418         /*
5419          * group,released vs. mhomed,active with same ip(s)
5420          */
5421         {
5422                 .line   = __location__,
5423                 .name   = _NBT_NAME("_GR_MA_SI", 0x00, NULL),
5424                 .wins   = {
5425                         .nb_flags       = NBT_NM_GROUP,
5426                         .mhomed         = False,
5427                         .num_ips        = ctx->addresses_best_num,
5428                         .ips            = ctx->addresses_best,
5429                         .apply_expected = True
5430                 },
5431                 .replica= {
5432                         .type           = WREPL_TYPE_MHOMED,
5433                         .state          = WREPL_STATE_ACTIVE,
5434                         .node           = WREPL_NODE_B,
5435                         .is_static      = False,
5436                         .num_ips        = ctx->addresses_best_num,
5437                         .ips            = ctx->addresses_best,
5438                         .apply_expected = False
5439                 },
5440         },
5441         /*
5442          * group,released vs. mhomed,active with different ip(s)
5443          */
5444         {
5445                 .line   = __location__,
5446                 .name   = _NBT_NAME("_GR_MA_DI", 0x00, NULL),
5447                 .wins   = {
5448                         .nb_flags       = NBT_NM_GROUP,
5449                         .mhomed         = False,
5450                         .num_ips        = ctx->addresses_best_num,
5451                         .ips            = ctx->addresses_best,
5452                         .apply_expected = True
5453                 },
5454                 .replica= {
5455                         .type           = WREPL_TYPE_MHOMED,
5456                         .state          = WREPL_STATE_ACTIVE,
5457                         .node           = WREPL_NODE_B,
5458                         .is_static      = False,
5459                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5460                         .ips            = addresses_B_1,
5461                         .apply_expected = False
5462                 },
5463         },
5464         /*
5465          * group,released vs. mhomed,tombstone with same ip(s)
5466          */
5467         {
5468                 .line   = __location__,
5469                 .name   = _NBT_NAME("_GR_MT_SI", 0x00, NULL),
5470                 .wins   = {
5471                         .nb_flags       = NBT_NM_GROUP,
5472                         .mhomed         = False,
5473                         .num_ips        = ctx->addresses_best_num,
5474                         .ips            = ctx->addresses_best,
5475                         .apply_expected = True
5476                 },
5477                 .replica= {
5478                         .type           = WREPL_TYPE_MHOMED,
5479                         .state          = WREPL_STATE_TOMBSTONE,
5480                         .node           = WREPL_NODE_B,
5481                         .is_static      = False,
5482                         .num_ips        = ctx->addresses_best_num,
5483                         .ips            = ctx->addresses_best,
5484                         .apply_expected = False
5485                 },
5486         },
5487         /*
5488          * group,released vs. mhomed,tombstone with different ip(s)
5489          */
5490         {
5491                 .line   = __location__,
5492                 .name   = _NBT_NAME("_GR_MT_DI", 0x00, NULL),
5493                 .wins   = {
5494                         .nb_flags       = NBT_NM_GROUP,
5495                         .mhomed         = False,
5496                         .num_ips        = ctx->addresses_best_num,
5497                         .ips            = ctx->addresses_best,
5498                         .apply_expected = True
5499                 },
5500                 .replica= {
5501                         .type           = WREPL_TYPE_MHOMED,
5502                         .state          = WREPL_STATE_TOMBSTONE,
5503                         .node           = WREPL_NODE_B,
5504                         .is_static      = False,
5505                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5506                         .ips            = addresses_B_1,
5507                         .apply_expected = False
5508                 },
5509         },
5510 /* 
5511  * special group vs. unique section
5512  */
5513         /*
5514          * sgroup,released vs. unique,active with same ip(s)
5515          */
5516         {
5517                 .line   = __location__,
5518                 .name   = _NBT_NAME("_SR_UA_SI", 0x1C, NULL),
5519                 .wins   = {
5520                         .nb_flags       = NBT_NM_GROUP,
5521                         .mhomed         = False,
5522                         .num_ips        = ctx->addresses_best_num,
5523                         .ips            = ctx->addresses_best,
5524                         .apply_expected = True
5525                 },
5526                 .replica= {
5527                         .type           = WREPL_TYPE_UNIQUE,
5528                         .state          = WREPL_STATE_ACTIVE,
5529                         .node           = WREPL_NODE_B,
5530                         .is_static      = False,
5531                         .num_ips        = ctx->addresses_best_num,
5532                         .ips            = ctx->addresses_best,
5533                         .apply_expected = True
5534                 },
5535         },
5536         /*
5537          * sgroup,released vs. unique,active with different ip(s)
5538          */
5539         {
5540                 .line   = __location__,
5541                 .name   = _NBT_NAME("_SR_UA_DI", 0x1C, NULL),
5542                 .wins   = {
5543                         .nb_flags       = NBT_NM_GROUP,
5544                         .mhomed         = False,
5545                         .num_ips        = ctx->addresses_best_num,
5546                         .ips            = ctx->addresses_best,
5547                         .apply_expected = True
5548                 },
5549                 .replica= {
5550                         .type           = WREPL_TYPE_UNIQUE,
5551                         .state          = WREPL_STATE_ACTIVE,
5552                         .node           = WREPL_NODE_B,
5553                         .is_static      = False,
5554                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5555                         .ips            = addresses_B_1,
5556                         .apply_expected = True
5557                 },
5558         },
5559         /*
5560          * sgroup,released vs. unique,tombstone with same ip(s)
5561          */
5562         {
5563                 .line   = __location__,
5564                 .name   = _NBT_NAME("_SR_UT_SI", 0x1C, NULL),
5565                 .wins   = {
5566                         .nb_flags       = NBT_NM_GROUP,
5567                         .mhomed         = False,
5568                         .num_ips        = ctx->addresses_best_num,
5569                         .ips            = ctx->addresses_best,
5570                         .apply_expected = True
5571                 },
5572                 .replica= {
5573                         .type           = WREPL_TYPE_UNIQUE,
5574                         .state          = WREPL_STATE_TOMBSTONE,
5575                         .node           = WREPL_NODE_B,
5576                         .is_static      = False,
5577                         .num_ips        = ctx->addresses_best_num,
5578                         .ips            = ctx->addresses_best,
5579                         .apply_expected = True
5580                 },
5581         },
5582         /*
5583          * sgroup,released vs. unique,tombstone with different ip(s)
5584          */
5585         {
5586                 .line   = __location__,
5587                 .name   = _NBT_NAME("_SR_UT_DI", 0x1C, NULL),
5588                 .wins   = {
5589                         .nb_flags       = NBT_NM_GROUP,
5590                         .mhomed         = False,
5591                         .num_ips        = ctx->addresses_best_num,
5592                         .ips            = ctx->addresses_best,
5593                         .apply_expected = True
5594                 },
5595                 .replica= {
5596                         .type           = WREPL_TYPE_UNIQUE,
5597                         .state          = WREPL_STATE_TOMBSTONE,
5598                         .node           = WREPL_NODE_B,
5599                         .is_static      = False,
5600                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5601                         .ips            = addresses_B_1,
5602                         .apply_expected = True
5603                 },
5604         },
5605 /* 
5606  * special group vs. group section
5607  */
5608         /*
5609          * sgroup,released vs. group,active with same ip(s)
5610          */
5611         {
5612                 .line   = __location__,
5613                 .name   = _NBT_NAME("_SR_GA_SI", 0x1C, NULL),
5614                 .wins   = {
5615                         .nb_flags       = NBT_NM_GROUP,
5616                         .mhomed         = False,
5617                         .num_ips        = ctx->addresses_best_num,
5618                         .ips            = ctx->addresses_best,
5619                         .apply_expected = True
5620                 },
5621                 .replica= {
5622                         .type           = WREPL_TYPE_GROUP,
5623                         .state          = WREPL_STATE_ACTIVE,
5624                         .node           = WREPL_NODE_B,
5625                         .is_static      = False,
5626                         .num_ips        = ctx->addresses_best_num,
5627                         .ips            = ctx->addresses_best,
5628                         .apply_expected = True
5629                 },
5630         },
5631         /*
5632          * sgroup,released vs. group,active with different ip(s)
5633          */
5634         {
5635                 .line   = __location__,
5636                 .name   = _NBT_NAME("_SR_GA_DI", 0x1C, NULL),
5637                 .wins   = {
5638                         .nb_flags       = NBT_NM_GROUP,
5639                         .mhomed         = False,
5640                         .num_ips        = ctx->addresses_best_num,
5641                         .ips            = ctx->addresses_best,
5642                         .apply_expected = True
5643                 },
5644                 .replica= {
5645                         .type           = WREPL_TYPE_GROUP,
5646                         .state          = WREPL_STATE_ACTIVE,
5647                         .node           = WREPL_NODE_B,
5648                         .is_static      = False,
5649                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5650                         .ips            = addresses_B_1,
5651                         .apply_expected = True
5652                 },
5653         },
5654         /*
5655          * sgroup,released vs. group,tombstone with same ip(s)
5656          */
5657         {
5658                 .line   = __location__,
5659                 .name   = _NBT_NAME("_SR_GT_SI", 0x1C, NULL),
5660                 .wins   = {
5661                         .nb_flags       = NBT_NM_GROUP,
5662                         .mhomed         = False,
5663                         .num_ips        = ctx->addresses_best_num,
5664                         .ips            = ctx->addresses_best,
5665                         .apply_expected = True
5666                 },
5667                 .replica= {
5668                         .type           = WREPL_TYPE_GROUP,
5669                         .state          = WREPL_STATE_TOMBSTONE,
5670                         .node           = WREPL_NODE_B,
5671                         .is_static      = False,
5672                         .num_ips        = ctx->addresses_best_num,
5673                         .ips            = ctx->addresses_best,
5674                         .apply_expected = True
5675                 },
5676         },
5677         /*
5678          * sgroup,released vs. group,tombstone with different ip(s)
5679          */
5680         {
5681                 .line   = __location__,
5682                 .name   = _NBT_NAME("_SR_GT_DI", 0x1C, NULL),
5683                 .wins   = {
5684                         .nb_flags       = NBT_NM_GROUP,
5685                         .mhomed         = False,
5686                         .num_ips        = ctx->addresses_best_num,
5687                         .ips            = ctx->addresses_best,
5688                         .apply_expected = True
5689                 },
5690                 .replica= {
5691                         .type           = WREPL_TYPE_GROUP,
5692                         .state          = WREPL_STATE_TOMBSTONE,
5693                         .node           = WREPL_NODE_B,
5694                         .is_static      = False,
5695                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5696                         .ips            = addresses_B_1,
5697                         .apply_expected = True
5698                 },
5699         },
5700 /* 
5701  * special group vs. special group section
5702  */
5703         /*
5704          * sgroup,released vs. sgroup,active with same ip(s)
5705          */
5706         {
5707                 .line   = __location__,
5708                 .name   = _NBT_NAME("_SR_SA_SI", 0x1C, NULL),
5709                 .wins   = {
5710                         .nb_flags       = NBT_NM_GROUP,
5711                         .mhomed         = False,
5712                         .num_ips        = ctx->addresses_best_num,
5713                         .ips            = ctx->addresses_best,
5714                         .apply_expected = True
5715                 },
5716                 .replica= {
5717                         .type           = WREPL_TYPE_SGROUP,
5718                         .state          = WREPL_STATE_ACTIVE,
5719                         .node           = WREPL_NODE_B,
5720                         .is_static      = False,
5721                         .num_ips        = ctx->addresses_best_num,
5722                         .ips            = ctx->addresses_best,
5723                         .apply_expected = True
5724                 },
5725         },
5726         /*
5727          * sgroup,released vs. sgroup,active with different ip(s)
5728          */
5729         {
5730                 .line   = __location__,
5731                 .name   = _NBT_NAME("_SR_SA_DI", 0x1C, NULL),
5732                 .wins   = {
5733                         .nb_flags       = NBT_NM_GROUP,
5734                         .mhomed         = False,
5735                         .num_ips        = ctx->addresses_best_num,
5736                         .ips            = ctx->addresses_best,
5737                         .apply_expected = True
5738                 },
5739                 .replica= {
5740                         .type           = WREPL_TYPE_SGROUP,
5741                         .state          = WREPL_STATE_ACTIVE,
5742                         .node           = WREPL_NODE_B,
5743                         .is_static      = False,
5744                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5745                         .ips            = addresses_B_1,
5746                         .apply_expected = True
5747                 },
5748         },
5749         /*
5750          * sgroup,released vs. sgroup,tombstone with same ip(s)
5751          */
5752         {
5753                 .line   = __location__,
5754                 .name   = _NBT_NAME("_SR_ST_SI", 0x1C, NULL),
5755                 .wins   = {
5756                         .nb_flags       = NBT_NM_GROUP,
5757                         .mhomed         = False,
5758                         .num_ips        = ctx->addresses_best_num,
5759                         .ips            = ctx->addresses_best,
5760                         .apply_expected = True
5761                 },
5762                 .replica= {
5763                         .type           = WREPL_TYPE_SGROUP,
5764                         .state          = WREPL_STATE_TOMBSTONE,
5765                         .node           = WREPL_NODE_B,
5766                         .is_static      = False,
5767                         .num_ips        = ctx->addresses_best_num,
5768                         .ips            = ctx->addresses_best,
5769                         .apply_expected = True
5770                 },
5771         },
5772         /*
5773          * sgroup,released vs. sgroup,tombstone with different ip(s)
5774          */
5775         {
5776                 .line   = __location__,
5777                 .name   = _NBT_NAME("_SR_ST_DI", 0x1C, NULL),
5778                 .wins   = {
5779                         .nb_flags       = NBT_NM_GROUP,
5780                         .mhomed         = False,
5781                         .num_ips        = ctx->addresses_best_num,
5782                         .ips            = ctx->addresses_best,
5783                         .apply_expected = True
5784                 },
5785                 .replica= {
5786                         .type           = WREPL_TYPE_SGROUP,
5787                         .state          = WREPL_STATE_TOMBSTONE,
5788                         .node           = WREPL_NODE_B,
5789                         .is_static      = False,
5790                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5791                         .ips            = addresses_B_1,
5792                         .apply_expected = True
5793                 },
5794         },
5795 /* 
5796  * special group vs. multi homed section
5797  */
5798         /*
5799          * sgroup,released vs. mhomed,active with same ip(s)
5800          */
5801         {
5802                 .line   = __location__,
5803                 .name   = _NBT_NAME("_SR_MA_SI", 0x1C, NULL),
5804                 .wins   = {
5805                         .nb_flags       = NBT_NM_GROUP,
5806                         .mhomed         = False,
5807                         .num_ips        = ctx->addresses_best_num,
5808                         .ips            = ctx->addresses_best,
5809                         .apply_expected = True
5810                 },
5811                 .replica= {
5812                         .type           = WREPL_TYPE_MHOMED,
5813                         .state          = WREPL_STATE_ACTIVE,
5814                         .node           = WREPL_NODE_B,
5815                         .is_static      = False,
5816                         .num_ips        = ctx->addresses_best_num,
5817                         .ips            = ctx->addresses_best,
5818                         .apply_expected = True
5819                 },
5820         },
5821         /*
5822          * sgroup,released vs. mhomed,active with different ip(s)
5823          */
5824         {
5825                 .line   = __location__,
5826                 .name   = _NBT_NAME("_SR_MA_DI", 0x1C, NULL),
5827                 .wins   = {
5828                         .nb_flags       = NBT_NM_GROUP,
5829                         .mhomed         = False,
5830                         .num_ips        = ctx->addresses_best_num,
5831                         .ips            = ctx->addresses_best,
5832                         .apply_expected = True
5833                 },
5834                 .replica= {
5835                         .type           = WREPL_TYPE_MHOMED,
5836                         .state          = WREPL_STATE_ACTIVE,
5837                         .node           = WREPL_NODE_B,
5838                         .is_static      = False,
5839                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5840                         .ips            = addresses_B_1,
5841                         .apply_expected = True
5842                 },
5843         },
5844         /*
5845          * sgroup,released vs. mhomed,tombstone with same ip(s)
5846          */
5847         {
5848                 .line   = __location__,
5849                 .name   = _NBT_NAME("_SR_MT_SI", 0x1C, NULL),
5850                 .wins   = {
5851                         .nb_flags       = NBT_NM_GROUP,
5852                         .mhomed         = False,
5853                         .num_ips        = ctx->addresses_best_num,
5854                         .ips            = ctx->addresses_best,
5855                         .apply_expected = True
5856                 },
5857                 .replica= {
5858                         .type           = WREPL_TYPE_MHOMED,
5859                         .state          = WREPL_STATE_TOMBSTONE,
5860                         .node           = WREPL_NODE_B,
5861                         .is_static      = False,
5862                         .num_ips        = ctx->addresses_best_num,
5863                         .ips            = ctx->addresses_best,
5864                         .apply_expected = True
5865                 },
5866         },
5867         /*
5868          * sgroup,released vs. mhomed,tombstone with different ip(s)
5869          */
5870         {
5871                 .line   = __location__,
5872                 .name   = _NBT_NAME("_SR_MT_DI", 0x1C, NULL),
5873                 .wins   = {
5874                         .nb_flags       = NBT_NM_GROUP,
5875                         .mhomed         = False,
5876                         .num_ips        = ctx->addresses_best_num,
5877                         .ips            = ctx->addresses_best,
5878                         .apply_expected = True
5879                 },
5880                 .replica= {
5881                         .type           = WREPL_TYPE_MHOMED,
5882                         .state          = WREPL_STATE_TOMBSTONE,
5883                         .node           = WREPL_NODE_B,
5884                         .is_static      = False,
5885                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5886                         .ips            = addresses_B_1,
5887                         .apply_expected = True
5888                 },
5889         },
5890 /* 
5891  * multi homed vs. unique section
5892  */
5893         /*
5894          * mhomed,released vs. unique,active with same ip(s)
5895          */
5896         {
5897                 .line   = __location__,
5898                 .name   = _NBT_NAME("_MR_UA_SI", 0x00, NULL),
5899                 .wins   = {
5900                         .nb_flags       = 0,
5901                         .mhomed         = True,
5902                         .num_ips        = ctx->addresses_best_num,
5903                         .ips            = ctx->addresses_best,
5904                         .apply_expected = True
5905                 },
5906                 .replica= {
5907                         .type           = WREPL_TYPE_UNIQUE,
5908                         .state          = WREPL_STATE_ACTIVE,
5909                         .node           = WREPL_NODE_B,
5910                         .is_static      = False,
5911                         .num_ips        = ctx->addresses_best_num,
5912                         .ips            = ctx->addresses_best,
5913                         .apply_expected = True
5914                 },
5915         },
5916         /*
5917          * mhomed,released vs. unique,active with different ip(s)
5918          */
5919         {
5920                 .line   = __location__,
5921                 .name   = _NBT_NAME("_MR_UA_DI", 0x00, NULL),
5922                 .wins   = {
5923                         .nb_flags       = 0,
5924                         .mhomed         = True,
5925                         .num_ips        = ctx->addresses_best_num,
5926                         .ips            = ctx->addresses_best,
5927                         .apply_expected = True
5928                 },
5929                 .replica= {
5930                         .type           = WREPL_TYPE_UNIQUE,
5931                         .state          = WREPL_STATE_ACTIVE,
5932                         .node           = WREPL_NODE_B,
5933                         .is_static      = False,
5934                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5935                         .ips            = addresses_B_1,
5936                         .apply_expected = True
5937                 },
5938         },
5939         /*
5940          * mhomed,released vs. unique,tombstone with same ip(s)
5941          */
5942         {
5943                 .line   = __location__,
5944                 .name   = _NBT_NAME("_MR_UT_SI", 0x00, NULL),
5945                 .wins   = {
5946                         .nb_flags       = 0,
5947                         .mhomed         = True,
5948                         .num_ips        = ctx->addresses_best_num,
5949                         .ips            = ctx->addresses_best,
5950                         .apply_expected = True
5951                 },
5952                 .replica= {
5953                         .type           = WREPL_TYPE_UNIQUE,
5954                         .state          = WREPL_STATE_TOMBSTONE,
5955                         .node           = WREPL_NODE_B,
5956                         .is_static      = False,
5957                         .num_ips        = ctx->addresses_best_num,
5958                         .ips            = ctx->addresses_best,
5959                         .apply_expected = True
5960                 },
5961         },
5962         /*
5963          * mhomed,released vs. unique,tombstone with different ip(s)
5964          */
5965         {
5966                 .line   = __location__,
5967                 .name   = _NBT_NAME("_MR_UT_DI", 0x00, NULL),
5968                 .wins   = {
5969                         .nb_flags       = 0,
5970                         .mhomed         = True,
5971                         .num_ips        = ctx->addresses_best_num,
5972                         .ips            = ctx->addresses_best,
5973                         .apply_expected = True
5974                 },
5975                 .replica= {
5976                         .type           = WREPL_TYPE_UNIQUE,
5977                         .state          = WREPL_STATE_TOMBSTONE,
5978                         .node           = WREPL_NODE_B,
5979                         .is_static      = False,
5980                         .num_ips        = ARRAY_SIZE(addresses_B_1),
5981                         .ips            = addresses_B_1,
5982                         .apply_expected = True
5983                 },
5984         },
5985 /* 
5986  * multi homed vs. group section
5987  */
5988         /*
5989          * mhomed,released vs. group,active with same ip(s)
5990          */
5991         {
5992                 .line   = __location__,
5993                 .name   = _NBT_NAME("_MR_GA_SI", 0x00, NULL),
5994                 .wins   = {
5995                         .nb_flags       = 0,
5996                         .mhomed         = True,
5997                         .num_ips        = ctx->addresses_best_num,
5998                         .ips            = ctx->addresses_best,
5999                         .apply_expected = True
6000                 },
6001                 .replica= {
6002                         .type           = WREPL_TYPE_GROUP,
6003                         .state          = WREPL_STATE_ACTIVE,
6004                         .node           = WREPL_NODE_B,
6005                         .is_static      = False,
6006                         .num_ips        = ctx->addresses_best_num,
6007                         .ips            = ctx->addresses_best,
6008                         .apply_expected = True
6009                 },
6010         },
6011         /*
6012          * mhomed,released vs. group,active with different ip(s)
6013          */
6014         {
6015                 .line   = __location__,
6016                 .name   = _NBT_NAME("_MR_GA_DI", 0x00, NULL),
6017                 .wins   = {
6018                         .nb_flags       = 0,
6019                         .mhomed         = True,
6020                         .num_ips        = ctx->addresses_best_num,
6021                         .ips            = ctx->addresses_best,
6022                         .apply_expected = True
6023                 },
6024                 .replica= {
6025                         .type           = WREPL_TYPE_GROUP,
6026                         .state          = WREPL_STATE_ACTIVE,
6027                         .node           = WREPL_NODE_B,
6028                         .is_static      = False,
6029                         .num_ips        = ARRAY_SIZE(addresses_B_1),
6030                         .ips            = addresses_B_1,
6031                         .apply_expected = True
6032                 },
6033         },
6034         /*
6035          * mhomed,released vs. group,tombstone with same ip(s)
6036          */
6037         {
6038                 .line   = __location__,
6039                 .name   = _NBT_NAME("_MR_GT_SI", 0x00, NULL),
6040                 .wins   = {
6041                         .nb_flags       = 0,
6042                         .mhomed         = True,
6043                         .num_ips        = ctx->addresses_best_num,
6044                         .ips            = ctx->addresses_best,
6045                         .apply_expected = True
6046                 },
6047                 .replica= {
6048                         .type           = WREPL_TYPE_GROUP,
6049                         .state          = WREPL_STATE_TOMBSTONE,
6050                         .node           = WREPL_NODE_B,
6051                         .is_static      = False,
6052                         .num_ips        = ctx->addresses_best_num,
6053                         .ips            = ctx->addresses_best,
6054                         .apply_expected = True
6055                 },
6056         },
6057         /*
6058          * mhomed,released vs. group,tombstone with different ip(s)
6059          */
6060         {
6061                 .line   = __location__,
6062                 .name   = _NBT_NAME("_MR_GT_DI", 0x00, NULL),
6063                 .wins   = {
6064                         .nb_flags       = 0,
6065                         .mhomed         = True,
6066                         .num_ips        = ctx->addresses_best_num,
6067                         .ips            = ctx->addresses_best,
6068                         .apply_expected = True
6069                 },
6070                 .replica= {
6071                         .type           = WREPL_TYPE_GROUP,
6072                         .state          = WREPL_STATE_TOMBSTONE,
6073                         .node           = WREPL_NODE_B,
6074                         .is_static      = False,
6075                         .num_ips        = ARRAY_SIZE(addresses_B_1),
6076                         .ips            = addresses_B_1,
6077                         .apply_expected = True
6078                 },
6079         },
6080 /* 
6081  * multi homed vs. special group section
6082  */
6083         /*
6084          * mhomed,released vs. sgroup,active with same ip(s)
6085          */
6086         {
6087                 .line   = __location__,
6088                 .name   = _NBT_NAME("_MR_SA_SI", 0x00, NULL),
6089                 .wins   = {
6090                         .nb_flags       = 0,
6091                         .mhomed         = True,
6092                         .num_ips        = ctx->addresses_best_num,
6093                         .ips            = ctx->addresses_best,
6094                         .apply_expected = True
6095                 },
6096                 .replica= {
6097                         .type           = WREPL_TYPE_SGROUP,
6098                         .state          = WREPL_STATE_ACTIVE,
6099                         .node           = WREPL_NODE_B,
6100                         .is_static      = False,
6101                         .num_ips        = ctx->addresses_best_num,
6102                         .ips            = ctx->addresses_best,
6103                         .apply_expected = True
6104                 },
6105         },
6106         /*
6107          * mhomed,released vs. sgroup,active with different ip(s)
6108          */
6109         {
6110                 .line   = __location__,
6111                 .name   = _NBT_NAME("_MR_SA_DI", 0x00, NULL),
6112                 .wins   = {
6113                         .nb_flags       = 0,
6114                         .mhomed         = True,
6115                         .num_ips        = ctx->addresses_best_num,
6116                         .ips            = ctx->addresses_best,
6117                         .apply_expected = True
6118                 },
6119                 .replica= {
6120                         .type           = WREPL_TYPE_SGROUP,
6121                         .state          = WREPL_STATE_ACTIVE,
6122                         .node           = WREPL_NODE_B,
6123                         .is_static      = False,
6124                         .num_ips        = ARRAY_SIZE(addresses_B_1),
6125                         .ips            = addresses_B_1,
6126                         .apply_expected = True
6127                 },
6128         },
6129         /*
6130          * mhomed,released vs. sgroup,tombstone with same ip(s)
6131          */
6132         {
6133                 .line   = __location__,
6134                 .name   = _NBT_NAME("_MR_ST_SI", 0x00, NULL),
6135                 .wins   = {
6136                         .nb_flags       = 0,
6137                         .mhomed         = True,
6138                         .num_ips        = ctx->addresses_best_num,
6139                         .ips            = ctx->addresses_best,
6140                         .apply_expected = True
6141                 },
6142                 .replica= {
6143                         .type           = WREPL_TYPE_SGROUP,
6144                         .state          = WREPL_STATE_TOMBSTONE,
6145                         .node           = WREPL_NODE_B,
6146                         .is_static      = False,
6147                         .num_ips        = ctx->addresses_best_num,
6148                         .ips            = ctx->addresses_best,
6149                         .apply_expected = True
6150                 },
6151         },
6152         /*
6153          * mhomed,released vs. sgroup,tombstone with different ip(s)
6154          */
6155         {
6156                 .line   = __location__,
6157                 .name   = _NBT_NAME("_MR_ST_DI", 0x00, NULL),
6158                 .wins   = {
6159                         .nb_flags       = 0,
6160                         .mhomed         = True,
6161                         .num_ips        = ctx->addresses_best_num,
6162                         .ips            = ctx->addresses_best,
6163                         .apply_expected = True
6164                 },
6165                 .replica= {
6166                         .type           = WREPL_TYPE_SGROUP,
6167                         .state          = WREPL_STATE_TOMBSTONE,
6168                         .node           = WREPL_NODE_B,
6169                         .is_static      = False,
6170                         .num_ips        = ARRAY_SIZE(addresses_B_1),
6171                         .ips            = addresses_B_1,
6172                         .apply_expected = True
6173                 },
6174         },
6175 /* 
6176  * multi homed vs. multi homed section
6177  */
6178         /*
6179          * mhomed,released vs. mhomed,active with same ip(s)
6180          */
6181         {
6182                 .line   = __location__,
6183                 .name   = _NBT_NAME("_MR_MA_SI", 0x00, NULL),
6184                 .wins   = {
6185                         .nb_flags       = 0,
6186                         .mhomed         = True,
6187                         .num_ips        = ctx->addresses_best_num,
6188                         .ips            = ctx->addresses_best,
6189                         .apply_expected = True
6190                 },
6191                 .replica= {
6192                         .type           = WREPL_TYPE_MHOMED,
6193                         .state          = WREPL_STATE_ACTIVE,
6194                         .node           = WREPL_NODE_B,
6195                         .is_static      = False,
6196                         .num_ips        = ctx->addresses_best_num,
6197                         .ips            = ctx->addresses_best,
6198                         .apply_expected = True
6199                 },
6200         },
6201         /*
6202          * mhomed,released vs. mhomed,active with different ip(s)
6203          */
6204         {
6205                 .line   = __location__,
6206                 .name   = _NBT_NAME("_MR_MA_DI", 0x00, NULL),
6207                 .wins   = {
6208                         .nb_flags       = 0,
6209                         .mhomed         = True,
6210                         .num_ips        = ctx->addresses_best_num,
6211                         .ips            = ctx->addresses_best,
6212                         .apply_expected = True
6213                 },
6214                 .replica= {
6215                         .type           = WREPL_TYPE_MHOMED,
6216                         .state          = WREPL_STATE_ACTIVE,
6217                         .node           = WREPL_NODE_B,
6218                         .is_static      = False,
6219                         .num_ips        = ARRAY_SIZE(addresses_B_1),
6220                         .ips            = addresses_B_1,
6221                         .apply_expected = True
6222                 },
6223         },
6224         /*
6225          * mhomed,released vs. mhomed,tombstone with same ip(s)
6226          */
6227         {
6228                 .line   = __location__,
6229                 .name   = _NBT_NAME("_MR_MT_SI", 0x00, NULL),
6230                 .wins   = {
6231                         .nb_flags       = 0,
6232                         .mhomed         = True,
6233                         .num_ips        = ctx->addresses_best_num,
6234                         .ips            = ctx->addresses_best,
6235                         .apply_expected = True
6236                 },
6237                 .replica= {
6238                         .type           = WREPL_TYPE_MHOMED,
6239                         .state          = WREPL_STATE_TOMBSTONE,
6240                         .node           = WREPL_NODE_B,
6241                         .is_static      = False,
6242                         .num_ips        = ctx->addresses_best_num,
6243                         .ips            = ctx->addresses_best,
6244                         .apply_expected = True
6245                 },
6246         },
6247         /*
6248          * mhomed,released vs. mhomed,tombstone with different ip(s)
6249          */
6250         {
6251                 .line   = __location__,
6252                 .name   = _NBT_NAME("_MR_MT_DI", 0x00, NULL),
6253                 .wins   = {
6254                         .nb_flags       = 0,
6255                         .mhomed         = True,
6256                         .num_ips        = ctx->addresses_best_num,
6257                         .ips            = ctx->addresses_best,
6258                         .apply_expected = True
6259                 },
6260                 .replica= {
6261                         .type           = WREPL_TYPE_MHOMED,
6262                         .state          = WREPL_STATE_TOMBSTONE,
6263                         .node           = WREPL_NODE_B,
6264                         .is_static      = False,
6265                         .num_ips        = ARRAY_SIZE(addresses_B_1),
6266                         .ips            = addresses_B_1,
6267                         .apply_expected = True
6268                 },
6269         },
6270         };
6271
6272         if (!ctx) return False;
6273
6274         printf("Test Replica records vs. owned released records\n");
6275
6276         for(i=0; ret && i < ARRAY_SIZE(records); i++) {
6277                 printf("%s => %s\n", nbt_name_string(ctx, &records[i].name),
6278                         (records[i].replica.apply_expected?"REPLACE":"NOT REPLACE"));
6279
6280                 /*
6281                  * Setup Register
6282                  */
6283                 name_register->in.name          = records[i].name;
6284                 name_register->in.dest_addr     = ctx->address;
6285                 name_register->in.address       = records[i].wins.ips[0].ip;
6286                 name_register->in.nb_flags      = records[i].wins.nb_flags;
6287                 name_register->in.register_demand= False;
6288                 name_register->in.broadcast     = False;
6289                 name_register->in.multi_homed   = records[i].wins.mhomed;
6290                 name_register->in.ttl           = 300000;
6291                 name_register->in.timeout       = 70;
6292                 name_register->in.retries       = 0;
6293
6294                 status = nbt_name_register(ctx->nbtsock, ctx, name_register);
6295                 if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
6296                         printf("No response from %s for name register\n", ctx->address);
6297                         ret = False;
6298                 }
6299                 if (!NT_STATUS_IS_OK(status)) {
6300                         printf("Bad response from %s for name register - %s\n",
6301                                ctx->address, nt_errstr(status));
6302                         ret = False;
6303                 }
6304                 CHECK_VALUE(name_register->out.rcode, 0);
6305                 CHECK_VALUE_STRING(name_register->out.reply_from, ctx->address);
6306                 CHECK_VALUE(name_register->out.name.type, records[i].name.type);
6307                 CHECK_VALUE_STRING(name_register->out.name.name, records[i].name.name);
6308                 CHECK_VALUE_STRING(name_register->out.name.scope, records[i].name.scope);
6309                 CHECK_VALUE_STRING(name_register->out.reply_addr, records[i].wins.ips[0].ip);
6310
6311                 /* release the record */
6312                 release->in.name        = records[i].name;
6313                 release->in.dest_addr   = ctx->address;
6314                 release->in.address     = records[i].wins.ips[0].ip;
6315                 release->in.nb_flags    = records[i].wins.nb_flags;
6316                 release->in.broadcast   = False;
6317                 release->in.timeout     = 30;
6318                 release->in.retries     = 0;
6319
6320                 status = nbt_name_release(ctx->nbtsock, ctx, release);
6321                 if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
6322                         printf("No response from %s for name release\n", ctx->address);
6323                         return False;
6324                 }
6325                 if (!NT_STATUS_IS_OK(status)) {
6326                         printf("Bad response from %s for name query - %s\n",
6327                                ctx->address, nt_errstr(status));
6328                         return False;
6329                 }
6330                 CHECK_VALUE(release->out.rcode, 0);
6331
6332                 /*
6333                  * Setup Replica
6334                  */
6335                 wins_name->name         = &records[i].name;
6336                 wins_name->flags        = WREPL_NAME_FLAGS(records[i].replica.type,
6337                                                            records[i].replica.state,
6338                                                            records[i].replica.node,
6339                                                            records[i].replica.is_static);
6340                 wins_name->id           = ++ctx->b.max_version;
6341                 if (wins_name->flags & 2) {
6342                         wins_name->addresses.addresses.num_ips = records[i].replica.num_ips;
6343                         wins_name->addresses.addresses.ips     = discard_const(records[i].replica.ips);
6344                 } else {
6345                         wins_name->addresses.ip = records[i].replica.ips[0].ip;
6346                 }
6347                 wins_name->unknown      = "255.255.255.255";
6348
6349                 ret &= test_wrepl_update_one(ctx, &ctx->b, wins_name);
6350                 ret &= test_wrepl_is_applied(ctx, &ctx->b, wins_name,
6351                                              records[i].replica.apply_expected);
6352
6353                 if (records[i].replica.apply_expected) {
6354                         wins_name->name         = &records[i].name;
6355                         wins_name->flags        = WREPL_NAME_FLAGS(WREPL_TYPE_UNIQUE,
6356                                                                    WREPL_STATE_TOMBSTONE,
6357                                                                    WREPL_NODE_B, False);
6358                         wins_name->id           = ++ctx->b.max_version;
6359                         wins_name->addresses.ip = addresses_B_1[0].ip;
6360                         wins_name->unknown      = "255.255.255.255";
6361
6362                         ret &= test_wrepl_update_one(ctx, &ctx->b, wins_name);
6363                         ret &= test_wrepl_is_applied(ctx, &ctx->b, wins_name, True);
6364                 } else {
6365                         release->in.name        = records[i].name;
6366                         release->in.dest_addr   = ctx->address;
6367                         release->in.address     = records[i].wins.ips[0].ip;
6368                         release->in.nb_flags    = records[i].wins.nb_flags;
6369                         release->in.broadcast   = False;
6370                         release->in.timeout     = 30;
6371                         release->in.retries     = 0;
6372
6373                         status = nbt_name_release(ctx->nbtsock, ctx, release);
6374                         if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
6375                                 printf("No response from %s for name release\n", ctx->address);
6376                                 return False;
6377                         }
6378                         if (!NT_STATUS_IS_OK(status)) {
6379                                 printf("Bad response from %s for name query - %s\n",
6380                                        ctx->address, nt_errstr(status));
6381                                 return False;
6382                         }
6383                         CHECK_VALUE(release->out.rcode, 0);
6384                 }
6385 done:
6386                 if (!ret) {
6387                         printf("conflict handled wrong or record[%u]: %s\n", i, records[i].line);
6388                         return ret;
6389                 }
6390         }
6391
6392         return ret;
6393 }
6394
6395 struct test_conflict_owned_active_vs_replica_struct {
6396         const char *line; /* just better debugging */
6397         const char *section; /* just better debugging */
6398         struct nbt_name name;
6399         BOOL skip;
6400         struct {
6401                 uint32_t nb_flags;
6402                 BOOL mhomed;
6403                 uint32_t num_ips;
6404                 const struct wrepl_ip *ips;
6405                 BOOL apply_expected;
6406         } wins;
6407         struct {
6408                 uint32_t timeout;
6409                 BOOL positive;
6410                 BOOL expect_release;
6411                 BOOL late_release;
6412                 BOOL ret;
6413                 /* when num_ips == 0, then .wins.ips are used */
6414                 uint32_t num_ips;
6415                 const struct wrepl_ip *ips;
6416         } defend;
6417         struct {
6418                 enum wrepl_name_type type;
6419                 enum wrepl_name_state state;
6420                 enum wrepl_name_node node;
6421                 BOOL is_static;
6422                 uint32_t num_ips;
6423                 const struct wrepl_ip *ips;
6424                 BOOL apply_expected;
6425                 BOOL mhomed_merge;
6426                 BOOL sgroup_merge;
6427         } replica;
6428 };
6429
6430 static void test_conflict_owned_active_vs_replica_handler(struct nbt_name_socket *nbtsock, 
6431                                                           struct nbt_name_packet *req_packet, 
6432                                                           const struct nbt_peer_socket *src);
6433
6434 static BOOL test_conflict_owned_active_vs_replica(struct test_wrepl_conflict_conn *ctx)
6435 {
6436         BOOL ret = True;
6437         NTSTATUS status;
6438         struct wrepl_wins_name wins_name_;
6439         struct wrepl_wins_name *wins_name = &wins_name_;
6440         struct nbt_name_register name_register_;
6441         struct nbt_name_register *name_register = &name_register_;
6442         struct nbt_name_release release_;
6443         struct nbt_name_release *release = &release_;
6444         uint32_t i;
6445         struct test_conflict_owned_active_vs_replica_struct records[] = {
6446 /* 
6447  * unique vs. unique section
6448  */
6449         /*
6450          * unique,active vs. unique,active with same ip(s), unchecked
6451          */
6452         {
6453                 .line   = __location__,
6454                 .name   = _NBT_NAME("_UA_UA_SI_U", 0x00, NULL),
6455                 .wins   = {
6456                         .nb_flags       = 0,
6457                         .mhomed         = False,
6458                         .num_ips        = ctx->addresses_best_num,
6459                         .ips            = ctx->addresses_best,
6460                         .apply_expected = True
6461                 },
6462                 .defend = {
6463                         .timeout        = 0,
6464                 },
6465                 .replica= {
6466                         .type           = WREPL_TYPE_UNIQUE,
6467                         .state          = WREPL_STATE_ACTIVE,
6468                         .node           = WREPL_NODE_B,
6469                         .is_static      = False,
6470                         .num_ips        = ctx->addresses_best_num,
6471                         .ips            = ctx->addresses_best,
6472                         .apply_expected = True
6473                 },
6474         },
6475         /*
6476          * unique,active vs. unique,active with different ip(s), positive response
6477          */
6478         {
6479                 .line   = __location__,
6480                 .name   = _NBT_NAME("_UA_UA_DI_P", 0x00, NULL),
6481                 .wins   = {
6482                         .nb_flags       = 0,
6483                         .mhomed         = False,
6484                         .num_ips        = ctx->addresses_best_num,
6485                         .ips            = ctx->addresses_best,
6486                         .apply_expected = True
6487                 },
6488                 .defend = {
6489                         .timeout        = 10,
6490                         .positive       = True,
6491                 },
6492                 .replica= {
6493                         .type           = WREPL_TYPE_UNIQUE,
6494                         .state          = WREPL_STATE_ACTIVE,
6495                         .node           = WREPL_NODE_B,
6496                         .is_static      = False,
6497                         .num_ips        = ARRAY_SIZE(addresses_B_1),
6498                         .ips            = addresses_B_1,
6499                         .apply_expected = False
6500                 },
6501         },
6502         /*
6503          * unique,active vs. unique,active with different ip(s), positive response other ips
6504          */
6505         {
6506                 .line   = __location__,
6507                 .name   = _NBT_NAME("_UA_UA_DI_O", 0x00, NULL),
6508                 .wins   = {
6509                         .nb_flags       = 0,
6510                         .mhomed         = False,
6511                         .num_ips        = ctx->addresses_best_num,
6512                         .ips            = ctx->addresses_best,
6513                         .apply_expected = True
6514                 },
6515                 .defend = {
6516                         .timeout        = 10,
6517                         .positive       = True,
6518                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
6519                         .ips            = addresses_A_3_4,
6520                 },
6521                 .replica= {
6522                         .type           = WREPL_TYPE_UNIQUE,
6523                         .state          = WREPL_STATE_ACTIVE,
6524                         .node           = WREPL_NODE_B,
6525                         .is_static      = False,
6526                         .num_ips        = ARRAY_SIZE(addresses_B_1),
6527                         .ips            = addresses_B_1,
6528                         .apply_expected = False
6529                 },
6530         },
6531         /*
6532          * unique,active vs. unique,active with different ip(s), negative response
6533          */
6534         {
6535                 .line   = __location__,
6536                 .name   = _NBT_NAME("_UA_UA_DI_N", 0x00, NULL),
6537                 .wins   = {
6538                         .nb_flags       = 0,
6539                         .mhomed         = False,
6540                         .num_ips        = ctx->addresses_best_num,
6541                         .ips            = ctx->addresses_best,
6542                         .apply_expected = True
6543                 },
6544                 .defend = {
6545                         .timeout        = 10,
6546                         .positive       = False,
6547                 },
6548                 .replica= {
6549                         .type           = WREPL_TYPE_UNIQUE,
6550                         .state          = WREPL_STATE_ACTIVE,
6551                         .node           = WREPL_NODE_B,
6552                         .is_static      = False,
6553                         .num_ips        = ARRAY_SIZE(addresses_B_1),
6554                         .ips            = addresses_B_1,
6555                         .apply_expected = True
6556                 },
6557         },
6558         /*
6559          * unique,active vs. unique,tombstone with same ip(s), unchecked
6560          */
6561         {
6562                 .line   = __location__,
6563                 .name   = _NBT_NAME("_UA_UT_SI_U", 0x00, NULL),
6564                 .wins   = {
6565                         .nb_flags       = 0,
6566                         .mhomed         = False,
6567                         .num_ips        = ctx->addresses_best_num,
6568                         .ips            = ctx->addresses_best,
6569                         .apply_expected = True
6570                 },
6571                 .defend = {
6572                         .timeout        = 0,
6573                 },
6574                 .replica= {
6575                         .type           = WREPL_TYPE_UNIQUE,
6576                         .state          = WREPL_STATE_TOMBSTONE,
6577                         .node           = WREPL_NODE_B,
6578                         .is_static      = False,
6579                         .num_ips        = ctx->addresses_best_num,
6580                         .ips            = ctx->addresses_best,
6581                         .apply_expected = False
6582                 },
6583         },
6584         /*
6585          * unique,active vs. unique,tombstone with different ip(s), unchecked
6586          */
6587         {
6588                 .line   = __location__,
6589                 .name   = _NBT_NAME("_UA_UT_DI_U", 0x00, NULL),
6590                 .wins   = {
6591                         .nb_flags       = 0,
6592                         .mhomed         = False,
6593                         .num_ips        = ctx->addresses_best_num,
6594                         .ips            = ctx->addresses_best,
6595                         .apply_expected = True
6596                 },
6597                 .defend = {
6598                         .timeout        = 0,
6599                 },
6600                 .replica= {
6601                         .type           = WREPL_TYPE_UNIQUE,
6602                         .state          = WREPL_STATE_TOMBSTONE,
6603                         .node           = WREPL_NODE_B,
6604                         .is_static      = False,
6605                         .num_ips        = ARRAY_SIZE(addresses_B_1),
6606                         .ips            = addresses_B_1,
6607                         .apply_expected = False
6608                 },
6609         },
6610 /* 
6611  * unique vs. group section
6612  */
6613         /*
6614          * unique,active vs. group,active with same ip(s), release expected
6615          */
6616         {
6617                 .line   = __location__,
6618                 .name   = _NBT_NAME("_UA_GA_SI_R", 0x00, NULL),
6619                 .wins   = {
6620                         .nb_flags       = 0,
6621                         .mhomed         = False,
6622                         .num_ips        = ctx->addresses_best_num,
6623                         .ips            = ctx->addresses_best,
6624                         .apply_expected = True
6625                 },
6626                 .defend = {
6627                         .timeout        = 10,
6628                         .expect_release = True,
6629                 },
6630                 .replica= {
6631                         .type           = WREPL_TYPE_GROUP,
6632                         .state          = WREPL_STATE_ACTIVE,
6633                         .node           = WREPL_NODE_B,
6634                         .is_static      = False,
6635                         .num_ips        = ctx->addresses_best_num,
6636                         .ips            = ctx->addresses_best,
6637                         .apply_expected = True
6638                 },
6639         },
6640         /*
6641          * unique,active vs. group,active with different ip(s), release expected
6642          */
6643         {
6644                 .line   = __location__,
6645                 .name   = _NBT_NAME("_UA_GA_DI_R", 0x00, NULL),
6646                 .wins   = {
6647                         .nb_flags       = 0,
6648                         .mhomed         = False,
6649                         .num_ips        = ctx->addresses_best_num,
6650                         .ips            = ctx->addresses_best,
6651                         .apply_expected = True
6652                 },
6653                 .defend = {
6654                         .timeout        = 10,
6655                         .expect_release = True,
6656                 },
6657                 .replica= {
6658                         .type           = WREPL_TYPE_GROUP,
6659                         .state          = WREPL_STATE_ACTIVE,
6660                         .node           = WREPL_NODE_B,
6661                         .is_static      = False,
6662                         .num_ips        = ARRAY_SIZE(addresses_B_1),
6663                         .ips            = addresses_B_1,
6664                         .apply_expected = True
6665                 },
6666         },
6667         /*
6668          * unique,active vs. group,tombstone with same ip(s), unchecked
6669          */
6670         {
6671                 .line   = __location__,
6672                 .name   = _NBT_NAME("_UA_GT_SI_U", 0x00, NULL),
6673                 .wins   = {
6674                         .nb_flags       = 0,
6675                         .mhomed         = False,
6676                         .num_ips        = ctx->addresses_best_num,
6677                         .ips            = ctx->addresses_best,
6678                         .apply_expected = True
6679                 },
6680                 .defend = {
6681                         .timeout        = 0,
6682                 },
6683                 .replica= {
6684                         .type           = WREPL_TYPE_GROUP,
6685                         .state          = WREPL_STATE_TOMBSTONE,
6686                         .node           = WREPL_NODE_B,
6687                         .is_static      = False,
6688                         .num_ips        = ctx->addresses_best_num,
6689                         .ips            = ctx->addresses_best,
6690                         .apply_expected = False
6691                 },
6692         },
6693         /*
6694          * unique,active vs. group,tombstone with different ip(s), unchecked
6695          */
6696         {
6697                 .line   = __location__,
6698                 .name   = _NBT_NAME("_UA_GT_DI_U", 0x00, NULL),
6699                 .wins   = {
6700                         .nb_flags       = 0,
6701                         .mhomed         = False,
6702                         .num_ips        = ctx->addresses_best_num,
6703                         .ips            = ctx->addresses_best,
6704                         .apply_expected = True
6705                 },
6706                 .defend = {
6707                         .timeout        = 0,
6708                 },
6709                 .replica= {
6710                         .type           = WREPL_TYPE_GROUP,
6711                         .state          = WREPL_STATE_TOMBSTONE,
6712                         .node           = WREPL_NODE_B,
6713                         .is_static      = False,
6714                         .num_ips        = ARRAY_SIZE(addresses_B_1),
6715                         .ips            = addresses_B_1,
6716                         .apply_expected = False
6717                 },
6718         },
6719 /* 
6720  * unique vs. special group section
6721  */
6722         /*
6723          * unique,active vs. sgroup,active with same ip(s), release expected
6724          */
6725         {
6726                 .line   = __location__,
6727                 .name   = _NBT_NAME("_UA_SA_SI_R", 0x00, NULL),
6728                 .wins   = {
6729                         .nb_flags       = 0,
6730                         .mhomed         = False,
6731                         .num_ips        = ctx->addresses_best_num,
6732                         .ips            = ctx->addresses_best,
6733                         .apply_expected = True
6734                 },
6735                 .defend = {
6736                         .timeout        = 10,
6737                         .expect_release = True,
6738                 },
6739                 .replica= {
6740                         .type           = WREPL_TYPE_SGROUP,
6741                         .state          = WREPL_STATE_ACTIVE,
6742                         .node           = WREPL_NODE_B,
6743                         .is_static      = False,
6744                         .num_ips        = ctx->addresses_best_num,
6745                         .ips            = ctx->addresses_best,
6746                         .apply_expected = True
6747                 },
6748         },
6749         /*
6750          * unique,active vs. group,active with different ip(s), release expected
6751          */
6752         {
6753                 .line   = __location__,
6754                 .name   = _NBT_NAME("_UA_SA_DI_R", 0x00, NULL),
6755                 .wins   = {
6756                         .nb_flags       = 0,
6757                         .mhomed         = False,
6758                         .num_ips        = ctx->addresses_best_num,
6759                         .ips            = ctx->addresses_best,
6760                         .apply_expected = True
6761                 },
6762                 .defend = {
6763                         .timeout        = 10,
6764                         .expect_release = True,
6765                 },
6766                 .replica= {
6767                         .type           = WREPL_TYPE_SGROUP,
6768                         .state          = WREPL_STATE_ACTIVE,
6769                         .node           = WREPL_NODE_B,
6770                         .is_static      = False,
6771                         .num_ips        = ARRAY_SIZE(addresses_B_1),
6772                         .ips            = addresses_B_1,
6773                         .apply_expected = True
6774                 },
6775         },
6776         /*
6777          * unique,active vs. sgroup,tombstone with same ip(s), unchecked
6778          */
6779         {
6780                 .line   = __location__,
6781                 .name   = _NBT_NAME("_UA_ST_SI_U", 0x00, NULL),
6782                 .wins   = {
6783                         .nb_flags       = 0,
6784                         .mhomed         = False,
6785                         .num_ips        = ctx->addresses_best_num,
6786                         .ips            = ctx->addresses_best,
6787                         .apply_expected = True
6788                 },
6789                 .defend = {
6790                         .timeout        = 0,
6791                 },
6792                 .replica= {
6793                         .type           = WREPL_TYPE_SGROUP,
6794                         .state          = WREPL_STATE_TOMBSTONE,
6795                         .node           = WREPL_NODE_B,
6796                         .is_static      = False,
6797                         .num_ips        = ctx->addresses_best_num,
6798                         .ips            = ctx->addresses_best,
6799                         .apply_expected = False
6800                 },
6801         },
6802         /*
6803          * unique,active vs. sgroup,tombstone with different ip(s), unchecked
6804          */
6805         {
6806                 .line   = __location__,
6807                 .name   = _NBT_NAME("_UA_ST_DI_U", 0x00, NULL),
6808                 .wins   = {
6809                         .nb_flags       = 0,
6810                         .mhomed         = False,
6811                         .num_ips        = ctx->addresses_best_num,
6812                         .ips            = ctx->addresses_best,
6813                         .apply_expected = True
6814                 },
6815                 .defend = {
6816                         .timeout        = 0,
6817                 },
6818                 .replica= {
6819                         .type           = WREPL_TYPE_SGROUP,
6820                         .state          = WREPL_STATE_TOMBSTONE,
6821                         .node           = WREPL_NODE_B,
6822                         .is_static      = False,
6823                         .num_ips        = ARRAY_SIZE(addresses_B_1),
6824                         .ips            = addresses_B_1,
6825                         .apply_expected = False
6826                 },
6827         },
6828 /* 
6829  * unique vs. multi homed section
6830  */
6831         /*
6832          * unique,active vs. mhomed,active with same ip(s), unchecked
6833          */
6834         {
6835                 .line   = __location__,
6836                 .name   = _NBT_NAME("_UA_MA_SI_U", 0x00, NULL),
6837                 .wins   = {
6838                         .nb_flags       = 0,
6839                         .mhomed         = False,
6840                         .num_ips        = ctx->addresses_best_num,
6841                         .ips            = ctx->addresses_best,
6842                         .apply_expected = True
6843                 },
6844                 .defend = {
6845                         .timeout        = 0,
6846                 },
6847                 .replica= {
6848                         .type           = WREPL_TYPE_MHOMED,
6849                         .state          = WREPL_STATE_ACTIVE,
6850                         .node           = WREPL_NODE_B,
6851                         .is_static      = False,
6852                         .num_ips        = ctx->addresses_best_num,
6853                         .ips            = ctx->addresses_best,
6854                         .apply_expected = True
6855                 },
6856         },
6857         /*
6858          * unique,active vs. mhomed,active with superset ip(s), unchecked
6859          */
6860         {
6861                 .line   = __location__,
6862                 .name   = _NBT_NAME("_UA_MA_SP_U", 0x00, NULL),
6863                 .wins   = {
6864                         .nb_flags       = 0,
6865                         .mhomed         = False,
6866                         .num_ips        = ctx->addresses_best_num,
6867                         .ips            = ctx->addresses_best,
6868                         .apply_expected = True
6869                 },
6870                 .defend = {
6871                         .timeout        = 0,
6872                 },
6873                 .replica= {
6874                         .type           = WREPL_TYPE_MHOMED,
6875                         .state          = WREPL_STATE_ACTIVE,
6876                         .node           = WREPL_NODE_B,
6877                         .is_static      = False,
6878                         .num_ips        = ctx->addresses_all_num,
6879                         .ips            = ctx->addresses_all,
6880                         .apply_expected = True
6881                 },
6882         },
6883         /*
6884          * unique,active vs. mhomed,active with different ip(s), positive response
6885          */
6886         {
6887                 .line   = __location__,
6888                 .name   = _NBT_NAME("_UA_MA_DI_P", 0x00, NULL),
6889                 .wins   = {
6890                         .nb_flags       = 0,
6891                         .mhomed         = False,
6892                         .num_ips        = ctx->addresses_best_num,
6893                         .ips            = ctx->addresses_best,
6894                         .apply_expected = True
6895                 },
6896                 .defend = {
6897                         .timeout        = 10,
6898                         .positive       = True,
6899                 },
6900                 .replica= {
6901                         .type           = WREPL_TYPE_MHOMED,
6902                         .state          = WREPL_STATE_ACTIVE,
6903                         .node           = WREPL_NODE_B,
6904                         .is_static      = False,
6905                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
6906                         .ips            = addresses_B_3_4,
6907                         .apply_expected = False
6908                 },
6909         },
6910         /*
6911          * unique,active vs. mhomed,active with different ip(s), positive response other ips
6912          */
6913         {
6914                 .line   = __location__,
6915                 .name   = _NBT_NAME("_UA_MA_DI_O", 0x00, NULL),
6916                 .wins   = {
6917                         .nb_flags       = 0,
6918                         .mhomed         = False,
6919                         .num_ips        = ctx->addresses_best_num,
6920                         .ips            = ctx->addresses_best,
6921                         .apply_expected = True
6922                 },
6923                 .defend = {
6924                         .timeout        = 10,
6925                         .positive       = True,
6926                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
6927                         .ips            = addresses_A_3_4,
6928                 },
6929                 .replica= {
6930                         .type           = WREPL_TYPE_MHOMED,
6931                         .state          = WREPL_STATE_ACTIVE,
6932                         .node           = WREPL_NODE_B,
6933                         .is_static      = False,
6934                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
6935                         .ips            = addresses_B_3_4,
6936                         .apply_expected = False
6937                 },
6938         },
6939         /*
6940          * unique,active vs. mhomed,active with different ip(s), negative response
6941          */
6942         {
6943                 .line   = __location__,
6944                 .name   = _NBT_NAME("_UA_MA_DI_N", 0x00, NULL),
6945                 .wins   = {
6946                         .nb_flags       = 0,
6947                         .mhomed         = False,
6948                         .num_ips        = ctx->addresses_best_num,
6949                         .ips            = ctx->addresses_best,
6950                         .apply_expected = True
6951                 },
6952                 .defend = {
6953                         .timeout        = 10,
6954                         .positive       = False,
6955                 },
6956                 .replica= {
6957                         .type           = WREPL_TYPE_MHOMED,
6958                         .state          = WREPL_STATE_ACTIVE,
6959                         .node           = WREPL_NODE_B,
6960                         .is_static      = False,
6961                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
6962                         .ips            = addresses_B_3_4,
6963                         .apply_expected = True
6964                 },
6965         },
6966         /*
6967          * unique,active vs. mhomed,tombstone with same ip(s), unchecked
6968          */
6969         {
6970                 .line   = __location__,
6971                 .name   = _NBT_NAME("_UA_MT_SI_U", 0x00, NULL),
6972                 .wins   = {
6973                         .nb_flags       = 0,
6974                         .mhomed         = False,
6975                         .num_ips        = ctx->addresses_best_num,
6976                         .ips            = ctx->addresses_best,
6977                         .apply_expected = True
6978                 },
6979                 .defend = {
6980                         .timeout        = 0,
6981                 },
6982                 .replica= {
6983                         .type           = WREPL_TYPE_MHOMED,
6984                         .state          = WREPL_STATE_TOMBSTONE,
6985                         .node           = WREPL_NODE_B,
6986                         .is_static      = False,
6987                         .num_ips        = ctx->addresses_best_num,
6988                         .ips            = ctx->addresses_best,
6989                         .apply_expected = False
6990                 },
6991         },
6992         /*
6993          * unique,active vs. mhomed,tombstone with different ip(s), unchecked
6994          */
6995         {
6996                 .line   = __location__,
6997                 .name   = _NBT_NAME("_UA_MT_DI_U", 0x00, NULL),
6998                 .wins   = {
6999                         .nb_flags       = 0,
7000                         .mhomed         = False,
7001                         .num_ips        = ctx->addresses_best_num,
7002                         .ips            = ctx->addresses_best,
7003                         .apply_expected = True
7004                 },
7005                 .defend = {
7006                         .timeout        = 0,
7007                 },
7008                 .replica= {
7009                         .type           = WREPL_TYPE_MHOMED,
7010                         .state          = WREPL_STATE_TOMBSTONE,
7011                         .node           = WREPL_NODE_B,
7012                         .is_static      = False,
7013                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
7014                         .ips            = addresses_B_3_4,
7015                         .apply_expected = False
7016                 },
7017         },
7018 /* 
7019  * normal group vs. unique section
7020  */
7021         /*
7022          * group,active vs. unique,active with same ip(s), unchecked
7023          */
7024         {
7025                 .line   = __location__,
7026                 .name   = _NBT_NAME("_GA_UA_SI_U", 0x00, NULL),
7027                 .wins   = {
7028                         .nb_flags       = NBT_NM_GROUP,
7029                         .mhomed         = False,
7030                         .num_ips        = ctx->addresses_best_num,
7031                         .ips            = ctx->addresses_best,
7032                         .apply_expected = True
7033                 },
7034                 .defend = {
7035                         .timeout        = 0,
7036                 },
7037                 .replica= {
7038                         .type           = WREPL_TYPE_UNIQUE,
7039                         .state          = WREPL_STATE_ACTIVE,
7040                         .node           = WREPL_NODE_B,
7041                         .is_static      = False,
7042                         .num_ips        = ctx->addresses_best_num,
7043                         .ips            = ctx->addresses_best,
7044                         .apply_expected = False
7045                 },
7046         },
7047         /*
7048          * group,active vs. unique,active with different ip(s), unchecked
7049          */
7050         {
7051                 .line   = __location__,
7052                 .name   = _NBT_NAME("_GA_UA_DI_U", 0x00, NULL),
7053                 .wins   = {
7054                         .nb_flags       = NBT_NM_GROUP,
7055                         .mhomed         = False,
7056                         .num_ips        = ctx->addresses_best_num,
7057                         .ips            = ctx->addresses_best,
7058                         .apply_expected = True
7059                 },
7060                 .defend = {
7061                         .timeout        = 0,
7062                 },
7063                 .replica= {
7064                         .type           = WREPL_TYPE_UNIQUE,
7065                         .state          = WREPL_STATE_ACTIVE,
7066                         .node           = WREPL_NODE_B,
7067                         .is_static      = False,
7068                         .num_ips        = ARRAY_SIZE(addresses_B_1),
7069                         .ips            = addresses_B_1,
7070                         .apply_expected = False
7071                 },
7072         },
7073         /*
7074          * group,active vs. unique,tombstone with same ip(s), unchecked
7075          */
7076         {
7077                 .line   = __location__,
7078                 .name   = _NBT_NAME("_GA_UT_SI_U", 0x00, NULL),
7079                 .wins   = {
7080                         .nb_flags       = NBT_NM_GROUP,
7081                         .mhomed         = False,
7082                         .num_ips        = ctx->addresses_best_num,
7083                         .ips            = ctx->addresses_best,
7084                         .apply_expected = True
7085                 },
7086                 .defend = {
7087                         .timeout        = 0,
7088                 },
7089                 .replica= {
7090                         .type           = WREPL_TYPE_UNIQUE,
7091                         .state          = WREPL_STATE_TOMBSTONE,
7092                         .node           = WREPL_NODE_B,
7093                         .is_static      = False,
7094                         .num_ips        = ctx->addresses_best_num,
7095                         .ips            = ctx->addresses_best,
7096                         .apply_expected = False
7097                 },
7098         },
7099         /*
7100          * group,active vs. unique,tombstone with different ip(s), unchecked
7101          */
7102         {
7103                 .line   = __location__,
7104                 .name   = _NBT_NAME("_GA_UT_DI_U", 0x00, NULL),
7105                 .wins   = {
7106                         .nb_flags       = NBT_NM_GROUP,
7107                         .mhomed         = False,
7108                         .num_ips        = ctx->addresses_best_num,
7109                         .ips            = ctx->addresses_best,
7110                         .apply_expected = True
7111                 },
7112                 .defend = {
7113                         .timeout        = 0,
7114                 },
7115                 .replica= {
7116                         .type           = WREPL_TYPE_UNIQUE,
7117                         .state          = WREPL_STATE_TOMBSTONE,
7118                         .node           = WREPL_NODE_B,
7119                         .is_static      = False,
7120                         .num_ips        = ARRAY_SIZE(addresses_B_1),
7121                         .ips            = addresses_B_1,
7122                         .apply_expected = False
7123                 },
7124         },
7125 /* 
7126  * normal group vs. normal group section
7127  */
7128         /*
7129          * group,active vs. group,active with same ip(s), unchecked
7130          */
7131         {
7132                 .line   = __location__,
7133                 .name   = _NBT_NAME("_GA_GA_SI_U", 0x00, NULL),
7134                 .wins   = {
7135                         .nb_flags       = NBT_NM_GROUP,
7136                         .mhomed         = False,
7137                         .num_ips        = ctx->addresses_best_num,
7138                         .ips            = ctx->addresses_best,
7139                         .apply_expected = True
7140                 },
7141                 .defend = {
7142                         .timeout        = 0,
7143                 },
7144                 .replica= {
7145                         .type           = WREPL_TYPE_GROUP,
7146                         .state          = WREPL_STATE_ACTIVE,
7147                         .node           = WREPL_NODE_B,
7148                         .is_static      = False,
7149                         .num_ips        = ctx->addresses_best_num,
7150                         .ips            = ctx->addresses_best,
7151                         .apply_expected = True
7152                 },
7153         },
7154         /*
7155          * group,active vs. group,active with different ip(s), unchecked
7156          */
7157         {
7158                 .line   = __location__,
7159                 .name   = _NBT_NAME("_GA_GA_DI_U", 0x00, NULL),
7160                 .wins   = {
7161                         .nb_flags       = NBT_NM_GROUP,
7162                         .mhomed         = False,
7163                         .num_ips        = ctx->addresses_best_num,
7164                         .ips            = ctx->addresses_best,
7165                         .apply_expected = True
7166                 },
7167                 .defend = {
7168                         .timeout        = 0,
7169                 },
7170                 .replica= {
7171                         .type           = WREPL_TYPE_GROUP,
7172                         .state          = WREPL_STATE_ACTIVE,
7173                         .node           = WREPL_NODE_B,
7174                         .is_static      = False,
7175                         .num_ips        = ARRAY_SIZE(addresses_B_1),
7176                         .ips            = addresses_B_1,
7177                         .apply_expected = True
7178                 },
7179         },
7180         /*
7181          * group,active vs. group,tombstone with same ip(s), unchecked
7182          */
7183         {
7184                 .line   = __location__,
7185                 .name   = _NBT_NAME("_GA_GT_SI_U", 0x00, NULL),
7186                 .wins   = {
7187                         .nb_flags       = NBT_NM_GROUP,
7188                         .mhomed         = False,
7189                         .num_ips        = ctx->addresses_best_num,
7190                         .ips            = ctx->addresses_best,
7191                         .apply_expected = True
7192                 },
7193                 .defend = {
7194                         .timeout        = 0,
7195                 },
7196                 .replica= {
7197                         .type           = WREPL_TYPE_GROUP,
7198                         .state          = WREPL_STATE_TOMBSTONE,
7199                         .node           = WREPL_NODE_B,
7200                         .is_static      = False,
7201                         .num_ips        = ctx->addresses_best_num,
7202                         .ips            = ctx->addresses_best,
7203                         .apply_expected = False
7204                 },
7205         },
7206         /*
7207          * group,active vs. group,tombstone with different ip(s), unchecked
7208          */
7209         {
7210                 .line   = __location__,
7211                 .name   = _NBT_NAME("_GA_GT_DI_U", 0x00, NULL),
7212                 .wins   = {
7213                         .nb_flags       = NBT_NM_GROUP,
7214                         .mhomed         = False,
7215                         .num_ips        = ctx->addresses_best_num,
7216                         .ips            = ctx->addresses_best,
7217                         .apply_expected = True
7218                 },
7219                 .defend = {
7220                         .timeout        = 0,
7221                 },
7222                 .replica= {
7223                         .type           = WREPL_TYPE_GROUP,
7224                         .state          = WREPL_STATE_TOMBSTONE,
7225                         .node           = WREPL_NODE_B,
7226                         .is_static      = False,
7227                         .num_ips        = ARRAY_SIZE(addresses_B_1),
7228                         .ips            = addresses_B_1,
7229                         .apply_expected = False
7230                 },
7231         },
7232 /* 
7233  * normal group vs. special group section
7234  */
7235         /*
7236          * group,active vs. sgroup,active with same ip(s), unchecked
7237          */
7238         {
7239                 .line   = __location__,
7240                 .name   = _NBT_NAME("_GA_SA_SI_U", 0x00, NULL),
7241                 .wins   = {
7242                         .nb_flags       = NBT_NM_GROUP,
7243                         .mhomed         = False,
7244                         .num_ips        = ctx->addresses_best_num,
7245                         .ips            = ctx->addresses_best,
7246                         .apply_expected = True
7247                 },
7248                 .defend = {
7249                         .timeout        = 0,
7250                 },
7251                 .replica= {
7252                         .type           = WREPL_TYPE_SGROUP,
7253                         .state          = WREPL_STATE_ACTIVE,
7254                         .node           = WREPL_NODE_B,
7255                         .is_static      = False,
7256                         .num_ips        = ctx->addresses_best_num,
7257                         .ips            = ctx->addresses_best,
7258                         .apply_expected = False
7259                 },
7260         },
7261         /*
7262          * group,active vs. sgroup,active with different ip(s), unchecked
7263          */
7264         {
7265                 .line   = __location__,
7266                 .name   = _NBT_NAME("_GA_SA_DI_U", 0x00, NULL),
7267                 .wins   = {
7268                         .nb_flags       = NBT_NM_GROUP,
7269                         .mhomed         = False,
7270                         .num_ips        = ctx->addresses_best_num,
7271                         .ips            = ctx->addresses_best,
7272                         .apply_expected = True
7273                 },
7274                 .defend = {
7275                         .timeout        = 0,
7276                 },
7277                 .replica= {
7278                         .type           = WREPL_TYPE_SGROUP,
7279                         .state          = WREPL_STATE_ACTIVE,
7280                         .node           = WREPL_NODE_B,
7281                         .is_static      = False,
7282                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
7283                         .ips            = addresses_B_3_4,
7284                         .apply_expected = False
7285                 },
7286         },
7287         /*
7288          * group,active vs. sgroup,tombstone with same ip(s), unchecked
7289          */
7290         {
7291                 .line   = __location__,
7292                 .name   = _NBT_NAME("_GA_ST_SI_U", 0x00, NULL),
7293                 .wins   = {
7294                         .nb_flags       = NBT_NM_GROUP,
7295                         .mhomed         = False,
7296                         .num_ips        = ctx->addresses_best_num,
7297                         .ips            = ctx->addresses_best,
7298                         .apply_expected = True
7299                 },
7300                 .defend = {
7301                         .timeout        = 0,
7302                 },
7303                 .replica= {
7304                         .type           = WREPL_TYPE_SGROUP,
7305                         .state          = WREPL_STATE_TOMBSTONE,
7306                         .node           = WREPL_NODE_B,
7307                         .is_static      = False,
7308                         .num_ips        = ctx->addresses_best_num,
7309                         .ips            = ctx->addresses_best,
7310                         .apply_expected = False
7311                 },
7312         },
7313         /*
7314          * group,active vs. sgroup,tombstone with different ip(s), unchecked
7315          */
7316         {
7317                 .line   = __location__,
7318                 .name   = _NBT_NAME("_GA_ST_DI_U", 0x00, NULL),
7319                 .wins   = {
7320                         .nb_flags       = NBT_NM_GROUP,
7321                         .mhomed         = False,
7322                         .num_ips        = ctx->addresses_best_num,
7323                         .ips            = ctx->addresses_best,
7324                         .apply_expected = True
7325                 },
7326                 .defend = {
7327                         .timeout        = 0,
7328                 },
7329                 .replica= {
7330                         .type           = WREPL_TYPE_SGROUP,
7331                         .state          = WREPL_STATE_TOMBSTONE,
7332                         .node           = WREPL_NODE_B,
7333                         .is_static      = False,
7334                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
7335                         .ips            = addresses_B_3_4,
7336                         .apply_expected = False
7337                 },
7338         },
7339 /* 
7340  * normal group vs. multi homed section
7341  */
7342         /*
7343          * group,active vs. mhomed,active with same ip(s), unchecked
7344          */
7345         {
7346                 .line   = __location__,
7347                 .name   = _NBT_NAME("_GA_MA_SI_U", 0x00, NULL),
7348                 .wins   = {
7349                         .nb_flags       = NBT_NM_GROUP,
7350                         .mhomed         = False,
7351                         .num_ips        = ctx->addresses_best_num,
7352                         .ips            = ctx->addresses_best,
7353                         .apply_expected = True
7354                 },
7355                 .defend = {
7356                         .timeout        = 0,
7357                 },
7358                 .replica= {
7359                         .type           = WREPL_TYPE_MHOMED,
7360                         .state          = WREPL_STATE_ACTIVE,
7361                         .node           = WREPL_NODE_B,
7362                         .is_static      = False,
7363                         .num_ips        = ctx->addresses_best_num,
7364                         .ips            = ctx->addresses_best,
7365                         .apply_expected = False
7366                 },
7367         },
7368         /*
7369          * group,active vs. mhomed,active with different ip(s), unchecked
7370          */
7371         {
7372                 .line   = __location__,
7373                 .name   = _NBT_NAME("_GA_MA_DI_U", 0x00, NULL),
7374                 .wins   = {
7375                         .nb_flags       = NBT_NM_GROUP,
7376                         .mhomed         = False,
7377                         .num_ips        = ctx->addresses_best_num,
7378                         .ips            = ctx->addresses_best,
7379                         .apply_expected = True
7380                 },
7381                 .defend = {
7382                         .timeout        = 0,
7383                 },
7384                 .replica= {
7385                         .type           = WREPL_TYPE_MHOMED,
7386                         .state          = WREPL_STATE_ACTIVE,
7387                         .node           = WREPL_NODE_B,
7388                         .is_static      = False,
7389                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
7390                         .ips            = addresses_B_3_4,
7391                         .apply_expected = False
7392                 },
7393         },
7394         /*
7395          * group,active vs. mhomed,tombstone with same ip(s), unchecked
7396          */
7397         {
7398                 .line   = __location__,
7399                 .name   = _NBT_NAME("_GA_MT_SI_U", 0x00, NULL),
7400                 .wins   = {
7401                         .nb_flags       = NBT_NM_GROUP,
7402                         .mhomed         = False,
7403                         .num_ips        = ctx->addresses_best_num,
7404                         .ips            = ctx->addresses_best,
7405                         .apply_expected = True
7406                 },
7407                 .defend = {
7408                         .timeout        = 0,
7409                 },
7410                 .replica= {
7411                         .type           = WREPL_TYPE_MHOMED,
7412                         .state          = WREPL_STATE_TOMBSTONE,
7413                         .node           = WREPL_NODE_B,
7414                         .is_static      = False,
7415                         .num_ips        = ctx->addresses_best_num,
7416                         .ips            = ctx->addresses_best,
7417                         .apply_expected = False
7418                 },
7419         },
7420         /*
7421          * group,active vs. mhomed,tombstone with different ip(s), unchecked
7422          */
7423         {
7424                 .line   = __location__,
7425                 .name   = _NBT_NAME("_GA_MT_DI_U", 0x00, NULL),
7426                 .wins   = {
7427                         .nb_flags       = NBT_NM_GROUP,
7428                         .mhomed         = False,
7429                         .num_ips        = ctx->addresses_best_num,
7430                         .ips            = ctx->addresses_best,
7431                         .apply_expected = True
7432                 },
7433                 .defend = {
7434                         .timeout        = 0,
7435                 },
7436                 .replica= {
7437                         .type           = WREPL_TYPE_MHOMED,
7438                         .state          = WREPL_STATE_TOMBSTONE,
7439                         .node           = WREPL_NODE_B,
7440                         .is_static      = False,
7441                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
7442                         .ips            = addresses_B_3_4,
7443                         .apply_expected = False
7444                 },
7445         },
7446 /* 
7447  * special group vs. unique section
7448  */
7449         /*
7450          * sgroup,active vs. unique,active with same ip(s), unchecked
7451          */
7452         {
7453                 .line   = __location__,
7454                 .name   = _NBT_NAME("_SA_UA_SI_U", 0x1C, NULL),
7455                 .wins   = {
7456                         .nb_flags       = NBT_NM_GROUP,
7457                         .mhomed         = False,
7458                         .num_ips        = ctx->addresses_best_num,
7459                         .ips            = ctx->addresses_best,
7460                         .apply_expected = True
7461                 },
7462                 .defend = {
7463                         .timeout        = 0,
7464                 },
7465                 .replica= {
7466                         .type           = WREPL_TYPE_UNIQUE,
7467                         .state          = WREPL_STATE_ACTIVE,
7468                         .node           = WREPL_NODE_B,
7469                         .is_static      = False,
7470                         .num_ips        = ctx->addresses_best_num,
7471                         .ips            = ctx->addresses_best,
7472                         .apply_expected = False
7473                 },
7474         },
7475         /*
7476          * sgroup,active vs. unique,active with different ip(s), unchecked
7477          */
7478         {
7479                 .line   = __location__,
7480                 .name   = _NBT_NAME("_SA_UA_DI_U", 0x1C, NULL),
7481                 .wins   = {
7482                         .nb_flags       = NBT_NM_GROUP,
7483                         .mhomed         = False,
7484                         .num_ips        = ctx->addresses_best_num,
7485                         .ips            = ctx->addresses_best,
7486                         .apply_expected = True
7487                 },
7488                 .defend = {
7489                         .timeout        = 0,
7490                 },
7491                 .replica= {
7492                         .type           = WREPL_TYPE_UNIQUE,
7493                         .state          = WREPL_STATE_ACTIVE,
7494                         .node           = WREPL_NODE_B,
7495                         .is_static      = False,
7496                         .num_ips        = ARRAY_SIZE(addresses_B_1),
7497                         .ips            = addresses_B_1,
7498                         .apply_expected = False
7499                 },
7500         },
7501         /*
7502          * sgroup,active vs. unique,tombstone with same ip(s), unchecked
7503          */
7504         {
7505                 .line   = __location__,
7506                 .name   = _NBT_NAME("_SA_UT_SI_U", 0x1C, NULL),
7507                 .wins   = {
7508                         .nb_flags       = NBT_NM_GROUP,
7509                         .mhomed         = False,
7510                         .num_ips        = ctx->addresses_best_num,
7511                         .ips            = ctx->addresses_best,
7512                         .apply_expected = True
7513                 },
7514                 .defend = {
7515                         .timeout        = 0,
7516                 },
7517                 .replica= {
7518                         .type           = WREPL_TYPE_UNIQUE,
7519                         .state          = WREPL_STATE_TOMBSTONE,
7520                         .node           = WREPL_NODE_B,
7521                         .is_static      = False,
7522                         .num_ips        = ctx->addresses_best_num,
7523                         .ips            = ctx->addresses_best,
7524                         .apply_expected = False
7525                 },
7526         },
7527         /*
7528          * sgroup,active vs. unique,tombstone with different ip(s), unchecked
7529          */
7530         {
7531                 .line   = __location__,
7532                 .name   = _NBT_NAME("_SA_UT_DI_U", 0x1C, NULL),
7533                 .wins   = {
7534                         .nb_flags       = NBT_NM_GROUP,
7535                         .mhomed         = False,
7536                         .num_ips        = ctx->addresses_best_num,
7537                         .ips            = ctx->addresses_best,
7538                         .apply_expected = True
7539                 },
7540                 .defend = {
7541                         .timeout        = 0,
7542                 },
7543                 .replica= {
7544                         .type           = WREPL_TYPE_UNIQUE,
7545                         .state          = WREPL_STATE_TOMBSTONE,
7546                         .node           = WREPL_NODE_B,
7547                         .is_static      = False,
7548                         .num_ips        = ARRAY_SIZE(addresses_B_1),
7549                         .ips            = addresses_B_1,
7550                         .apply_expected = False
7551                 },
7552         },
7553 /* 
7554  * special group vs. normal group section
7555  */
7556         /*
7557          * sgroup,active vs. group,active with same ip(s), unchecked
7558          */
7559         {
7560                 .line   = __location__,
7561                 .name   = _NBT_NAME("_SA_GA_SI_U", 0x1C, NULL),
7562                 .wins   = {
7563                         .nb_flags       = NBT_NM_GROUP,
7564                         .mhomed         = False,
7565                         .num_ips        = ctx->addresses_best_num,
7566                         .ips            = ctx->addresses_best,
7567                         .apply_expected = True
7568                 },
7569                 .defend = {
7570                         .timeout        = 0,
7571                 },
7572                 .replica= {
7573                         .type           = WREPL_TYPE_GROUP,
7574                         .state          = WREPL_STATE_ACTIVE,
7575                         .node           = WREPL_NODE_B,
7576                         .is_static      = False,
7577                         .num_ips        = ctx->addresses_best_num,
7578                         .ips            = ctx->addresses_best,
7579                         .apply_expected = False
7580                 },
7581         },
7582         /*
7583          * sgroup,active vs. group,active with different ip(s), unchecked
7584          */
7585         {
7586                 .line   = __location__,
7587                 .name   = _NBT_NAME("_SA_GA_DI_U", 0x1C, NULL),
7588                 .wins   = {
7589                         .nb_flags       = NBT_NM_GROUP,
7590                         .mhomed         = False,
7591                         .num_ips        = ctx->addresses_best_num,
7592                         .ips            = ctx->addresses_best,
7593                         .apply_expected = True
7594                 },
7595                 .defend = {
7596                         .timeout        = 0,
7597                 },
7598                 .replica= {
7599                         .type           = WREPL_TYPE_GROUP,
7600                         .state          = WREPL_STATE_ACTIVE,
7601                         .node           = WREPL_NODE_B,
7602                         .is_static      = False,
7603                         .num_ips        = ARRAY_SIZE(addresses_B_1),
7604                         .ips            = addresses_B_1,
7605                         .apply_expected = False
7606                 },
7607         },
7608         /*
7609          * sgroup,active vs. group,tombstone with same ip(s), unchecked
7610          */
7611         {
7612                 .line   = __location__,
7613                 .name   = _NBT_NAME("_SA_GT_SI_U", 0x1C, NULL),
7614                 .wins   = {
7615                         .nb_flags       = NBT_NM_GROUP,
7616                         .mhomed         = False,
7617                         .num_ips        = ctx->addresses_best_num,
7618                         .ips            = ctx->addresses_best,
7619                         .apply_expected = True
7620                 },
7621                 .defend = {
7622                         .timeout        = 0,
7623                 },
7624                 .replica= {
7625                         .type           = WREPL_TYPE_GROUP,
7626                         .state          = WREPL_STATE_TOMBSTONE,
7627                         .node           = WREPL_NODE_B,
7628                         .is_static      = False,
7629                         .num_ips        = ctx->addresses_best_num,
7630                         .ips            = ctx->addresses_best,
7631                         .apply_expected = False
7632                 },
7633         },
7634         /*
7635          * sgroup,active vs. group,tombstone with different ip(s), unchecked
7636          */
7637         {
7638                 .line   = __location__,
7639                 .name   = _NBT_NAME("_SA_GT_DI_U", 0x1C, NULL),
7640                 .wins   = {
7641                         .nb_flags       = NBT_NM_GROUP,
7642                         .mhomed         = False,
7643                         .num_ips        = ctx->addresses_best_num,
7644                         .ips            = ctx->addresses_best,
7645                         .apply_expected = True
7646                 },
7647                 .defend = {
7648                         .timeout        = 0,
7649                 },
7650                 .replica= {
7651                         .type           = WREPL_TYPE_GROUP,
7652                         .state          = WREPL_STATE_TOMBSTONE,
7653                         .node           = WREPL_NODE_B,
7654                         .is_static      = False,
7655                         .num_ips        = ARRAY_SIZE(addresses_B_1),
7656                         .ips            = addresses_B_1,
7657                         .apply_expected = False
7658                 },
7659         },
7660 /* 
7661  * special group vs. multi homed section
7662  */
7663         /*
7664          * sgroup,active vs. mhomed,active with same ip(s), unchecked
7665          */
7666         {
7667                 .line   = __location__,
7668                 .name   = _NBT_NAME("_SA_MA_SI_U", 0x1C, NULL),
7669                 .wins   = {
7670                         .nb_flags       = NBT_NM_GROUP,
7671                         .mhomed         = False,
7672                         .num_ips        = ctx->addresses_best_num,
7673                         .ips            = ctx->addresses_best,
7674                         .apply_expected = True
7675                 },
7676                 .defend = {
7677                         .timeout        = 0,
7678                 },
7679                 .replica= {
7680                         .type           = WREPL_TYPE_MHOMED,
7681                         .state          = WREPL_STATE_ACTIVE,
7682                         .node           = WREPL_NODE_B,
7683                         .is_static      = False,
7684                         .num_ips        = ctx->addresses_best_num,
7685                         .ips            = ctx->addresses_best,
7686                         .apply_expected = False
7687                 },
7688         },
7689         /*
7690          * sgroup,active vs. mhomed,active with different ip(s), unchecked
7691          */
7692         {
7693                 .line   = __location__,
7694                 .name   = _NBT_NAME("_SA_MA_DI_U", 0x1C, NULL),
7695                 .wins   = {
7696                         .nb_flags       = NBT_NM_GROUP,
7697                         .mhomed         = False,
7698                         .num_ips        = ctx->addresses_best_num,
7699                         .ips            = ctx->addresses_best,
7700                         .apply_expected = True
7701                 },
7702                 .defend = {
7703                         .timeout        = 0,
7704                 },
7705                 .replica= {
7706                         .type           = WREPL_TYPE_MHOMED,
7707                         .state          = WREPL_STATE_ACTIVE,
7708                         .node           = WREPL_NODE_B,
7709                         .is_static      = False,
7710                         .num_ips        = ARRAY_SIZE(addresses_B_1),
7711                         .ips            = addresses_B_1,
7712                         .apply_expected = False
7713                 },
7714         },
7715         /*
7716          * sgroup,active vs. mhomed,tombstone with same ip(s), unchecked
7717          */
7718         {
7719                 .line   = __location__,
7720                 .name   = _NBT_NAME("_SA_MT_SI_U", 0x1C, NULL),
7721                 .wins   = {
7722                         .nb_flags       = NBT_NM_GROUP,
7723                         .mhomed         = False,
7724                         .num_ips        = ctx->addresses_best_num,
7725                         .ips            = ctx->addresses_best,
7726                         .apply_expected = True
7727                 },
7728                 .defend = {
7729                         .timeout        = 0,
7730                 },
7731                 .replica= {
7732                         .type           = WREPL_TYPE_MHOMED,
7733                         .state          = WREPL_STATE_TOMBSTONE,
7734                         .node           = WREPL_NODE_B,
7735                         .is_static      = False,
7736                         .num_ips        = ctx->addresses_best_num,
7737                         .ips            = ctx->addresses_best,
7738                         .apply_expected = False
7739                 },
7740         },
7741         /*
7742          * sgroup,active vs. mhomed,tombstone with different ip(s), unchecked
7743          */
7744         {
7745                 .line   = __location__,
7746                 .name   = _NBT_NAME("_SA_MT_DI_U", 0x1C, NULL),
7747                 .wins   = {
7748                         .nb_flags       = NBT_NM_GROUP,
7749                         .mhomed         = False,
7750                         .num_ips        = ctx->addresses_best_num,
7751                         .ips            = ctx->addresses_best,
7752                         .apply_expected = True
7753                 },
7754                 .defend = {
7755                         .timeout        = 0,
7756                 },
7757                 .replica= {
7758                         .type           = WREPL_TYPE_MHOMED,
7759                         .state          = WREPL_STATE_TOMBSTONE,
7760                         .node           = WREPL_NODE_B,
7761                         .is_static      = False,
7762                         .num_ips        = ARRAY_SIZE(addresses_B_1),
7763                         .ips            = addresses_B_1,
7764                         .apply_expected = False
7765                 },
7766         },
7767 /* 
7768  * multi homed vs. unique section
7769  */
7770         /*
7771          * mhomed,active vs. unique,active with same ip(s), unchecked
7772          */
7773         {
7774                 .line   = __location__,
7775                 .name   = _NBT_NAME("_MA_UA_SI_U", 0x00, NULL),
7776                 .wins   = {
7777                         .nb_flags       = 0,
7778                         .mhomed         = True,
7779                         .num_ips        = ctx->addresses_best_num,
7780                         .ips            = ctx->addresses_best,
7781                         .apply_expected = True
7782                 },
7783                 .defend = {
7784                         .timeout        = 0,
7785                 },
7786                 .replica= {
7787                         .type           = WREPL_TYPE_UNIQUE,
7788                         .state          = WREPL_STATE_ACTIVE,
7789                         .node           = WREPL_NODE_B,
7790                         .is_static      = False,
7791                         .num_ips        = ctx->addresses_best_num,
7792                         .ips            = ctx->addresses_best,
7793                         .apply_expected = True
7794                 },
7795         },
7796         /*
7797          * mhomed,active vs. unique,active with different ip(s), positive response
7798          */
7799         {
7800                 .line   = __location__,
7801                 .name   = _NBT_NAME("_MA_UA_DI_P", 0x00, NULL),
7802                 .wins   = {
7803                         .nb_flags       = 0,
7804                         .mhomed         = True,
7805                         .num_ips        = ctx->addresses_best_num,
7806                         .ips            = ctx->addresses_best,
7807                         .apply_expected = True
7808                 },
7809                 .defend = {
7810                         .timeout        = 10,
7811                         .positive       = True,
7812                 },
7813                 .replica= {
7814                         .type           = WREPL_TYPE_UNIQUE,
7815                         .state          = WREPL_STATE_ACTIVE,
7816                         .node           = WREPL_NODE_B,
7817                         .is_static      = False,
7818                         .num_ips        = ARRAY_SIZE(addresses_B_1),
7819                         .ips            = addresses_B_1,
7820                         .apply_expected = False
7821                 },
7822         },
7823         /*
7824          * mhomed,active vs. unique,active with different ip(s), positive response other ips
7825          */
7826         {
7827                 .line   = __location__,
7828                 .name   = _NBT_NAME("_MA_UA_DI_O", 0x00, NULL),
7829                 .wins   = {
7830                         .nb_flags       = 0,
7831                         .mhomed         = True,
7832                         .num_ips        = ctx->addresses_best_num,
7833                         .ips            = ctx->addresses_best,
7834                         .apply_expected = True
7835                 },
7836                 .defend = {
7837                         .timeout        = 10,
7838                         .positive       = True,
7839                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
7840                         .ips            = addresses_A_3_4,
7841                 },
7842                 .replica= {
7843                         .type           = WREPL_TYPE_UNIQUE,
7844                         .state          = WREPL_STATE_ACTIVE,
7845                         .node           = WREPL_NODE_B,
7846                         .is_static      = False,
7847                         .num_ips        = ARRAY_SIZE(addresses_B_1),
7848                         .ips            = addresses_B_1,
7849                         .apply_expected = False
7850                 },
7851         },
7852         /*
7853          * mhomed,active vs. unique,active with different ip(s), negative response
7854          */
7855         {
7856                 .line   = __location__,
7857                 .name   = _NBT_NAME("_MA_UA_DI_N", 0x00, NULL),
7858                 .wins   = {
7859                         .nb_flags       = 0,
7860                         .mhomed         = True,
7861                         .num_ips        = ctx->addresses_best_num,
7862                         .ips            = ctx->addresses_best,
7863                         .apply_expected = True
7864                 },
7865                 .defend = {
7866                         .timeout        = 10,
7867                         .positive       = False,
7868                 },
7869                 .replica= {
7870                         .type           = WREPL_TYPE_UNIQUE,
7871                         .state          = WREPL_STATE_ACTIVE,
7872                         .node           = WREPL_NODE_B,
7873                         .is_static      = False,
7874                         .num_ips        = ARRAY_SIZE(addresses_B_1),
7875                         .ips            = addresses_B_1,
7876                         .apply_expected = True
7877                 },
7878         },
7879         /*
7880          * mhomed,active vs. unique,tombstone with same ip(s), unchecked
7881          */
7882         {
7883                 .line   = __location__,
7884                 .name   = _NBT_NAME("_MA_UT_SI_U", 0x00, NULL),
7885                 .wins   = {
7886                         .nb_flags       = 0,
7887                         .mhomed         = True,
7888                         .num_ips        = ctx->addresses_best_num,
7889                         .ips            = ctx->addresses_best,
7890                         .apply_expected = True
7891                 },
7892                 .defend = {
7893                         .timeout        = 0,
7894                 },
7895                 .replica= {
7896                         .type           = WREPL_TYPE_UNIQUE,
7897                         .state          = WREPL_STATE_TOMBSTONE,
7898                         .node           = WREPL_NODE_B,
7899                         .is_static      = False,
7900                         .num_ips        = ctx->addresses_best_num,
7901                         .ips            = ctx->addresses_best,
7902                         .apply_expected = False
7903                 },
7904         },
7905         /*
7906          * mhomed,active vs. unique,tombstone with different ip(s), unchecked
7907          */
7908         {
7909                 .line   = __location__,
7910                 .name   = _NBT_NAME("_MA_UT_DI_U", 0x00, NULL),
7911                 .wins   = {
7912                         .nb_flags       = 0,
7913                         .mhomed         = True,
7914                         .num_ips        = ctx->addresses_best_num,
7915                         .ips            = ctx->addresses_best,
7916                         .apply_expected = True
7917                 },
7918                 .defend = {
7919                         .timeout        = 0,
7920                 },
7921                 .replica= {
7922                         .type           = WREPL_TYPE_UNIQUE,
7923                         .state          = WREPL_STATE_TOMBSTONE,
7924                         .node           = WREPL_NODE_B,
7925                         .is_static      = False,
7926                         .num_ips        = ARRAY_SIZE(addresses_B_1),
7927                         .ips            = addresses_B_1,
7928                         .apply_expected = False
7929                 },
7930         },
7931 /* 
7932  * multi homed vs. normal group section
7933  */
7934         /*
7935          * mhomed,active vs. group,active with same ip(s), release expected
7936          */
7937         {
7938                 .line   = __location__,
7939                 .name   = _NBT_NAME("_MA_GA_SI_R", 0x00, NULL),
7940                 .wins   = {
7941                         .nb_flags       = 0,
7942                         .mhomed         = True,
7943                         .num_ips        = ctx->addresses_best_num,
7944                         .ips            = ctx->addresses_best,
7945                         .apply_expected = True
7946                 },
7947                 .defend = {
7948                         .timeout        = 10,
7949                         .expect_release = True,
7950                 },
7951                 .replica= {
7952                         .type           = WREPL_TYPE_GROUP,
7953                         .state          = WREPL_STATE_ACTIVE,
7954                         .node           = WREPL_NODE_B,
7955                         .is_static      = False,
7956                         .num_ips        = ctx->addresses_best_num,
7957                         .ips            = ctx->addresses_best,
7958                         .apply_expected = True
7959                 },
7960         },
7961         /*
7962          * mhomed,active vs. group,active with different ip(s), release expected
7963          */
7964         {
7965                 .line   = __location__,
7966                 .name   = _NBT_NAME("_MA_GA_DI_R", 0x00, NULL),
7967                 .wins   = {
7968                         .nb_flags       = 0,
7969                         .mhomed         = True,
7970                         .num_ips        = ctx->addresses_best_num,
7971                         .ips            = ctx->addresses_best,
7972                         .apply_expected = True
7973                 },
7974                 .defend = {
7975                         .timeout        = 10,
7976                         .expect_release = True,
7977                 },
7978                 .replica= {
7979                         .type           = WREPL_TYPE_GROUP,
7980                         .state          = WREPL_STATE_ACTIVE,
7981                         .node           = WREPL_NODE_B,
7982                         .is_static      = False,
7983                         .num_ips        = ARRAY_SIZE(addresses_B_1),
7984                         .ips            = addresses_B_1,
7985                         .apply_expected = True
7986                 },
7987         },
7988         /*
7989          * mhomed,active vs. group,tombstone with same ip(s), unchecked
7990          */
7991         {
7992                 .line   = __location__,
7993                 .name   = _NBT_NAME("_MA_GT_SI_U", 0x00, NULL),
7994                 .wins   = {
7995                         .nb_flags       = 0,
7996                         .mhomed         = True,
7997                         .num_ips        = ctx->addresses_best_num,
7998                         .ips            = ctx->addresses_best,
7999                         .apply_expected = True
8000                 },
8001                 .defend = {
8002                         .timeout        = 0,
8003                 },
8004                 .replica= {
8005                         .type           = WREPL_TYPE_GROUP,
8006                         .state          = WREPL_STATE_TOMBSTONE,
8007                         .node           = WREPL_NODE_B,
8008                         .is_static      = False,
8009                         .num_ips        = ctx->addresses_best_num,
8010                         .ips            = ctx->addresses_best,
8011                         .apply_expected = False
8012                 },
8013         },
8014         /*
8015          * mhomed,active vs. group,tombstone with different ip(s), unchecked
8016          */
8017         {
8018                 .line   = __location__,
8019                 .name   = _NBT_NAME("_MA_GT_DI_U", 0x00, NULL),
8020                 .wins   = {
8021                         .nb_flags       = 0,
8022                         .mhomed         = True,
8023                         .num_ips        = ctx->addresses_best_num,
8024                         .ips            = ctx->addresses_best,
8025                         .apply_expected = True
8026                 },
8027                 .defend = {
8028                         .timeout        = 0,
8029                 },
8030                 .replica= {
8031                         .type           = WREPL_TYPE_GROUP,
8032                         .state          = WREPL_STATE_TOMBSTONE,
8033                         .node           = WREPL_NODE_B,
8034                         .is_static      = False,
8035                         .num_ips        = ARRAY_SIZE(addresses_B_1),
8036                         .ips            = addresses_B_1,
8037                         .apply_expected = False
8038                 },
8039         },
8040 /* 
8041  * multi homed vs. special group section
8042  */
8043         /*
8044          * mhomed,active vs. sgroup,active with same ip(s), release expected
8045          */
8046         {
8047                 .line   = __location__,
8048                 .name   = _NBT_NAME("_MA_SA_SI_R", 0x00, NULL),
8049                 .wins   = {
8050                         .nb_flags       = 0,
8051                         .mhomed         = True,
8052                         .num_ips        = ctx->addresses_best_num,
8053                         .ips            = ctx->addresses_best,
8054                         .apply_expected = True
8055                 },
8056                 .defend = {
8057                         .timeout        = 10,
8058                         .expect_release = True,
8059                 },
8060                 .replica= {
8061                         .type           = WREPL_TYPE_SGROUP,
8062                         .state          = WREPL_STATE_ACTIVE,
8063                         .node           = WREPL_NODE_B,
8064                         .is_static      = False,
8065                         .num_ips        = ctx->addresses_best_num,
8066                         .ips            = ctx->addresses_best,
8067                         .apply_expected = True
8068                 },
8069         },
8070         /*
8071          * mhomed,active vs. group,active with different ip(s), release expected
8072          */
8073         {
8074                 .line   = __location__,
8075                 .name   = _NBT_NAME("_MA_SA_DI_R", 0x00, NULL),
8076                 .wins   = {
8077                         .nb_flags       = 0,
8078                         .mhomed         = True,
8079                         .num_ips        = ctx->addresses_best_num,
8080                         .ips            = ctx->addresses_best,
8081                         .apply_expected = True
8082                 },
8083                 .defend = {
8084                         .timeout        = 10,
8085                         .expect_release = True,
8086                 },
8087                 .replica= {
8088                         .type           = WREPL_TYPE_SGROUP,
8089                         .state          = WREPL_STATE_ACTIVE,
8090                         .node           = WREPL_NODE_B,
8091                         .is_static      = False,
8092                         .num_ips        = ARRAY_SIZE(addresses_B_1),
8093                         .ips            = addresses_B_1,
8094                         .apply_expected = True
8095                 },
8096         },
8097         /*
8098          * mhomed,active vs. sgroup,tombstone with same ip(s), unchecked
8099          */
8100         {
8101                 .line   = __location__,
8102                 .name   = _NBT_NAME("_MA_ST_SI_U", 0x00, NULL),
8103                 .wins   = {
8104                         .nb_flags       = 0,
8105                         .mhomed         = True,
8106                         .num_ips        = ctx->addresses_best_num,
8107                         .ips            = ctx->addresses_best,
8108                         .apply_expected = True
8109                 },
8110                 .defend = {
8111                         .timeout        = 0,
8112                 },
8113                 .replica= {
8114                         .type           = WREPL_TYPE_SGROUP,
8115                         .state          = WREPL_STATE_TOMBSTONE,
8116                         .node           = WREPL_NODE_B,
8117                         .is_static      = False,
8118                         .num_ips        = ctx->addresses_best_num,
8119                         .ips            = ctx->addresses_best,
8120                         .apply_expected = False
8121                 },
8122         },
8123         /*
8124          * mhomed,active vs. sgroup,tombstone with different ip(s), unchecked
8125          */
8126         {
8127                 .line   = __location__,
8128                 .name   = _NBT_NAME("_MA_ST_DI_U", 0x00, NULL),
8129                 .wins   = {
8130                         .nb_flags       = 0,
8131                         .mhomed         = True,
8132                         .num_ips        = ctx->addresses_best_num,
8133                         .ips            = ctx->addresses_best,
8134                         .apply_expected = True
8135                 },
8136                 .defend = {
8137                         .timeout        = 0,
8138                 },
8139                 .replica= {
8140                         .type           = WREPL_TYPE_SGROUP,
8141                         .state          = WREPL_STATE_TOMBSTONE,
8142                         .node           = WREPL_NODE_B,
8143                         .is_static      = False,
8144                         .num_ips        = ARRAY_SIZE(addresses_B_1),
8145                         .ips            = addresses_B_1,
8146                         .apply_expected = False
8147                 },
8148         },
8149 /* 
8150  * multi homed vs. multi homed section
8151  */
8152         /*
8153          * mhomed,active vs. mhomed,active with same ip(s), unchecked
8154          */
8155         {
8156                 .line   = __location__,
8157                 .name   = _NBT_NAME("_MA_MA_SI_U", 0x00, NULL),
8158                 .wins   = {
8159                         .nb_flags       = 0,
8160                         .mhomed         = True,
8161                         .num_ips        = ctx->addresses_best_num,
8162                         .ips            = ctx->addresses_best,
8163                         .apply_expected = True
8164                 },
8165                 .defend = {
8166                         .timeout        = 0,
8167                 },
8168                 .replica= {
8169                         .type           = WREPL_TYPE_MHOMED,
8170                         .state          = WREPL_STATE_ACTIVE,
8171                         .node           = WREPL_NODE_B,
8172                         .is_static      = False,
8173                         .num_ips        = ctx->addresses_best_num,
8174                         .ips            = ctx->addresses_best,
8175                         .apply_expected = True
8176                 },
8177         },
8178         /*
8179          * mhomed,active vs. mhomed,active with superset ip(s), unchecked
8180          */
8181         {
8182                 .line   = __location__,
8183                 .name   = _NBT_NAME("_MA_MA_SP_U", 0x00, NULL),
8184                 .wins   = {
8185                         .nb_flags       = 0,
8186                         .mhomed         = True,
8187                         .num_ips        = ctx->addresses_best_num,
8188                         .ips            = ctx->addresses_best,
8189                         .apply_expected = True
8190                 },
8191                 .defend = {
8192                         .timeout        = 0,
8193                 },
8194                 .replica= {
8195                         .type           = WREPL_TYPE_MHOMED,
8196                         .state          = WREPL_STATE_ACTIVE,
8197                         .node           = WREPL_NODE_B,
8198                         .is_static      = False,
8199                         .num_ips        = ctx->addresses_all_num,
8200                         .ips            = ctx->addresses_all,
8201                         .apply_expected = True
8202                 },
8203         },
8204         /*
8205          * mhomed,active vs. mhomed,active with different ip(s), positive response
8206          */
8207         {
8208                 .line   = __location__,
8209                 .name   = _NBT_NAME("_MA_MA_DI_P", 0x00, NULL),
8210                 .wins   = {
8211                         .nb_flags       = 0,
8212                         .mhomed         = True,
8213                         .num_ips        = ctx->addresses_best_num,
8214                         .ips            = ctx->addresses_best,
8215                         .apply_expected = True
8216                 },
8217                 .defend = {
8218                         .timeout        = 10,
8219                         .positive       = True,
8220                 },
8221                 .replica= {
8222                         .type           = WREPL_TYPE_MHOMED,
8223                         .state          = WREPL_STATE_ACTIVE,
8224                         .node           = WREPL_NODE_B,
8225                         .is_static      = False,
8226                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
8227                         .ips            = addresses_B_3_4,
8228                         .apply_expected = False
8229                 },
8230         },
8231         /*
8232          * mhomed,active vs. mhomed,active with different ip(s), positive response other ips
8233          */
8234         {
8235                 .line   = __location__,
8236                 .name   = _NBT_NAME("_MA_MA_DI_O", 0x00, NULL),
8237                 .wins   = {
8238                         .nb_flags       = 0,
8239                         .mhomed         = True,
8240                         .num_ips        = ctx->addresses_best_num,
8241                         .ips            = ctx->addresses_best,
8242                         .apply_expected = True
8243                 },
8244                 .defend = {
8245                         .timeout        = 10,
8246                         .positive       = True,
8247                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
8248                         .ips            = addresses_A_3_4,
8249                 },
8250                 .replica= {
8251                         .type           = WREPL_TYPE_MHOMED,
8252                         .state          = WREPL_STATE_ACTIVE,
8253                         .node           = WREPL_NODE_B,
8254                         .is_static      = False,
8255                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
8256                         .ips            = addresses_B_3_4,
8257                         .apply_expected = False
8258                 },
8259         },
8260         /*
8261          * mhomed,active vs. mhomed,active with different ip(s), negative response
8262          */
8263         {
8264                 .line   = __location__,
8265                 .name   = _NBT_NAME("_MA_MA_DI_N", 0x00, NULL),
8266                 .wins   = {
8267                         .nb_flags       = 0,
8268                         .mhomed         = True,
8269                         .num_ips        = ctx->addresses_best_num,
8270                         .ips            = ctx->addresses_best,
8271                         .apply_expected = True
8272                 },
8273                 .defend = {
8274                         .timeout        = 10,
8275                         .positive       = False,
8276                 },
8277                 .replica= {
8278                         .type           = WREPL_TYPE_MHOMED,
8279                         .state          = WREPL_STATE_ACTIVE,
8280                         .node           = WREPL_NODE_B,
8281                         .is_static      = False,
8282                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
8283                         .ips            = addresses_B_3_4,
8284                         .apply_expected = True
8285                 },
8286         },
8287         /*
8288          * mhomed,active vs. mhomed,tombstone with same ip(s), unchecked
8289          */
8290         {
8291                 .line   = __location__,
8292                 .name   = _NBT_NAME("_MA_MT_SI_U", 0x00, NULL),
8293                 .wins   = {
8294                         .nb_flags       = 0,
8295                         .mhomed         = True,
8296                         .num_ips        = ctx->addresses_best_num,
8297                         .ips            = ctx->addresses_best,
8298                         .apply_expected = True
8299                 },
8300                 .defend = {
8301                         .timeout        = 0,
8302                 },
8303                 .replica= {
8304                         .type           = WREPL_TYPE_MHOMED,
8305                         .state          = WREPL_STATE_TOMBSTONE,
8306                         .node           = WREPL_NODE_B,
8307                         .is_static      = False,
8308                         .num_ips        = ctx->addresses_best_num,
8309                         .ips            = ctx->addresses_best,
8310                         .apply_expected = False
8311                 },
8312         },
8313         /*
8314          * mhomed,active vs. mhomed,tombstone with different ip(s), unchecked
8315          */
8316         {
8317                 .line   = __location__,
8318                 .name   = _NBT_NAME("_MA_MT_DI_U", 0x00, NULL),
8319                 .wins   = {
8320                         .nb_flags       = 0,
8321                         .mhomed         = True,
8322                         .num_ips        = ctx->addresses_best_num,
8323                         .ips            = ctx->addresses_best,
8324                         .apply_expected = True
8325                 },
8326                 .defend = {
8327                         .timeout        = 0,
8328                 },
8329                 .replica= {
8330                         .type           = WREPL_TYPE_MHOMED,
8331                         .state          = WREPL_STATE_TOMBSTONE,
8332                         .node           = WREPL_NODE_B,
8333                         .is_static      = False,
8334                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
8335                         .ips            = addresses_B_3_4,
8336                         .apply_expected = False
8337                 },
8338         },
8339 /*
8340  * some more multi homed test, including merging
8341  */
8342         /*
8343          * mhomed,active vs. mhomed,active with superset ip(s), unchecked
8344          */
8345         {
8346                 .line   = __location__,
8347                 .section= "Test Replica vs. owned active: some more MHOMED combinations",
8348                 .name   = _NBT_NAME("_MA_MA_SP_U", 0x00, NULL),
8349                 .skip   = (ctx->addresses_all_num < 3),
8350                 .wins   = {
8351                         .nb_flags       = 0,
8352                         .mhomed         = True,
8353                         .num_ips        = ctx->addresses_mhomed_num,
8354                         .ips            = ctx->addresses_mhomed,
8355                         .apply_expected = True
8356                 },
8357                 .defend = {
8358                         .timeout        = 0,
8359                 },
8360                 .replica= {
8361                         .type           = WREPL_TYPE_MHOMED,
8362                         .state          = WREPL_STATE_ACTIVE,
8363                         .node           = WREPL_NODE_B,
8364                         .is_static      = False,
8365                         .num_ips        = ctx->addresses_all_num,
8366                         .ips            = ctx->addresses_all,
8367                         .apply_expected = True
8368                 },
8369         },
8370         /*
8371          * mhomed,active vs. mhomed,active with same ips, unchecked
8372          */
8373         {
8374                 .line   = __location__,
8375                 .name   = _NBT_NAME("_MA_MA_SM_U", 0x00, NULL),
8376                 .skip   = (ctx->addresses_mhomed_num != 2),
8377                 .wins   = {
8378                         .nb_flags       = 0,
8379                         .mhomed         = True,
8380                         .num_ips        = ctx->addresses_mhomed_num,
8381                         .ips            = ctx->addresses_mhomed,
8382                         .apply_expected = True
8383                 },
8384                 .defend = {
8385                         .timeout        = 0,
8386                 },
8387                 .replica= {
8388                         .type           = WREPL_TYPE_MHOMED,
8389                         .state          = WREPL_STATE_ACTIVE,
8390                         .node           = WREPL_NODE_B,
8391                         .is_static      = False,
8392                         .num_ips        = ctx->addresses_mhomed_num,
8393                         .ips            = ctx->addresses_mhomed,
8394                         .apply_expected = True
8395                 },
8396         },
8397         /*
8398          * mhomed,active vs. mhomed,active with subset ip(s), positive response
8399          */
8400         {
8401                 .line   = __location__,
8402                 .name   = _NBT_NAME("_MA_MA_SB_P", 0x00, NULL),
8403                 .skip   = (ctx->addresses_mhomed_num != 2),
8404                 .wins   = {
8405                         .nb_flags       = 0,
8406                         .mhomed         = True,
8407                         .num_ips        = ctx->addresses_mhomed_num,
8408                         .ips            = ctx->addresses_mhomed,
8409                         .apply_expected = True
8410                 },
8411                 .defend = {
8412                         .timeout        = 10,
8413                         .positive       = True
8414                 },
8415                 .replica= {
8416                         .type           = WREPL_TYPE_MHOMED,
8417                         .state          = WREPL_STATE_ACTIVE,
8418                         .node           = WREPL_NODE_B,
8419                         .is_static      = False,
8420                         .num_ips        = ctx->addresses_best_num,
8421                         .ips            = ctx->addresses_best,
8422                         .mhomed_merge   = True
8423                 },
8424         },
8425         /*
8426          * mhomed,active vs. mhomed,active with subset ip(s), positive response, with all addresses
8427          */
8428         {
8429                 .line   = __location__,
8430                 .name   = _NBT_NAME("_MA_MA_SB_A", 0x00, NULL),
8431                 .skip   = (ctx->addresses_all_num < 3),
8432                 .wins   = {
8433                         .nb_flags       = 0,
8434                         .mhomed         = True,
8435                         .num_ips        = ctx->addresses_mhomed_num,
8436                         .ips            = ctx->addresses_mhomed,
8437                         .apply_expected = True
8438                 },
8439                 .defend = {
8440                         .timeout        = 10,
8441                         .positive       = True,
8442                         .num_ips        = ctx->addresses_all_num,
8443                         .ips            = ctx->addresses_all,
8444                 },
8445                 .replica= {
8446                         .type           = WREPL_TYPE_MHOMED,
8447                         .state          = WREPL_STATE_ACTIVE,
8448                         .node           = WREPL_NODE_B,
8449                         .is_static      = False,
8450                         .num_ips        = ctx->addresses_best_num,
8451                         .ips            = ctx->addresses_best,
8452                         .mhomed_merge   = True
8453                 },
8454         },
8455         /*
8456          * mhomed,active vs. mhomed,active with subset ip(s), positive response, with replicas addresses
8457          * TODO: check why the server sends a name release demand for one address?
8458          *       the release demand has no effect to the database record...
8459          */
8460         {
8461                 .line   = __location__,
8462                 .name   = _NBT_NAME("_MA_MA_SB_PRA", 0x00, NULL),
8463                 .skip   = (ctx->addresses_all_num < 3),
8464                 .wins   = {
8465                         .nb_flags       = 0,
8466                         .mhomed         = True,
8467                         .num_ips        = ctx->addresses_mhomed_num,
8468                         .ips            = ctx->addresses_mhomed,
8469                         .apply_expected = True
8470                 },
8471                 .defend = {
8472                         .timeout        = 10,
8473                         .positive       = True,
8474                         .num_ips        = ctx->addresses_best_num,
8475                         .ips            = ctx->addresses_best,
8476                         .late_release   = True
8477                 },
8478                 .replica= {
8479                         .type           = WREPL_TYPE_MHOMED,
8480                         .state          = WREPL_STATE_ACTIVE,
8481                         .node           = WREPL_NODE_B,
8482                         .is_static      = False,
8483                         .num_ips        = ctx->addresses_best_num,
8484                         .ips            = ctx->addresses_best,
8485                         .apply_expected = False
8486                 },
8487         },
8488         /*
8489          * mhomed,active vs. mhomed,active with subset ip(s), positive response, with other addresses
8490          */
8491         {
8492                 .line   = __location__,
8493                 .name   = _NBT_NAME("_MA_MA_SB_O", 0x00, NULL),
8494
8495                 .skip   = (ctx->addresses_all_num < 3),
8496                 .wins   = {
8497                         .nb_flags       = 0,
8498                         .mhomed         = True,
8499                         .num_ips        = ctx->addresses_mhomed_num,
8500                         .ips            = ctx->addresses_mhomed,
8501                         .apply_expected = True
8502                 },
8503                 .defend = {
8504                         .timeout        = 10,
8505                         .positive       = True,
8506                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
8507                         .ips            = addresses_B_3_4,
8508                 },
8509                 .replica= {
8510                         .type           = WREPL_TYPE_MHOMED,
8511                         .state          = WREPL_STATE_ACTIVE,
8512                         .node           = WREPL_NODE_B,
8513                         .is_static      = False,
8514                         .num_ips        = ctx->addresses_best_num,
8515                         .ips            = ctx->addresses_best,
8516                         .apply_expected = False
8517                 },
8518         },
8519         /*
8520          * mhomed,active vs. mhomed,active with subset ip(s), negative response
8521          */
8522         {
8523                 .line   = __location__,
8524                 .name   = _NBT_NAME("_MA_MA_SB_N", 0x00, NULL),
8525                 .skip   = (ctx->addresses_mhomed_num != 2),
8526                 .wins   = {
8527                         .nb_flags       = 0,
8528                         .mhomed         = True,
8529                         .num_ips        = ctx->addresses_mhomed_num,
8530                         .ips            = ctx->addresses_mhomed,
8531                         .apply_expected = True
8532                 },
8533                 .defend = {
8534                         .timeout        = 10,
8535                         .positive       = False
8536                 },
8537                 .replica= {
8538                         .type           = WREPL_TYPE_MHOMED,
8539                         .state          = WREPL_STATE_ACTIVE,
8540                         .node           = WREPL_NODE_B,
8541                         .is_static      = False,
8542                         .num_ips        = ctx->addresses_best_num,
8543                         .ips            = ctx->addresses_best,
8544                         .apply_expected = True
8545                 },
8546         },
8547 /*
8548  * some more multi homed and unique test, including merging
8549  */
8550         /*
8551          * mhomed,active vs. unique,active with subset ip(s), positive response
8552          */
8553         {
8554                 .line   = __location__,
8555                 .section= "Test Replica vs. owned active: some more UNIQUE,MHOMED combinations",
8556                 .name   = _NBT_NAME("_MA_UA_SB_P", 0x00, NULL),
8557                 .skip   = (ctx->addresses_all_num < 3),
8558                 .wins   = {
8559                         .nb_flags       = 0,
8560                         .mhomed         = True,
8561                         .num_ips        = ctx->addresses_mhomed_num,
8562                         .ips            = ctx->addresses_mhomed,
8563                         .apply_expected = True
8564                 },
8565                 .defend = {
8566                         .timeout        = 10,
8567                         .positive       = True,
8568                 },
8569                 .replica= {
8570                         .type           = WREPL_TYPE_UNIQUE,
8571                         .state          = WREPL_STATE_ACTIVE,
8572                         .node           = WREPL_NODE_B,
8573                         .is_static      = False,
8574                         .num_ips        = ctx->addresses_best_num,
8575                         .ips            = ctx->addresses_best,
8576                         .mhomed_merge   = True
8577                 },
8578         },
8579         /*
8580          * unique,active vs. unique,active with different ip(s), positive response, with all addresses
8581          */
8582         {
8583                 .line   = __location__,
8584                 .name   = _NBT_NAME("_UA_UA_DI_A", 0x00, NULL),
8585                 .skip   = (ctx->addresses_all_num < 3),
8586                 .wins   = {
8587                         .nb_flags       = 0,
8588                         .mhomed         = False,
8589                         .num_ips        = ctx->addresses_best_num,
8590                         .ips            = ctx->addresses_best,
8591                         .apply_expected = True
8592                 },
8593                 .defend = {
8594                         .timeout        = 10,
8595                         .positive       = True,
8596                         .num_ips        = ctx->addresses_all_num,
8597                         .ips            = ctx->addresses_all,
8598                 },
8599                 .replica= {
8600                         .type           = WREPL_TYPE_UNIQUE,
8601                         .state          = WREPL_STATE_ACTIVE,
8602                         .node           = WREPL_NODE_B,
8603                         .is_static      = False,
8604                         .num_ips        = ctx->addresses_best2_num,
8605                         .ips            = ctx->addresses_best2,
8606                         .mhomed_merge   = True,
8607                 },
8608         },
8609         /*
8610          * unique,active vs. mhomed,active with different ip(s), positive response, with all addresses
8611          */
8612         {
8613                 .line   = __location__,
8614                 .name   = _NBT_NAME("_UA_MA_DI_A", 0x00, NULL),
8615                 .skip   = (ctx->addresses_all_num < 3),
8616                 .wins   = {
8617                         .nb_flags       = 0,
8618                         .mhomed         = False,
8619                         .num_ips        = ctx->addresses_best_num,
8620                         .ips            = ctx->addresses_best,
8621                         .apply_expected = True
8622                 },
8623                 .defend = {
8624                         .timeout        = 10,
8625                         .positive       = True,
8626                         .num_ips        = ctx->addresses_all_num,
8627                         .ips            = ctx->addresses_all,
8628                 },
8629                 .replica= {
8630                         .type           = WREPL_TYPE_MHOMED,
8631                         .state          = WREPL_STATE_ACTIVE,
8632                         .node           = WREPL_NODE_B,
8633                         .is_static      = False,
8634                         .num_ips        = ctx->addresses_best2_num,
8635                         .ips            = ctx->addresses_best2,
8636                         .mhomed_merge   = True,
8637                 },
8638         },
8639 /*
8640  * special group vs. special group merging section
8641  */
8642         /*
8643          * sgroup,active vs. sgroup,active with different ip(s)
8644          */
8645         {
8646                 .line   = __location__,
8647                 .section= "Test Replica vs. owned active: SGROUP vs. SGROUP tests",
8648                 .name   = _NBT_NAME("_SA_SA_DI_U", 0x1C, NULL),
8649                 .skip   = (ctx->addresses_all_num < 3),
8650                 .wins   = {
8651                         .nb_flags       = NBT_NM_GROUP,
8652                         .mhomed         = False,
8653                         .num_ips        = ctx->addresses_mhomed_num,
8654                         .ips            = ctx->addresses_mhomed,
8655                         .apply_expected = True
8656                 },
8657                 .defend = {
8658                         .timeout        = 0,
8659                 },
8660                 .replica= {
8661                         .type           = WREPL_TYPE_SGROUP,
8662                         .state          = WREPL_STATE_ACTIVE,
8663                         .node           = WREPL_NODE_B,
8664                         .is_static      = False,
8665                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
8666                         .ips            = addresses_B_3_4,
8667                         .sgroup_merge   = True
8668                 },
8669         },
8670         /*
8671          * sgroup,active vs. sgroup,active with same ip(s)
8672          */
8673         {
8674                 .line   = __location__,
8675                 .name   = _NBT_NAME("_SA_SA_SI_U", 0x1C, NULL),
8676                 .skip   = (ctx->addresses_all_num < 3),
8677                 .wins   = {
8678                         .nb_flags       = NBT_NM_GROUP,
8679                         .mhomed         = False,
8680                         .num_ips        = ctx->addresses_mhomed_num,
8681                         .ips            = ctx->addresses_mhomed,
8682                         .apply_expected = True
8683                 },
8684                 .defend = {
8685                         .timeout        = 0,
8686                 },
8687                 .replica= {
8688                         .type           = WREPL_TYPE_SGROUP,
8689                         .state          = WREPL_STATE_ACTIVE,
8690                         .node           = WREPL_NODE_B,
8691                         .is_static      = False,
8692                         .num_ips        = ctx->addresses_mhomed_num,
8693                         .ips            = ctx->addresses_mhomed,
8694                         .sgroup_merge   = True
8695                 },
8696         },
8697         /*
8698          * sgroup,active vs. sgroup,active with superset ip(s)
8699          */
8700         {
8701                 .line   = __location__,
8702                 .name   = _NBT_NAME("_SA_SA_SP_U", 0x1C, NULL),
8703                 .skip   = (ctx->addresses_all_num < 3),
8704                 .wins   = {
8705                         .nb_flags       = NBT_NM_GROUP,
8706                         .mhomed         = False,
8707                         .num_ips        = ctx->addresses_mhomed_num,
8708                         .ips            = ctx->addresses_mhomed,
8709                         .apply_expected = True
8710                 },
8711                 .defend = {
8712                         .timeout        = 0,
8713                 },
8714                 .replica= {
8715                         .type           = WREPL_TYPE_SGROUP,
8716                         .state          = WREPL_STATE_ACTIVE,
8717                         .node           = WREPL_NODE_B,
8718                         .is_static      = False,
8719                         .num_ips        = ctx->addresses_all_num,
8720                         .ips            = ctx->addresses_all,
8721                         .sgroup_merge   = True
8722                 },
8723         },
8724         /*
8725          * sgroup,active vs. sgroup,active with subset ip(s)
8726          */
8727         {
8728                 .line   = __location__,
8729                 .name   = _NBT_NAME("_SA_SA_SB_U", 0x1C, NULL),
8730                 .skip   = (ctx->addresses_all_num < 3),
8731                 .wins   = {
8732                         .nb_flags       = NBT_NM_GROUP,
8733                         .mhomed         = False,
8734                         .num_ips        = ctx->addresses_mhomed_num,
8735                         .ips            = ctx->addresses_mhomed,
8736                         .apply_expected = True
8737                 },
8738                 .defend = {
8739                         .timeout        = 0,
8740                 },
8741                 .replica= {
8742                         .type           = WREPL_TYPE_SGROUP,
8743                         .state          = WREPL_STATE_ACTIVE,
8744                         .node           = WREPL_NODE_B,
8745                         .is_static      = False,
8746                         .num_ips        = ctx->addresses_best_num,
8747                         .ips            = ctx->addresses_best,
8748                         .sgroup_merge   = True
8749                 },
8750         },
8751         /*
8752          * sgroup,active vs. sgroup,tombstone with different ip(s)
8753          */
8754         {
8755                 .line   = __location__,
8756                 .name   = _NBT_NAME("_SA_ST_DI_U", 0x1C, NULL),
8757                 .skip   = (ctx->addresses_all_num < 3),
8758                 .wins   = {
8759                         .nb_flags       = NBT_NM_GROUP,
8760                         .mhomed         = False,
8761                         .num_ips        = ctx->addresses_mhomed_num,
8762                         .ips            = ctx->addresses_mhomed,
8763                         .apply_expected = True
8764                 },
8765                 .defend = {
8766                         .timeout        = 0,
8767                 },
8768                 .replica= {
8769                         .type           = WREPL_TYPE_SGROUP,
8770                         .state          = WREPL_STATE_TOMBSTONE,
8771                         .node           = WREPL_NODE_B,
8772                         .is_static      = False,
8773                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
8774                         .ips            = addresses_B_3_4,
8775                         .apply_expected = False
8776                 },
8777         },
8778         /*
8779          * sgroup,active vs. sgroup,tombstone with same ip(s)
8780          */
8781         {
8782                 .line   = __location__,
8783                 .name   = _NBT_NAME("_SA_ST_SI_U", 0x1C, NULL),
8784                 .skip   = (ctx->addresses_all_num < 3),
8785                 .wins   = {
8786                         .nb_flags       = NBT_NM_GROUP,
8787                         .mhomed         = False,
8788                         .num_ips        = ctx->addresses_mhomed_num,
8789                         .ips            = ctx->addresses_mhomed,
8790                         .apply_expected = True
8791                 },
8792                 .defend = {
8793                         .timeout        = 0,
8794                 },
8795                 .replica= {
8796                         .type           = WREPL_TYPE_SGROUP,
8797                         .state          = WREPL_STATE_TOMBSTONE,
8798                         .node           = WREPL_NODE_B,
8799                         .is_static      = False,
8800                         .num_ips        = ctx->addresses_mhomed_num,
8801                         .ips            = ctx->addresses_mhomed,
8802                         .apply_expected = False
8803                 },
8804         },
8805         /*
8806          * sgroup,active vs. sgroup,tombstone with superset ip(s)
8807          */
8808         {
8809                 .line   = __location__,
8810                 .name   = _NBT_NAME("_SA_ST_SP_U", 0x1C, NULL),
8811                 .skip   = (ctx->addresses_all_num < 3),
8812                 .wins   = {
8813                         .nb_flags       = NBT_NM_GROUP,
8814                         .mhomed         = False,
8815                         .num_ips        = ctx->addresses_mhomed_num,
8816                         .ips            = ctx->addresses_mhomed,
8817                         .apply_expected = True
8818                 },
8819                 .defend = {
8820                         .timeout        = 0,
8821                 },
8822                 .replica= {
8823                         .type           = WREPL_TYPE_SGROUP,
8824                         .state          = WREPL_STATE_TOMBSTONE,
8825                         .node           = WREPL_NODE_B,
8826                         .is_static      = False,
8827                         .num_ips        = ctx->addresses_all_num,
8828                         .ips            = ctx->addresses_all,
8829                         .apply_expected = False
8830                 },
8831         },
8832         /*
8833          * sgroup,active vs. sgroup,tombstone with subset ip(s)
8834          */
8835         {
8836                 .line   = __location__,
8837                 .name   = _NBT_NAME("_SA_ST_SB_U", 0x1C, NULL),
8838                 .skip   = (ctx->addresses_all_num < 3),
8839                 .wins   = {
8840                         .nb_flags       = NBT_NM_GROUP,
8841                         .mhomed         = False,
8842                         .num_ips        = ctx->addresses_mhomed_num,
8843                         .ips            = ctx->addresses_mhomed,
8844                         .apply_expected = True
8845                 },
8846                 .defend = {
8847                         .timeout        = 0,
8848                 },
8849                 .replica= {
8850                         .type           = WREPL_TYPE_SGROUP,
8851                         .state          = WREPL_STATE_TOMBSTONE,
8852                         .node           = WREPL_NODE_B,
8853                         .is_static      = False,
8854                         .num_ips        = ctx->addresses_best_num,
8855                         .ips            = ctx->addresses_best,
8856                         .apply_expected = False
8857                 },
8858         },
8859         };
8860
8861         if (!ctx) return False;
8862
8863         if (!ctx->nbtsock_srv) {
8864                 printf("SKIP: Test Replica records vs. owned active records: not bound to port[%d]\n",
8865                         lp_nbt_port());
8866                 return True;
8867         }
8868
8869         printf("Test Replica records vs. owned active records\n");
8870
8871         for(i=0; ret && i < ARRAY_SIZE(records); i++) {
8872                 struct timeval end;
8873                 struct test_conflict_owned_active_vs_replica_struct record = records[i];
8874                 uint32_t j, count = 1;
8875                 const char *action;
8876
8877                 if (records[i].wins.mhomed || records[i].name.type == 0x1C) {
8878                         count = records[i].wins.num_ips;
8879                 }
8880
8881                 if (records[i].section) {
8882                         printf("%s\n", records[i].section);
8883                 }
8884
8885                 if (records[i].skip) {
8886                         printf("%s => SKIPPED\n", nbt_name_string(ctx, &records[i].name));
8887                         continue;
8888                 }
8889
8890                 if (records[i].replica.mhomed_merge) {
8891                         action = "MHOMED_MERGE";
8892                 } else if (records[i].replica.sgroup_merge) {
8893                         action = "SGROUP_MERGE";
8894                 } else if (records[i].replica.apply_expected) {
8895                         action = "REPLACE";
8896                 } else {
8897                         action = "NOT REPLACE";
8898                 }
8899
8900                 printf("%s => %s\n", nbt_name_string(ctx, &records[i].name), action);
8901
8902                 /* Prepare for multi homed registration */
8903                 ZERO_STRUCT(records[i].defend);
8904                 records[i].defend.timeout       = 10;
8905                 records[i].defend.positive      = True;
8906                 nbt_set_incoming_handler(ctx->nbtsock_srv,
8907                                          test_conflict_owned_active_vs_replica_handler,
8908                                          &records[i]);
8909                 if (ctx->nbtsock_srv2) {
8910                         nbt_set_incoming_handler(ctx->nbtsock_srv2,
8911                                                  test_conflict_owned_active_vs_replica_handler,
8912                                                  &records[i]);
8913                 }
8914
8915                 /*
8916                  * Setup Register
8917                  */
8918                 for (j=0; j < count; j++) {
8919                         struct nbt_name_request *req;
8920
8921                         name_register->in.name          = records[i].name;
8922                         name_register->in.dest_addr     = ctx->address;
8923                         name_register->in.address       = records[i].wins.ips[j].ip;
8924                         name_register->in.nb_flags      = records[i].wins.nb_flags;
8925                         name_register->in.register_demand= False;
8926                         name_register->in.broadcast     = False;
8927                         name_register->in.multi_homed   = records[i].wins.mhomed;
8928                         name_register->in.ttl           = 300000;
8929                         name_register->in.timeout       = 70;
8930                         name_register->in.retries       = 0;
8931
8932                         req = nbt_name_register_send(ctx->nbtsock, name_register);
8933
8934                         /* push the request on the wire */
8935                         event_loop_once(ctx->nbtsock->event_ctx);
8936
8937                         /*
8938                          * if we register multiple addresses,
8939                          * the server will do name queries to see if the old addresses
8940                          * are still alive
8941                          */
8942                         if (records[i].wins.mhomed && j > 0) {
8943                                 end = timeval_current_ofs(records[i].defend.timeout,0);
8944                                 records[i].defend.ret = True;
8945                                 while (records[i].defend.timeout > 0) {
8946                                         event_loop_once(ctx->nbtsock_srv->event_ctx);
8947                                         if (timeval_expired(&end)) break;
8948                                 }
8949                                 ret &= records[i].defend.ret;
8950                         }
8951
8952                         status = nbt_name_register_recv(req, ctx, name_register);
8953                         if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
8954                                 printf("No response from %s for name register\n", ctx->address);
8955                                 ret = False;
8956                         }
8957                         if (!NT_STATUS_IS_OK(status)) {
8958                                 printf("Bad response from %s for name register - %s\n",
8959                                        ctx->address, nt_errstr(status));
8960                                 ret = False;
8961                         }
8962                         CHECK_VALUE(name_register->out.rcode, 0);
8963                         CHECK_VALUE_STRING(name_register->out.reply_from, ctx->address);
8964                         CHECK_VALUE(name_register->out.name.type, records[i].name.type);
8965                         CHECK_VALUE_STRING(name_register->out.name.name, records[i].name.name);
8966                         CHECK_VALUE_STRING(name_register->out.name.scope, records[i].name.scope);
8967                         CHECK_VALUE_STRING(name_register->out.reply_addr, records[i].wins.ips[j].ip);
8968                 }
8969
8970                 /* Prepare for the current test */
8971                 records[i].defend = record.defend;
8972                 nbt_set_incoming_handler(ctx->nbtsock_srv,
8973                                          test_conflict_owned_active_vs_replica_handler,
8974                                          &records[i]);
8975                 if (ctx->nbtsock_srv2) {
8976                         nbt_set_incoming_handler(ctx->nbtsock_srv2,
8977                                                  test_conflict_owned_active_vs_replica_handler,
8978                                                  &records[i]);
8979                 }
8980
8981                 /*
8982                  * Setup Replica
8983                  */
8984                 wins_name->name         = &records[i].name;
8985                 wins_name->flags        = WREPL_NAME_FLAGS(records[i].replica.type,
8986                                                            records[i].replica.state,
8987                                                            records[i].replica.node,
8988                                                            records[i].replica.is_static);
8989                 wins_name->id           = ++ctx->b.max_version;
8990                 if (wins_name->flags & 2) {
8991                         wins_name->addresses.addresses.num_ips = records[i].replica.num_ips;
8992                         wins_name->addresses.addresses.ips     = discard_const(records[i].replica.ips);
8993                 } else {
8994                         wins_name->addresses.ip = records[i].replica.ips[0].ip;
8995                 }
8996                 wins_name->unknown      = "255.255.255.255";
8997
8998                 ret &= test_wrepl_update_one(ctx, &ctx->b, wins_name);
8999
9000                 /*
9001                  * wait for the name query, which is handled in
9002                  * test_conflict_owned_active_vs_replica_handler()
9003                  */
9004                 end = timeval_current_ofs(records[i].defend.timeout,0);
9005                 records[i].defend.ret = True;
9006                 while (records[i].defend.timeout > 0) {
9007                         event_loop_once(ctx->nbtsock_srv->event_ctx);
9008                         if (timeval_expired(&end)) break;
9009                 }
9010                 ret &= records[i].defend.ret;
9011
9012                 if (records[i].defend.late_release) {
9013                         records[i].defend = record.defend;
9014                         records[i].defend.expect_release = True;
9015                         /*
9016                          * wait for the name release demand, which is handled in
9017                          * test_conflict_owned_active_vs_replica_handler()
9018                          */
9019                         end = timeval_current_ofs(records[i].defend.timeout,0);
9020                         records[i].defend.ret = True;
9021                         while (records[i].defend.timeout > 0) {
9022                                 event_loop_once(ctx->nbtsock_srv->event_ctx);
9023                                 if (timeval_expired(&end)) break;
9024                         }
9025                         ret &= records[i].defend.ret;
9026                 }
9027
9028                 if (records[i].replica.mhomed_merge) {
9029                         ret &= test_wrepl_mhomed_merged(ctx, &ctx->c,
9030                                                         records[i].wins.num_ips, records[i].wins.ips,
9031                                                         &ctx->b,
9032                                                         records[i].replica.num_ips, records[i].replica.ips,
9033                                                         wins_name);
9034                 } else if (records[i].replica.sgroup_merge) {
9035                         ret &= test_wrepl_sgroup_merged(ctx, NULL,
9036                                                         &ctx->c,
9037                                                         records[i].wins.num_ips, records[i].wins.ips,
9038                                                         &ctx->b,
9039                                                         records[i].replica.num_ips, records[i].replica.ips,
9040                                                         wins_name);
9041                 } else {
9042                         ret &= test_wrepl_is_applied(ctx, &ctx->b, wins_name,
9043                                                      records[i].replica.apply_expected);
9044                 }
9045
9046                 if (records[i].replica.apply_expected ||
9047                     records[i].replica.mhomed_merge) {
9048                         wins_name->name         = &records[i].name;
9049                         wins_name->flags        = WREPL_NAME_FLAGS(WREPL_TYPE_UNIQUE,
9050                                                                    WREPL_STATE_TOMBSTONE,
9051                                                                    WREPL_NODE_B, False);
9052                         wins_name->id           = ++ctx->b.max_version;
9053                         wins_name->addresses.ip = addresses_B_1[0].ip;
9054                         wins_name->unknown      = "255.255.255.255";
9055
9056                         ret &= test_wrepl_update_one(ctx, &ctx->b, wins_name);
9057                         ret &= test_wrepl_is_applied(ctx, &ctx->b, wins_name, True);
9058                 } else {
9059                         for (j=0; j < count; j++) {
9060                                 struct nbt_name_socket *nbtsock = ctx->nbtsock;
9061
9062                                 if (ctx->myaddr2 && strcmp(records[i].wins.ips[j].ip, ctx->myaddr2) == 0) {
9063                                         nbtsock = ctx->nbtsock2;
9064                                 }
9065
9066                                 release->in.name        = records[i].name;
9067                                 release->in.dest_addr   = ctx->address;
9068                                 release->in.address     = records[i].wins.ips[j].ip;
9069                                 release->in.nb_flags    = records[i].wins.nb_flags;
9070                                 release->in.broadcast   = False;
9071                                 release->in.timeout     = 30;
9072                                 release->in.retries     = 0;
9073
9074                                 status = nbt_name_release(nbtsock, ctx, release);
9075                                 if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
9076                                         printf("No response from %s for name release\n", ctx->address);
9077                                         return False;
9078                                 }
9079                                 if (!NT_STATUS_IS_OK(status)) {
9080                                         printf("Bad response from %s for name query - %s\n",
9081                                                ctx->address, nt_errstr(status));
9082                                         return False;
9083                                 }
9084                                 CHECK_VALUE(release->out.rcode, 0);
9085                         }
9086
9087                         if (records[i].replica.sgroup_merge) {
9088                                 /* clean up the SGROUP record */
9089                                 wins_name->name         = &records[i].name;
9090                                 wins_name->flags        = WREPL_NAME_FLAGS(WREPL_TYPE_SGROUP,
9091                                                                            WREPL_STATE_ACTIVE,
9092                                                                            WREPL_NODE_B, False);
9093                                 wins_name->id           = ++ctx->b.max_version;
9094                                 wins_name->addresses.addresses.num_ips = 0;
9095                                 wins_name->addresses.addresses.ips     = NULL;
9096                                 wins_name->unknown      = "255.255.255.255";
9097                                 ret &= test_wrepl_update_one(ctx, &ctx->b, wins_name);
9098
9099                                 /* take ownership of the SGROUP record */
9100                                 wins_name->name         = &records[i].name;
9101                                 wins_name->flags        = WREPL_NAME_FLAGS(WREPL_TYPE_SGROUP,
9102                                                                            WREPL_STATE_ACTIVE,
9103                                                                            WREPL_NODE_B, False);
9104                                 wins_name->id           = ++ctx->b.max_version;
9105                                 wins_name->addresses.addresses.num_ips = ARRAY_SIZE(addresses_B_1);
9106                                 wins_name->addresses.addresses.ips     = discard_const(addresses_B_1);
9107                                 wins_name->unknown      = "255.255.255.255";
9108                                 ret &= test_wrepl_update_one(ctx, &ctx->b, wins_name);
9109                                 ret &= test_wrepl_is_applied(ctx, &ctx->b, wins_name, True);
9110
9111                                 /* overwrite the SGROUP record with unique,tombstone */
9112                                 wins_name->name         = &records[i].name;
9113                                 wins_name->flags        = WREPL_NAME_FLAGS(WREPL_TYPE_UNIQUE,
9114                                                                            WREPL_STATE_TOMBSTONE,
9115                                                                            WREPL_NODE_B, False);
9116                                 wins_name->id           = ++ctx->b.max_version;
9117                                 wins_name->addresses.ip = addresses_A_1[0].ip;
9118                                 wins_name->unknown      = "255.255.255.255";
9119                                 ret &= test_wrepl_update_one(ctx, &ctx->b, wins_name);
9120                                 ret &= test_wrepl_is_applied(ctx, &ctx->b, wins_name, True);
9121                         }
9122                 }
9123
9124 done:
9125                 if (!ret) {
9126                         printf("conflict handled wrong or record[%u]: %s\n", i, records[i].line);
9127                         return ret;
9128                 }
9129         }
9130
9131         return ret;
9132 }
9133
9134 #define _NBT_ASSERT(v, correct) do { \
9135         if ((v) != (correct)) { \
9136                 printf("(%s) Incorrect value %s=%d - should be %s (%d)\n", \
9137                        __location__, #v, v, #correct, correct); \
9138                 return; \
9139         } \
9140 } while (0)
9141
9142 #define _NBT_ASSERT_STRING(v, correct) do { \
9143         if ( ((!v) && (correct)) || \
9144              ((v) && (!correct)) || \
9145              ((v) && (correct) && strcmp(v,correct) != 0)) { \
9146                 printf("(%s) Incorrect value %s=%s - should be %s\n", \
9147                        __location__, #v, v, correct); \
9148                 return; \
9149         } \
9150 } while (0)
9151
9152 static void test_conflict_owned_active_vs_replica_handler_query(struct nbt_name_socket *nbtsock, 
9153                                                                 struct nbt_name_packet *req_packet, 
9154                                                                 const struct nbt_peer_socket *src)
9155 {
9156         struct nbt_name *name;
9157         struct nbt_name_packet *rep_packet;
9158         struct test_conflict_owned_active_vs_replica_struct *rec = nbtsock->incoming.private;
9159
9160         _NBT_ASSERT(req_packet->qdcount, 1);
9161         _NBT_ASSERT(req_packet->questions[0].question_type, NBT_QTYPE_NETBIOS);
9162         _NBT_ASSERT(req_packet->questions[0].question_class, NBT_QCLASS_IP);
9163
9164         name = &req_packet->questions[0].name;
9165
9166         _NBT_ASSERT(name->type, rec->name.type);
9167         _NBT_ASSERT_STRING(name->name, rec->name.name);
9168         _NBT_ASSERT_STRING(name->scope, rec->name.scope);
9169
9170         _NBT_ASSERT(rec->defend.expect_release, False);
9171
9172         rep_packet = talloc_zero(nbtsock, struct nbt_name_packet);
9173         if (rep_packet == NULL) return;
9174
9175         rep_packet->name_trn_id = req_packet->name_trn_id;
9176         rep_packet->ancount     = 1;
9177
9178         rep_packet->answers     = talloc_array(rep_packet, struct nbt_res_rec, 1);
9179         if (rep_packet->answers == NULL) return;
9180
9181         rep_packet->answers[0].name      = *name;
9182         rep_packet->answers[0].rr_class  = NBT_QCLASS_IP;
9183         rep_packet->answers[0].ttl       = 0;
9184
9185         if (rec->defend.positive) {
9186                 uint32_t i, num_ips;
9187                 const struct wrepl_ip *ips;             
9188
9189                 if (rec->defend.num_ips > 0) {
9190                         num_ips = rec->defend.num_ips;
9191                         ips     = rec->defend.ips;
9192                 } else {
9193                         num_ips = rec->wins.num_ips;
9194                         ips     = rec->wins.ips;
9195                 }
9196
9197                 /* send a positive reply */
9198                 rep_packet->operation   = 
9199                                         NBT_FLAG_REPLY | 
9200                                         NBT_OPCODE_QUERY | 
9201                                         NBT_FLAG_AUTHORITIVE |
9202                                         NBT_FLAG_RECURSION_DESIRED |
9203                                         NBT_FLAG_RECURSION_AVAIL;
9204
9205                 rep_packet->answers[0].rr_type   = NBT_QTYPE_NETBIOS;
9206
9207                 rep_packet->answers[0].rdata.netbios.length = num_ips*6;
9208                 rep_packet->answers[0].rdata.netbios.addresses = 
9209                         talloc_array(rep_packet->answers, struct nbt_rdata_address, num_ips);
9210                 if (rep_packet->answers[0].rdata.netbios.addresses == NULL) return;
9211
9212                 for (i=0; i < num_ips; i++) {
9213                         struct nbt_rdata_address *addr = 
9214                                 &rep_packet->answers[0].rdata.netbios.addresses[i];
9215                         addr->nb_flags  = rec->wins.nb_flags;
9216                         addr->ipaddr    = ips[i].ip;
9217                 }
9218                 DEBUG(2,("Sending positive name query reply for %s to %s:%d\n", 
9219                         nbt_name_string(rep_packet, name), src->addr, src->port));
9220         } else {
9221                 /* send a negative reply */
9222                 rep_packet->operation   =
9223                                         NBT_FLAG_REPLY | 
9224                                         NBT_OPCODE_QUERY | 
9225                                         NBT_FLAG_AUTHORITIVE |
9226                                         NBT_RCODE_NAM;
9227
9228                 rep_packet->answers[0].rr_type   = NBT_QTYPE_NULL;
9229
9230                 ZERO_STRUCT(rep_packet->answers[0].rdata);
9231
9232                 DEBUG(2,("Sending negative name query reply for %s to %s:%d\n", 
9233                         nbt_name_string(rep_packet, name), src->addr, src->port));
9234         }
9235
9236         nbt_name_reply_send(nbtsock, src, rep_packet);
9237         talloc_free(rep_packet);
9238
9239         /* make sure we push the reply to the wire */
9240         event_loop_once(nbtsock->event_ctx);
9241
9242         rec->defend.timeout     = 0;
9243         rec->defend.ret         = True;
9244 }
9245
9246 static void test_conflict_owned_active_vs_replica_handler_release(struct nbt_name_socket *nbtsock, 
9247                                                                   struct nbt_name_packet *req_packet, 
9248                                                                   const struct nbt_peer_socket *src)
9249 {
9250         struct nbt_name *name;
9251         struct nbt_name_packet *rep_packet;
9252         struct test_conflict_owned_active_vs_replica_struct *rec = nbtsock->incoming.private;
9253
9254         _NBT_ASSERT(req_packet->qdcount, 1);
9255         _NBT_ASSERT(req_packet->questions[0].question_type, NBT_QTYPE_NETBIOS);
9256         _NBT_ASSERT(req_packet->questions[0].question_class, NBT_QCLASS_IP);
9257
9258         name = &req_packet->questions[0].name;
9259
9260         _NBT_ASSERT(name->type, rec->name.type);
9261         _NBT_ASSERT_STRING(name->name, rec->name.name);
9262         _NBT_ASSERT_STRING(name->scope, rec->name.scope);
9263
9264         _NBT_ASSERT(rec->defend.expect_release, True);
9265
9266         rep_packet = talloc_zero(nbtsock, struct nbt_name_packet);
9267         if (rep_packet == NULL) return;
9268
9269         rep_packet->name_trn_id = req_packet->name_trn_id;
9270         rep_packet->ancount     = 1;
9271         rep_packet->operation   = 
9272                                 NBT_FLAG_REPLY | 
9273                                 NBT_OPCODE_RELEASE |
9274                                 NBT_FLAG_AUTHORITIVE;
9275
9276         rep_packet->answers     = talloc_array(rep_packet, struct nbt_res_rec, 1);
9277         if (rep_packet->answers == NULL) return;
9278
9279         rep_packet->answers[0].name     = *name;
9280         rep_packet->answers[0].rr_type  = NBT_QTYPE_NETBIOS;
9281         rep_packet->answers[0].rr_class = NBT_QCLASS_IP;
9282         rep_packet->answers[0].ttl      = req_packet->additional[0].ttl;
9283         rep_packet->answers[0].rdata    = req_packet->additional[0].rdata;
9284
9285         DEBUG(2,("Sending name release reply for %s to %s:%d\n", 
9286                 nbt_name_string(rep_packet, name), src->addr, src->port));
9287
9288         nbt_name_reply_send(nbtsock, src, rep_packet);
9289         talloc_free(rep_packet);
9290
9291         /* make sure we push the reply to the wire */
9292         event_loop_once(nbtsock->event_ctx);
9293
9294         rec->defend.timeout     = 0;
9295         rec->defend.ret         = True;
9296 }
9297
9298 static void test_conflict_owned_active_vs_replica_handler(struct nbt_name_socket *nbtsock, 
9299                                                           struct nbt_name_packet *req_packet, 
9300                                                           const struct nbt_peer_socket *src)
9301 {
9302         struct test_conflict_owned_active_vs_replica_struct *rec = nbtsock->incoming.private;
9303
9304         rec->defend.ret = False;
9305
9306         switch (req_packet->operation & NBT_OPCODE) {
9307         case NBT_OPCODE_QUERY:
9308                 test_conflict_owned_active_vs_replica_handler_query(nbtsock, req_packet, src);
9309                 break;
9310         case NBT_OPCODE_RELEASE:
9311                 test_conflict_owned_active_vs_replica_handler_release(nbtsock, req_packet, src);
9312                 break;
9313         default:
9314                 printf("%s: unexpected incoming packet\n", __location__);
9315                 return;
9316         }
9317 }
9318
9319 /*
9320   test WINS replication operations
9321 */
9322 BOOL torture_nbt_winsreplication_quick(void)
9323 {
9324         const char *address;
9325         struct nbt_name name;
9326         TALLOC_CTX *mem_ctx = talloc_new(NULL);
9327         NTSTATUS status;
9328         BOOL ret = True;
9329         struct test_wrepl_conflict_conn *ctx;
9330
9331         make_nbt_name_server(&name, lp_parm_string(-1, "torture", "host"));
9332
9333         /* do an initial name resolution to find its IP */
9334         status = resolve_name(&name, mem_ctx, &address, NULL);
9335         if (!NT_STATUS_IS_OK(status)) {
9336                 printf("Failed to resolve %s - %s\n",
9337                        name.name, nt_errstr(status));
9338                 talloc_free(mem_ctx);
9339                 return False;
9340         }
9341
9342         ret &= test_assoc_ctx1(mem_ctx, address);
9343         ret &= test_assoc_ctx2(mem_ctx, address);
9344
9345         ret &= test_wins_replication(mem_ctx, address);
9346
9347         ctx = test_create_conflict_ctx(mem_ctx, address);
9348
9349         ret &= test_conflict_same_owner(ctx);
9350
9351         talloc_free(mem_ctx);
9352
9353         return ret;
9354 }
9355
9356 /*
9357   test WINS replication operations
9358 */
9359 BOOL torture_nbt_winsreplication(void)
9360 {
9361         const char *address;
9362         struct nbt_name name;
9363         TALLOC_CTX *mem_ctx = talloc_new(NULL);
9364         NTSTATUS status;
9365         BOOL ret = True;
9366         struct test_wrepl_conflict_conn *ctx;
9367
9368         make_nbt_name_server(&name, lp_parm_string(-1, "torture", "host"));
9369
9370         /* do an initial name resolution to find its IP */
9371         status = resolve_name(&name, mem_ctx, &address, NULL);
9372         if (!NT_STATUS_IS_OK(status)) {
9373                 printf("Failed to resolve %s - %s\n",
9374                        name.name, nt_errstr(status));
9375                 talloc_free(mem_ctx);
9376                 return False;
9377         }
9378
9379         ret &= test_assoc_ctx1(mem_ctx, address);
9380         ret &= test_assoc_ctx2(mem_ctx, address);
9381
9382         ret &= test_wins_replication(mem_ctx, address);
9383
9384         ctx = test_create_conflict_ctx(mem_ctx, address);
9385
9386         ret &= test_conflict_same_owner(ctx);
9387         ret &= test_conflict_different_owner(ctx);
9388         ret &= test_conflict_owned_released_vs_replica(ctx);
9389         ret &= test_conflict_owned_active_vs_replica(ctx);
9390
9391         talloc_free(mem_ctx);
9392
9393         return ret;
9394 }