r11189: add some more special group vs. special group tests,
[tprouty/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    
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12    
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17    
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 #include "includes.h"
24 #include "libcli/nbt/libnbt.h"
25 #include "libcli/wrepl/winsrepl.h"
26
27 #define CHECK_STATUS(status, correct) do { \
28         if (!NT_STATUS_EQUAL(status, correct)) { \
29                 printf("(%s) Incorrect status %s - should be %s\n", \
30                        __location__, nt_errstr(status), nt_errstr(correct)); \
31                 ret = False; \
32                 goto done; \
33         }} while (0)
34
35 #define CHECK_VALUE(v, correct) do { \
36         if ((v) != (correct)) { \
37                 printf("(%s) Incorrect value %s=%d - should be %d\n", \
38                        __location__, #v, v, correct); \
39                 ret = False; \
40                 goto done; \
41         }} while (0)
42
43 #define CHECK_VALUE_UINT64(v, correct) do { \
44         if ((v) != (correct)) { \
45                 printf("(%s) Incorrect value %s=%llu - should be %llu\n", \
46                        __location__, #v, v, correct); \
47                 ret = False; \
48                 goto done; \
49         }} while (0)
50
51 #define CHECK_VALUE_STRING(v, correct) do { \
52         if ( ((!v) && (correct)) || \
53              ((v) && (!correct)) || \
54              ((v) && (correct) && strcmp(v,correct) != 0)) { \
55                 printf("(%s) Incorrect value %s='%s' - should be '%s'\n", \
56                        __location__, #v, v, correct); \
57                 ret = False; \
58                 goto done; \
59         }} while (0)
60
61 #define _NBT_NAME(n,t,s) {\
62         .name   = n,\
63         .type   = t,\
64         .scope  = s\
65 }
66
67 static const char *wrepl_name_type_string(enum wrepl_name_type type)
68 {
69         switch (type) {
70         case WREPL_TYPE_UNIQUE: return "UNIQUE";
71         case WREPL_TYPE_GROUP: return "GROUP";
72         case WREPL_TYPE_SGROUP: return "SGROUP";
73         case WREPL_TYPE_MHOMED: return "MHOMED";
74         }
75         return "UNKNOWN_TYPE";
76 }
77
78 static const char *wrepl_name_state_string(enum wrepl_name_state state)
79 {
80         switch (state) {
81         case WREPL_STATE_ACTIVE: return "ACTIVE";
82         case WREPL_STATE_RELEASED: return "RELEASED";
83         case WREPL_STATE_TOMBSTONE: return "TOMBSTONE";
84         case WREPL_STATE_RESERVED: return "RESERVED";
85         }
86         return "UNKNOWN_STATE";
87 }
88
89 /*
90   test how assoc_ctx's are only usable on the connection
91   they are created on.
92 */
93 static BOOL test_assoc_ctx1(TALLOC_CTX *mem_ctx, const char *address)
94 {
95         BOOL ret = True;
96         struct wrepl_request *req;
97         struct wrepl_socket *wrepl_socket1;
98         struct wrepl_associate associate1;
99         struct wrepl_socket *wrepl_socket2;
100         struct wrepl_associate associate2;
101         struct wrepl_pull_table pull_table;
102         struct wrepl_packet *rep_packet;
103         struct wrepl_associate_stop assoc_stop;
104         NTSTATUS status;
105
106         if (!lp_parm_bool(-1, "torture", "dangerous", False)) {
107                 printf("winsrepl: cross connection assoc_ctx usage disabled - enable dangerous tests to use\n");
108                 return True;
109         }
110
111         printf("Test if assoc_ctx is only valid on the conection it was created on\n");
112
113         wrepl_socket1 = wrepl_socket_init(mem_ctx, NULL);
114         wrepl_socket2 = wrepl_socket_init(mem_ctx, NULL);
115
116         printf("Setup 2 wrepl connections\n");
117         status = wrepl_connect(wrepl_socket1, NULL, address);
118         CHECK_STATUS(status, NT_STATUS_OK);
119
120         status = wrepl_connect(wrepl_socket2, NULL, address);
121         CHECK_STATUS(status, NT_STATUS_OK);
122
123         printf("Send a start association request (conn1)\n");
124         status = wrepl_associate(wrepl_socket1, &associate1);
125         CHECK_STATUS(status, NT_STATUS_OK);
126
127         printf("association context (conn1): 0x%x\n", associate1.out.assoc_ctx);
128
129         printf("Send a start association request (conn2)\n");
130         status = wrepl_associate(wrepl_socket2, &associate2);
131         CHECK_STATUS(status, NT_STATUS_OK);
132
133         printf("association context (conn2): 0x%x\n", associate2.out.assoc_ctx);
134
135         printf("Send a replication table query, with assoc 1 (conn2), the anwser should be on conn1\n");
136         pull_table.in.assoc_ctx = associate1.out.assoc_ctx;
137         req = wrepl_pull_table_send(wrepl_socket2, &pull_table);
138         req->send_only = True;
139         status = wrepl_request_recv(req, mem_ctx, &rep_packet);
140         CHECK_STATUS(status, NT_STATUS_OK);
141
142         printf("Send a association request (conn2), to make sure the last request was ignored\n");
143         status = wrepl_associate(wrepl_socket2, &associate2);
144         CHECK_STATUS(status, NT_STATUS_OK);
145
146         printf("Send a replication table query, with invalid assoc (conn1), receive answer from conn2\n");
147         pull_table.in.assoc_ctx = 0;
148         req = wrepl_pull_table_send(wrepl_socket1, &pull_table);
149         status = wrepl_request_recv(req, mem_ctx, &rep_packet);
150         CHECK_STATUS(status, NT_STATUS_OK);
151
152         printf("Send a association request (conn1), to make sure the last request was handled correct\n");
153         status = wrepl_associate(wrepl_socket1, &associate2);
154         CHECK_STATUS(status, NT_STATUS_OK);
155
156         assoc_stop.in.assoc_ctx = associate1.out.assoc_ctx;
157         assoc_stop.in.reason    = 4;
158         printf("Send a association stop request (conn1), reson: %u\n", assoc_stop.in.reason);
159         status = wrepl_associate_stop(wrepl_socket1, &assoc_stop);
160         CHECK_STATUS(status, NT_STATUS_END_OF_FILE);
161
162         assoc_stop.in.assoc_ctx = associate2.out.assoc_ctx;
163         assoc_stop.in.reason    = 0;
164         printf("Send a association stop request (conn2), reson: %u\n", assoc_stop.in.reason);
165         status = wrepl_associate_stop(wrepl_socket2, &assoc_stop);
166         CHECK_STATUS(status, NT_STATUS_OK);
167
168 done:
169         printf("Close 2 wrepl connections\n");
170         talloc_free(wrepl_socket1);
171         talloc_free(wrepl_socket2);
172         return ret;
173 }
174
175 /*
176   test if we always get back the same assoc_ctx
177 */
178 static BOOL test_assoc_ctx2(TALLOC_CTX *mem_ctx, const char *address)
179 {
180         BOOL ret = True;
181         struct wrepl_socket *wrepl_socket;
182         struct wrepl_associate associate;
183         uint32_t assoc_ctx1;
184         NTSTATUS status;
185
186         printf("Test if we always get back the same assoc_ctx\n");
187
188         wrepl_socket = wrepl_socket_init(mem_ctx, NULL);
189         
190         printf("Setup wrepl connections\n");
191         status = wrepl_connect(wrepl_socket, NULL, address);
192         CHECK_STATUS(status, NT_STATUS_OK);
193
194
195         printf("Send 1st start association request\n");
196         status = wrepl_associate(wrepl_socket, &associate);
197         CHECK_STATUS(status, NT_STATUS_OK);
198         assoc_ctx1 = associate.out.assoc_ctx;
199         printf("1st association context: 0x%x\n", associate.out.assoc_ctx);
200
201         printf("Send 2nd start association request\n");
202         status = wrepl_associate(wrepl_socket, &associate);
203         CHECK_VALUE(associate.out.assoc_ctx, assoc_ctx1);
204         CHECK_STATUS(status, NT_STATUS_OK);
205         printf("2nd association context: 0x%x\n", associate.out.assoc_ctx);
206
207         printf("Send 3rd start association request\n");
208         status = wrepl_associate(wrepl_socket, &associate);
209         CHECK_VALUE(associate.out.assoc_ctx, assoc_ctx1);
210         CHECK_STATUS(status, NT_STATUS_OK);
211         printf("3rd association context: 0x%x\n", associate.out.assoc_ctx);
212
213 done:
214         printf("Close wrepl connections\n");
215         talloc_free(wrepl_socket);
216         return ret;
217 }
218
219
220 /*
221   display a replication entry
222 */
223 static void display_entry(TALLOC_CTX *mem_ctx, struct wrepl_name *name)
224 {
225         int i;
226
227         printf("%s\n", nbt_name_string(mem_ctx, &name->name));
228         printf("\tTYPE:%u STATE:%u NODE:%u STATIC:%u VERSION_ID: %llu\n",
229                 name->type, name->state, name->node, name->is_static, name->version_id);
230         printf("\tRAW_FLAGS: 0x%08X OWNER: %-15s\n",
231                 name->raw_flags, name->owner);
232         for (i=0;i<name->num_addresses;i++) {
233                 printf("\tADDR: %-15s OWNER: %-15s\n", 
234                         name->addresses[i].address, name->addresses[i].owner);
235         }
236 }
237
238 /*
239   test a full replication dump from a WINS server
240 */
241 static BOOL test_wins_replication(TALLOC_CTX *mem_ctx, const char *address)
242 {
243         BOOL ret = True;
244         struct wrepl_socket *wrepl_socket;
245         NTSTATUS status;
246         int i, j;
247         struct wrepl_associate associate;
248         struct wrepl_pull_table pull_table;
249         struct wrepl_pull_names pull_names;
250
251         printf("Test one pull replication cycle\n");
252
253         wrepl_socket = wrepl_socket_init(mem_ctx, NULL);
254         
255         printf("Setup wrepl connections\n");
256         status = wrepl_connect(wrepl_socket, NULL, address);
257         CHECK_STATUS(status, NT_STATUS_OK);
258
259         printf("Send a start association request\n");
260
261         status = wrepl_associate(wrepl_socket, &associate);
262         CHECK_STATUS(status, NT_STATUS_OK);
263
264         printf("association context: 0x%x\n", associate.out.assoc_ctx);
265
266         printf("Send a replication table query\n");
267         pull_table.in.assoc_ctx = associate.out.assoc_ctx;
268
269         status = wrepl_pull_table(wrepl_socket, mem_ctx, &pull_table);
270         if (NT_STATUS_EQUAL(NT_STATUS_NETWORK_ACCESS_DENIED,status)) {
271                 struct wrepl_packet packet;
272                 struct wrepl_request *req;
273
274                 ZERO_STRUCT(packet);
275                 packet.opcode                      = WREPL_OPCODE_BITS;
276                 packet.assoc_ctx                   = associate.out.assoc_ctx;
277                 packet.mess_type                   = WREPL_STOP_ASSOCIATION;
278                 packet.message.stop.reason         = 0;
279
280                 req = wrepl_request_send(wrepl_socket, &packet);
281                 talloc_free(req);
282
283                 printf("failed - We are not a valid pull partner for the server\n");
284                 ret = False;
285                 goto done;
286         }
287         CHECK_STATUS(status, NT_STATUS_OK);
288
289         printf("Found %d replication partners\n", pull_table.out.num_partners);
290
291         for (i=0;i<pull_table.out.num_partners;i++) {
292                 struct wrepl_wins_owner *partner = &pull_table.out.partners[i];
293                 printf("%s   max_version=%6llu   min_version=%6llu type=%d\n",
294                        partner->address, 
295                        partner->max_version, 
296                        partner->min_version, 
297                        partner->type);
298
299                 pull_names.in.assoc_ctx = associate.out.assoc_ctx;
300                 pull_names.in.partner = *partner;
301                 
302                 status = wrepl_pull_names(wrepl_socket, mem_ctx, &pull_names);
303                 CHECK_STATUS(status, NT_STATUS_OK);
304
305                 printf("Received %d names\n", pull_names.out.num_names);
306
307                 for (j=0;j<pull_names.out.num_names;j++) {
308                         display_entry(mem_ctx, &pull_names.out.names[j]);
309                 }
310         }
311
312 done:
313         printf("Close wrepl connections\n");
314         talloc_free(wrepl_socket);
315         return ret;
316 }
317
318 struct test_wrepl_conflict_conn {
319         const char *address;
320         struct wrepl_socket *pull;
321         uint32_t pull_assoc;
322
323 #define TEST_OWNER_A_ADDRESS "127.65.65.1"
324 #define TEST_ADDRESS_A_PREFIX "127.0.65"
325 #define TEST_OWNER_B_ADDRESS "127.66.66.1"
326 #define TEST_ADDRESS_B_PREFIX "127.0.66"
327
328         struct wrepl_wins_owner a, b, c;
329 };
330
331 static const struct wrepl_ip addresses_A_1[] = {
332         {
333         .owner  = TEST_OWNER_A_ADDRESS,
334         .ip     = TEST_ADDRESS_A_PREFIX".1"
335         }
336 };
337 static const struct wrepl_ip addresses_A_2[] = {
338         {
339         .owner  = TEST_OWNER_A_ADDRESS,
340         .ip     = TEST_ADDRESS_A_PREFIX".2"
341         }
342 };
343 static const struct wrepl_ip addresses_A_3_4[] = {
344         {
345         .owner  = TEST_OWNER_A_ADDRESS,
346         .ip     = TEST_ADDRESS_A_PREFIX".3"
347         },
348         {
349         .owner  = TEST_OWNER_A_ADDRESS,
350         .ip     = TEST_ADDRESS_A_PREFIX".4"
351         }
352 };
353
354 static const struct wrepl_ip addresses_B_1[] = {
355         {
356         .owner  = TEST_OWNER_B_ADDRESS,
357         .ip     = TEST_ADDRESS_B_PREFIX".1"
358         }
359 };
360 static const struct wrepl_ip addresses_B_2[] = {
361         {
362         .owner  = TEST_OWNER_B_ADDRESS,
363         .ip     = TEST_ADDRESS_B_PREFIX".2"
364         }
365 };
366 static const struct wrepl_ip addresses_B_3_4[] = {
367         {
368         .owner  = TEST_OWNER_B_ADDRESS,
369         .ip     = TEST_ADDRESS_B_PREFIX".3"
370         },
371         {
372         .owner  = TEST_OWNER_B_ADDRESS,
373         .ip     = TEST_ADDRESS_B_PREFIX".4"
374         }
375 };
376
377 static struct test_wrepl_conflict_conn *test_create_conflict_ctx(TALLOC_CTX *mem_ctx,
378                                                                  const char *address)
379 {
380         struct test_wrepl_conflict_conn *ctx;
381         struct wrepl_associate associate;
382         struct wrepl_pull_table pull_table;
383         NTSTATUS status;
384         uint32_t i;
385
386         ctx = talloc_zero(mem_ctx, struct test_wrepl_conflict_conn);
387         if (!ctx) return NULL;
388
389         ctx->address    = address;
390         ctx->pull       = wrepl_socket_init(ctx, NULL);
391         if (!ctx->pull) return NULL;
392
393         printf("Setup wrepl conflict pull connection\n");
394         status = wrepl_connect(ctx->pull, NULL, ctx->address);
395         if (!NT_STATUS_IS_OK(status)) return NULL;
396
397         status = wrepl_associate(ctx->pull, &associate);
398         if (!NT_STATUS_IS_OK(status)) return NULL;
399
400         ctx->pull_assoc = associate.out.assoc_ctx;
401
402         ctx->a.address          = TEST_OWNER_A_ADDRESS;
403         ctx->a.max_version      = 0;
404         ctx->a.min_version      = 0;
405         ctx->a.type             = 1;
406
407         ctx->b.address          = TEST_OWNER_B_ADDRESS;
408         ctx->b.max_version      = 0;
409         ctx->b.min_version      = 0;
410         ctx->b.type             = 1;
411
412         ctx->c.address          = address;
413         ctx->c.max_version      = 0;
414         ctx->c.min_version      = 0;
415         ctx->c.type             = 1;
416
417         pull_table.in.assoc_ctx = ctx->pull_assoc;
418         status = wrepl_pull_table(ctx->pull, ctx->pull, &pull_table);
419         if (!NT_STATUS_IS_OK(status)) return NULL;
420
421         for (i=0; i < pull_table.out.num_partners; i++) {
422                 if (strcmp(TEST_OWNER_A_ADDRESS,pull_table.out.partners[i].address)==0) {
423                         ctx->a.max_version      = pull_table.out.partners[i].max_version;
424                         ctx->a.min_version      = pull_table.out.partners[i].min_version;
425                 }
426                 if (strcmp(TEST_OWNER_B_ADDRESS,pull_table.out.partners[i].address)==0) {
427                         ctx->b.max_version      = pull_table.out.partners[i].max_version;
428                         ctx->b.min_version      = pull_table.out.partners[i].min_version;
429                 }
430                 if (strcmp(address,pull_table.out.partners[i].address)==0) {
431                         ctx->c.max_version      = pull_table.out.partners[i].max_version;
432                         ctx->c.min_version      = pull_table.out.partners[i].min_version;
433                 }
434         }
435
436         talloc_free(pull_table.out.partners);
437
438         return ctx;
439 }
440
441 static BOOL test_wrepl_update_one(struct test_wrepl_conflict_conn *ctx,
442                                   const struct wrepl_wins_owner *owner,
443                                   const struct wrepl_wins_name *name)
444 {
445         BOOL ret = True;
446         struct wrepl_socket *wrepl_socket;
447         struct wrepl_associate associate;
448         struct wrepl_packet update_packet, repl_send;
449         struct wrepl_table *update;
450         struct wrepl_wins_owner wrepl_wins_owners[1];
451         struct wrepl_packet *repl_recv;
452         struct wrepl_wins_owner *send_request;
453         struct wrepl_send_reply *send_reply;
454         struct wrepl_wins_name wrepl_wins_names[1];
455         uint32_t assoc_ctx;
456         NTSTATUS status;
457
458         wrepl_socket = wrepl_socket_init(ctx, NULL);
459
460         status = wrepl_connect(wrepl_socket, NULL, ctx->address);
461         CHECK_STATUS(status, NT_STATUS_OK);
462
463         status = wrepl_associate(wrepl_socket, &associate);
464         CHECK_STATUS(status, NT_STATUS_OK);
465         assoc_ctx = associate.out.assoc_ctx;
466
467         /* now send a WREPL_REPL_UPDATE message */
468         ZERO_STRUCT(update_packet);
469         update_packet.opcode                    = WREPL_OPCODE_BITS;
470         update_packet.assoc_ctx                 = assoc_ctx;
471         update_packet.mess_type                 = WREPL_REPLICATION;
472         update_packet.message.replication.command       = WREPL_REPL_UPDATE;
473         update  = &update_packet.message.replication.info.table;
474
475         update->partner_count   = ARRAY_SIZE(wrepl_wins_owners);
476         update->partners        = wrepl_wins_owners;
477         update->initiator       = "0.0.0.0";
478
479         wrepl_wins_owners[0]    = *owner;
480
481         status = wrepl_request(wrepl_socket, wrepl_socket,
482                                &update_packet, &repl_recv);
483         CHECK_STATUS(status, NT_STATUS_OK);
484         CHECK_VALUE(repl_recv->mess_type, WREPL_REPLICATION);
485         CHECK_VALUE(repl_recv->message.replication.command, WREPL_REPL_SEND_REQUEST);
486         send_request = &repl_recv->message.replication.info.owner;
487
488         ZERO_STRUCT(repl_send);
489         repl_send.opcode                        = WREPL_OPCODE_BITS;
490         repl_send.assoc_ctx                     = assoc_ctx;
491         repl_send.mess_type                     = WREPL_REPLICATION;
492         repl_send.message.replication.command   = WREPL_REPL_SEND_REPLY;
493         send_reply = &repl_send.message.replication.info.reply;
494
495         send_reply->num_names   = ARRAY_SIZE(wrepl_wins_names);
496         send_reply->names       = wrepl_wins_names;
497
498         wrepl_wins_names[0]     = *name;
499
500         status = wrepl_request(wrepl_socket, wrepl_socket,
501                                &repl_send, &repl_recv);
502         CHECK_STATUS(status, NT_STATUS_OK);
503         CHECK_VALUE(repl_recv->mess_type, WREPL_STOP_ASSOCIATION);
504         CHECK_VALUE(repl_recv->message.stop.reason, 0);
505
506 done:
507         talloc_free(wrepl_socket);
508         return ret;
509 }
510
511 static BOOL test_wrepl_is_applied(struct test_wrepl_conflict_conn *ctx,
512                                   const struct wrepl_wins_owner *owner,
513                                   const struct wrepl_wins_name *name,
514                                   BOOL expected)
515 {
516         BOOL ret = True;
517         NTSTATUS status;
518         struct wrepl_pull_names pull_names;
519         struct wrepl_name *names;
520
521         pull_names.in.assoc_ctx = ctx->pull_assoc;
522         pull_names.in.partner   = *owner;
523         pull_names.in.partner.min_version = pull_names.in.partner.max_version;
524                 
525         status = wrepl_pull_names(ctx->pull, ctx->pull, &pull_names);
526         CHECK_STATUS(status, NT_STATUS_OK);
527         CHECK_VALUE(pull_names.out.num_names, (expected?1:0));
528
529         names = pull_names.out.names;
530
531         if (expected) {
532                 uint32_t flags = WREPL_NAME_FLAGS(names[0].type,
533                                                   names[0].state,
534                                                   names[0].node,
535                                                   names[0].is_static);
536                 CHECK_VALUE(names[0].name.type, name->name->type);
537                 CHECK_VALUE_STRING(names[0].name.name, name->name->name);
538                 CHECK_VALUE_STRING(names[0].name.scope, name->name->scope);
539                 CHECK_VALUE(flags, name->flags);
540                 CHECK_VALUE_UINT64(names[0].version_id, name->id);
541
542                 if (flags & 2) {
543                         CHECK_VALUE(names[0].num_addresses,
544                                     name->addresses.addresses.num_ips);
545                 } else {
546                         CHECK_VALUE(names[0].num_addresses, 1);
547                         CHECK_VALUE_STRING(names[0].addresses[0].address,
548                                            name->addresses.ip);
549                 }
550         }
551 done:
552         talloc_free(pull_names.out.names);
553         return ret;
554 }
555
556 static BOOL test_wrepl_is_merged(struct test_wrepl_conflict_conn *ctx,
557                                  const struct wrepl_wins_name *name1,
558                                  const struct wrepl_wins_name *name2)
559 {
560         return True;
561 #if 0
562         BOOL ret = True;
563         NTSTATUS status;
564         struct wrepl_pull_names pull_names;
565         struct wrepl_name *names;
566         uint32_t num_ips;
567
568         pull_names.in.assoc_ctx = ctx->pull_assoc;
569         pull_names.in.partner   = ctx->c;
570         pull_names.in.partner.min_version = ctx->c.max_version-1;
571
572         status = wrepl_pull_names(ctx->pull, ctx->pull, &pull_names);
573         CHECK_STATUS(status, NT_STATUS_OK);
574         CHECK_VALUE(pull_names.out.num_names, 1);
575
576         names = pull_names.out.names;
577
578         num_ips = name1->addresses.addresses.num_ips + name2->addresses.addresses.num_ips;
579
580         CHECK_VALUE(names[0].name.type, name1->name->type);
581         CHECK_VALUE_STRING(names[0].name.name, name1->name->name);
582         CHECK_VALUE_STRING(names[0].name.scope, name1->name->scope);
583         CHECK_VALUE(names[0].type, WREPL_TYPE_SGROUP);
584         CHECK_VALUE(names[0].state, (num_ips>0?WREPL_STATE_ACTIVE:WREPL_STATE_RELEASED));
585         CHECK_VALUE_UINT64(names[0].version_id, ctx->c.max_version);
586
587         CHECK_VALUE(names[0].num_addresses,
588                     name1->addresses.addresses.num_ips+
589                     name2->addresses.addresses.num_ips);
590 done:
591         talloc_free(pull_names.out.names);
592         return ret;
593 #endif
594 }
595
596 static BOOL test_conflict_same_owner(struct test_wrepl_conflict_conn *ctx)
597 {
598         BOOL ret = True;
599         struct nbt_name name;
600         struct wrepl_wins_name wins_name1;
601         struct wrepl_wins_name wins_name2;
602         struct wrepl_wins_name *wins_name_tmp;
603         struct wrepl_wins_name *wins_name_last;
604         struct wrepl_wins_name *wins_name_cur;
605         uint32_t i,j;
606         uint8_t types[] = { 0x00, 0x1C };
607         struct {
608                 enum wrepl_name_type type;
609                 enum wrepl_name_state state;
610                 enum wrepl_name_node node;
611                 BOOL is_static;
612                 uint32_t num_ips;
613                 const struct wrepl_ip *ips;
614         } records[] = {
615                 {
616                 .type           = WREPL_TYPE_GROUP,
617                 .state          = WREPL_STATE_ACTIVE,
618                 .node           = WREPL_NODE_B,
619                 .is_static      = False,
620                 .num_ips        = ARRAY_SIZE(addresses_A_1),
621                 .ips            = addresses_A_1,
622                 },{
623                 .type           = WREPL_TYPE_UNIQUE,
624                 .state          = WREPL_STATE_ACTIVE,
625                 .node           = WREPL_NODE_B,
626                 .is_static      = False,
627                 .num_ips        = ARRAY_SIZE(addresses_A_1),
628                 .ips            = addresses_A_1,
629                 },{
630                 .type           = WREPL_TYPE_UNIQUE,
631                 .state          = WREPL_STATE_ACTIVE,
632                 .node           = WREPL_NODE_B,
633                 .is_static      = False,
634                 .num_ips        = ARRAY_SIZE(addresses_A_2),
635                 .ips            = addresses_A_2,
636                 },{
637                 .type           = WREPL_TYPE_UNIQUE,
638                 .state          = WREPL_STATE_ACTIVE,
639                 .node           = WREPL_NODE_B,
640                 .is_static      = True,
641                 .num_ips        = ARRAY_SIZE(addresses_A_1),
642                 .ips            = addresses_A_1,
643                 },{
644                 .type           = WREPL_TYPE_UNIQUE,
645                 .state          = WREPL_STATE_ACTIVE,
646                 .node           = WREPL_NODE_B,
647                 .is_static      = False,
648                 .num_ips        = ARRAY_SIZE(addresses_A_2),
649                 .ips            = addresses_A_2,
650                 },{
651                 .type           = WREPL_TYPE_SGROUP,
652                 .state          = WREPL_STATE_TOMBSTONE,
653                 .node           = WREPL_NODE_B,
654                 .is_static      = False,
655                 .num_ips        = ARRAY_SIZE(addresses_A_2),
656                 .ips            = addresses_A_2,
657                 },{
658                 .type           = WREPL_TYPE_MHOMED,
659                 .state          = WREPL_STATE_TOMBSTONE,
660                 .node           = WREPL_NODE_B,
661                 .is_static      = False,
662                 .num_ips        = ARRAY_SIZE(addresses_A_1),
663                 .ips            = addresses_A_1,
664                 },{
665                 .type           = WREPL_TYPE_MHOMED,
666                 .state          = WREPL_STATE_RELEASED,
667                 .node           = WREPL_NODE_B,
668                 .is_static      = False,
669                 .num_ips        = ARRAY_SIZE(addresses_A_2),
670                 .ips            = addresses_A_2,
671                 },{
672                 .type           = WREPL_TYPE_SGROUP,
673                 .state          = WREPL_STATE_ACTIVE,
674                 .node           = WREPL_NODE_B,
675                 .is_static      = False,
676                 .num_ips        = ARRAY_SIZE(addresses_A_1),
677                 .ips            = addresses_A_1,
678                 },{
679                 .type           = WREPL_TYPE_SGROUP,
680                 .state          = WREPL_STATE_ACTIVE,
681                 .node           = WREPL_NODE_B,
682                 .is_static      = False,
683                 .num_ips        = ARRAY_SIZE(addresses_A_3_4),
684                 .ips            = addresses_A_3_4,
685                 },{
686                 .type           = WREPL_TYPE_SGROUP,
687                 .state          = WREPL_STATE_TOMBSTONE,
688                 .node           = WREPL_NODE_B,
689                 .is_static      = False,
690                 .num_ips        = ARRAY_SIZE(addresses_B_3_4),
691                 .ips            = addresses_B_3_4,
692                 },{
693                 /* the last one should always be a unique,tomstone record! */
694                 .type           = WREPL_TYPE_UNIQUE,
695                 .state          = WREPL_STATE_TOMBSTONE,
696                 .node           = WREPL_NODE_B,
697                 .is_static      = False,
698                 .num_ips        = ARRAY_SIZE(addresses_A_1),
699                 .ips            = addresses_A_1,
700                 }
701         };
702
703         if (!ctx) return False;
704
705         name.name       = "_SAME_OWNER_A";
706         name.type       = 0;
707         name.scope      = NULL;
708
709         wins_name_tmp   = NULL;
710         wins_name_last  = &wins_name2;
711         wins_name_cur   = &wins_name1;
712
713         for (j=0; ret && j < ARRAY_SIZE(types); j++) {
714                 name.type = types[j];
715                 printf("Test Replica Conflicts with same owner[%s] for %s\n",
716                         nbt_name_string(ctx, &name), ctx->a.address);
717
718                 for(i=0; ret && i < ARRAY_SIZE(records); i++) {
719                         wins_name_tmp   = wins_name_last;
720                         wins_name_last  = wins_name_cur;
721                         wins_name_cur   = wins_name_tmp;
722
723                         if (i > 0) {
724                                 printf("%s,%s%s vs. %s,%s%s with %s ip(s) => %s\n",
725                                         wrepl_name_type_string(records[i-1].type),
726                                         wrepl_name_state_string(records[i-1].state),
727                                         (records[i-1].is_static?",static":""),
728                                         wrepl_name_type_string(records[i].type),
729                                         wrepl_name_state_string(records[i].state),
730                                         (records[i].is_static?",static":""),
731                                         (records[i-1].ips==records[i].ips?"same":"different"),
732                                         "REPLACE");
733                         }
734
735                         wins_name_cur->name     = &name;
736                         wins_name_cur->flags    = WREPL_NAME_FLAGS(records[i].type,
737                                                                    records[i].state,
738                                                                    records[i].node,
739                                                                    records[i].is_static);
740                         wins_name_cur->id       = ++ctx->a.max_version;
741                         if (wins_name_cur->flags & 2) {
742                                 wins_name_cur->addresses.addresses.num_ips = records[i].num_ips;
743                                 wins_name_cur->addresses.addresses.ips     = discard_const(records[i].ips);
744                         } else {
745                                 wins_name_cur->addresses.ip = records[i].ips[0].ip;
746                         }
747                         wins_name_cur->unknown  = "255.255.255.255";
748
749                         ret &= test_wrepl_update_one(ctx, &ctx->a,wins_name_cur);
750                         if (records[i].state == WREPL_STATE_RELEASED) {
751                                 ret &= test_wrepl_is_applied(ctx, &ctx->a, wins_name_last, False);
752                                 ret &= test_wrepl_is_applied(ctx, &ctx->a, wins_name_cur, False);
753                         } else {
754                                 ret &= test_wrepl_is_applied(ctx, &ctx->a, wins_name_cur, True);
755                         }
756
757                         /* the first one is a cleanup run */
758                         if (!ret && i == 0) ret = True;
759
760                         if (!ret) {
761                                 printf("conflict handled wrong or record[%u]: %s\n", i, __location__);
762                                 return ret;
763                         }
764                 }
765         }
766         return ret;
767 }
768
769 static BOOL test_conflict_different_owner(struct test_wrepl_conflict_conn *ctx)
770 {
771         BOOL ret = True;
772         struct wrepl_wins_name wins_name1;
773         struct wrepl_wins_name wins_name2;
774         struct wrepl_wins_name *wins_name_r1;
775         struct wrepl_wins_name *wins_name_r2;
776         uint32_t i;
777         struct {
778                 const char *line; /* just better debugging */
779                 struct nbt_name name;
780                 BOOL extra; /* not the worst case, this is an extra test */
781                 BOOL cleanup;
782                 struct {
783                         struct wrepl_wins_owner *owner;
784                         enum wrepl_name_type type;
785                         enum wrepl_name_state state;
786                         enum wrepl_name_node node;
787                         BOOL is_static;
788                         uint32_t num_ips;
789                         const struct wrepl_ip *ips;
790                         BOOL apply_expected;
791                         BOOL merge_expected;
792                 } r1, r2;
793         } records[] = {
794         /* 
795          * NOTE: the first record and the last applied one
796          *       needs to be from the same owner,
797          *       to not conflict in the next smbtorture run!!!
798          */
799         {
800                 .line   = __location__,
801                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
802                 .cleanup= True,
803                 .r1     = {
804                         .owner          = &ctx->b,
805                         .type           = WREPL_TYPE_UNIQUE,
806                         .state          = WREPL_STATE_TOMBSTONE,
807                         .node           = WREPL_NODE_B,
808                         .is_static      = False,
809                         .num_ips        = ARRAY_SIZE(addresses_B_1),
810                         .ips            = addresses_B_1,
811                         .apply_expected = True /* ignored */
812                 },
813                 .r2     = {
814                         .owner          = &ctx->a,
815                         .type           = WREPL_TYPE_UNIQUE,
816                         .state          = WREPL_STATE_TOMBSTONE,
817                         .node           = WREPL_NODE_B,
818                         .is_static      = False,
819                         .num_ips        = ARRAY_SIZE(addresses_A_1),
820                         .ips            = addresses_A_1,
821                         .apply_expected = True /* ignored */
822                 }
823         },
824
825 /*
826  * unique vs unique section
827  */
828         /* 
829          * unique,active vs. unique,active
830          * => should be replaced
831          */
832         {
833                 .line   = __location__,
834                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
835                 .r1     = {
836                         .owner          = &ctx->a,
837                         .type           = WREPL_TYPE_UNIQUE,
838                         .state          = WREPL_STATE_ACTIVE,
839                         .node           = WREPL_NODE_B,
840                         .is_static      = False,
841                         .num_ips        = ARRAY_SIZE(addresses_A_1),
842                         .ips            = addresses_A_1,
843                         .apply_expected = True
844                 },
845                 .r2     = {
846                         .owner          = &ctx->b,
847                         .type           = WREPL_TYPE_UNIQUE,
848                         .state          = WREPL_STATE_ACTIVE,
849                         .node           = WREPL_NODE_B,
850                         .is_static      = False,
851                         .num_ips        = ARRAY_SIZE(addresses_B_1),
852                         .ips            = addresses_B_1,
853                         .apply_expected = True
854                 }
855         },
856
857         /* 
858          * unique,active vs. unique,tombstone
859          * => should NOT be replaced
860          */
861         {
862                 .line   = __location__,
863                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
864                 .r1     = {
865                         .owner          = &ctx->b,
866                         .type           = WREPL_TYPE_UNIQUE,
867                         .state          = WREPL_STATE_ACTIVE,
868                         .node           = WREPL_NODE_B,
869                         .is_static      = False,
870                         .num_ips        = ARRAY_SIZE(addresses_B_1),
871                         .ips            = addresses_B_1,
872                         .apply_expected = True
873                 },
874                 .r2     = {
875                         .owner          = &ctx->a,
876                         .type           = WREPL_TYPE_UNIQUE,
877                         .state          = WREPL_STATE_TOMBSTONE,
878                         .node           = WREPL_NODE_B,
879                         .is_static      = False,
880                         .num_ips        = ARRAY_SIZE(addresses_B_1),
881                         .ips            = addresses_B_1,
882                         .apply_expected = False
883                 }
884         },
885
886         /* 
887          * unique,released vs. unique,active
888          * => should be replaced
889          */
890         {
891                 .line   = __location__,
892                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
893                 .r1     = {
894                         .owner          = &ctx->b,
895                         .type           = WREPL_TYPE_UNIQUE,
896                         .state          = WREPL_STATE_RELEASED,
897                         .node           = WREPL_NODE_B,
898                         .is_static      = False,
899                         .num_ips        = ARRAY_SIZE(addresses_B_1),
900                         .ips            = addresses_B_1,
901                         .apply_expected = False
902                 },
903                 .r2     = {
904                         .owner          = &ctx->a,
905                         .type           = WREPL_TYPE_UNIQUE,
906                         .state          = WREPL_STATE_ACTIVE,
907                         .node           = WREPL_NODE_B,
908                         .is_static      = False,
909                         .num_ips        = ARRAY_SIZE(addresses_A_1),
910                         .ips            = addresses_A_1,
911                         .apply_expected = True
912                 }
913         },
914
915         /* 
916          * unique,released vs. unique,tombstone
917          * => should be replaced
918          */
919         {
920                 .line   = __location__,
921                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
922                 .r1     = {
923                         .owner          = &ctx->a,
924                         .type           = WREPL_TYPE_UNIQUE,
925                         .state          = WREPL_STATE_RELEASED,
926                         .node           = WREPL_NODE_B,
927                         .is_static      = False,
928                         .num_ips        = ARRAY_SIZE(addresses_A_1),
929                         .ips            = addresses_A_1,
930                         .apply_expected = False
931                 },
932                 .r2     = {
933                         .owner          = &ctx->b,
934                         .type           = WREPL_TYPE_UNIQUE,
935                         .state          = WREPL_STATE_TOMBSTONE,
936                         .node           = WREPL_NODE_B,
937                         .is_static      = False,
938                         .num_ips        = ARRAY_SIZE(addresses_B_1),
939                         .ips            = addresses_B_1,
940                         .apply_expected = True
941                 }
942         },
943
944         /* 
945          * unique,tombstone vs. unique,active
946          * => should be replaced
947          */
948         {
949                 .line   = __location__,
950                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
951                 .r1     = {
952                         .owner          = &ctx->b,
953                         .type           = WREPL_TYPE_UNIQUE,
954                         .state          = WREPL_STATE_TOMBSTONE,
955                         .node           = WREPL_NODE_B,
956                         .is_static      = False,
957                         .num_ips        = ARRAY_SIZE(addresses_B_1),
958                         .ips            = addresses_B_1,
959                         .apply_expected = True
960                 },
961                 .r2     = {
962                         .owner          = &ctx->a,
963                         .type           = WREPL_TYPE_UNIQUE,
964                         .state          = WREPL_STATE_ACTIVE,
965                         .node           = WREPL_NODE_B,
966                         .is_static      = False,
967                         .num_ips        = ARRAY_SIZE(addresses_A_1),
968                         .ips            = addresses_A_1,
969                         .apply_expected = True
970                 }
971         },
972
973         /* 
974          * unique,tombstone vs. unique,tombstone
975          * => should be replaced
976          */
977         {
978                 .line   = __location__,
979                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
980                 .r1     = {
981                         .owner          = &ctx->a,
982                         .type           = WREPL_TYPE_UNIQUE,
983                         .state          = WREPL_STATE_TOMBSTONE,
984                         .node           = WREPL_NODE_B,
985                         .is_static      = False,
986                         .num_ips        = ARRAY_SIZE(addresses_A_1),
987                         .ips            = addresses_A_1,
988                         .apply_expected = True
989                 },
990                 .r2     = {
991                         .owner          = &ctx->b,
992                         .type           = WREPL_TYPE_UNIQUE,
993                         .state          = WREPL_STATE_TOMBSTONE,
994                         .node           = WREPL_NODE_B,
995                         .is_static      = False,
996                         .num_ips        = ARRAY_SIZE(addresses_B_1),
997                         .ips            = addresses_B_1,
998                         .apply_expected = True
999                 }
1000         },
1001
1002
1003 /*
1004  * unique vs normal groups section,
1005  */
1006         /* 
1007          * unique,active vs. group,active
1008          * => should be replaced
1009          */
1010         {
1011                 .line   = __location__,
1012                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1013                 .r1     = {
1014                         .owner          = &ctx->b,
1015                         .type           = WREPL_TYPE_UNIQUE,
1016                         .state          = WREPL_STATE_ACTIVE,
1017                         .node           = WREPL_NODE_B,
1018                         .is_static      = False,
1019                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1020                         .ips            = addresses_B_1,
1021                         .apply_expected = True
1022                 },
1023                 .r2     = {
1024                         .owner          = &ctx->a,
1025                         .type           = WREPL_TYPE_GROUP,
1026                         .state          = WREPL_STATE_ACTIVE,
1027                         .node           = WREPL_NODE_B,
1028                         .is_static      = False,
1029                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1030                         .ips            = addresses_A_1,
1031                         .apply_expected = True
1032                 }
1033         },
1034
1035         /* 
1036          * unique,active vs. group,tombstone
1037          * => should NOT be replaced
1038          */
1039         {
1040                 .line   = __location__,
1041                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1042                 .r1     = {
1043                         .owner          = &ctx->a,
1044                         .type           = WREPL_TYPE_UNIQUE,
1045                         .state          = WREPL_STATE_ACTIVE,
1046                         .node           = WREPL_NODE_B,
1047                         .is_static      = False,
1048                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1049                         .ips            = addresses_A_1,
1050                         .apply_expected = True
1051                 },
1052                 .r2     = {
1053                         .owner          = &ctx->b,
1054                         .type           = WREPL_TYPE_GROUP,
1055                         .state          = WREPL_STATE_TOMBSTONE,
1056                         .node           = WREPL_NODE_B,
1057                         .is_static      = False,
1058                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1059                         .ips            = addresses_A_1,
1060                         .apply_expected = False
1061                 }
1062         },
1063
1064         /* 
1065          * unique,released vs. group,active
1066          * => should be replaced
1067          */
1068         {
1069                 .line   = __location__,
1070                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1071                 .r1     = {
1072                         .owner          = &ctx->a,
1073                         .type           = WREPL_TYPE_UNIQUE,
1074                         .state          = WREPL_STATE_RELEASED,
1075                         .node           = WREPL_NODE_B,
1076                         .is_static      = False,
1077                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1078                         .ips            = addresses_A_1,
1079                         .apply_expected = False
1080                 },
1081                 .r2     = {
1082                         .owner          = &ctx->b,
1083                         .type           = WREPL_TYPE_GROUP,
1084                         .state          = WREPL_STATE_ACTIVE,
1085                         .node           = WREPL_NODE_B,
1086                         .is_static      = False,
1087                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1088                         .ips            = addresses_B_1,
1089                         .apply_expected = True
1090                 }
1091         },
1092
1093         /* 
1094          * unique,released vs. group,tombstone
1095          * => should be replaced
1096          */
1097         {
1098                 .line   = __location__,
1099                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1100                 .r1     = {
1101                         .owner          = &ctx->b,
1102                         .type           = WREPL_TYPE_UNIQUE,
1103                         .state          = WREPL_STATE_RELEASED,
1104                         .node           = WREPL_NODE_B,
1105                         .is_static      = False,
1106                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1107                         .ips            = addresses_B_1,
1108                         .apply_expected = False
1109                 },
1110                 .r2     = {
1111                         .owner          = &ctx->a,
1112                         .type           = WREPL_TYPE_GROUP,
1113                         .state          = WREPL_STATE_TOMBSTONE,
1114                         .node           = WREPL_NODE_B,
1115                         .is_static      = False,
1116                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1117                         .ips            = addresses_A_1,
1118                         .apply_expected = True
1119                 }
1120         },
1121
1122         /* 
1123          * unique,tombstone vs. group,active
1124          * => should be replaced
1125          */
1126         {
1127                 .line   = __location__,
1128                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1129                 .r1     = {
1130                         .owner          = &ctx->a,
1131                         .type           = WREPL_TYPE_UNIQUE,
1132                         .state          = WREPL_STATE_TOMBSTONE,
1133                         .node           = WREPL_NODE_B,
1134                         .is_static      = False,
1135                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1136                         .ips            = addresses_A_1,
1137                         .apply_expected = True
1138                 },
1139                 .r2     = {
1140                         .owner          = &ctx->b,
1141                         .type           = WREPL_TYPE_GROUP,
1142                         .state          = WREPL_STATE_ACTIVE,
1143                         .node           = WREPL_NODE_B,
1144                         .is_static      = False,
1145                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1146                         .ips            = addresses_B_1,
1147                         .apply_expected = True
1148                 }
1149         },
1150
1151         /* 
1152          * unique,tombstone vs. group,tombstone
1153          * => should be replaced
1154          */
1155         {
1156                 .line   = __location__,
1157                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1158                 .r1     = {
1159                         .owner          = &ctx->b,
1160                         .type           = WREPL_TYPE_UNIQUE,
1161                         .state          = WREPL_STATE_TOMBSTONE,
1162                         .node           = WREPL_NODE_B,
1163                         .is_static      = False,
1164                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1165                         .ips            = addresses_B_1,
1166                         .apply_expected = True
1167                 },
1168                 .r2     = {
1169                         .owner          = &ctx->a,
1170                         .type           = WREPL_TYPE_GROUP,
1171                         .state          = WREPL_STATE_TOMBSTONE,
1172                         .node           = WREPL_NODE_B,
1173                         .is_static      = False,
1174                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1175                         .ips            = addresses_A_1,
1176                         .apply_expected = True
1177                 }
1178         },
1179
1180 /*
1181  * unique vs special groups section,
1182  */
1183         /* 
1184          * unique,active vs. sgroup,active
1185          * => should NOT be replaced
1186          */
1187         {
1188                 .line   = __location__,
1189                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1190                 .r1     = {
1191                         .owner          = &ctx->a,
1192                         .type           = WREPL_TYPE_UNIQUE,
1193                         .state          = WREPL_STATE_ACTIVE,
1194                         .node           = WREPL_NODE_B,
1195                         .is_static      = False,
1196                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1197                         .ips            = addresses_A_1,
1198                         .apply_expected = True
1199                 },
1200                 .r2     = {
1201                         .owner          = &ctx->b,
1202                         .type           = WREPL_TYPE_SGROUP,
1203                         .state          = WREPL_STATE_ACTIVE,
1204                         .node           = WREPL_NODE_B,
1205                         .is_static      = False,
1206                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1207                         .ips            = addresses_A_1,
1208                         .apply_expected = False
1209                 }
1210         },
1211
1212         /* 
1213          * unique,active vs. sgroup,tombstone
1214          * => should NOT be replaced
1215          */
1216         {
1217                 .line   = __location__,
1218                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1219                 .r1     = {
1220                         .owner          = &ctx->a,
1221                         .type           = WREPL_TYPE_UNIQUE,
1222                         .state          = WREPL_STATE_ACTIVE,
1223                         .node           = WREPL_NODE_B,
1224                         .is_static      = False,
1225                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1226                         .ips            = addresses_A_1,
1227                         .apply_expected = True
1228                 },
1229                 .r2     = {
1230                         .owner          = &ctx->b,
1231                         .type           = WREPL_TYPE_SGROUP,
1232                         .state          = WREPL_STATE_TOMBSTONE,
1233                         .node           = WREPL_NODE_B,
1234                         .is_static      = False,
1235                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1236                         .ips            = addresses_A_1,
1237                         .apply_expected = False
1238                 }
1239         },
1240
1241         /* 
1242          * unique,released vs. sgroup,active
1243          * => should be replaced
1244          */
1245         {
1246                 .line   = __location__,
1247                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1248                 .r1     = {
1249                         .owner          = &ctx->a,
1250                         .type           = WREPL_TYPE_UNIQUE,
1251                         .state          = WREPL_STATE_RELEASED,
1252                         .node           = WREPL_NODE_B,
1253                         .is_static      = False,
1254                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1255                         .ips            = addresses_A_1,
1256                         .apply_expected = False
1257                 },
1258                 .r2     = {
1259                         .owner          = &ctx->b,
1260                         .type           = WREPL_TYPE_SGROUP,
1261                         .state          = WREPL_STATE_ACTIVE,
1262                         .node           = WREPL_NODE_B,
1263                         .is_static      = False,
1264                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
1265                         .ips            = addresses_B_3_4,
1266                         .apply_expected = True
1267                 }
1268         },
1269
1270         /* 
1271          * unique,released vs. sgroup,tombstone
1272          * => should be replaced
1273          */
1274         {
1275                 .line   = __location__,
1276                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1277                 .r1     = {
1278                         .owner          = &ctx->b,
1279                         .type           = WREPL_TYPE_UNIQUE,
1280                         .state          = WREPL_STATE_RELEASED,
1281                         .node           = WREPL_NODE_B,
1282                         .is_static      = False,
1283                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1284                         .ips            = addresses_B_1,
1285                         .apply_expected = False
1286                 },
1287                 .r2     = {
1288                         .owner          = &ctx->a,
1289                         .type           = WREPL_TYPE_SGROUP,
1290                         .state          = WREPL_STATE_TOMBSTONE,
1291                         .node           = WREPL_NODE_B,
1292                         .is_static      = False,
1293                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
1294                         .ips            = addresses_A_3_4,
1295                         .apply_expected = True
1296                 }
1297         },
1298
1299         /* 
1300          * unique,tombstone vs. sgroup,active
1301          * => should be replaced
1302          */
1303         {
1304                 .line   = __location__,
1305                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1306                 .r1     = {
1307                         .owner          = &ctx->a,
1308                         .type           = WREPL_TYPE_UNIQUE,
1309                         .state          = WREPL_STATE_TOMBSTONE,
1310                         .node           = WREPL_NODE_B,
1311                         .is_static      = False,
1312                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1313                         .ips            = addresses_A_1,
1314                         .apply_expected = True
1315                 },
1316                 .r2     = {
1317                         .owner          = &ctx->b,
1318                         .type           = WREPL_TYPE_SGROUP,
1319                         .state          = WREPL_STATE_ACTIVE,
1320                         .node           = WREPL_NODE_B,
1321                         .is_static      = False,
1322                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
1323                         .ips            = addresses_B_3_4,
1324                         .apply_expected = True
1325                 }
1326         },
1327
1328         /* 
1329          * unique,tombstone vs. sgroup,tombstone
1330          * => should be replaced
1331          */
1332         {
1333                 .line   = __location__,
1334                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1335                 .r1     = {
1336                         .owner          = &ctx->b,
1337                         .type           = WREPL_TYPE_UNIQUE,
1338                         .state          = WREPL_STATE_TOMBSTONE,
1339                         .node           = WREPL_NODE_B,
1340                         .is_static      = False,
1341                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1342                         .ips            = addresses_B_1,
1343                         .apply_expected = True
1344                 },
1345                 .r2     = {
1346                         .owner          = &ctx->a,
1347                         .type           = WREPL_TYPE_SGROUP,
1348                         .state          = WREPL_STATE_TOMBSTONE,
1349                         .node           = WREPL_NODE_B,
1350                         .is_static      = False,
1351                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
1352                         .ips            = addresses_A_3_4,
1353                         .apply_expected = True
1354                 }
1355         },
1356
1357 /*
1358  * unique vs multi homed section,
1359  */
1360         /* 
1361          * unique,active vs. mhomed,active
1362          * => should be replaced
1363          */
1364         {
1365                 .line   = __location__,
1366                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1367                 .r1     = {
1368                         .owner          = &ctx->a,
1369                         .type           = WREPL_TYPE_UNIQUE,
1370                         .state          = WREPL_STATE_ACTIVE,
1371                         .node           = WREPL_NODE_B,
1372                         .is_static      = False,
1373                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1374                         .ips            = addresses_A_1,
1375                         .apply_expected = True
1376                 },
1377                 .r2     = {
1378                         .owner          = &ctx->b,
1379                         .type           = WREPL_TYPE_MHOMED,
1380                         .state          = WREPL_STATE_ACTIVE,
1381                         .node           = WREPL_NODE_B,
1382                         .is_static      = False,
1383                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
1384                         .ips            = addresses_B_3_4,
1385                         .apply_expected = True
1386                 }
1387         },
1388
1389         /* 
1390          * unique,active vs. mhomed,tombstone
1391          * => should NOT be replaced
1392          */
1393         {
1394                 .line   = __location__,
1395                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1396                 .r1     = {
1397                         .owner          = &ctx->b,
1398                         .type           = WREPL_TYPE_UNIQUE,
1399                         .state          = WREPL_STATE_ACTIVE,
1400                         .node           = WREPL_NODE_B,
1401                         .is_static      = False,
1402                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
1403                         .ips            = addresses_B_3_4,
1404                         .apply_expected = True
1405                 },
1406                 .r2     = {
1407                         .owner          = &ctx->a,
1408                         .type           = WREPL_TYPE_MHOMED,
1409                         .state          = WREPL_STATE_TOMBSTONE,
1410                         .node           = WREPL_NODE_B,
1411                         .is_static      = False,
1412                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
1413                         .ips            = addresses_B_3_4,
1414                         .apply_expected = False
1415                 }
1416         },
1417
1418         /* 
1419          * unique,released vs. mhomed,active
1420          * => should be replaced
1421          */
1422         {
1423                 .line   = __location__,
1424                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1425                 .r1     = {
1426                         .owner          = &ctx->b,
1427                         .type           = WREPL_TYPE_UNIQUE,
1428                         .state          = WREPL_STATE_RELEASED,
1429                         .node           = WREPL_NODE_B,
1430                         .is_static      = False,
1431                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1432                         .ips            = addresses_B_1,
1433                         .apply_expected = False
1434                 },
1435                 .r2     = {
1436                         .owner          = &ctx->a,
1437                         .type           = WREPL_TYPE_MHOMED,
1438                         .state          = WREPL_STATE_ACTIVE,
1439                         .node           = WREPL_NODE_B,
1440                         .is_static      = False,
1441                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
1442                         .ips            = addresses_A_3_4,
1443                         .apply_expected = True
1444                 }
1445         },
1446
1447         /* 
1448          * unique,released vs. mhomed,tombstone
1449          * => should be replaced
1450          */
1451         {
1452                 .line   = __location__,
1453                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1454                 .r1     = {
1455                         .owner          = &ctx->a,
1456                         .type           = WREPL_TYPE_UNIQUE,
1457                         .state          = WREPL_STATE_RELEASED,
1458                         .node           = WREPL_NODE_B,
1459                         .is_static      = False,
1460                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1461                         .ips            = addresses_A_1,
1462                         .apply_expected = False
1463                 },
1464                 .r2     = {
1465                         .owner          = &ctx->b,
1466                         .type           = WREPL_TYPE_MHOMED,
1467                         .state          = WREPL_STATE_TOMBSTONE,
1468                         .node           = WREPL_NODE_B,
1469                         .is_static      = False,
1470                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
1471                         .ips            = addresses_B_3_4,
1472                         .apply_expected = True
1473                 }
1474         },
1475
1476         /* 
1477          * unique,tombstone vs. mhomed,active
1478          * => should be replaced
1479          */
1480         {
1481                 .line   = __location__,
1482                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1483                 .r1     = {
1484                         .owner          = &ctx->b,
1485                         .type           = WREPL_TYPE_UNIQUE,
1486                         .state          = WREPL_STATE_TOMBSTONE,
1487                         .node           = WREPL_NODE_B,
1488                         .is_static      = False,
1489                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1490                         .ips            = addresses_B_1,
1491                         .apply_expected = True
1492                 },
1493                 .r2     = {
1494                         .owner          = &ctx->a,
1495                         .type           = WREPL_TYPE_MHOMED,
1496                         .state          = WREPL_STATE_ACTIVE,
1497                         .node           = WREPL_NODE_B,
1498                         .is_static      = False,
1499                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
1500                         .ips            = addresses_A_3_4,
1501                         .apply_expected = True
1502                 }
1503         },
1504
1505         /* 
1506          * unique,tombstone vs. mhomed,tombstone
1507          * => should be replaced
1508          */
1509         {
1510                 .line   = __location__,
1511                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1512                 .r1     = {
1513                         .owner          = &ctx->a,
1514                         .type           = WREPL_TYPE_UNIQUE,
1515                         .state          = WREPL_STATE_TOMBSTONE,
1516                         .node           = WREPL_NODE_B,
1517                         .is_static      = False,
1518                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1519                         .ips            = addresses_A_1,
1520                         .apply_expected = True
1521                 },
1522                 .r2     = {
1523                         .owner          = &ctx->b,
1524                         .type           = WREPL_TYPE_MHOMED,
1525                         .state          = WREPL_STATE_TOMBSTONE,
1526                         .node           = WREPL_NODE_B,
1527                         .is_static      = False,
1528                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
1529                         .ips            = addresses_B_3_4,
1530                         .apply_expected = True
1531                 }
1532         },
1533
1534 /*
1535  * normal groups vs unique section,
1536  */
1537         /* 
1538          * group,active vs. unique,active
1539          * => should NOT be replaced
1540          */
1541         {
1542                 .line   = __location__,
1543                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1544                 .r1     = {
1545                         .owner          = &ctx->a,
1546                         .type           = WREPL_TYPE_GROUP,
1547                         .state          = WREPL_STATE_ACTIVE,
1548                         .node           = WREPL_NODE_B,
1549                         .is_static      = False,
1550                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1551                         .ips            = addresses_A_1,
1552                         .apply_expected = True
1553                 },
1554                 .r2     = {
1555                         .owner          = &ctx->b,
1556                         .type           = WREPL_TYPE_UNIQUE,
1557                         .state          = WREPL_STATE_ACTIVE,
1558                         .node           = WREPL_NODE_B,
1559                         .is_static      = False,
1560                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1561                         .ips            = addresses_A_1,
1562                         .apply_expected = False
1563                 }
1564         },
1565
1566         /* 
1567          * group,active vs. unique,tombstone
1568          * => should NOT be replaced
1569          */
1570         {
1571                 .line   = __location__,
1572                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1573                 .r1     = {
1574                         .owner          = &ctx->a,
1575                         .type           = WREPL_TYPE_GROUP,
1576                         .state          = WREPL_STATE_ACTIVE,
1577                         .node           = WREPL_NODE_B,
1578                         .is_static      = False,
1579                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1580                         .ips            = addresses_A_1,
1581                         .apply_expected = True
1582                 },
1583                 .r2     = {
1584                         .owner          = &ctx->b,
1585                         .type           = WREPL_TYPE_UNIQUE,
1586                         .state          = WREPL_STATE_TOMBSTONE,
1587                         .node           = WREPL_NODE_B,
1588                         .is_static      = False,
1589                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1590                         .ips            = addresses_A_1,
1591                         .apply_expected = False
1592                 }
1593         },
1594
1595         /* 
1596          * group,released vs. unique,active
1597          * => should NOT be replaced
1598          */
1599         {
1600                 .line   = __location__,
1601                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1602                 .r1     = {
1603                         .owner          = &ctx->a,
1604                         .type           = WREPL_TYPE_GROUP,
1605                         .state          = WREPL_STATE_RELEASED,
1606                         .node           = WREPL_NODE_B,
1607                         .is_static      = False,
1608                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1609                         .ips            = addresses_A_1,
1610                         .apply_expected = False
1611                 },
1612                 .r2     = {
1613                         .owner          = &ctx->b,
1614                         .type           = WREPL_TYPE_UNIQUE,
1615                         .state          = WREPL_STATE_ACTIVE,
1616                         .node           = WREPL_NODE_B,
1617                         .is_static      = False,
1618                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1619                         .ips            = addresses_A_1,
1620                         .apply_expected = False
1621                 }
1622         },
1623
1624         /* 
1625          * group,released vs. unique,tombstone
1626          * => should NOT be replaced
1627          */
1628         {
1629                 .line   = __location__,
1630                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1631                 .r1     = {
1632                         .owner          = &ctx->a,
1633                         .type           = WREPL_TYPE_GROUP,
1634                         .state          = WREPL_STATE_RELEASED,
1635                         .node           = WREPL_NODE_B,
1636                         .is_static      = False,
1637                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1638                         .ips            = addresses_A_1,
1639                         .apply_expected = False
1640                 },
1641                 .r2     = {
1642                         .owner          = &ctx->b,
1643                         .type           = WREPL_TYPE_UNIQUE,
1644                         .state          = WREPL_STATE_TOMBSTONE,
1645                         .node           = WREPL_NODE_B,
1646                         .is_static      = False,
1647                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1648                         .ips            = addresses_A_1,
1649                         .apply_expected = False
1650                 }
1651         },
1652
1653         /* 
1654          * group,tombstone vs. unique,active
1655          * => should NOT be replaced
1656          */
1657         {
1658                 .line   = __location__,
1659                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1660                 .r1     = {
1661                         .owner          = &ctx->a,
1662                         .type           = WREPL_TYPE_GROUP,
1663                         .state          = WREPL_STATE_TOMBSTONE,
1664                         .node           = WREPL_NODE_B,
1665                         .is_static      = False,
1666                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1667                         .ips            = addresses_A_1,
1668                         .apply_expected = True
1669                 },
1670                 .r2     = {
1671                         .owner          = &ctx->b,
1672                         .type           = WREPL_TYPE_UNIQUE,
1673                         .state          = WREPL_STATE_ACTIVE,
1674                         .node           = WREPL_NODE_B,
1675                         .is_static      = False,
1676                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1677                         .ips            = addresses_A_1,
1678                         .apply_expected = False
1679                 }
1680         },
1681
1682         /* 
1683          * group,tombstone vs. unique,tombstone
1684          * => should NOT be replaced
1685          */
1686         {
1687                 .line   = __location__,
1688                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1689                 .r1     = {
1690                         .owner          = &ctx->a,
1691                         .type           = WREPL_TYPE_GROUP,
1692                         .state          = WREPL_STATE_TOMBSTONE,
1693                         .node           = WREPL_NODE_B,
1694                         .is_static      = False,
1695                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1696                         .ips            = addresses_A_1,
1697                         .apply_expected = True
1698                 },
1699                 .r2     = {
1700                         .owner          = &ctx->b,
1701                         .type           = WREPL_TYPE_UNIQUE,
1702                         .state          = WREPL_STATE_TOMBSTONE,
1703                         .node           = WREPL_NODE_B,
1704                         .is_static      = False,
1705                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1706                         .ips            = addresses_A_1,
1707                         .apply_expected = False
1708                 }
1709         },
1710
1711 /*
1712  * normal groups vs normal groups section,
1713  */
1714         /* 
1715          * group,active vs. group,active
1716          * => should NOT be replaced
1717          */
1718         {
1719                 .line   = __location__,
1720                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1721                 .r1     = {
1722                         .owner          = &ctx->a,
1723                         .type           = WREPL_TYPE_GROUP,
1724                         .state          = WREPL_STATE_ACTIVE,
1725                         .node           = WREPL_NODE_B,
1726                         .is_static      = False,
1727                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1728                         .ips            = addresses_A_1,
1729                         .apply_expected = True
1730                 },
1731                 .r2     = {
1732                         .owner          = &ctx->b,
1733                         .type           = WREPL_TYPE_GROUP,
1734                         .state          = WREPL_STATE_ACTIVE,
1735                         .node           = WREPL_NODE_B,
1736                         .is_static      = False,
1737                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1738                         .ips            = addresses_A_1,
1739                         .apply_expected = False
1740                 }
1741         },
1742
1743         /* 
1744          * group,active vs. group,tombstone
1745          * => should NOT be replaced
1746          */
1747         {
1748                 .line   = __location__,
1749                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1750                 .r1     = {
1751                         .owner          = &ctx->a,
1752                         .type           = WREPL_TYPE_GROUP,
1753                         .state          = WREPL_STATE_ACTIVE,
1754                         .node           = WREPL_NODE_B,
1755                         .is_static      = False,
1756                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1757                         .ips            = addresses_A_1,
1758                         .apply_expected = True
1759                 },
1760                 .r2     = {
1761                         .owner          = &ctx->b,
1762                         .type           = WREPL_TYPE_GROUP,
1763                         .state          = WREPL_STATE_TOMBSTONE,
1764                         .node           = WREPL_NODE_B,
1765                         .is_static      = False,
1766                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1767                         .ips            = addresses_A_1,
1768                         .apply_expected = False
1769                 }
1770         },
1771
1772         /* 
1773          * group,released vs. group,active
1774          * => should be replaced
1775          */
1776         {
1777                 .line   = __location__,
1778                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1779                 .r1     = {
1780                         .owner          = &ctx->a,
1781                         .type           = WREPL_TYPE_GROUP,
1782                         .state          = WREPL_STATE_RELEASED,
1783                         .node           = WREPL_NODE_B,
1784                         .is_static      = False,
1785                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1786                         .ips            = addresses_A_1,
1787                         .apply_expected = False
1788                 },
1789                 .r2     = {
1790                         .owner          = &ctx->b,
1791                         .type           = WREPL_TYPE_GROUP,
1792                         .state          = WREPL_STATE_ACTIVE,
1793                         .node           = WREPL_NODE_B,
1794                         .is_static      = False,
1795                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1796                         .ips            = addresses_B_1,
1797                         .apply_expected = True
1798                 }
1799         },
1800
1801         /* 
1802          * group,released vs. group,tombstone
1803          * => should be replaced
1804          */
1805         {
1806                 .line   = __location__,
1807                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1808                 .r1     = {
1809                         .owner          = &ctx->a,
1810                         .type           = WREPL_TYPE_GROUP,
1811                         .state          = WREPL_STATE_RELEASED,
1812                         .node           = WREPL_NODE_B,
1813                         .is_static      = False,
1814                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1815                         .ips            = addresses_A_1,
1816                         .apply_expected = False
1817                 },
1818                 .r2     = {
1819                         .owner          = &ctx->b,
1820                         .type           = WREPL_TYPE_GROUP,
1821                         .state          = WREPL_STATE_TOMBSTONE,
1822                         .node           = WREPL_NODE_B,
1823                         .is_static      = False,
1824                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1825                         .ips            = addresses_B_1,
1826                         .apply_expected = True
1827                 }
1828         },
1829
1830         /* 
1831          * group,tombstone vs. group,active
1832          * => should be replaced
1833          */
1834         {
1835                 .line   = __location__,
1836                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1837                 .r1     = {
1838                         .owner          = &ctx->b,
1839                         .type           = WREPL_TYPE_GROUP,
1840                         .state          = WREPL_STATE_TOMBSTONE,
1841                         .node           = WREPL_NODE_B,
1842                         .is_static      = False,
1843                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1844                         .ips            = addresses_B_1,
1845                         .apply_expected = True
1846                 },
1847                 .r2     = {
1848                         .owner          = &ctx->a,
1849                         .type           = WREPL_TYPE_GROUP,
1850                         .state          = WREPL_STATE_ACTIVE,
1851                         .node           = WREPL_NODE_B,
1852                         .is_static      = False,
1853                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1854                         .ips            = addresses_A_1,
1855                         .apply_expected = True
1856                 }
1857         },
1858
1859         /* 
1860          * group,tombstone vs. group,tombstone
1861          * => should be replaced
1862          */
1863         {
1864                 .line   = __location__,
1865                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1866                 .r1     = {
1867                         .owner          = &ctx->a,
1868                         .type           = WREPL_TYPE_GROUP,
1869                         .state          = WREPL_STATE_TOMBSTONE,
1870                         .node           = WREPL_NODE_B,
1871                         .is_static      = False,
1872                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1873                         .ips            = addresses_A_1,
1874                         .apply_expected = True
1875                 },
1876                 .r2     = {
1877                         .owner          = &ctx->b,
1878                         .type           = WREPL_TYPE_GROUP,
1879                         .state          = WREPL_STATE_TOMBSTONE,
1880                         .node           = WREPL_NODE_B,
1881                         .is_static      = False,
1882                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1883                         .ips            = addresses_B_1,
1884                         .apply_expected = True
1885                 }
1886         },
1887
1888 /*
1889  * normal groups vs special groups section,
1890  */
1891         /* 
1892          * group,active vs. sgroup,active
1893          * => should NOT be replaced
1894          */
1895         {
1896                 .line   = __location__,
1897                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1898                 .r1     = {
1899                         .owner          = &ctx->b,
1900                         .type           = WREPL_TYPE_GROUP,
1901                         .state          = WREPL_STATE_ACTIVE,
1902                         .node           = WREPL_NODE_B,
1903                         .is_static      = False,
1904                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1905                         .ips            = addresses_B_1,
1906                         .apply_expected = True
1907                 },
1908                 .r2     = {
1909                         .owner          = &ctx->a,
1910                         .type           = WREPL_TYPE_SGROUP,
1911                         .state          = WREPL_STATE_ACTIVE,
1912                         .node           = WREPL_NODE_B,
1913                         .is_static      = False,
1914                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1915                         .ips            = addresses_B_1,
1916                         .apply_expected = False
1917                 }
1918         },
1919
1920         /* 
1921          * group,active vs. sgroup,tombstone
1922          * => should NOT be replaced
1923          */
1924         {
1925                 .line   = __location__,
1926                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1927                 .r1     = {
1928                         .owner          = &ctx->b,
1929                         .type           = WREPL_TYPE_GROUP,
1930                         .state          = WREPL_STATE_ACTIVE,
1931                         .node           = WREPL_NODE_B,
1932                         .is_static      = False,
1933                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1934                         .ips            = addresses_B_1,
1935                         .apply_expected = True
1936                 },
1937                 .r2     = {
1938                         .owner          = &ctx->a,
1939                         .type           = WREPL_TYPE_SGROUP,
1940                         .state          = WREPL_STATE_TOMBSTONE,
1941                         .node           = WREPL_NODE_B,
1942                         .is_static      = False,
1943                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1944                         .ips            = addresses_B_1,
1945                         .apply_expected = False
1946                 }
1947         },
1948
1949         /* 
1950          * group,released vs. sgroup,active
1951          * => should be replaced
1952          */
1953         {
1954                 .line   = __location__,
1955                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1956                 .r1     = {
1957                         .owner          = &ctx->a,
1958                         .type           = WREPL_TYPE_GROUP,
1959                         .state          = WREPL_STATE_RELEASED,
1960                         .node           = WREPL_NODE_B,
1961                         .is_static      = False,
1962                         .num_ips        = ARRAY_SIZE(addresses_A_1),
1963                         .ips            = addresses_A_1,
1964                         .apply_expected = False
1965                 },
1966                 .r2     = {
1967                         .owner          = &ctx->b,
1968                         .type           = WREPL_TYPE_SGROUP,
1969                         .state          = WREPL_STATE_ACTIVE,
1970                         .node           = WREPL_NODE_B,
1971                         .is_static      = False,
1972                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1973                         .ips            = addresses_B_1,
1974                         .apply_expected = True
1975                 }
1976         },
1977
1978         /* 
1979          * group,released vs. sgroup,tombstone
1980          * => should NOT be replaced
1981          */
1982         {
1983                 .line   = __location__,
1984                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
1985                 .r1     = {
1986                         .owner          = &ctx->b,
1987                         .type           = WREPL_TYPE_GROUP,
1988                         .state          = WREPL_STATE_RELEASED,
1989                         .node           = WREPL_NODE_B,
1990                         .is_static      = False,
1991                         .num_ips        = ARRAY_SIZE(addresses_B_1),
1992                         .ips            = addresses_B_1,
1993                         .apply_expected = False
1994                 },
1995                 .r2     = {
1996                         .owner          = &ctx->a,
1997                         .type           = WREPL_TYPE_SGROUP,
1998                         .state          = WREPL_STATE_TOMBSTONE,
1999                         .node           = WREPL_NODE_B,
2000                         .is_static      = False,
2001                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2002                         .ips            = addresses_B_1,
2003                         .apply_expected = False
2004                 }
2005         },
2006
2007         /* 
2008          * group,tombstone vs. sgroup,active
2009          * => should be replaced
2010          */
2011         {
2012                 .line   = __location__,
2013                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2014                 .r1     = {
2015                         .owner          = &ctx->b,
2016                         .type           = WREPL_TYPE_GROUP,
2017                         .state          = WREPL_STATE_TOMBSTONE,
2018                         .node           = WREPL_NODE_B,
2019                         .is_static      = False,
2020                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2021                         .ips            = addresses_B_1,
2022                         .apply_expected = True
2023                 },
2024                 .r2     = {
2025                         .owner          = &ctx->a,
2026                         .type           = WREPL_TYPE_SGROUP,
2027                         .state          = WREPL_STATE_ACTIVE,
2028                         .node           = WREPL_NODE_B,
2029                         .is_static      = False,
2030                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2031                         .ips            = addresses_A_1,
2032                         .apply_expected = True
2033                 }
2034         },
2035
2036         /* 
2037          * group,tombstone vs. sgroup,tombstone
2038          * => should be replaced
2039          */
2040         {
2041                 .line   = __location__,
2042                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2043                 .r1     = {
2044                         .owner          = &ctx->a,
2045                         .type           = WREPL_TYPE_GROUP,
2046                         .state          = WREPL_STATE_TOMBSTONE,
2047                         .node           = WREPL_NODE_B,
2048                         .is_static      = False,
2049                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2050                         .ips            = addresses_A_1,
2051                         .apply_expected = True
2052                 },
2053                 .r2     = {
2054                         .owner          = &ctx->b,
2055                         .type           = WREPL_TYPE_SGROUP,
2056                         .state          = WREPL_STATE_TOMBSTONE,
2057                         .node           = WREPL_NODE_B,
2058                         .is_static      = False,
2059                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2060                         .ips            = addresses_B_1,
2061                         .apply_expected = True
2062                 }
2063         },
2064
2065 /*
2066  * normal groups vs multi homed section,
2067  */
2068         /* 
2069          * group,active vs. mhomed,active
2070          * => should NOT be replaced
2071          */
2072         {
2073                 .line   = __location__,
2074                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2075                 .r1     = {
2076                         .owner          = &ctx->b,
2077                         .type           = WREPL_TYPE_GROUP,
2078                         .state          = WREPL_STATE_ACTIVE,
2079                         .node           = WREPL_NODE_B,
2080                         .is_static      = False,
2081                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2082                         .ips            = addresses_B_1,
2083                         .apply_expected = True
2084                 },
2085                 .r2     = {
2086                         .owner          = &ctx->a,
2087                         .type           = WREPL_TYPE_MHOMED,
2088                         .state          = WREPL_STATE_ACTIVE,
2089                         .node           = WREPL_NODE_B,
2090                         .is_static      = False,
2091                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2092                         .ips            = addresses_B_1,
2093                         .apply_expected = False
2094                 }
2095         },
2096
2097         /* 
2098          * group,active vs. mhomed,tombstone
2099          * => should NOT be replaced
2100          */
2101         {
2102                 .line   = __location__,
2103                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2104                 .r1     = {
2105                         .owner          = &ctx->b,
2106                         .type           = WREPL_TYPE_GROUP,
2107                         .state          = WREPL_STATE_ACTIVE,
2108                         .node           = WREPL_NODE_B,
2109                         .is_static      = False,
2110                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2111                         .ips            = addresses_B_1,
2112                         .apply_expected = True
2113                 },
2114                 .r2     = {
2115                         .owner          = &ctx->a,
2116                         .type           = WREPL_TYPE_MHOMED,
2117                         .state          = WREPL_STATE_TOMBSTONE,
2118                         .node           = WREPL_NODE_B,
2119                         .is_static      = False,
2120                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2121                         .ips            = addresses_B_1,
2122                         .apply_expected = False
2123                 }
2124         },
2125
2126         /* 
2127          * group,released vs. mhomed,active
2128          * => should NOT be replaced
2129          */
2130         {
2131                 .line   = __location__,
2132                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2133                 .r1     = {
2134                         .owner          = &ctx->b,
2135                         .type           = WREPL_TYPE_GROUP,
2136                         .state          = WREPL_STATE_RELEASED,
2137                         .node           = WREPL_NODE_B,
2138                         .is_static      = False,
2139                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2140                         .ips            = addresses_B_1,
2141                         .apply_expected = False
2142                 },
2143                 .r2     = {
2144                         .owner          = &ctx->a,
2145                         .type           = WREPL_TYPE_MHOMED,
2146                         .state          = WREPL_STATE_ACTIVE,
2147                         .node           = WREPL_NODE_B,
2148                         .is_static      = False,
2149                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2150                         .ips            = addresses_B_1,
2151                         .apply_expected = False
2152                 }
2153         },
2154
2155         /* 
2156          * group,released vs. mhomed,tombstone
2157          * => should NOT be replaced
2158          */
2159         {
2160                 .line   = __location__,
2161                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2162                 .r1     = {
2163                         .owner          = &ctx->b,
2164                         .type           = WREPL_TYPE_GROUP,
2165                         .state          = WREPL_STATE_RELEASED,
2166                         .node           = WREPL_NODE_B,
2167                         .is_static      = False,
2168                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2169                         .ips            = addresses_B_1,
2170                         .apply_expected = False
2171                 },
2172                 .r2     = {
2173                         .owner          = &ctx->a,
2174                         .type           = WREPL_TYPE_MHOMED,
2175                         .state          = WREPL_STATE_TOMBSTONE,
2176                         .node           = WREPL_NODE_B,
2177                         .is_static      = False,
2178                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2179                         .ips            = addresses_B_1,
2180                         .apply_expected = False
2181                 }
2182         },
2183
2184         /* 
2185          * group,tombstone vs. mhomed,active
2186          * => should be replaced
2187          */
2188         {
2189                 .line   = __location__,
2190                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2191                 .r1     = {
2192                         .owner          = &ctx->b,
2193                         .type           = WREPL_TYPE_GROUP,
2194                         .state          = WREPL_STATE_TOMBSTONE,
2195                         .node           = WREPL_NODE_B,
2196                         .is_static      = False,
2197                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2198                         .ips            = addresses_B_1,
2199                         .apply_expected = True
2200                 },
2201                 .r2     = {
2202                         .owner          = &ctx->a,
2203                         .type           = WREPL_TYPE_MHOMED,
2204                         .state          = WREPL_STATE_ACTIVE,
2205                         .node           = WREPL_NODE_B,
2206                         .is_static      = False,
2207                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2208                         .ips            = addresses_A_1,
2209                         .apply_expected = True
2210                 }
2211         },
2212
2213         /* 
2214          * group,tombstone vs. mhomed,tombstone
2215          * => should be replaced
2216          */
2217         {
2218                 .line   = __location__,
2219                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2220                 .r1     = {
2221                         .owner          = &ctx->a,
2222                         .type           = WREPL_TYPE_GROUP,
2223                         .state          = WREPL_STATE_TOMBSTONE,
2224                         .node           = WREPL_NODE_B,
2225                         .is_static      = False,
2226                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2227                         .ips            = addresses_A_1,
2228                         .apply_expected = True
2229                 },
2230                 .r2     = {
2231                         .owner          = &ctx->b,
2232                         .type           = WREPL_TYPE_MHOMED,
2233                         .state          = WREPL_STATE_TOMBSTONE,
2234                         .node           = WREPL_NODE_B,
2235                         .is_static      = False,
2236                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2237                         .ips            = addresses_B_1,
2238                         .apply_expected = True
2239                 }
2240         },
2241
2242 /*
2243  * special groups vs unique section,
2244  */
2245         /* 
2246          * sgroup,active vs. unique,active
2247          * => should NOT be replaced
2248          */
2249         {
2250                 .line   = __location__,
2251                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2252                 .r1     = {
2253                         .owner          = &ctx->b,
2254                         .type           = WREPL_TYPE_SGROUP,
2255                         .state          = WREPL_STATE_ACTIVE,
2256                         .node           = WREPL_NODE_B,
2257                         .is_static      = False,
2258                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2259                         .ips            = addresses_B_1,
2260                         .apply_expected = True
2261                 },
2262                 .r2     = {
2263                         .owner          = &ctx->a,
2264                         .type           = WREPL_TYPE_UNIQUE,
2265                         .state          = WREPL_STATE_ACTIVE,
2266                         .node           = WREPL_NODE_B,
2267                         .is_static      = False,
2268                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2269                         .ips            = addresses_B_1,
2270                         .apply_expected = False
2271                 }
2272         },
2273
2274         /* 
2275          * sgroup,active vs. unique,tombstone
2276          * => should NOT be replaced
2277          */
2278         {
2279                 .line   = __location__,
2280                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2281                 .r1     = {
2282                         .owner          = &ctx->b,
2283                         .type           = WREPL_TYPE_SGROUP,
2284                         .state          = WREPL_STATE_ACTIVE,
2285                         .node           = WREPL_NODE_B,
2286                         .is_static      = False,
2287                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2288                         .ips            = addresses_B_1,
2289                         .apply_expected = True
2290                 },
2291                 .r2     = {
2292                         .owner          = &ctx->a,
2293                         .type           = WREPL_TYPE_UNIQUE,
2294                         .state          = WREPL_STATE_TOMBSTONE,
2295                         .node           = WREPL_NODE_B,
2296                         .is_static      = False,
2297                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2298                         .ips            = addresses_B_1,
2299                         .apply_expected = False
2300                 }
2301         },
2302
2303         /* 
2304          * sgroup,released vs. unique,active
2305          * => should be replaced
2306          */
2307         {
2308                 .line   = __location__,
2309                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2310                 .r1     = {
2311                         .owner          = &ctx->b,
2312                         .type           = WREPL_TYPE_SGROUP,
2313                         .state          = WREPL_STATE_RELEASED,
2314                         .node           = WREPL_NODE_B,
2315                         .is_static      = False,
2316                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2317                         .ips            = addresses_B_1,
2318                         .apply_expected = False
2319                 },
2320                 .r2     = {
2321                         .owner          = &ctx->a,
2322                         .type           = WREPL_TYPE_UNIQUE,
2323                         .state          = WREPL_STATE_ACTIVE,
2324                         .node           = WREPL_NODE_B,
2325                         .is_static      = False,
2326                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2327                         .ips            = addresses_A_1,
2328                         .apply_expected = True
2329                 }
2330         },
2331
2332         /* 
2333          * sgroup,released vs. unique,tombstone
2334          * => should be replaced
2335          */
2336         {
2337                 .line   = __location__,
2338                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2339                 .r1     = {
2340                         .owner          = &ctx->a,
2341                         .type           = WREPL_TYPE_SGROUP,
2342                         .state          = WREPL_STATE_RELEASED,
2343                         .node           = WREPL_NODE_B,
2344                         .is_static      = False,
2345                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2346                         .ips            = addresses_A_1,
2347                         .apply_expected = False
2348                 },
2349                 .r2     = {
2350                         .owner          = &ctx->b,
2351                         .type           = WREPL_TYPE_UNIQUE,
2352                         .state          = WREPL_STATE_TOMBSTONE,
2353                         .node           = WREPL_NODE_B,
2354                         .is_static      = False,
2355                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2356                         .ips            = addresses_B_1,
2357                         .apply_expected = True
2358                 }
2359         },
2360
2361         /* 
2362          * sgroup,tombstone vs. unique,active
2363          * => should be replaced
2364          */
2365         {
2366                 .line   = __location__,
2367                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2368                 .r1     = {
2369                         .owner          = &ctx->a,
2370                         .type           = WREPL_TYPE_SGROUP,
2371                         .state          = WREPL_STATE_TOMBSTONE,
2372                         .node           = WREPL_NODE_B,
2373                         .is_static      = False,
2374                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2375                         .ips            = addresses_A_1,
2376                         .apply_expected = True
2377                 },
2378                 .r2     = {
2379                         .owner          = &ctx->b,
2380                         .type           = WREPL_TYPE_UNIQUE,
2381                         .state          = WREPL_STATE_ACTIVE,
2382                         .node           = WREPL_NODE_B,
2383                         .is_static      = False,
2384                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2385                         .ips            = addresses_B_1,
2386                         .apply_expected = True
2387                 }
2388         },
2389
2390         /* 
2391          * sgroup,tombstone vs. unique,tombstone
2392          * => should be replaced
2393          */
2394         {
2395                 .line   = __location__,
2396                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2397                 .r1     = {
2398                         .owner          = &ctx->b,
2399                         .type           = WREPL_TYPE_SGROUP,
2400                         .state          = WREPL_STATE_TOMBSTONE,
2401                         .node           = WREPL_NODE_B,
2402                         .is_static      = False,
2403                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2404                         .ips            = addresses_B_1,
2405                         .apply_expected = True
2406                 },
2407                 .r2     = {
2408                         .owner          = &ctx->a,
2409                         .type           = WREPL_TYPE_UNIQUE,
2410                         .state          = WREPL_STATE_TOMBSTONE,
2411                         .node           = WREPL_NODE_B,
2412                         .is_static      = False,
2413                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2414                         .ips            = addresses_A_1,
2415                         .apply_expected = True
2416                 }
2417         },
2418
2419 /*
2420  * special groups vs normal group section,
2421  */
2422         /* 
2423          * sgroup,active vs. group,active
2424          * => should NOT be replaced
2425          */
2426         {
2427                 .line   = __location__,
2428                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2429                 .r1     = {
2430                         .owner          = &ctx->a,
2431                         .type           = WREPL_TYPE_SGROUP,
2432                         .state          = WREPL_STATE_ACTIVE,
2433                         .node           = WREPL_NODE_B,
2434                         .is_static      = False,
2435                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2436                         .ips            = addresses_A_1,
2437                         .apply_expected = True
2438                 },
2439                 .r2     = {
2440                         .owner          = &ctx->b,
2441                         .type           = WREPL_TYPE_GROUP,
2442                         .state          = WREPL_STATE_ACTIVE,
2443                         .node           = WREPL_NODE_B,
2444                         .is_static      = False,
2445                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2446                         .ips            = addresses_A_1,
2447                         .apply_expected = False
2448                 }
2449         },
2450
2451         /* 
2452          * sgroup,active vs. group,tombstone
2453          * => should NOT be replaced
2454          */
2455         {
2456                 .line   = __location__,
2457                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2458                 .r1     = {
2459                         .owner          = &ctx->a,
2460                         .type           = WREPL_TYPE_SGROUP,
2461                         .state          = WREPL_STATE_ACTIVE,
2462                         .node           = WREPL_NODE_B,
2463                         .is_static      = False,
2464                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2465                         .ips            = addresses_A_1,
2466                         .apply_expected = True
2467                 },
2468                 .r2     = {
2469                         .owner          = &ctx->b,
2470                         .type           = WREPL_TYPE_GROUP,
2471                         .state          = WREPL_STATE_TOMBSTONE,
2472                         .node           = WREPL_NODE_B,
2473                         .is_static      = False,
2474                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2475                         .ips            = addresses_A_1,
2476                         .apply_expected = False
2477                 }
2478         },
2479
2480         /* 
2481          * sgroup,released vs. group,active
2482          * => should be replaced
2483          */
2484         {
2485                 .line   = __location__,
2486                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2487                 .r1     = {
2488                         .owner          = &ctx->a,
2489                         .type           = WREPL_TYPE_SGROUP,
2490                         .state          = WREPL_STATE_RELEASED,
2491                         .node           = WREPL_NODE_B,
2492                         .is_static      = False,
2493                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2494                         .ips            = addresses_A_1,
2495                         .apply_expected = False
2496                 },
2497                 .r2     = {
2498                         .owner          = &ctx->b,
2499                         .type           = WREPL_TYPE_GROUP,
2500                         .state          = WREPL_STATE_ACTIVE,
2501                         .node           = WREPL_NODE_B,
2502                         .is_static      = False,
2503                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2504                         .ips            = addresses_B_1,
2505                         .apply_expected = True
2506                 }
2507         },
2508
2509         /* 
2510          * sgroup,released vs. group,tombstone
2511          * => should be replaced
2512          */
2513         {
2514                 .line   = __location__,
2515                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2516                 .r1     = {
2517                         .owner          = &ctx->b,
2518                         .type           = WREPL_TYPE_SGROUP,
2519                         .state          = WREPL_STATE_RELEASED,
2520                         .node           = WREPL_NODE_B,
2521                         .is_static      = False,
2522                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2523                         .ips            = addresses_B_1,
2524                         .apply_expected = False
2525                 },
2526                 .r2     = {
2527                         .owner          = &ctx->a,
2528                         .type           = WREPL_TYPE_GROUP,
2529                         .state          = WREPL_STATE_TOMBSTONE,
2530                         .node           = WREPL_NODE_B,
2531                         .is_static      = False,
2532                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2533                         .ips            = addresses_A_1,
2534                         .apply_expected = True
2535                 }
2536         },
2537
2538         /* 
2539          * sgroup,tombstone vs. group,active
2540          * => should NOT be replaced
2541          */
2542         {
2543                 .line   = __location__,
2544                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2545                 .r1     = {
2546                         .owner          = &ctx->a,
2547                         .type           = WREPL_TYPE_SGROUP,
2548                         .state          = WREPL_STATE_TOMBSTONE,
2549                         .node           = WREPL_NODE_B,
2550                         .is_static      = False,
2551                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2552                         .ips            = addresses_A_1,
2553                         .apply_expected = True
2554                 },
2555                 .r2     = {
2556                         .owner          = &ctx->b,
2557                         .type           = WREPL_TYPE_GROUP,
2558                         .state          = WREPL_STATE_ACTIVE,
2559                         .node           = WREPL_NODE_B,
2560                         .is_static      = False,
2561                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2562                         .ips            = addresses_B_1,
2563                         .apply_expected = True
2564                 }
2565         },
2566
2567         /* 
2568          * sgroup,tombstone vs. group,tombstone
2569          * => should NOT be replaced
2570          */
2571         {
2572                 .line   = __location__,
2573                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2574                 .r1     = {
2575                         .owner          = &ctx->b,
2576                         .type           = WREPL_TYPE_SGROUP,
2577                         .state          = WREPL_STATE_TOMBSTONE,
2578                         .node           = WREPL_NODE_B,
2579                         .is_static      = False,
2580                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2581                         .ips            = addresses_B_1,
2582                         .apply_expected = True
2583                 },
2584                 .r2     = {
2585                         .owner          = &ctx->a,
2586                         .type           = WREPL_TYPE_GROUP,
2587                         .state          = WREPL_STATE_TOMBSTONE,
2588                         .node           = WREPL_NODE_B,
2589                         .is_static      = False,
2590                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2591                         .ips            = addresses_A_1,
2592                         .apply_expected = True
2593                 }
2594         },
2595
2596 /*
2597  * special groups vs multi homed section,
2598  */
2599         /* 
2600          * sgroup,active vs. mhomed,active
2601          * => should NOT be replaced
2602          */
2603         {
2604                 .line   = __location__,
2605                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2606                 .r1     = {
2607                         .owner          = &ctx->a,
2608                         .type           = WREPL_TYPE_SGROUP,
2609                         .state          = WREPL_STATE_ACTIVE,
2610                         .node           = WREPL_NODE_B,
2611                         .is_static      = False,
2612                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2613                         .ips            = addresses_A_1,
2614                         .apply_expected = True
2615                 },
2616                 .r2     = {
2617                         .owner          = &ctx->b,
2618                         .type           = WREPL_TYPE_MHOMED,
2619                         .state          = WREPL_STATE_ACTIVE,
2620                         .node           = WREPL_NODE_B,
2621                         .is_static      = False,
2622                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2623                         .ips            = addresses_A_1,
2624                         .apply_expected = False
2625                 }
2626         },
2627
2628         /* 
2629          * sgroup,active vs. mhomed,tombstone
2630          * => should NOT be replaced
2631          */
2632         {
2633                 .line   = __location__,
2634                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2635                 .r1     = {
2636                         .owner          = &ctx->a,
2637                         .type           = WREPL_TYPE_SGROUP,
2638                         .state          = WREPL_STATE_ACTIVE,
2639                         .node           = WREPL_NODE_B,
2640                         .is_static      = False,
2641                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2642                         .ips            = addresses_A_1,
2643                         .apply_expected = True
2644                 },
2645                 .r2     = {
2646                         .owner          = &ctx->b,
2647                         .type           = WREPL_TYPE_MHOMED,
2648                         .state          = WREPL_STATE_TOMBSTONE,
2649                         .node           = WREPL_NODE_B,
2650                         .is_static      = False,
2651                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2652                         .ips            = addresses_A_1,
2653                         .apply_expected = False
2654                 }
2655         },
2656
2657         /* 
2658          * sgroup,released vs. mhomed,active
2659          * => should be replaced
2660          */
2661         {
2662                 .line   = __location__,
2663                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2664                 .r1     = {
2665                         .owner          = &ctx->a,
2666                         .type           = WREPL_TYPE_SGROUP,
2667                         .state          = WREPL_STATE_RELEASED,
2668                         .node           = WREPL_NODE_B,
2669                         .is_static      = False,
2670                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2671                         .ips            = addresses_A_1,
2672                         .apply_expected = False
2673                 },
2674                 .r2     = {
2675                         .owner          = &ctx->b,
2676                         .type           = WREPL_TYPE_MHOMED,
2677                         .state          = WREPL_STATE_ACTIVE,
2678                         .node           = WREPL_NODE_B,
2679                         .is_static      = False,
2680                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2681                         .ips            = addresses_B_1,
2682                         .apply_expected = True
2683                 }
2684         },
2685
2686         /* 
2687          * sgroup,released vs. mhomed,tombstone
2688          * => should be replaced
2689          */
2690         {
2691                 .line   = __location__,
2692                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2693                 .r1     = {
2694                         .owner          = &ctx->b,
2695                         .type           = WREPL_TYPE_SGROUP,
2696                         .state          = WREPL_STATE_RELEASED,
2697                         .node           = WREPL_NODE_B,
2698                         .is_static      = False,
2699                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2700                         .ips            = addresses_B_1,
2701                         .apply_expected = False
2702                 },
2703                 .r2     = {
2704                         .owner          = &ctx->a,
2705                         .type           = WREPL_TYPE_MHOMED,
2706                         .state          = WREPL_STATE_TOMBSTONE,
2707                         .node           = WREPL_NODE_B,
2708                         .is_static      = False,
2709                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2710                         .ips            = addresses_A_1,
2711                         .apply_expected = True
2712                 }
2713         },
2714
2715         /* 
2716          * sgroup,tombstone vs. mhomed,active
2717          * => should be replaced
2718          */
2719         {
2720                 .line   = __location__,
2721                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2722                 .r1     = {
2723                         .owner          = &ctx->a,
2724                         .type           = WREPL_TYPE_SGROUP,
2725                         .state          = WREPL_STATE_TOMBSTONE,
2726                         .node           = WREPL_NODE_B,
2727                         .is_static      = False,
2728                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2729                         .ips            = addresses_A_1,
2730                         .apply_expected = True
2731                 },
2732                 .r2     = {
2733                         .owner          = &ctx->b,
2734                         .type           = WREPL_TYPE_MHOMED,
2735                         .state          = WREPL_STATE_ACTIVE,
2736                         .node           = WREPL_NODE_B,
2737                         .is_static      = False,
2738                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2739                         .ips            = addresses_B_1,
2740                         .apply_expected = True
2741                 }
2742         },
2743
2744         /* 
2745          * sgroup,tombstone vs. mhomed,tombstone
2746          * => should be replaced
2747          */
2748         {
2749                 .line   = __location__,
2750                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2751                 .r1     = {
2752                         .owner          = &ctx->b,
2753                         .type           = WREPL_TYPE_SGROUP,
2754                         .state          = WREPL_STATE_TOMBSTONE,
2755                         .node           = WREPL_NODE_B,
2756                         .is_static      = False,
2757                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2758                         .ips            = addresses_B_1,
2759                         .apply_expected = True
2760                 },
2761                 .r2     = {
2762                         .owner          = &ctx->a,
2763                         .type           = WREPL_TYPE_MHOMED,
2764                         .state          = WREPL_STATE_TOMBSTONE,
2765                         .node           = WREPL_NODE_B,
2766                         .is_static      = False,
2767                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2768                         .ips            = addresses_A_1,
2769                         .apply_expected = True
2770                 }
2771         },
2772
2773 /*
2774  * multi homed vs. unique section,
2775  */
2776         /* 
2777          * mhomed,active vs. unique,active
2778          * => should be replaced
2779          */
2780         {
2781                 .line   = __location__,
2782                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2783                 .r1     = {
2784                         .owner          = &ctx->a,
2785                         .type           = WREPL_TYPE_MHOMED,
2786                         .state          = WREPL_STATE_ACTIVE,
2787                         .node           = WREPL_NODE_B,
2788                         .is_static      = False,
2789                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
2790                         .ips            = addresses_A_3_4,
2791                         .apply_expected = True
2792                 },
2793                 .r2     = {
2794                         .owner          = &ctx->b,
2795                         .type           = WREPL_TYPE_UNIQUE,
2796                         .state          = WREPL_STATE_ACTIVE,
2797                         .node           = WREPL_NODE_B,
2798                         .is_static      = False,
2799                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2800                         .ips            = addresses_B_1,
2801                         .apply_expected = True
2802                 }
2803         },
2804
2805         /* 
2806          * mhomed,active vs. unique,tombstone
2807          * => should NOT be replaced
2808          */
2809         {
2810                 .line   = __location__,
2811                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2812                 .r1     = {
2813                         .owner          = &ctx->b,
2814                         .type           = WREPL_TYPE_MHOMED,
2815                         .state          = WREPL_STATE_ACTIVE,
2816                         .node           = WREPL_NODE_B,
2817                         .is_static      = False,
2818                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2819                         .ips            = addresses_B_1,
2820                         .apply_expected = True
2821                 },
2822                 .r2     = {
2823                         .owner          = &ctx->a,
2824                         .type           = WREPL_TYPE_UNIQUE,
2825                         .state          = WREPL_STATE_TOMBSTONE,
2826                         .node           = WREPL_NODE_B,
2827                         .is_static      = False,
2828                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2829                         .ips            = addresses_B_1,
2830                         .apply_expected = False
2831                 }
2832         },
2833
2834         /* 
2835          * mhomed,released vs. unique,active
2836          * => should be replaced
2837          */
2838         {
2839                 .line   = __location__,
2840                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2841                 .r1     = {
2842                         .owner          = &ctx->a,
2843                         .type           = WREPL_TYPE_MHOMED,
2844                         .state          = WREPL_STATE_RELEASED,
2845                         .node           = WREPL_NODE_B,
2846                         .is_static      = False,
2847                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2848                         .ips            = addresses_A_1,
2849                         .apply_expected = False
2850                 },
2851                 .r2     = {
2852                         .owner          = &ctx->b,
2853                         .type           = WREPL_TYPE_UNIQUE,
2854                         .state          = WREPL_STATE_ACTIVE,
2855                         .node           = WREPL_NODE_B,
2856                         .is_static      = False,
2857                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2858                         .ips            = addresses_B_1,
2859                         .apply_expected = True
2860                 }
2861         },
2862
2863         /* 
2864          * mhomed,released vs. uinique,tombstone
2865          * => should be replaced
2866          */
2867         {
2868                 .line   = __location__,
2869                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2870                 .r1     = {
2871                         .owner          = &ctx->b,
2872                         .type           = WREPL_TYPE_MHOMED,
2873                         .state          = WREPL_STATE_RELEASED,
2874                         .node           = WREPL_NODE_B,
2875                         .is_static      = False,
2876                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2877                         .ips            = addresses_B_1,
2878                         .apply_expected = False
2879                 },
2880                 .r2     = {
2881                         .owner          = &ctx->a,
2882                         .type           = WREPL_TYPE_UNIQUE,
2883                         .state          = WREPL_STATE_TOMBSTONE,
2884                         .node           = WREPL_NODE_B,
2885                         .is_static      = False,
2886                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2887                         .ips            = addresses_A_1,
2888                         .apply_expected = True
2889                 }
2890         },
2891
2892         /* 
2893          * mhomed,tombstone vs. unique,active
2894          * => should be replaced
2895          */
2896         {
2897                 .line   = __location__,
2898                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2899                 .r1     = {
2900                         .owner          = &ctx->a,
2901                         .type           = WREPL_TYPE_MHOMED,
2902                         .state          = WREPL_STATE_TOMBSTONE,
2903                         .node           = WREPL_NODE_B,
2904                         .is_static      = False,
2905                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2906                         .ips            = addresses_A_1,
2907                         .apply_expected = True
2908                 },
2909                 .r2     = {
2910                         .owner          = &ctx->b,
2911                         .type           = WREPL_TYPE_UNIQUE,
2912                         .state          = WREPL_STATE_ACTIVE,
2913                         .node           = WREPL_NODE_B,
2914                         .is_static      = False,
2915                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2916                         .ips            = addresses_B_1,
2917                         .apply_expected = True
2918                 }
2919         },
2920
2921         /* 
2922          * mhomed,tombstone vs. uinique,tombstone
2923          * => should be replaced
2924          */
2925         {
2926                 .line   = __location__,
2927                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2928                 .r1     = {
2929                         .owner          = &ctx->b,
2930                         .type           = WREPL_TYPE_MHOMED,
2931                         .state          = WREPL_STATE_TOMBSTONE,
2932                         .node           = WREPL_NODE_B,
2933                         .is_static      = False,
2934                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2935                         .ips            = addresses_B_1,
2936                         .apply_expected = True
2937                 },
2938                 .r2     = {
2939                         .owner          = &ctx->a,
2940                         .type           = WREPL_TYPE_UNIQUE,
2941                         .state          = WREPL_STATE_TOMBSTONE,
2942                         .node           = WREPL_NODE_B,
2943                         .is_static      = False,
2944                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2945                         .ips            = addresses_A_1,
2946                         .apply_expected = True
2947                 }
2948         },
2949
2950 /*
2951  * multi homed vs. normal group section,
2952  */
2953         /* 
2954          * mhomed,active vs. group,active
2955          * => should be replaced
2956          */
2957         {
2958                 .line   = __location__,
2959                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2960                 .r1     = {
2961                         .owner          = &ctx->a,
2962                         .type           = WREPL_TYPE_MHOMED,
2963                         .state          = WREPL_STATE_ACTIVE,
2964                         .node           = WREPL_NODE_B,
2965                         .is_static      = False,
2966                         .num_ips        = ARRAY_SIZE(addresses_A_1),
2967                         .ips            = addresses_A_1,
2968                         .apply_expected = True
2969                 },
2970                 .r2     = {
2971                         .owner          = &ctx->b,
2972                         .type           = WREPL_TYPE_GROUP,
2973                         .state          = WREPL_STATE_ACTIVE,
2974                         .node           = WREPL_NODE_B,
2975                         .is_static      = False,
2976                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2977                         .ips            = addresses_B_1,
2978                         .apply_expected = True
2979                 }
2980         },
2981
2982         /* 
2983          * mhomed,active vs. group,tombstone
2984          * => should NOT be replaced
2985          */
2986         {
2987                 .line   = __location__,
2988                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
2989                 .r1     = {
2990                         .owner          = &ctx->b,
2991                         .type           = WREPL_TYPE_MHOMED,
2992                         .state          = WREPL_STATE_ACTIVE,
2993                         .node           = WREPL_NODE_B,
2994                         .is_static      = False,
2995                         .num_ips        = ARRAY_SIZE(addresses_B_1),
2996                         .ips            = addresses_B_1,
2997                         .apply_expected = True
2998                 },
2999                 .r2     = {
3000                         .owner          = &ctx->a,
3001                         .type           = WREPL_TYPE_GROUP,
3002                         .state          = WREPL_STATE_TOMBSTONE,
3003                         .node           = WREPL_NODE_B,
3004                         .is_static      = False,
3005                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3006                         .ips            = addresses_B_1,
3007                         .apply_expected = False
3008                 }
3009         },
3010
3011         /* 
3012          * mhomed,released vs. group,active
3013          * => should be replaced
3014          */
3015         {
3016                 .line   = __location__,
3017                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3018                 .r1     = {
3019                         .owner          = &ctx->b,
3020                         .type           = WREPL_TYPE_MHOMED,
3021                         .state          = WREPL_STATE_RELEASED,
3022                         .node           = WREPL_NODE_B,
3023                         .is_static      = False,
3024                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3025                         .ips            = addresses_B_1,
3026                         .apply_expected = False
3027                 },
3028                 .r2     = {
3029                         .owner          = &ctx->a,
3030                         .type           = WREPL_TYPE_GROUP,
3031                         .state          = WREPL_STATE_ACTIVE,
3032                         .node           = WREPL_NODE_B,
3033                         .is_static      = False,
3034                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3035                         .ips            = addresses_A_1,
3036                         .apply_expected = True
3037                 }
3038         },
3039
3040         /* 
3041          * mhomed,released vs. group,tombstone
3042          * => should be replaced
3043          */
3044         {
3045                 .line   = __location__,
3046                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3047                 .r1     = {
3048                         .owner          = &ctx->a,
3049                         .type           = WREPL_TYPE_MHOMED,
3050                         .state          = WREPL_STATE_RELEASED,
3051                         .node           = WREPL_NODE_B,
3052                         .is_static      = False,
3053                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3054                         .ips            = addresses_A_1,
3055                         .apply_expected = False
3056                 },
3057                 .r2     = {
3058                         .owner          = &ctx->b,
3059                         .type           = WREPL_TYPE_GROUP,
3060                         .state          = WREPL_STATE_TOMBSTONE,
3061                         .node           = WREPL_NODE_B,
3062                         .is_static      = False,
3063                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3064                         .ips            = addresses_B_1,
3065                         .apply_expected = True
3066                 }
3067         },
3068
3069         /* 
3070          * mhomed,tombstone vs. group,active
3071          * => should be replaced
3072          */
3073         {
3074                 .line   = __location__,
3075                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3076                 .r1     = {
3077                         .owner          = &ctx->b,
3078                         .type           = WREPL_TYPE_MHOMED,
3079                         .state          = WREPL_STATE_TOMBSTONE,
3080                         .node           = WREPL_NODE_B,
3081                         .is_static      = False,
3082                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3083                         .ips            = addresses_B_1,
3084                         .apply_expected = True
3085                 },
3086                 .r2     = {
3087                         .owner          = &ctx->a,
3088                         .type           = WREPL_TYPE_GROUP,
3089                         .state          = WREPL_STATE_ACTIVE,
3090                         .node           = WREPL_NODE_B,
3091                         .is_static      = False,
3092                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3093                         .ips            = addresses_A_1,
3094                         .apply_expected = True
3095                 }
3096         },
3097
3098         /* 
3099          * mhomed,tombstone vs. group,tombstone
3100          * => should be replaced
3101          */
3102         {
3103                 .line   = __location__,
3104                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3105                 .r1     = {
3106                         .owner          = &ctx->a,
3107                         .type           = WREPL_TYPE_MHOMED,
3108                         .state          = WREPL_STATE_TOMBSTONE,
3109                         .node           = WREPL_NODE_B,
3110                         .is_static      = False,
3111                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3112                         .ips            = addresses_A_1,
3113                         .apply_expected = True
3114                 },
3115                 .r2     = {
3116                         .owner          = &ctx->b,
3117                         .type           = WREPL_TYPE_GROUP,
3118                         .state          = WREPL_STATE_TOMBSTONE,
3119                         .node           = WREPL_NODE_B,
3120                         .is_static      = False,
3121                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3122                         .ips            = addresses_B_1,
3123                         .apply_expected = True
3124                 }
3125         },
3126
3127 /*
3128  * multi homed vs. special group section,
3129  */
3130         /* 
3131          * mhomed,active vs. sgroup,active
3132          * => should NOT be replaced
3133          */
3134         {
3135                 .line   = __location__,
3136                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3137                 .r1     = {
3138                         .owner          = &ctx->a,
3139                         .type           = WREPL_TYPE_MHOMED,
3140                         .state          = WREPL_STATE_ACTIVE,
3141                         .node           = WREPL_NODE_B,
3142                         .is_static      = False,
3143                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3144                         .ips            = addresses_A_1,
3145                         .apply_expected = True
3146                 },
3147                 .r2     = {
3148                         .owner          = &ctx->b,
3149                         .type           = WREPL_TYPE_SGROUP,
3150                         .state          = WREPL_STATE_ACTIVE,
3151                         .node           = WREPL_NODE_B,
3152                         .is_static      = False,
3153                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3154                         .ips            = addresses_A_1,
3155                         .apply_expected = False
3156                 }
3157         },
3158
3159         /* 
3160          * mhomed,active vs. sgroup,tombstone
3161          * => should NOT be replaced
3162          */
3163         {
3164                 .line   = __location__,
3165                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3166                 .r1     = {
3167                         .owner          = &ctx->a,
3168                         .type           = WREPL_TYPE_MHOMED,
3169                         .state          = WREPL_STATE_ACTIVE,
3170                         .node           = WREPL_NODE_B,
3171                         .is_static      = False,
3172                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3173                         .ips            = addresses_A_1,
3174                         .apply_expected = True
3175                 },
3176                 .r2     = {
3177                         .owner          = &ctx->b,
3178                         .type           = WREPL_TYPE_SGROUP,
3179                         .state          = WREPL_STATE_TOMBSTONE,
3180                         .node           = WREPL_NODE_B,
3181                         .is_static      = False,
3182                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3183                         .ips            = addresses_A_1,
3184                         .apply_expected = False
3185                 }
3186         },
3187
3188         /* 
3189          * mhomed,released vs. sgroup,active
3190          * => should be replaced
3191          */
3192         {
3193                 .line   = __location__,
3194                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3195                 .r1     = {
3196                         .owner          = &ctx->a,
3197                         .type           = WREPL_TYPE_MHOMED,
3198                         .state          = WREPL_STATE_RELEASED,
3199                         .node           = WREPL_NODE_B,
3200                         .is_static      = False,
3201                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3202                         .ips            = addresses_A_1,
3203                         .apply_expected = False
3204                 },
3205                 .r2     = {
3206                         .owner          = &ctx->b,
3207                         .type           = WREPL_TYPE_SGROUP,
3208                         .state          = WREPL_STATE_ACTIVE,
3209                         .node           = WREPL_NODE_B,
3210                         .is_static      = False,
3211                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3212                         .ips            = addresses_B_1,
3213                         .apply_expected = True
3214                 }
3215         },
3216
3217         /* 
3218          * mhomed,released vs. sgroup,tombstone
3219          * => should be replaced
3220          */
3221         {
3222                 .line   = __location__,
3223                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3224                 .r1     = {
3225                         .owner          = &ctx->b,
3226                         .type           = WREPL_TYPE_MHOMED,
3227                         .state          = WREPL_STATE_RELEASED,
3228                         .node           = WREPL_NODE_B,
3229                         .is_static      = False,
3230                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3231                         .ips            = addresses_B_1,
3232                         .apply_expected = False
3233                 },
3234                 .r2     = {
3235                         .owner          = &ctx->a,
3236                         .type           = WREPL_TYPE_SGROUP,
3237                         .state          = WREPL_STATE_TOMBSTONE,
3238                         .node           = WREPL_NODE_B,
3239                         .is_static      = False,
3240                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3241                         .ips            = addresses_A_1,
3242                         .apply_expected = True
3243                 }
3244         },
3245
3246         /* 
3247          * mhomed,tombstone vs. sgroup,active
3248          * => should be replaced
3249          */
3250         {
3251                 .line   = __location__,
3252                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3253                 .r1     = {
3254                         .owner          = &ctx->a,
3255                         .type           = WREPL_TYPE_MHOMED,
3256                         .state          = WREPL_STATE_TOMBSTONE,
3257                         .node           = WREPL_NODE_B,
3258                         .is_static      = False,
3259                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3260                         .ips            = addresses_A_1,
3261                         .apply_expected = True
3262                 },
3263                 .r2     = {
3264                         .owner          = &ctx->b,
3265                         .type           = WREPL_TYPE_SGROUP,
3266                         .state          = WREPL_STATE_ACTIVE,
3267                         .node           = WREPL_NODE_B,
3268                         .is_static      = False,
3269                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3270                         .ips            = addresses_B_1,
3271                         .apply_expected = True
3272                 }
3273         },
3274
3275         /* 
3276          * mhomed,tombstone vs. sgroup,tombstone
3277          * => should be replaced
3278          */
3279         {
3280                 .line   = __location__,
3281                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3282                 .r1     = {
3283                         .owner          = &ctx->b,
3284                         .type           = WREPL_TYPE_MHOMED,
3285                         .state          = WREPL_STATE_TOMBSTONE,
3286                         .node           = WREPL_NODE_B,
3287                         .is_static      = False,
3288                         .num_ips        = ARRAY_SIZE(addresses_B_1),
3289                         .ips            = addresses_B_1,
3290                         .apply_expected = True
3291                 },
3292                 .r2     = {
3293                         .owner          = &ctx->a,
3294                         .type           = WREPL_TYPE_SGROUP,
3295                         .state          = WREPL_STATE_TOMBSTONE,
3296                         .node           = WREPL_NODE_B,
3297                         .is_static      = False,
3298                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3299                         .ips            = addresses_A_1,
3300                         .apply_expected = True
3301                 }
3302         },
3303
3304 /*
3305  * multi homed vs. mlti homed section,
3306  */
3307         /* 
3308          * mhomed,active vs. mhomed,active
3309          * => should be replaced
3310          */
3311         {
3312                 .line   = __location__,
3313                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3314                 .r1     = {
3315                         .owner          = &ctx->a,
3316                         .type           = WREPL_TYPE_MHOMED,
3317                         .state          = WREPL_STATE_ACTIVE,
3318                         .node           = WREPL_NODE_B,
3319                         .is_static      = False,
3320                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
3321                         .ips            = addresses_A_3_4,
3322                         .apply_expected = True
3323                 },
3324                 .r2     = {
3325                         .owner          = &ctx->b,
3326                         .type           = WREPL_TYPE_MHOMED,
3327                         .state          = WREPL_STATE_ACTIVE,
3328                         .node           = WREPL_NODE_B,
3329                         .is_static      = False,
3330                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
3331                         .ips            = addresses_B_3_4,
3332                         .apply_expected = True
3333                 }
3334         },
3335
3336         /* 
3337          * mhomed,active vs. mhomed,tombstone
3338          * => should NOT be replaced
3339          */
3340         {
3341                 .line   = __location__,
3342                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3343                 .r1     = {
3344                         .owner          = &ctx->b,
3345                         .type           = WREPL_TYPE_MHOMED,
3346                         .state          = WREPL_STATE_ACTIVE,
3347                         .node           = WREPL_NODE_B,
3348                         .is_static      = False,
3349                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
3350                         .ips            = addresses_B_3_4,
3351                         .apply_expected = True
3352                 },
3353                 .r2     = {
3354                         .owner          = &ctx->a,
3355                         .type           = WREPL_TYPE_MHOMED,
3356                         .state          = WREPL_STATE_TOMBSTONE,
3357                         .node           = WREPL_NODE_B,
3358                         .is_static      = False,
3359                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
3360                         .ips            = addresses_B_3_4,
3361                         .apply_expected = False
3362                 }
3363         },
3364
3365         /* 
3366          * mhomed,released vs. mhomed,active
3367          * => should be replaced
3368          */
3369         {
3370                 .line   = __location__,
3371                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3372                 .r1     = {
3373                         .owner          = &ctx->b,
3374                         .type           = WREPL_TYPE_MHOMED,
3375                         .state          = WREPL_STATE_RELEASED,
3376                         .node           = WREPL_NODE_B,
3377                         .is_static      = False,
3378                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
3379                         .ips            = addresses_B_3_4,
3380                         .apply_expected = False
3381                 },
3382                 .r2     = {
3383                         .owner          = &ctx->a,
3384                         .type           = WREPL_TYPE_MHOMED,
3385                         .state          = WREPL_STATE_ACTIVE,
3386                         .node           = WREPL_NODE_B,
3387                         .is_static      = False,
3388                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
3389                         .ips            = addresses_A_3_4,
3390                         .apply_expected = True
3391                 }
3392         },
3393
3394         /* 
3395          * mhomed,released vs. mhomed,tombstone
3396          * => should be replaced
3397          */
3398         {
3399                 .line   = __location__,
3400                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3401                 .r1     = {
3402                         .owner          = &ctx->a,
3403                         .type           = WREPL_TYPE_MHOMED,
3404                         .state          = WREPL_STATE_RELEASED,
3405                         .node           = WREPL_NODE_B,
3406                         .is_static      = False,
3407                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
3408                         .ips            = addresses_A_3_4,
3409                         .apply_expected = False
3410                 },
3411                 .r2     = {
3412                         .owner          = &ctx->b,
3413                         .type           = WREPL_TYPE_MHOMED,
3414                         .state          = WREPL_STATE_TOMBSTONE,
3415                         .node           = WREPL_NODE_B,
3416                         .is_static      = False,
3417                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
3418                         .ips            = addresses_B_3_4,
3419                         .apply_expected = True
3420                 }
3421         },
3422
3423         /* 
3424          * mhomed,tombstone vs. mhomed,active
3425          * => should be replaced
3426          */
3427         {
3428                 .line   = __location__,
3429                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3430                 .r1     = {
3431                         .owner          = &ctx->b,
3432                         .type           = WREPL_TYPE_MHOMED,
3433                         .state          = WREPL_STATE_TOMBSTONE,
3434                         .node           = WREPL_NODE_B,
3435                         .is_static      = False,
3436                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
3437                         .ips            = addresses_B_3_4,
3438                         .apply_expected = True
3439                 },
3440                 .r2     = {
3441                         .owner          = &ctx->a,
3442                         .type           = WREPL_TYPE_MHOMED,
3443                         .state          = WREPL_STATE_ACTIVE,
3444                         .node           = WREPL_NODE_B,
3445                         .is_static      = False,
3446                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
3447                         .ips            = addresses_A_3_4,
3448                         .apply_expected = True
3449                 }
3450         },
3451
3452         /* 
3453          * mhomed,tombstone vs. mhomed,tombstone
3454          * => should be replaced
3455          */
3456         {
3457                 .line   = __location__,
3458                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3459                 .r1     = {
3460                         .owner          = &ctx->a,
3461                         .type           = WREPL_TYPE_MHOMED,
3462                         .state          = WREPL_STATE_TOMBSTONE,
3463                         .node           = WREPL_NODE_B,
3464                         .is_static      = False,
3465                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
3466                         .ips            = addresses_A_3_4,
3467                         .apply_expected = True
3468                 },
3469                 .r2     = {
3470                         .owner          = &ctx->b,
3471                         .type           = WREPL_TYPE_MHOMED,
3472                         .state          = WREPL_STATE_TOMBSTONE,
3473                         .node           = WREPL_NODE_B,
3474                         .is_static      = False,
3475                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
3476                         .ips            = addresses_B_3_4,
3477                         .apply_expected = True
3478                 }
3479         },
3480
3481 #if 0
3482 /*
3483  * special group vs special group section,
3484  */
3485         /* 
3486          * sgroup,active vs. sgroup,active
3487          * => should be merged
3488          */
3489         {
3490                 .line   = __location__,
3491                 .name   = _NBT_NAME("_DIFF_OWNER_SG", 0x00, NULL),
3492                 .extra  = True,
3493                 .r1     = {
3494                         .owner          = &ctx->a,
3495                         .type           = WREPL_TYPE_SGROUP,
3496                         .state          = WREPL_STATE_ACTIVE,
3497                         .node           = WREPL_NODE_B,
3498                         .is_static      = False,
3499                         .num_ips        = ARRAY_SIZE(addresses_A_3_4),
3500                         .ips            = addresses_A_3_4,
3501                         .apply_expected = True,
3502                 },
3503                 .r2     = {
3504                         .owner          = &ctx->b,
3505                         .type           = WREPL_TYPE_SGROUP,
3506                         .state          = WREPL_STATE_ACTIVE,
3507                         .node           = WREPL_NODE_B,
3508                         .is_static      = False,
3509                         .num_ips        = ARRAY_SIZE(addresses_B_3_4),
3510                         .ips            = addresses_B_3_4,
3511                         .apply_expected = False,
3512                         .merge_expected = True
3513                 }
3514         },
3515         {
3516                 .line   = __location__,
3517                 .name   = _NBT_NAME("_DIFF_OWNER_SG", 0x00, NULL),
3518                 .cleanup= True,
3519                 .r1     = {
3520                         .owner          = &ctx->a,
3521                         .type           = WREPL_TYPE_SGROUP,
3522                         .state          = WREPL_STATE_ACTIVE,
3523                         .node           = WREPL_NODE_B,
3524                         .is_static      = False,
3525                         .num_ips        = 0,
3526                         .ips            = NULL,
3527                         .apply_expected = False
3528                 },
3529                 .r2     = {
3530                         .owner          = &ctx->b,
3531                         .type           = WREPL_TYPE_SGROUP,
3532                         .state          = WREPL_STATE_ACTIVE,
3533                         .node           = WREPL_NODE_B,
3534                         .is_static      = False,
3535                         .num_ips        = 0,
3536                         .ips            = NULL,
3537                         .apply_expected = False,
3538                         .merge_expected = False
3539                 }
3540         },
3541         {
3542                 .line   = __location__,
3543                 .name   = _NBT_NAME("_DIFF_OWNER_SG", 0x00, NULL),
3544                 .cleanup= True,
3545                 .r1     = {
3546                         .owner          = &ctx->a,
3547                         .type           = WREPL_TYPE_SGROUP,
3548                         .state          = WREPL_STATE_ACTIVE,
3549                         .node           = WREPL_NODE_B,
3550                         .is_static      = False,
3551                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3552                         .ips            = addresses_A_1,
3553                         .apply_expected = True
3554                 },
3555                 .r2     = {
3556                         .owner          = &ctx->a,
3557                         .type           = WREPL_TYPE_UNIQUE,
3558                         .state          = WREPL_STATE_TOMBSTONE,
3559                         .node           = WREPL_NODE_B,
3560                         .is_static      = False,
3561                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3562                         .ips            = addresses_A_1,
3563                         .apply_expected = True
3564                 }
3565         },
3566 #endif
3567         /* 
3568          * This should be the last record in this array,
3569          * we need to make sure the we leave a tombstoned unique entry
3570          * owned by OWNER_A
3571          */
3572         {
3573                 .line   = __location__,
3574                 .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
3575                 .cleanup= True,
3576                 .r1     = {
3577                         .owner          = &ctx->b,
3578                         .type           = WREPL_TYPE_UNIQUE,
3579                         .state          = WREPL_STATE_TOMBSTONE,
3580                         .node           = WREPL_NODE_B,
3581                         .is_static      = False,
3582                         .num_ips        = ARRAY_SIZE(addresses_A_1),
3583                         .ips            = addresses_A_1,
3584                         .apply_expected = True
3585                 },
3586                 .r2     = {
3587                         .owner          = &ctx->a,
3588                         .type           = WREPL_TYPE_UNIQUE,
3589                         .state          = WREPL_STATE_TOMBSTONE,
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         }}; /* do not add entries here, this should be the last record! */
3597
3598         if (!ctx) return False;
3599
3600         wins_name_r1    = &wins_name1;
3601         wins_name_r2    = &wins_name2;
3602
3603         printf("Test Replica Conflicts with different owners\n");
3604
3605         for(i=0; ret && i < ARRAY_SIZE(records); i++) {
3606         
3607                 if (!records[i].extra && !records[i].cleanup) {
3608                         /* we should test the worst cases */
3609                         if (records[i].r2.apply_expected && records[i].r1.ips==records[i].r2.ips) {
3610                                 printf("(%s) Programmer error, invalid record[%u]: %s\n",
3611                                         __location__, i, records[i].line);
3612                                 return False;
3613                         } else if (!records[i].r2.apply_expected && records[i].r1.ips!=records[i].r2.ips) {
3614                                 printf("(%s) Programmer error, invalid record[%u]: %s\n",
3615                                         __location__, i, records[i].line);
3616                                 return False;
3617                         }
3618                 }
3619
3620                 if (!records[i].cleanup) {
3621                         const char *expected;
3622                         const char *ips;
3623
3624                         if (records[i].r2.merge_expected) {
3625                                 expected = "MERGE";
3626                         } else if (records[i].r2.apply_expected) {
3627                                 expected = "REPLACE";
3628                         } else {
3629                                 expected = "NOT REPLACE";
3630                         }
3631
3632                         if (!records[i].r1.ips && !records[i].r2.ips) {
3633                                 ips = "no";
3634                         } else if (records[i].r1.ips==records[i].r2.ips) {
3635                                 ips = "same";
3636                         } else {
3637                                 ips = "different";
3638                         }
3639
3640                         printf("%s,%s%s vs. %s,%s%s with %s ip(s) => %s\n",
3641                                 wrepl_name_type_string(records[i].r1.type),
3642                                 wrepl_name_state_string(records[i].r1.state),
3643                                 (records[i].r1.is_static?",static":""),
3644                                 wrepl_name_type_string(records[i].r2.type),
3645                                 wrepl_name_state_string(records[i].r2.state),
3646                                 (records[i].r2.is_static?",static":""),
3647                                 ips, expected);
3648                 }
3649
3650                 /*
3651                  * Setup R1
3652                  */
3653                 wins_name_r1->name      = &records[i].name;
3654                 wins_name_r1->flags     = WREPL_NAME_FLAGS(records[i].r1.type,
3655                                                            records[i].r1.state,
3656                                                            records[i].r1.node,
3657                                                            records[i].r1.is_static);
3658                 wins_name_r1->id        = ++records[i].r1.owner->max_version;
3659                 if (wins_name_r1->flags & 2) {
3660                         wins_name_r1->addresses.addresses.num_ips = records[i].r1.num_ips;
3661                         wins_name_r1->addresses.addresses.ips     = discard_const(records[i].r1.ips);
3662                 } else {
3663                         wins_name_r1->addresses.ip = records[i].r1.ips[0].ip;
3664                 }
3665                 wins_name_r1->unknown   = "255.255.255.255";
3666
3667                 /* now apply R1 */
3668                 ret &= test_wrepl_update_one(ctx, records[i].r1.owner, wins_name_r1);
3669                 ret &= test_wrepl_is_applied(ctx, records[i].r1.owner,
3670                                              wins_name_r1, records[i].r1.apply_expected);
3671
3672                 /*
3673                  * Setup R2
3674                  */
3675                 wins_name_r2->name      = &records[i].name;
3676                 wins_name_r2->flags     = WREPL_NAME_FLAGS(records[i].r2.type,
3677                                                            records[i].r2.state,
3678                                                            records[i].r2.node,
3679                                                            records[i].r2.is_static);
3680                 wins_name_r2->id        = ++records[i].r2.owner->max_version;
3681                 if (wins_name_r2->flags & 2) {
3682                         wins_name_r2->addresses.addresses.num_ips = records[i].r2.num_ips;
3683                         wins_name_r2->addresses.addresses.ips     = discard_const(records[i].r2.ips);
3684                 } else {
3685                         wins_name_r2->addresses.ip = records[i].r2.ips[0].ip;
3686                 }
3687                 wins_name_r2->unknown   = "255.255.255.255";
3688
3689                 /* now apply R2 */
3690                 ret &= test_wrepl_update_one(ctx, records[i].r2.owner, wins_name_r2);
3691                 if (records[i].r1.state == WREPL_STATE_RELEASED) {
3692                         ret &= test_wrepl_is_applied(ctx, records[i].r1.owner,
3693                                                      wins_name_r1, False);
3694                 } else if (records[i].r2.merge_expected) {
3695                         ret &= test_wrepl_is_merged(ctx, wins_name_r1, wins_name_r2);           
3696                 } else if (records[i].r1.owner != records[i].r2.owner) {
3697                         BOOL _expected;
3698                         _expected = (records[i].r1.apply_expected && !records[i].r2.apply_expected);
3699                         ret &= test_wrepl_is_applied(ctx, records[i].r1.owner,
3700                                                      wins_name_r1, _expected);
3701                 }
3702                 if (records[i].r2.state == WREPL_STATE_RELEASED) {
3703                         ret &= test_wrepl_is_applied(ctx, records[i].r2.owner,
3704                                                      wins_name_r2, False);
3705                 } else if (!records[i].r2.merge_expected) {
3706                         ret &= test_wrepl_is_applied(ctx, records[i].r2.owner,
3707                                                      wins_name_r2, records[i].r2.apply_expected);
3708                 }
3709
3710                 /* the first one is a cleanup run */
3711                 if (!ret && i == 0) ret = True;
3712
3713                 if (!ret) {
3714                         printf("conflict handled wrong or record[%u]: %s\n", i, records[i].line);
3715                         return ret;
3716                 }
3717         }
3718
3719         return ret;
3720 }
3721
3722 /*
3723   test WINS replication operations
3724 */
3725 BOOL torture_nbt_winsreplication_quick(void)
3726 {
3727         const char *address;
3728         struct nbt_name name;
3729         TALLOC_CTX *mem_ctx = talloc_new(NULL);
3730         NTSTATUS status;
3731         BOOL ret = True;
3732
3733         make_nbt_name_server(&name, lp_parm_string(-1, "torture", "host"));
3734
3735         /* do an initial name resolution to find its IP */
3736         status = resolve_name(&name, mem_ctx, &address, NULL);
3737         if (!NT_STATUS_IS_OK(status)) {
3738                 printf("Failed to resolve %s - %s\n",
3739                        name.name, nt_errstr(status));
3740                 talloc_free(mem_ctx);
3741                 return False;
3742         }
3743
3744         ret &= test_assoc_ctx1(mem_ctx, address);
3745         ret &= test_assoc_ctx2(mem_ctx, address);
3746
3747         talloc_free(mem_ctx);
3748
3749         return ret;
3750 }
3751
3752 /*
3753   test WINS replication operations
3754 */
3755 BOOL torture_nbt_winsreplication(void)
3756 {
3757         const char *address;
3758         struct nbt_name name;
3759         TALLOC_CTX *mem_ctx = talloc_new(NULL);
3760         NTSTATUS status;
3761         BOOL ret = True;
3762         struct test_wrepl_conflict_conn *ctx;
3763
3764         make_nbt_name_server(&name, lp_parm_string(-1, "torture", "host"));
3765
3766         /* do an initial name resolution to find its IP */
3767         status = resolve_name(&name, mem_ctx, &address, NULL);
3768         if (!NT_STATUS_IS_OK(status)) {
3769                 printf("Failed to resolve %s - %s\n",
3770                        name.name, nt_errstr(status));
3771                 talloc_free(mem_ctx);
3772                 return False;
3773         }
3774
3775         ret &= test_assoc_ctx1(mem_ctx, address);
3776         ret &= test_assoc_ctx2(mem_ctx, address);
3777
3778         ret &= test_wins_replication(mem_ctx, address);
3779
3780         ctx = test_create_conflict_ctx(mem_ctx, address);
3781
3782         ret &= test_conflict_same_owner(ctx);
3783         ret &= test_conflict_different_owner(ctx);
3784
3785         talloc_free(mem_ctx);
3786
3787         return ret;
3788 }