Rev 349: moved system specific ip code to system.c in http://samba.org/~tridge/ctdb

2007-05-26 Thread tridge

revno: 349
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell [EMAIL PROTECTED]
branch nick: tridge
timestamp: Sat 2007-05-26 14:01:08 +1000
message:
  moved system specific ip code to system.c
modified:
  common/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1
  include/ctdb_private.h 
ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13
  takeover/ctdb_takeover.c   
ctdb_takeover.c-20070525071636-a5n1ihghjtppy08r-2
  takeover/system.c  system.c-20070525071636-a5n1ihghjtppy08r-3
=== modified file 'common/ctdb_recoverd.c'
--- a/common/ctdb_recoverd.c2007-05-25 14:05:30 +
+++ b/common/ctdb_recoverd.c2007-05-26 04:01:08 +
@@ -666,9 +666,10 @@
return;
}
 
-   /* wait for one second to collect all responses */
+   /* wait for a few seconds to collect all responses */
timed_out = 0;
-   event_add_timed(ctdb-ev, mem_ctx, CONTROL_TIMEOUT(), timeout_func, 
ctdb);
+   event_add_timed(ctdb-ev, mem_ctx, timeval_current_ofs(3, 0), 
+   timeout_func, ctdb);
while (!timed_out) {
event_loop_once(ctdb-ev);
}

=== modified file 'include/ctdb_private.h'
--- a/include/ctdb_private.h2007-05-25 11:27:26 +
+++ b/include/ctdb_private.h2007-05-26 04:01:08 +
@@ -894,6 +894,8 @@
 
 /* from takeover/system.c */
 int ctdb_sys_send_arp(const struct sockaddr_in *saddr, const char *iface);
+int ctdb_sys_take_ip(const char *ip, const char *interface);
+int ctdb_sys_release_ip(const char *ip, const char *interface);
 
 int ctdb_set_public_addresses(struct ctdb_context *ctdb, const char *alist);
 

