]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
change the signature for ctdb_sys_send_ack() to ctdb_sys_send_tcp()
authorRonnie Sahlberg <sahlberg@ronnie>
Wed, 4 Jul 2007 03:32:38 +0000 (13:32 +1000)
committerRonnie Sahlberg <sahlberg@ronnie>
Wed, 4 Jul 2007 03:32:38 +0000 (13:32 +1000)
to make it possible to provide which seq/ack numbers to use and also
whether the RST flag should be set.

update all callers to the new signature

(This used to be ctdb commit b694d7d4a6f3865a18bea8f484ba690e4ae7546c)

ctdb/include/ctdb_private.h
ctdb/takeover/ctdb_takeover.c
ctdb/takeover/system.c

index bce24343af77b58c43228a8a6df743a4599a11ce..7f1c5e30c641023f14effc193b31ee4d8e846cd8 100644 (file)
@@ -981,8 +981,9 @@ int ctdb_ctrl_get_public_ips(struct ctdb_context *ctdb,
 /* from takeover/system.c */
 int ctdb_sys_send_arp(const struct sockaddr_in *saddr, const char *iface);
 bool ctdb_sys_have_ip(const char *ip);
-int ctdb_sys_send_ack(const struct sockaddr_in *dest, 
-                     const struct sockaddr_in *src);
+int ctdb_sys_send_tcp(const struct sockaddr_in *dest, 
+                     const struct sockaddr_in *src,
+                     uint32_t seq, uint32_t ack, int rst);
 
 int ctdb_set_public_addresses(struct ctdb_context *ctdb, const char *alist);
 int ctdb_set_event_script(struct ctdb_context *ctdb, const char *script);
index 7f84eaedaa8fc539b254763bbfdaffdbf46f4faa..14d4adaae73ee7ed692fa623ccf31738d045fef4 100644 (file)
@@ -83,7 +83,7 @@ static void ctdb_control_send_arp(struct event_context *ev, struct timed_event *
                         (unsigned)ntohs(tcp->daddr.sin_port), 
                         inet_ntoa(tcp->saddr.sin_addr),
                         (unsigned)ntohs(tcp->saddr.sin_port)));
-               ret = ctdb_sys_send_ack(&tcp->saddr, &tcp->daddr);
+               ret = ctdb_sys_send_tcp(&tcp->saddr, &tcp->daddr, 0, 0, 0);
                if (ret != 0) {
                        DEBUG(0,(__location__ " Failed to send tcp tickle ack for %s\n",
                                 inet_ntoa(tcp->saddr.sin_addr)));
index 7cd4dbcc7d37ea76281f71dec387a934f819128a..74a860a918e34206bb836040027cf1136c1baf2f 100644 (file)
@@ -174,15 +174,19 @@ static uint16_t tcp_checksum(uint16_t *data, size_t n, struct iphdr *ip)
 }
 
 /*
-  send tcp ack packet from the specified IP/port to the specified
+  Send tcp segment 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
+
+  This can also be used to send RST segments (if rst is true) and also
+  if correct seq and ack numbers are provided.
  */
-int ctdb_sys_send_ack(const struct sockaddr_in *dest, 
-                     const struct sockaddr_in *src)
+int ctdb_sys_send_tcp(const struct sockaddr_in *dest, 
+                     const struct sockaddr_in *src,
+                     uint32_t seq, uint32_t ack, int rst)
 {
        int s, ret;
        uint32_t one = 1;
@@ -224,7 +228,12 @@ int ctdb_sys_send_ack(const struct sockaddr_in *dest,
 
        pkt.tcp.source   = src->sin_port;
        pkt.tcp.dest     = dest->sin_port;
+       pkt.tcp.seq      = seq;
+       pkt.tcp.ack_seq  = ack;
        pkt.tcp.ack      = 1;
+       if (rst) {
+               pkt.tcp.rst      = 1;
+       }
        pkt.tcp.doff     = sizeof(pkt.tcp)/4;
        pkt.tcp.window   = htons(1234);
        pkt.tcp.check    = tcp_checksum((uint16_t *)&pkt.tcp, sizeof(pkt.tcp), &pkt.ip);