LCOV - code coverage report
Current view: top level - source4/torture/nbt - winsreplication.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 1576 1816 86.8 %
Date: 2024-04-21 15:09:00 Functions: 21 22 95.5 %

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

Generated by: LCOV version 1.14