=== modified file 'takeover/ctdb_takeover.c'
--- a/takeover/ctdb_takeover.c  2007-05-25 14:21:07 +
+++ b/takeover/ctdb_takeover.c  2007-05-26 04:01:08 +
@@ -73,16 +73,16 @@
 {
int ret;
struct sockaddr_in *sin = (struct sockaddr_in *)indata.dptr;
-   char *cmdstr;
struct ctdb_takeover_arp *arp;
-
-   cmdstr = talloc_asprintf(ctdb, ip addr add %s/32 dev %s 2 /dev/null,
-inet_ntoa(sin-sin_addr), 
ctdb-takeover.interface);
-   CTDB_NO_MEMORY(ctdb, cmdstr);
-
-   DEBUG(0,(Taking over IP : %s\n, cmdstr));
-   system(cmdstr);
-   talloc_free(cmdstr);
+   char *ip = inet_ntoa(sin-sin_addr);
+
+   DEBUG(0,(Takover of IP %s on interface %s\n, ip, 
ctdb-takeover.interface));
+   ret = ctdb_sys_take_ip(ip, ctdb-takeover.interface);
+   if (ret != 0) {
+   DEBUG(0,(__location__  Failed to takeover IP %s on interface 
%s\n,
+ip, ctdb-takeover.interface));
+   return -1;
+   }
 
if (!ctdb-takeover.last_ctx) {
ctdb-takeover.last_ctx = talloc_new(ctdb);
@@ -107,21 +107,22 @@
 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);
+   int ret;
+
+   DEBUG(0,(Release of IP %s on interface %s\n, ip, 
ctdb-takeover.interface));
 
/* 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,
-ip, ctdb-takeover.interface);
-   
-   DEBUG(0,(Releasing IP : %s\n, cmdstr));
-   system(cmdstr);
-
-   talloc_free(cmdstr);
+   ret = ctdb_sys_release_ip(ip, ctdb-takeover.interface);
+   if (ret != 0) {
+   DEBUG(0,(__location__  Failed to release IP %s on interface 
%s\n,
+ip, ctdb-takeover.interface));
+   return -1;
+   }
 
/* send a message to all clients of this node telling them
   that the cluster has been reconfigured and they should

=== modified file 'takeover/system.c'
--- a/takeover/system.c 2007-05-25 07:16:50 +
+++ b/takeover/system.c 2007-05-26 04:01:08 +
@@ -126,3 +126,35 @@
close(s);
return 0;
 }
+
+/*
+  takeover an IP on an interface
+ */
+int ctdb_sys_take_ip(const char *ip, const char *interface)
+{
+   char *cmdstr;
+   cmdstr = talloc_asprintf(NULL, /sbin/ip addr add %s/32 dev %s 2 
/dev/null,
+ip, interface);
+   if (cmdstr == NULL) {
+   return -1;
+   }
+   system(cmdstr);
+   talloc_free(cmdstr);
+   return 0;
+}
+
+/*
+  release an IP on an interface
+ */
+int ctdb_sys_release_ip(const char *ip, const char *interface)
+{
+   char *cmdstr;
+   cmdstr = talloc_asprintf(NULL, /sbin/ip addr del %s/32 dev %s 2 
/dev/null,
+ip, interface);
+   if (cmdstr == NULL) {
+   return -1;
+   }
+   system(cmdstr);
+ 

Rev 351: paranoid checks for bad packets in tcp layer. Close the socket if it gets a bad packet in http://samba.org/~tridge/ctdb

2007-05-26 Thread tridge

revno: 351
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell [EMAIL PROTECTED]
branch nick: tridge
timestamp: Sat 2007-05-26 16:32:32 +1000
message:
  paranoid checks for bad packets in tcp layer. Close the socket if it gets a 
bad packet
modified:
  common/ctdb.c  ctdb.c-20061127094323-t50f58d65iaao5of-2
  tcp/tcp_io.c   tcp_io.c-20061128004937-x70q1cu5xzg5g2tm-3
=== modified file 'common/ctdb.c'
--- a/common/ctdb.c 2007-05-25 07:04:13 +
+++ b/common/ctdb.c 2007-05-26 06:32:32 +
@@ -347,26 +347,6 @@
 
ctdb-status.node_packets_recv++;
 
-   if (length  sizeof(*hdr)) {
-   ctdb_set_error(ctdb, Bad packet length %u\n, length);
-   return;
-   }
-   if (length != hdr-length) {
-   ctdb_set_error(ctdb, Bad header length %u expected %u\n, 
-  hdr-length, length);
-   return;
-   }
-
-   if (hdr-ctdb_magic != CTDB_MAGIC) {
-   ctdb_set_error(ctdb, Non CTDB packet rejected\n);
-   return;
-   }
-
-   if (hdr-ctdb_version != CTDB_VERSION) {
-   ctdb_set_error(ctdb, Bad CTDB version 0x%x rejected\n, 
hdr-ctdb_version);
-   return;
-   }
-
/* up the counter for this source node, so we know its alive */
if (ctdb_validate_vnn(ctdb, hdr-srcnode)) {
/* as a special case, redirected calls don't increment the 
rx_cnt */

=== modified file 'tcp/tcp_io.c'
--- a/tcp/tcp_io.c  2007-04-28 09:35:49 +
+++ b/tcp/tcp_io.c  2007-05-26 06:32:32 +
@@ -34,38 +34,48 @@
 void ctdb_tcp_read_cb(uint8_t *data, size_t cnt, void *args)
 {
struct ctdb_incoming *in = talloc_get_type(args, struct ctdb_incoming);
-   struct ctdb_req_header *hdr;
+   struct ctdb_req_header *hdr = (struct ctdb_req_header *)data;
 
if (data == NULL) {
/* incoming socket has died */
-   talloc_free(in);
-   return;
+   goto failed;
}
 
if (cnt  sizeof(*hdr)) {
-   ctdb_set_error(in-ctdb, Bad packet length %u\n, 
(unsigned)cnt);
-   return;
-   }
-   hdr = (struct ctdb_req_header *)data;
+   DEBUG(0,(__location__  Bad packet length %u\n, 
(unsigned)cnt));
+   goto failed;
+   }
+
+   if (cnt  (CTDB_TCP_ALIGNMENT-1)) {
+   DEBUG(0,(__location__  Length 0x%x not multiple of 
alignment\n, cnt));
+   goto failed;
+   }
+
+
if (cnt != hdr-length) {
-   ctdb_set_error(in-ctdb, Bad header length %u expected %u\n, 
-  (unsigned)hdr-length, (unsigned)cnt);
-   return;
+   DEBUG(0,(__location__  Bad header length %u expected %u\n, 
+(unsigned)hdr-length, (unsigned)cnt));
+   goto failed;
}
 
if (hdr-ctdb_magic != CTDB_MAGIC) {
-   ctdb_set_error(in-ctdb, Non CTDB packet rejected\n);
-   return;
+   DEBUG(0,(__location__  Non CTDB packet 0x%x rejected\n, 
+hdr-ctdb_magic));
+   goto failed;
}
 
if (hdr-ctdb_version != CTDB_VERSION) {
-   ctdb_set_error(in-ctdb, Bad CTDB version 0x%x rejected\n, 
hdr-ctdb_version);
-   return;
+   DEBUG(0, (__location__  Bad CTDB version 0x%x rejected\n, 
+ hdr-ctdb_version));
+   goto failed;
}
 
-   /* most common case - we got a whole packet in one go
-  tell the ctdb layer above that we have a packet */
+   /* tell the ctdb layer above that we have a packet */
in-ctdb-upcalls-recv_pkt(in-ctdb, data, cnt);
+   return;
+
+failed:
+   talloc_free(in);
 }
 
 /*



Rev 353: drop any partialialy send packets when we get a socket write error in http://samba.org/~tridge/ctdb

2007-05-26 Thread tridge

revno: 353
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell [EMAIL PROTECTED]
branch nick: tridge
timestamp: Sat 2007-05-26 16:41:32 +1000
message:
  drop any partialialy send packets when we get a socket write error
modified:
  common/ctdb_io.c   ctdb_io.c-20070409200335-dzfc7f3rra5rcf60-1
=== modified file 'common/ctdb_io.c'
--- a/common/ctdb_io.c  2007-05-26 04:46:12 +
+++ b/common/ctdb_io.c  2007-05-26 06:41:32 +
@@ -40,6 +40,7 @@
struct ctdb_queue_pkt *next, *prev;
uint8_t *data;
uint32_t length;
+   uint32_t full_length;
 };
 
 struct ctdb_queue {
@@ -175,6 +176,11 @@
}
 
if (n == -1  errno != EAGAIN  errno != EWOULDBLOCK) {
+   if (pkt-length != pkt-full_length) {
+   /* partial packet sent - we have to drop it */
+   DLIST_REMOVE(queue-out_queue, pkt);
+   talloc_free(pkt);
+   }
talloc_free(queue-fde);
queue-fde = NULL;
queue-fd = -1;
@@ -262,6 +268,7 @@
CTDB_NO_MEMORY(queue-ctdb, pkt-data);
 
pkt-length = length2;
+   pkt-full_length = length2;
 
if (queue-out_queue == NULL  queue-fd != -1) {
EVENT_FD_WRITEABLE(queue-fde);



Rev 352: show op type of badly aligned packets in tcp layer in http://samba.org/~tridge/ctdb

2007-05-26 Thread tridge

revno: 352
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell [EMAIL PROTECTED]
branch nick: tridge
timestamp: Sat 2007-05-26 16:35:41 +1000
message:
  show op type of badly aligned packets in tcp layer
modified:
  tcp/tcp_io.c   tcp_io.c-20061128004937-x70q1cu5xzg5g2tm-3
=== modified file 'tcp/tcp_io.c'
--- a/tcp/tcp_io.c  2007-05-26 06:32:32 +
+++ b/tcp/tcp_io.c  2007-05-26 06:35:41 +
@@ -85,5 +85,12 @@
 {
struct ctdb_tcp_node *tnode = talloc_get_type(node-private_data,
  struct ctdb_tcp_node);
+   struct ctdb_req_header *hdr = (struct ctdb_req_header *)data;
+
+   if (length  (CTDB_TCP_ALIGNMENT-1)) {
+   DEBUG(0,(__location__  Length 0x%x not multiple of alignment 
op %d\n, 
+length, hdr-operation));
+   }
+
return ctdb_queue_send(tnode-queue, data, length);
 }



Rev 350: handle corrupt ctdb packets better in http://samba.org/~tridge/ctdb

2007-05-26 Thread tridge

revno: 350
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell [EMAIL PROTECTED]
branch nick: tridge
timestamp: Sat 2007-05-26 14:46:12 +1000
message:
  handle corrupt ctdb packets better
modified:
  common/ctdb_io.c   ctdb_io.c-20070409200335-dzfc7f3rra5rcf60-1
=== modified file 'common/ctdb_io.c'
--- a/common/ctdb_io.c  2007-05-15 04:08:58 +
+++ b/common/ctdb_io.c  2007-05-26 04:46:12 +
@@ -109,6 +109,11 @@
uint8_t *d2;
uint32_t len;
len = *(uint32_t *)data;
+   if (len == 0) {
+   /* bad packet! treat as EOF */
+   DEBUG(0,(Invalid packet of length 0\n));
+   goto failed;
+   }
d2 = talloc_memdup(queue, data, len);
if (d2 == NULL) {
DEBUG(0,(read error memdup failed for %u\n, len));



Rev 354: removed bogus alignment check in http://samba.org/~tridge/ctdb

2007-05-26 Thread tridge

revno: 354
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell [EMAIL PROTECTED]
branch nick: tridge
timestamp: Sat 2007-05-26 18:13:19 +1000
message:
  removed bogus alignment check
modified:
  tcp/tcp_io.c   tcp_io.c-20061128004937-x70q1cu5xzg5g2tm-3
=== modified file 'tcp/tcp_io.c'
--- a/tcp/tcp_io.c  2007-05-26 06:35:41 +
+++ b/tcp/tcp_io.c  2007-05-26 08:13:19 +
@@ -85,12 +85,5 @@
 {
struct ctdb_tcp_node *tnode = talloc_get_type(node-private_data,
  struct ctdb_tcp_node);
-   struct ctdb_req_header *hdr = (struct ctdb_req_header *)data;
-
-   if (length  (CTDB_TCP_ALIGNMENT-1)) {
-   DEBUG(0,(__location__  Length 0x%x not multiple of alignment 
op %d\n, 
-length, hdr-operation));
-   }
-
return ctdb_queue_send(tnode-queue, data, length);
 }



svn commit: samba r23153 - in branches/SAMBA_4_0/source/lib/messaging: .

2007-05-26 Thread tridge
Author: tridge
Date: 2007-05-26 08:47:27 + (Sat, 26 May 2007)
New Revision: 23153

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=23153

Log:

a first cut at a fix for the dgram flood problem that volker
found. Not sure this is the best solution, but it should work.

Modified:
   branches/SAMBA_4_0/source/lib/messaging/messaging.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/messaging/messaging.c
===
--- branches/SAMBA_4_0/source/lib/messaging/messaging.c 2007-05-26 03:24:08 UTC 
(rev 23152)
+++ branches/SAMBA_4_0/source/lib/messaging/messaging.c 2007-05-26 08:47:27 UTC 
(rev 23153)
@@ -48,11 +48,12 @@
uint32_t num_types;
struct idr_context *dispatch_tree;
struct messaging_rec *pending;
+   struct messaging_rec *retry_queue;
struct irpc_list *irpc;
struct idr_context *idr;
const char **names;
struct timeval start_time;
-
+   struct timed_event *retry_te;
struct {
struct event_context *ev;
struct fd_event *fde;
@@ -83,6 +84,7 @@
} *header;
 
DATA_BLOB packet;
+   uint32_t retries;
 };
 
 
@@ -168,6 +170,7 @@
rec-path  = msg-path;
rec-header= (struct messaging_header *)packet.data;
rec-packet= packet;
+   rec-retries   = 0;
 
if (packet.length != sizeof(*rec-header) + rec-header-length) {
DEBUG(0,(messaging: bad message header size %d should be 
%d\n, 
@@ -211,6 +214,26 @@
 }
 
 /*
+  retry backed off messages
+*/
+static void msg_retry_timer(struct event_context *ev, struct timed_event *te, 
+   struct timeval t, void *private)
+{
+   struct messaging_context *msg = talloc_get_type(private, 
+   struct 
messaging_context);
+   msg-retry_te = NULL;
+
+   /* put the messages back on the main queue */
+   while (msg-retry_queue) {
+   struct messaging_rec *rec = msg-retry_queue;
+   DLIST_REMOVE(msg-retry_queue, rec);
+   DLIST_ADD_END(msg-pending, rec, struct messaging_rec *);
+   }
+
+   EVENT_FD_WRITEABLE(msg-event.fde); 
+}
+
+/*
   handle a socket write event
 */
 static void messaging_send_handler(struct messaging_context *msg)
@@ -220,8 +243,23 @@
NTSTATUS status;
status = try_send(rec);
if (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) {
+   rec-retries++;
+   if (rec-retries  3) {
+   /* we're getting continuous write errors -
+  backoff this record */
+   DLIST_REMOVE(msg-pending, rec);
+   DLIST_ADD_END(msg-retry_queue, rec, 
+ struct messaging_rec *);
+   if (msg-retry_te == NULL) {
+   msg-retry_te = 
+   event_add_timed(msg-event.ev, 
msg, 
+   
timeval_current_ofs(1, 0), 
+   
msg_retry_timer, msg);
+   }
+   }
break;
}
+   rec-retries = 0;
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1,(messaging: Lost message from %u to %u of type 
%u - %s\n, 
 rec-header-from.id, rec-header-to.id, 
rec-header-msg_type, 
@@ -281,6 +319,7 @@
rec-path  = msg-path;
rec-header= (struct messaging_header *)packet.data;
rec-packet= packet;
+   rec-retries   = 0;
 
if (msize != sizeof(*rec-header) + rec-header-length) {
DEBUG(0,(messaging: bad message header size %d should be 
%d\n, 
@@ -415,6 +454,7 @@
return NT_STATUS_NO_MEMORY;
}
 
+   rec-retries   = 0;
rec-msg  = msg;
rec-header   = (struct messaging_header *)rec-packet.data;
rec-header-version  = MESSAGING_VERSION;



svn commit: samba r23154 - in branches: SAMBA_3_0/source SAMBA_3_0_26/source

2007-05-26 Thread lmuelle
Author: lmuelle
Date: 2007-05-26 13:24:56 + (Sat, 26 May 2007)
New Revision: 23154

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=23154

Log:
Add INSTALLPERMS_DATA set to 0644 to install the header files with this
permission set instead of 0755.

Modified:
   branches/SAMBA_3_0/source/Makefile.in
   branches/SAMBA_3_0_26/source/Makefile.in


Changeset:
Modified: branches/SAMBA_3_0/source/Makefile.in
===
--- branches/SAMBA_3_0/source/Makefile.in   2007-05-26 08:47:27 UTC (rev 
23153)
+++ branches/SAMBA_3_0/source/Makefile.in   2007-05-26 13:24:56 UTC (rev 
23154)
@@ -91,8 +91,9 @@
 MANDIR = @mandir@
 DATADIR = @datadir@
 
-# The permissions to give the executables
+# The permissions to give the executables and other data
 INSTALLPERMS = 0755
+INSTALLPERMS_DATA = 0644
 
 # set these to where to find various files
 # These can be overridden by command line switches (see smbd(8))
@@ -1775,14 +1776,14 @@
-$(INSTALLLIBCMD_SH) bin/[EMAIL PROTECTED]@ $(DESTDIR)$(LIBDIR)
-$(INSTALLLIBCMD_A) bin/libsmbclient.a $(DESTDIR)$(LIBDIR)
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) 
${prefix}/include
-   -$(INSTALLCMD) $(srcdir)/include/libsmbclient.h 
$(DESTDIR)${prefix}/include
+   -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/include/libsmbclient.h 
$(DESTDIR)${prefix}/include
 
 installlibmsrpc: installdirs libmsrpc
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) 
$(LIBDIR)
-$(INSTALLLIBCMD_SH) bin/[EMAIL PROTECTED]@ $(DESTDIR)$(LIBDIR)
-$(INSTALLLIBCMD_A) bin/libmsrpc.a $(DESTDIR)$(LIBDIR)
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) 
${prefix}/include
-   -$(INSTALLCMD) $(srcdir)/include/libmsrpc.h $(DESTDIR)${prefix}/include
+   -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/include/libmsrpc.h 
$(DESTDIR)${prefix}/include
 
 installlibsmbsharemodes: installdirs libsmbsharemodes
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) 
$(LIBDIR)

Modified: branches/SAMBA_3_0_26/source/Makefile.in
===
--- branches/SAMBA_3_0_26/source/Makefile.in2007-05-26 08:47:27 UTC (rev 
23153)
+++ branches/SAMBA_3_0_26/source/Makefile.in2007-05-26 13:24:56 UTC (rev 
23154)
@@ -84,8 +84,9 @@
 MANDIR = @mandir@
 DATADIR = @datadir@
 
-# The permissions to give the executables
+# The permissions to give the executables and other data
 INSTALLPERMS = 0755
+INSTALLPERMS_DATA = 0644
 
 # set these to where to find various files
 # These can be overridden by command line switches (see smbd(8))
@@ -1653,14 +1654,14 @@
-$(INSTALLLIBCMD_SH) bin/[EMAIL PROTECTED]@ $(DESTDIR)$(LIBDIR)
-$(INSTALLLIBCMD_A) bin/libsmbclient.a $(DESTDIR)$(LIBDIR)
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) 
${prefix}/include
-   -$(INSTALLCMD) $(srcdir)/include/libsmbclient.h 
$(DESTDIR)${prefix}/include
+   -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/include/libsmbclient.h 
$(DESTDIR)${prefix}/include
 
 installlibmsrpc: installdirs libmsrpc
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) 
$(LIBDIR)
-$(INSTALLLIBCMD_SH) bin/[EMAIL PROTECTED]@ $(DESTDIR)$(LIBDIR)
-$(INSTALLLIBCMD_A) bin/libmsrpc.a $(DESTDIR)$(LIBDIR)
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) 
${prefix}/include
-   -$(INSTALLCMD) $(srcdir)/include/libmsrpc.h $(DESTDIR)${prefix}/include
+   -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/include/libmsrpc.h 
$(DESTDIR)${prefix}/include
 
 installlibsmbsharemodes: installdirs libsmbsharemodes
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) 
$(LIBDIR)



