]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
send a message to clients when an IP has been released
authorAndrew Tridgell <tridge@samba.org>
Fri, 25 May 2007 14:05:30 +0000 (00:05 +1000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 25 May 2007 14:05:30 +0000 (00:05 +1000)
(This used to be ctdb commit 8b7ab0b00253462593d368052c2cb10a385b4e63)

ctdb/common/ctdb_recoverd.c
ctdb/include/ctdb.h
ctdb/takeover/ctdb_takeover.c

index ad847c614b94038910620b9ba4e6f39dc4e31cea..05dc649a33aa53673cf2ab78ff0dfe9a676db832 100644 (file)
@@ -557,7 +557,8 @@ static int do_recovery(struct ctdb_context *ctdb,
                return -1;
        }
 
-       /* send a message to all clients telling them that the cluster has been reconfigured */
+       /* send a message to all clients telling them that the cluster 
+          has been reconfigured */
        ctdb_send_message(ctdb, CTDB_BROADCAST_ALL, CTDB_SRVID_RECONFIGURE, tdb_null);
 
        DEBUG(0, (__location__ " Recovery complete\n"));
index b523c70531156e70b30ac192b0758bf693b94211..a82effda235ee12c5e2448f61f5ba0f27ff38763 100644 (file)
@@ -67,6 +67,11 @@ struct ctdb_call_info {
  */
 #define CTDB_SRVID_RECONFIGURE 0xF200000000000000LL
 
+/* 
+   a message handler ID meaning that an IP address has been released
+ */
+#define CTDB_SRVID_RELEASE_IP 0xF300000000000000LL
+
 struct event_context;
 
 /*
index 355e85a7eca8fea08872a6488480ea6014107b9f..23cc8c30f4ca2330eb6db68ffa876f90a563b831 100644 (file)
@@ -108,19 +108,30 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb, TDB_DATA indata)
 {
        struct sockaddr_in *sin = (struct sockaddr_in *)indata.dptr;
        char *cmdstr;
+       TDB_DATA data;
+       char *ip = inet_ntoa(sin->sin_addr);
 
        /* stop any previous arps */
        talloc_free(ctdb->takeover.last_ctx);
        ctdb->takeover.last_ctx = NULL;
 
        cmdstr = talloc_asprintf(ctdb, "ip addr del %s/32 dev %s 2> /dev/null",
-                                inet_ntoa(sin->sin_addr), ctdb->takeover.interface);
+                                ip, ctdb->takeover.interface);
                
        DEBUG(0,("Releasing IP : %s\n", cmdstr));
        system(cmdstr);
 
        talloc_free(cmdstr);
 
+       /* send a message to all clients of this node telling them
+          that the cluster has been reconfigured and they should
+          release any sockets on this IP */
+       data.dptr = (uint8_t *)ip;
+       data.dsize = strlen(ip)+1;
+
+       ctdb_send_message(ctdb, ctdb->vnn, CTDB_SRVID_RELEASE_IP, data);
+
+
        return 0;
 }