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)
/* 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);
(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)));
}
/*
- 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;
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);