svn commit: samba r23155 - in branches: SAMBA_3_0/source SAMBA_3_0_26/source

2007-05-26 Thread lmuelle
Author: lmuelle
Date: 2007-05-26 13:30:45 + (Sat, 26 May 2007)
New Revision: 23155

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=23155

Log:
Rename INSTALLPERMS to INSTALLPERMS_BIN to differenciate clearer from
INSTALLPERMS_DATA.

Modified:
   branches/SAMBA_3_0/source/Makefile.in
   branches/SAMBA_3_0_26/source/Makefile.in


Changeset:
Modified: branches/SAMBA_3_0/source/Makefile.in
===
--- branches/SAMBA_3_0/source/Makefile.in   2007-05-26 13:24:56 UTC (rev 
23154)
+++ branches/SAMBA_3_0/source/Makefile.in   2007-05-26 13:30:45 UTC (rev 
23155)
@@ -92,7 +92,7 @@
 DATADIR = @datadir@
 
 # The permissions to give the executables and other data
-INSTALLPERMS = 0755
+INSTALLPERMS_BIN = 0755
 INSTALLPERMS_DATA = 0644
 
 # set these to where to find various files
@@ -1728,28 +1728,28 @@
 # is not used
 
 installdirs:
-   @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) 
$(prefix) $(BINDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(PRIVATEDIR) $(PIDDIR) 
$(LOCKDIR) $(MANDIR)
+   @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) 
$(DESTDIR) $(prefix) $(BINDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(PRIVATEDIR) 
$(PIDDIR) $(LOCKDIR) $(MANDIR)
 
 installservers: all installdirs
-   @$(SHELL) script/installbin.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) 
$(SBINDIR) $(SBIN_PROGS)
+   @$(SHELL) script/installbin.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(prefix) 
$(SBINDIR) $(SBIN_PROGS)
 
 installbin: all installdirs
