mirror of
https://github.com/samba-team/samba.git
synced 2025-01-14 19:24:43 +03:00
merge from tridge
(This used to be ctdb commit 58e3aa4ce42a34e137c1751df21467c42bfc56bb)
This commit is contained in:
commit
9c8049054d
@ -93,6 +93,8 @@ struct ctdb_call_info {
|
||||
#define CTDB_BROADCAST_ALL 0xF0000002
|
||||
/* send a broadcast to all nodes in the current vnn map */
|
||||
#define CTDB_BROADCAST_VNNMAP 0xF0000003
|
||||
/* send a broadcast to all connected nodes */
|
||||
#define CTDB_BROADCAST_CONNECTED 0xF0000004
|
||||
|
||||
|
||||
struct event_context;
|
||||
|
@ -433,12 +433,17 @@ int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode,
|
||||
struct ctdb_control_state *state;
|
||||
size_t len;
|
||||
|
||||
if (((destnode == CTDB_BROADCAST_VNNMAP) || (destnode == CTDB_BROADCAST_VNNMAP)) && !(flags & CTDB_CTRL_FLAG_NOREPLY)) {
|
||||
if (((destnode == CTDB_BROADCAST_VNNMAP) ||
|
||||
(destnode == CTDB_BROADCAST_ALL) ||
|
||||
(destnode == CTDB_BROADCAST_CONNECTED)) &&
|
||||
!(flags & CTDB_CTRL_FLAG_NOREPLY)) {
|
||||
DEBUG(0,("Attempt to broadcast control without NOREPLY\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (destnode != CTDB_BROADCAST_VNNMAP && destnode != CTDB_BROADCAST_ALL &&
|
||||
if (destnode != CTDB_BROADCAST_VNNMAP &&
|
||||
destnode != CTDB_BROADCAST_ALL &&
|
||||
destnode != CTDB_BROADCAST_CONNECTED &&
|
||||
(!ctdb_validate_vnn(ctdb, destnode) ||
|
||||
(ctdb->nodes[destnode]->flags & NODE_FLAGS_DISCONNECTED))) {
|
||||
if (!(flags & CTDB_CTRL_FLAG_NOREPLY)) {
|
||||
|
@ -122,7 +122,7 @@ static void ctdb_health_callback(struct ctdb_context *ctdb, int status, void *p)
|
||||
data.dsize = sizeof(c);
|
||||
|
||||
/* tell the other nodes that something has changed */
|
||||
ctdb_daemon_send_message(ctdb, CTDB_BROADCAST_VNNMAP,
|
||||
ctdb_daemon_send_message(ctdb, CTDB_BROADCAST_CONNECTED,
|
||||
CTDB_SRVID_NODE_FLAGS_CHANGED, data);
|
||||
|
||||
}
|
||||
@ -213,7 +213,7 @@ int32_t ctdb_control_modflags(struct ctdb_context *ctdb, TDB_DATA indata)
|
||||
data.dsize = sizeof(c);
|
||||
|
||||
/* tell the other nodes that something has changed */
|
||||
ctdb_daemon_send_message(ctdb, CTDB_BROADCAST_VNNMAP,
|
||||
ctdb_daemon_send_message(ctdb, CTDB_BROADCAST_CONNECTED,
|
||||
CTDB_SRVID_NODE_FLAGS_CHANGED, data);
|
||||
|
||||
if ((node->flags & NODE_FLAGS_BANNED) && !(old_flags & NODE_FLAGS_BANNED)) {
|
||||
|
@ -392,7 +392,7 @@ static int update_flags_on_all_nodes(struct ctdb_context *ctdb, struct ctdb_node
|
||||
data.dptr = (uint8_t *)&c;
|
||||
data.dsize = sizeof(c);
|
||||
|
||||
ctdb_send_message(ctdb, CTDB_BROADCAST_VNNMAP,
|
||||
ctdb_send_message(ctdb, CTDB_BROADCAST_CONNECTED,
|
||||
CTDB_SRVID_NODE_FLAGS_CHANGED, data);
|
||||
|
||||
}
|
||||
|
@ -390,7 +390,8 @@ static void ctdb_defer_packet(struct ctdb_context *ctdb, struct ctdb_req_header
|
||||
/*
|
||||
broadcast a packet to all nodes
|
||||
*/
|
||||
static void ctdb_broadcast_packet_all(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
|
||||
static void ctdb_broadcast_packet_all(struct ctdb_context *ctdb,
|
||||
struct ctdb_req_header *hdr)
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<ctdb->num_nodes;i++) {
|
||||
@ -402,7 +403,8 @@ static void ctdb_broadcast_packet_all(struct ctdb_context *ctdb, struct ctdb_req
|
||||
/*
|
||||
broadcast a packet to all nodes in the current vnnmap
|
||||
*/
|
||||
static void ctdb_broadcast_packet_vnnmap(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
|
||||
static void ctdb_broadcast_packet_vnnmap(struct ctdb_context *ctdb,
|
||||
struct ctdb_req_header *hdr)
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<ctdb->vnn_map->size;i++) {
|
||||
@ -411,6 +413,21 @@ static void ctdb_broadcast_packet_vnnmap(struct ctdb_context *ctdb, struct ctdb_
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
broadcast a packet to all connected nodes
|
||||
*/
|
||||
static void ctdb_broadcast_packet_connected(struct ctdb_context *ctdb,
|
||||
struct ctdb_req_header *hdr)
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<ctdb->num_nodes;i++) {
|
||||
if (!(ctdb->nodes[i]->flags & NODE_FLAGS_DISCONNECTED)) {
|
||||
hdr->destnode = ctdb->nodes[i]->vnn;
|
||||
ctdb_queue_packet(ctdb, hdr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
queue a packet or die
|
||||
*/
|
||||
@ -425,6 +442,9 @@ void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
|
||||
case CTDB_BROADCAST_VNNMAP:
|
||||
ctdb_broadcast_packet_vnnmap(ctdb, hdr);
|
||||
return;
|
||||
case CTDB_BROADCAST_CONNECTED:
|
||||
ctdb_broadcast_packet_connected(ctdb, hdr);
|
||||
return;
|
||||
}
|
||||
|
||||
ctdb->statistics.node_packets_sent++;
|
||||
|
@ -248,7 +248,8 @@ static struct ctdb_traverse_all_handle *ctdb_daemon_traverse_all(struct ctdb_db_
|
||||
data.dsize = sizeof(r);
|
||||
|
||||
/* tell all the nodes in the cluster to start sending records to this node */
|
||||
ret = ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNNMAP, 0, CTDB_CONTROL_TRAVERSE_ALL,
|
||||
ret = ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNNMAP, 0,
|
||||
CTDB_CONTROL_TRAVERSE_ALL,
|
||||
0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
|
||||
if (ret != 0) {
|
||||
talloc_free(state);
|
||||
|
@ -66,9 +66,16 @@ int ctdb_sys_send_arp(const struct sockaddr_in *saddr, const char *iface)
|
||||
DEBUG(0,(__location__ " ioctl failed\n"));
|
||||
return -1;
|
||||
}
|
||||
if (ARPHRD_LOOPBACK == if_hwaddr.ifr_hwaddr.sa_family) {
|
||||
DEBUG(3,("Ignoring loopback arp request\n"));
|
||||
close(s);
|
||||
return 0;
|
||||
}
|
||||
if (if_hwaddr.ifr_hwaddr.sa_family != AF_LOCAL) {
|
||||
close(s);
|
||||
DEBUG(0,(__location__ " not an ethernet address\n"));
|
||||
errno = EINVAL;
|
||||
DEBUG(0,(__location__ " not an ethernet address family (0x%x)\n",
|
||||
if_hwaddr.ifr_hwaddr.sa_family));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user