/*
This function is used to open a raw socket to capture from
*/
-int ctdb_sys_open_capture_socket(void)
+int ctdb_sys_open_capture_socket(const char *iface, void **private_data)
{
int s;
return s;
}
+/*
+ This function is used to do any additional cleanup required when closing
+ a capture socket.
+ Note that the socket itself is closed automatically in the caller.
+ */
+int ctdb_sys_close_capture_socket(void *private_data)
+{
+ return 0;
+}
+
/*
This function is used to open a raw socket to send tickles from
*/
/*
called when the raw socket becomes readable
*/
-int ctdb_sys_read_tcp_packet(int s, struct sockaddr_in *src, struct sockaddr_in *dst,
- uint32_t *ack_seq, uint32_t *seq)
+int ctdb_sys_read_tcp_packet(int s, void *private_data,
+ struct sockaddr_in *src, struct sockaddr_in *dst,
+ uint32_t *ack_seq, uint32_t *seq)
{
int ret;
#define RCVPKTSIZE 100
bool parse_ip_port(const char *s, struct sockaddr_in *ip);
-int ctdb_sys_open_capture_socket(void);
+int ctdb_sys_open_capture_socket(const char *iface, void **private_data);
+int ctdb_sys_close_capture_socket(void *private_data);
int ctdb_sys_open_sending_socket(void);
-int ctdb_sys_read_tcp_packet(int s, struct sockaddr_in *src, struct sockaddr_in *dst,
+int ctdb_sys_read_tcp_packet(int s, void *private_data, struct sockaddr_in *src, struct sockaddr_in *dst,
uint32_t *ack_seq, uint32_t *seq);
int ctdb_ctrl_killtcp(struct ctdb_context *ctdb,
int sending_fd;
struct fd_event *fde;
struct ctdb_killtcp_connection *connections;
+ void *private_data;
};
/*
return;
}
- if (ctdb_sys_read_tcp_packet(killtcp->capture_fd, &src, &dst,
- &ack_seq, &seq) != 0) {
+ if (ctdb_sys_read_tcp_packet(killtcp->capture_fd,
+ killtcp->private_data,
+ &src, &dst,
+ &ack_seq, &seq) != 0) {
/* probably a non-tcp ACK packet */
return;
}
If we dont have a socket to listen on yet we must create it
*/
if (killtcp->capture_fd == -1) {
- killtcp->capture_fd = ctdb_sys_open_capture_socket();
+ killtcp->capture_fd = ctdb_sys_open_capture_socket(ctdb->takeover.interface, &killtcp->private_data);
if (killtcp->capture_fd == -1) {
DEBUG(0,(__location__ " Failed to open capturing socket for killtcp\n"));
goto failed;