-   @$(SHELL) script/installbin.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) 
$(BINDIR) $(BIN_PROGS)
+   @$(SHELL) script/installbin.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(prefix) 
$(BINDIR) $(BIN_PROGS)
 
 installcifsmount: @CIFSMOUNT_PROGS@
-   @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) 
$(ROOTSBINDIR)
-   @$(SHELL) script/installbin.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) 
$(ROOTSBINDIR) @CIFSMOUNT_PROGS@
+   @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) 
$(DESTDIR) $(ROOTSBINDIR)
+   @$(SHELL) script/installbin.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(prefix) 
$(ROOTSBINDIR) @CIFSMOUNT_PROGS@
 
 # Some symlinks are required for the 'probing' of modules.
 # This mechanism should go at some point..
 installmodules: modules installdirs
-   @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR) 
$(prefix) $(VFSLIBDIR) $(VFS_MODULES)
-   @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR) 
$(prefix) $(PDBLIBDIR) $(PDB_MODULES)
-   @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR) 
$(prefix) $(RPCLIBDIR) $(RPC_MODULES)
-   @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR) 
$(prefix) $(IDMAPLIBDIR) $(IDMAP_MODULES)
-   @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR) 
$(prefix) $(NSSINFOLIBDIR) $(NSS_INFO_MODULES)
-   @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR) 
$(prefix) $(CHARSETLIBDIR) $(CHARSET_MODULES)
-   @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR) 
$(prefix) $(AUTHLIBDIR) $(AUTH_MODULES)
+   @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS_BIN) 
$(DESTDIR) $(prefix) $(VFSLIBDIR) $(VFS_MODULES)
+   @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS_BIN) 
$(DESTDIR) $(prefix) $(PDBLIBDIR) $(PDB_MODULES)
+   @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS_BIN) 
$(DESTDIR) $(prefix) $(RPCLIBDIR) $(RPC_MODULES)
+   @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS_BIN) 
$(DESTDIR) $(prefix) $(IDMAPLIBDIR) $(IDMAP_MODULES)
+   @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS_BIN) 
$(DESTDIR) $(prefix) $(NSSINFOLIBDIR) $(NSS_INFO_MODULES)
+   @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS_BIN) 
$(DESTDIR) $(prefix) $(CHARSETLIBDIR) $(CHARSET_MODULES)
+   @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS_BIN) 
$(DESTDIR) $(prefix) $(AUTHLIBDIR) $(AUTH_MODULES)
@$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(PDBLIBDIR) [EMAIL 
PROTECTED]@ [EMAIL PROTECTED]@
@$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(PDBLIBDIR) [EMAIL 
PROTECTED]@ [EMAIL PROTECTED]@
@$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(PDBLIBDIR) [EMAIL 
PROTECTED]@ [EMAIL PROTECTED]@
@@ -1760,7 +1760,7 @@
@$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(NSSINFOLIBDIR) 
../idmap/[EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@
 
 installscripts: installdirs
-   @$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) 
$(DESTDIR)$(BINDIR) $(SCRIPTS)
+   @$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS_BIN) 
$(DESTDIR)$(BINDIR) $(SCRIPTS)
 
 installdat: installdirs
@$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR) $(LIBDIR) $(srcdir)
@@ -1772,34 +1772,34 @@
@$(SHELL) 

svn commit: samba r23156 - in branches: SAMBA_3_0/source SAMBA_3_0_26/source

2007-05-26 Thread lmuelle
Author: lmuelle
Date: 2007-05-26 13:33:56 + (Sat, 26 May 2007)
New Revision: 23156

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=23156

Log:
Install the smb_share_modes.h header file.

Modified:
   branches/SAMBA_3_0/source/Makefile.in
   branches/SAMBA_3_0_26/source/Makefile.in


Changeset:
Modified: branches/SAMBA_3_0/source/Makefile.in
===
--- branches/SAMBA_3_0/source/Makefile.in   2007-05-26 13:30:45 UTC (rev 
23155)
+++ branches/SAMBA_3_0/source/Makefile.in   2007-05-26 13:33:56 UTC (rev 
23156)
@@ -1789,6 +1789,7 @@
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) 
$(DESTDIR) $(LIBDIR)
-$(INSTALLLIBCMD_SH) bin/[EMAIL PROTECTED]@ $(DESTDIR)$(LIBDIR)
-$(INSTALLLIBCMD_A) bin/libsmbsharemodes.a $(DESTDIR)$(LIBDIR)
+   -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) 
$(srcdir)/include/smb_share_modes.h $(DESTDIR)${prefix}/include
 
 installlibaddns: installdirs libaddns
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) 
$(DESTDIR) $(LIBDIR)

Modified: branches/SAMBA_3_0_26/source/Makefile.in
===
--- branches/SAMBA_3_0_26/source/Makefile.in2007-05-26 13:30:45 UTC (rev 
23155)
+++ branches/SAMBA_3_0_26/source/Makefile.in2007-05-26 13:33:56 UTC (rev 
23156)
@@ -1667,6 +1667,7 @@
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) 
$(DESTDIR) $(LIBDIR)
-$(INSTALLLIBCMD_SH) bin/[EMAIL PROTECTED]@ $(DESTDIR)$(LIBDIR)
-$(INSTALLLIBCMD_A) bin/libsmbsharemodes.a $(DESTDIR)$(LIBDIR)
+   -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) 
$(srcdir)/include/smb_share_modes.h $(DESTDIR)${prefix}/include
 
 installlibaddns: installdirs libaddns
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) 
$(DESTDIR) $(LIBDIR)



svn commit: samba r23157 - in branches/SAMBA_4_0/source/lib/talloc: .

2007-05-26 Thread jelmer
Author: jelmer
Date: 2007-05-26 16:55:08 + (Sat, 26 May 2007)
New Revision: 23157

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=23157

Log:
Add news file for talloc.
Added:
   branches/SAMBA_4_0/source/lib/talloc/NEWS


Changeset:
Added: branches/SAMBA_4_0/source/lib/talloc/NEWS
===
--- branches/SAMBA_4_0/source/lib/talloc/NEWS   2007-05-26 13:33:56 UTC (rev 
23156)
+++ branches/SAMBA_4_0/source/lib/talloc/NEWS   2007-05-26 16:55:08 UTC (rev 
23157)
@@ -0,0 +1,13 @@
+1.0.1  26 May 2007
+
+ BUGS
+  
+   * Set name of correctly when using talloc_append_string() (metze)
+
+ LICENSE
+   
+   * Change license of files in lib/replace to LGPL (was GPL). (jelmer)
+
+1.0.0  30 April 2007
+ 
+ Initial release.



svn commit: samba r23158 - in branches/SAMBA_4_0/source/lib/talloc: .

2007-05-26 Thread jelmer
Author: jelmer
Date: 2007-05-26 16:56:54 + (Sat, 26 May 2007)
New Revision: 23158

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=23158

Log:
Set version to 1.0.1.
Modified:
   branches/SAMBA_4_0/source/lib/talloc/configure.ac


Changeset:
Modified: branches/SAMBA_4_0/source/lib/talloc/configure.ac
===
--- branches/SAMBA_4_0/source/lib/talloc/configure.ac   2007-05-26 16:55:08 UTC 
(rev 23157)
+++ branches/SAMBA_4_0/source/lib/talloc/configure.ac   2007-05-26 16:56:54 UTC 
(rev 23158)
@@ -1,5 +1,5 @@
 AC_PREREQ(2.50)
-AC_INIT(talloc, 1.0)
+AC_INIT(talloc, 1.0.1)
 AC_CONFIG_SRCDIR([talloc.c])
 AC_SUBST(datarootdir)
 AC_CONFIG_HEADER(config.h)



svn commit: samba r23159 - in tags: . TALLOC_1_0_1

2007-05-26 Thread jelmer
Author: jelmer
Date: 2007-05-26 16:57:27 + (Sat, 26 May 2007)
New Revision: 23159

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=23159

Log:
Tag talloc 1.0.1

Added:
   tags/TALLOC_1_0_1/
   tags/TALLOC_1_0_1/NEWS
   tags/TALLOC_1_0_1/configure.ac
Removed:
   tags/TALLOC_1_0_1/configure.ac


Changeset:
Copied: tags/TALLOC_1_0_1 (from rev 23156, branches/SAMBA_4_0/source/lib/talloc)

Copied: tags/TALLOC_1_0_1/NEWS (from rev 23157, 
branches/SAMBA_4_0/source/lib/talloc/NEWS)

Deleted: tags/TALLOC_1_0_1/configure.ac
===
--- branches/SAMBA_4_0/source/lib/talloc/configure.ac   2007-05-26 13:33:56 UTC 
(rev 23156)
+++ tags/TALLOC_1_0_1/configure.ac  2007-05-26 16:57:27 UTC (rev 23159)
@@ -1,18 +0,0 @@
-AC_PREREQ(2.50)
-AC_INIT(talloc, 1.0)
-AC_CONFIG_SRCDIR([talloc.c])
-AC_SUBST(datarootdir)
-AC_CONFIG_HEADER(config.h)
-
-AC_LIBREPLACE_ALL_CHECKS
-
-m4_include(libtalloc.m4)
-
-AC_PATH_PROG(XSLTPROC,xsltproc)
-DOC_TARGET=
-if test -n $XSLTPROC; then
-   DOC_TARGET=doc
-fi
-AC_SUBST(DOC_TARGET)
-
-AC_OUTPUT(Makefile talloc.pc)

Copied: tags/TALLOC_1_0_1/configure.ac (from rev 23158, 
branches/SAMBA_4_0/source/lib/talloc/configure.ac)



svn commit: samba r23160 - in tags/TALLOC_1_0_1: .

2007-05-26 Thread jelmer
Author: jelmer
Date: 2007-05-26 16:57:53 + (Sat, 26 May 2007)
New Revision: 23160

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=23160

Log:
Add libreplace.

Added:
   tags/TALLOC_1_0_1/libreplace/


Changeset:
Copied: tags/TALLOC_1_0_1/libreplace (from rev 23156, 
branches/SAMBA_4_0/source/lib/replace)



Build status as of Sun May 27 00:00:03 2007

2007-05-26 Thread build
URL: http://build.samba.org/

--- /home/build/master/cache/broken_results.txt.old 2007-05-26 
00:02:37.0 +
+++ /home/build/master/cache/broken_results.txt 2007-05-27 00:01:48.0 
+
@@ -1,4 +1,4 @@
-Build status as of Sat May 26 00:00:02 2007
+Build status as of Sun May 27 00:00:03 2007
 
 Build counts:
 Tree Total  Broken Panic 
@@ -17,9 +17,9 @@
 samba0  0  0 
 samba-docs   0  0  0 
 samba-gtk3  2  0 
-samba4   33 24 4 
-samba_3_036 29 0 
+samba4   33 22 4 
+samba_3_036 18 0 
 smb-build33 32 0 
-talloc   35 5  0 
-tdb  35 5  0 
+talloc   36 6  0 
+tdb  34 5  0 
 


Rev 355: tweak timeouts in http://samba.org/~tridge/ctdb

2007-05-26 Thread tridge

revno: 355
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell [EMAIL PROTECTED]
branch nick: tridge
timestamp: Sun 2007-05-27 09:43:25 +1000
message:
  tweak timeouts
modified:
  common/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1
  include/ctdb_private.h 
ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13
=== modified file 'common/ctdb_recoverd.c'
--- a/common/ctdb_recoverd.c2007-05-26 04:01:08 +
+++ b/common/ctdb_recoverd.c2007-05-26 23:43:25 +
@@ -36,6 +36,7 @@
 }
 
 #define CONTROL_TIMEOUT() timeval_current_ofs(5, 0)
+#define MONITOR_TIMEOUT() timeval_current_ofs(1, 0)
 
 static int set_recovery_mode(struct ctdb_context *ctdb, struct ctdb_node_map 
*nodemap, uint32_t rec_mode)
 {
@@ -699,7 +700,7 @@
 
/* we only check for recovery once every second */
timed_out = 0;
-   event_add_timed(ctdb-ev, mem_ctx, CONTROL_TIMEOUT(), timeout_func, 
ctdb);
+   event_add_timed(ctdb-ev, mem_ctx, MONITOR_TIMEOUT(), timeout_func, 
ctdb);
while (!timed_out) {
event_loop_once(ctdb-ev);
}

=== modified file 'include/ctdb_private.h'
--- a/include/ctdb_private.h2007-05-26 04:01:08 +
+++ b/include/ctdb_private.h2007-05-26 23:43:25 +
@@ -334,7 +334,7 @@
 #define CTDB_TRAVERSE_TIMEOUT 20
 
 /* timeout between dead-node monitoring events */
-#define CTDB_MONITORING_TIMEOUT 3
+#define CTDB_MONITORING_TIMEOUT 2
 
 /* number of monitoring timeouts before a node is considered dead */
 #define CTDB_MONITORING_DEAD_COUNT 2



Rev 356: added function to send a raw tcp ack packet in http://samba.org/~tridge/ctdb

2007-05-26 Thread tridge

revno: 356
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell [EMAIL PROTECTED]
branch nick: tridge
timestamp: Sun 2007-05-27 13:39:36 +1000
message:
  added function to send a raw tcp ack packet
modified:
  takeover/system.c  system.c-20070525071636-a5n1ihghjtppy08r-3
=== modified file 'takeover/system.c'
--- a/takeover/system.c 2007-05-26 04:01:08 +
+++ b/takeover/system.c 2007-05-27 03:39:36 +
@@ -28,6 +28,7 @@
 #include net/if_arp.h
 
 
+
 /*
   send gratuitous arp reply after we have taken over an ip address
 
@@ -44,7 +45,6 @@
unsigned char buffer[64]; /*minimum eth frame size */
char *ptr;
 
-
/* for now, we only handle AF_INET addresses */
if (saddr-sin_family != AF_INET) {
DEBUG(0,(__location__  not an ipv4 address\n));
@@ -53,7 +53,7 @@
 
s = socket(AF_INET, SOCK_PACKET, htons(ETHERTYPE_ARP));
if (s == -1){
-   DEBUG(0,(__location__ failed to open raw socket\n));
+   DEBUG(0,(__location__  failed to open raw socket\n));
return -1;
}
 
@@ -128,6 +128,87 @@
 }
 
 /*
+  simple IP checksum - assumes data is multiple of 2 bytes long
+ */
+static uint16_t ip_checksum(uint16_t *data, size_t n)
+{
+   uint16_t sum=0;
+   while (n--) {
+   sum += ntohs(*data);
+   data++;
+   }
+   if (sum == 0) {
+   return 0x;
+   }
+   return htons(sum);
+}
+
+/*
+  send tcp ack packet from the specified IP/port to the specified
+  destination IP/port. 
+
+  This is used to trigger the receiving host into sending its own ACK,
+  which should trigger early detection of TCP reset by the client
+  after IP takeover
+ */
+int ctdb_sys_send_ack(const struct sockaddr_in *dest, 
+ const struct sockaddr_in *src)
+{
+   int s, ret;
+   uint32_t one = 1;
+   struct {
+   struct iphdr ip;
+   struct tcphdr tcp;
+   } pkt;
+
+   /* for now, we only handle AF_INET addresses */
+   if (src-sin_family != AF_INET || dest-sin_family != AF_INET) {
+   DEBUG(0,(__location__  not an ipv4 address\n));
+   return -1;
+   }
+
+   s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
+   if (s == -1) {
+   DEBUG(0,(__location__  failed to open raw socket (%s)\n,
+strerror(errno)));
+   return -1;
+   }
+
+   ret = setsockopt(s, SOL_IP, IP_HDRINCL, one, sizeof(one));
+   if (ret != 0) {
+   DEBUG(0,(__location__  failed to setup IP headers (%s)\n,
+strerror(errno)));
+   close(s);
+   return -1;
+   }
+
+   ZERO_STRUCT(pkt);
+   pkt.ip.version  = 4;
+   pkt.ip.ihl  = sizeof(pkt.ip)/4;
+   pkt.ip.tot_len  = sizeof(pkt);
+   pkt.ip.ttl  = 255;
+   pkt.ip.protocol = IPPROTO_TCP;
+   pkt.ip.saddr= src-sin_addr.s_addr;
+   pkt.ip.daddr= dest-sin_addr.s_addr;
+   pkt.ip.check= ip_checksum((uint16_t *)pkt.ip, sizeof(pkt.ip)/2);
+
+   pkt.tcp.source   = src-sin_port;
+   pkt.tcp.dest = dest-sin_port;
+   pkt.tcp.ack  = 1;
+   pkt.tcp.check= ip_checksum((uint16_t *)pkt.tcp, sizeof(pkt.tcp)/2);
+
+   ret = sendto(3, pkt, sizeof(pkt), 0, dest, sizeof(*dest));
+   if (ret != 0) {
+   DEBUG(0,(__location__  failed sendto (%s)\n, 
strerror(errno)));
+   }
+   close(s);
+
+   return ret;
+}
+
+
+
+/*
   takeover an IP on an interface
  */
 int ctdb_sys_take_ip(const char *ip, const char *interface)