39 #include <sys/types.h> 41 #include <sys/socket.h> 44 #include <sys/ioctl.h> 45 #include <sys/param.h> 46 #include <netinet/in.h> 47 #include <net/ethernet.h> 48 #include <arpa/inet.h> 61 #include <qb/qbdefs.h> 62 #include <qb/qbloop.h> 65 #include <libnozzle.h> 82 #define MSG_NOSIGNAL 0 86 static int setup_nozzle(
void *knet_context);
90 #define CFG_INTERFACE_STATUS_MAX_LEN 512 106 unsigned int msg_len,
112 unsigned int link_no);
140 const char *
function,
174 #ifdef HAVE_LIBNOZZLE 178 char *nozzle_macaddr;
179 nozzle_t nozzle_handle;
195 static void totemknet_start_merge_detect_timeout(
198 static void totemknet_stop_merge_detect_timeout(
201 static void log_flush_messages (
209 #define knet_log_printf(level, format, args...) \ 211 instance->totemknet_log_printf ( \ 212 level, instance->totemknet_subsys_id, \ 213 __FUNCTION__, __FILE__, __LINE__, \ 214 (const char *)format, ##args); \ 217 #define libknet_log_printf(level, format, args...) \ 219 instance->totemknet_log_printf ( \ 220 level, instance->knet_subsys_id, \ 221 __FUNCTION__, "libknet.h", __LINE__, \ 222 (const char *)format, ##args); \ 225 #define KNET_LOGSYS_PERROR(err_num, level, fmt, args...) \ 227 char _error_str[LOGSYS_MAX_PERROR_MSG_LEN]; \ 228 const char *_error_ptr = qb_strerror_r(err_num, _error_str, sizeof(_error_str)); \ 229 instance->totemknet_log_printf ( \ 230 level, instance->totemknet_subsys_id, \ 231 __FUNCTION__, __FILE__, __LINE__, \ 232 fmt ": %s (%d)", ##args, _error_ptr, err_num); \ 236 #ifdef HAVE_LIBNOZZLE 237 static inline int is_ether_addr_multicast(
const uint8_t *
addr)
239 return (addr[0] & 0x01);
241 static inline int is_ether_addr_zero(
const uint8_t *
addr)
243 return (!addr[0] && !addr[1] && !addr[2] && !addr[3] && !addr[4] && !addr[5]);
246 static int ether_host_filter_fn(
void *private_data,
247 const unsigned char *outdata,
250 knet_node_id_t this_host_id,
251 knet_node_id_t src_host_id,
253 knet_node_id_t *dst_host_ids,
254 size_t *dst_host_ids_entries)
256 struct ether_header *eth_h = (
struct ether_header *)outdata;
257 uint8_t *dst_mac = (uint8_t *)eth_h->ether_dhost;
258 uint16_t dst_host_id;
260 if (is_ether_addr_zero(dst_mac))
263 if (is_ether_addr_multicast(dst_mac)) {
267 memmove(&dst_host_id, &dst_mac[4], 2);
269 dst_host_ids[0] = ntohs(dst_host_id);
270 *dst_host_ids_entries = 1;
276 static int dst_host_filter_callback_fn(
void *private_data,
277 const unsigned char *outdata,
280 knet_node_id_t this_host_id,
281 knet_node_id_t src_host_id,
283 knet_node_id_t *dst_host_ids,
284 size_t *dst_host_ids_entries)
289 #ifdef HAVE_LIBNOZZLE 291 return ether_host_filter_fn(private_data,
292 outdata, outdata_len,
294 this_host_id, src_host_id,
297 dst_host_ids_entries);
302 *dst_host_ids_entries = 1;
306 *dst_host_ids_entries = 0;
312 static void socket_error_callback_fn(
void *private_data,
int datafd, int8_t channel, uint8_t tx_rx,
int error,
int errorno)
317 if ((error == -1 && errorno != EAGAIN) || (error == 0)) {
318 knet_handle_remove_datafd(instance->
knet_handle, datafd);
322 static void host_change_callback_fn(
void *private_data, knet_node_id_t host_id, uint8_t reachable, uint8_t remote, uint8_t external)
330 static void pmtu_change_callback_fn(
void *private_data,
unsigned int data_mtu)
341 const char *cipher_type,
342 const char *hash_type)
348 static inline void ucast_sendmsg (
352 unsigned int msg_len)
356 struct msghdr msg_ucast;
361 iovec.iov_base = (
void *)msg;
362 iovec.iov_len = msg_len;
367 memset(&msg_ucast, 0,
sizeof(msg_ucast));
368 msg_ucast.msg_iov = (
void *)&iovec;
369 msg_ucast.msg_iovlen = 1;
370 #ifdef HAVE_MSGHDR_CONTROL 371 msg_ucast.msg_control = 0;
373 #ifdef HAVE_MSGHDR_CONTROLLEN 374 msg_ucast.msg_controllen = 0;
376 #ifdef HAVE_MSGHDR_FLAGS 377 msg_ucast.msg_flags = 0;
379 #ifdef HAVE_MSGHDR_ACCRIGHTS 380 msg_ucast.msg_accrights = NULL;
382 #ifdef HAVE_MSGHDR_ACCRIGHTSLEN 383 msg_ucast.msg_accrightslen = 0;
394 "sendmsg(ucast) failed (non-critical)");
398 static inline void mcast_sendmsg (
401 unsigned int msg_len,
406 struct msghdr msg_mcast;
409 iovec.iov_base = (
void *)msg;
410 iovec.iov_len = msg_len;
417 memset(&msg_mcast, 0,
sizeof(msg_mcast));
418 msg_mcast.msg_iov = (
void *)&iovec;
419 msg_mcast.msg_iovlen = 1;
420 #ifdef HAVE_MSGHDR_CONTROL 421 msg_mcast.msg_control = 0;
423 #ifdef HAVE_MSGHDR_CONTROLLEN 424 msg_mcast.msg_controllen = 0;
426 #ifdef HAVE_MSGHDR_FLAGS 427 msg_mcast.msg_flags = 0;
429 #ifdef HAVE_MSGHDR_ACCRIGHTS 430 msg_mcast.msg_accrights = NULL;
432 #ifdef HAVE_MSGHDR_ACCRIGHTSLEN 433 msg_mcast.msg_accrightslen = 0;
453 static int node_compare(
const void *aptr,
const void *bptr)
457 a = *(uint16_t *)aptr;
458 b = *(uint16_t *)bptr;
465 unsigned int *iface_count)
468 struct knet_link_status link_status;
469 knet_node_id_t host_list[KNET_MAX_HOST];
470 uint8_t link_list[KNET_MAX_LINK];
484 res = knet_host_get_host_list(instance->
knet_handle,
485 host_list, &num_hosts);
489 qsort(host_list, num_hosts,
sizeof(uint16_t), node_compare);
499 for (j=0; j<num_hosts; j++) {
500 res = knet_link_get_link_list(instance->
knet_handle,
501 host_list[j], link_list, &num_links);
507 for (i=0; i < num_links; i++) {
522 sizeof(link_status));
524 ptr[j] =
'0' + (link_status.enabled |
525 link_status.connected<<1 |
526 link_status.dynconnected<<2);
547 static knet_node_id_t nodes[KNET_MAX_HOST];
548 uint8_t links[KNET_MAX_LINK];
557 res = knet_host_get_host_list(instance->
knet_handle, nodes, &num_nodes);
565 for (i=0; i<num_nodes; i++) {
567 res = knet_link_get_link_list(instance->
knet_handle, nodes[i], links, &num_links);
572 for (j=0; j<num_links; j++) {
573 res = knet_link_set_enable(instance->
knet_handle, nodes[i], links[j], 0);
577 res = knet_link_clear_config(instance->
knet_handle, nodes[i], links[j]);
582 res = knet_host_remove(instance->
knet_handle, nodes[i]);
589 res = knet_handle_setfwd(instance->
knet_handle, 0);
598 totemknet_stop_merge_detect_timeout(instance);
600 log_flush_messages(instance);
605 static int log_deliver_fn (
611 char buffer[
sizeof(
struct knet_log_msg)*4];
612 char *bufptr = buffer;
616 len = read(fd, buffer,
sizeof(buffer));
618 struct knet_log_msg *msg = (
struct knet_log_msg *)bufptr;
619 switch (msg->msglevel) {
622 knet_log_get_subsystem_name(msg->subsystem),
627 knet_log_get_subsystem_name(msg->subsystem),
632 knet_log_get_subsystem_name(msg->subsystem),
637 knet_log_get_subsystem_name(msg->subsystem),
641 bufptr +=
sizeof(
struct knet_log_msg);
642 done +=
sizeof(
struct knet_log_msg);
647 static int data_deliver_fn (
653 struct msghdr msg_hdr;
654 struct iovec iov_recv;
655 struct sockaddr_storage system_from;
657 int truncated_packet;
660 iov_recv.iov_len = KNET_MAX_PACKET_SIZE;
663 msg_hdr.msg_namelen =
sizeof (
struct sockaddr_storage);
664 msg_hdr.msg_iov = &iov_recv;
665 msg_hdr.msg_iovlen = 1;
666 #ifdef HAVE_MSGHDR_CONTROL 667 msg_hdr.msg_control = 0;
669 #ifdef HAVE_MSGHDR_CONTROLLEN 670 msg_hdr.msg_controllen = 0;
672 #ifdef HAVE_MSGHDR_FLAGS 673 msg_hdr.msg_flags = 0;
675 #ifdef HAVE_MSGHDR_ACCRIGHTS 676 msg_hdr.msg_accrights = NULL;
678 #ifdef HAVE_MSGHDR_ACCRIGHTSLEN 679 msg_hdr.msg_accrightslen = 0;
682 msg_len = recvmsg (fd, &msg_hdr,
MSG_NOSIGNAL | MSG_DONTWAIT);
687 truncated_packet = 0;
689 #ifdef HAVE_MSGHDR_FLAGS 690 if (msg_hdr.msg_flags & MSG_TRUNC) {
691 truncated_packet = 1;
698 if (bytes_received == KNET_MAX_PACKET_SIZE) {
699 truncated_packet = 1;
703 if (truncated_packet) {
705 "Received too big message. This may be because something bad is happening" 706 "on the network (attack?), or you tried join more nodes than corosync is" 707 "compiled with (%u) or bug in the code (bad estimation of " 724 static void timer_function_netif_check_timeout (
742 #ifdef HAVE_KNET_ACCESS_LIST 749 err = knet_handle_enable_access_lists(instance->
knet_handle, value);
758 static void totemknet_refresh_config(
760 const char *key_name,
769 knet_node_id_t host_ids[KNET_MAX_HOST];
780 if (
icmap_get_uint8(
"config.totemconfig_reload_in_progress", &reloading) ==
CS_OK && reloading) {
784 knet_set_access_list_config(instance);
797 err = knet_host_get_host_list(instance->
knet_handle, host_ids, &num_nodes);
802 for (i=0; i<num_nodes; i++) {
808 err = knet_link_set_ping_timers(instance->
knet_handle, host_ids[i], link_no,
815 err = knet_link_set_pong_count(instance->
knet_handle, host_ids[i], link_no,
820 err = knet_link_set_priority(instance->
knet_handle, host_ids[i], link_no,
841 totemknet_refresh_config,
847 totemknet_refresh_config,
849 &icmap_track_reload);
858 qb_loop_t *poll_handle,
867 unsigned int msg_len,
870 void (*iface_change_fn) (
873 unsigned int link_no),
875 void (*mtu_changed) (
879 void (*target_set_completed) (
888 if (instance == NULL) {
892 totemknet_instance_initialize (instance);
942 fcntl(instance->
logpipes[0], F_SETFL, O_NONBLOCK);
943 fcntl(instance->
logpipes[1], F_SETFL, O_NONBLOCK);
945 #if !defined(KNET_API_VER) || (KNET_API_VER == 1) 948 #if KNET_API_VER == 2 957 knet_set_access_list_config(instance);
963 res = knet_handle_enable_filter(instance->
knet_handle, instance, dst_host_filter_callback_fn);
967 res = knet_handle_enable_sock_notify(instance->
knet_handle, instance, socket_error_callback_fn);
971 res = knet_host_enable_status_change_notify(instance->
knet_handle, instance, host_change_callback_fn);
975 res = knet_handle_enable_pmtud_notify(instance->
knet_handle, instance, pmtu_change_callback_fn);
979 global_instance = instance;
985 knet_log_printf(LOG_DEBUG,
"knet_handle_add_datafd failed: %s", strerror(errno));
991 struct knet_handle_crypto_cfg crypto_cfg;
999 res = knet_handle_crypto(instance->
knet_handle, &crypto_cfg);
1008 knet_log_printf(LOG_INFO,
"kronosnet crypto initialized: %s/%s", crypto_cfg.crypto_cipher_type, crypto_cfg.crypto_hash_type);
1016 instance->
link_mode = KNET_LINK_POLICY_PASSIVE;
1018 instance->
link_mode = KNET_LINK_POLICY_ACTIVE;
1021 instance->
link_mode = KNET_LINK_POLICY_RR;
1034 POLLIN, instance, log_deliver_fn);
1039 POLLIN, instance, data_deliver_fn);
1047 100*QB_TIME_NS_IN_MSEC,
1049 timer_function_netif_check_timeout,
1050 &instance->timer_netif_check_timeout);
1052 totemknet_start_merge_detect_timeout(instance);
1055 totemknet_add_config_notifications(instance);
1061 *knet_context = instance;
1066 log_flush_messages(instance);
1074 return malloc(KNET_MAX_PACKET_SIZE + 512);
1084 int processor_count)
1102 unsigned int msg_len)
1107 ucast_sendmsg (instance, &instance->
token_target, msg, msg_len);
1114 unsigned int msg_len)
1119 mcast_sendmsg (instance, msg, msg_len, 0);
1127 unsigned int msg_len)
1132 mcast_sendmsg (instance, msg, msg_len, 1);
1174 struct sockaddr_storage system_from;
1175 struct msghdr msg_hdr;
1176 struct iovec iov_recv;
1179 int msg_processed = 0;
1182 iov_recv.iov_len = KNET_MAX_PACKET_SIZE;
1185 msg_hdr.msg_namelen =
sizeof (
struct sockaddr_storage);
1186 msg_hdr.msg_iov = &iov_recv;
1187 msg_hdr.msg_iovlen = 1;
1188 #ifdef HAVE_MSGHDR_CONTROL 1189 msg_hdr.msg_control = 0;
1191 #ifdef HAVE_MSGHDR_CONTROLLEN 1192 msg_hdr.msg_controllen = 0;
1194 #ifdef HAVE_MSGHDR_FLAGS 1195 msg_hdr.msg_flags = 0;
1197 #ifdef HAVE_MSGHDR_ACCRIGHTS 1198 msg_msg_hdr.msg_accrights = NULL;
1200 #ifdef HAVE_MSGHDR_ACCRIGHTSLEN 1201 msg_msg_hdr.msg_accrightslen = 0;
1206 ufd.events = POLLIN;
1207 nfds = poll (&ufd, 1, 0);
1208 if (nfds == 1 && ufd.revents & POLLIN) {
1216 }
while (nfds == 1);
1218 return (msg_processed);
1224 unsigned int iface_no)
1246 int port = instance->
ip_port[link_no];
1247 struct sockaddr_storage remote_ss;
1248 struct sockaddr_storage local_ss;
1252 knet_node_id_t host_ids[KNET_MAX_HOST];
1253 size_t num_host_ids;
1271 err = knet_host_get_host_list(instance->
knet_handle, host_ids, &num_host_ids);
1276 for (i=0; i<num_host_ids; i++) {
1277 if (host_ids[i] == member->
nodeid) {
1284 if (err != 0 && errno != EEXIST) {
1300 memset(&local_ss, 0,
sizeof(local_ss));
1309 KNET_TRANSPORT_LOOPBACK,
1310 &local_ss, &remote_ss, KNET_LINK_FLAG_TRAFFICHIPRIO);
1315 &local_ss, &remote_ss, KNET_LINK_FLAG_TRAFFICHIPRIO);
1366 uint8_t link_list[KNET_MAX_LINK];
1380 res = knet_link_set_enable(instance->
knet_handle, token_target->
nodeid, link_no, 0);
1386 res = knet_link_clear_config(instance->
knet_handle, token_target->
nodeid, link_no);
1393 res = knet_link_get_link_list(instance->
knet_handle,
1394 token_target->
nodeid, link_list, &num_links);
1399 if (num_links == 0) {
1413 struct totem_config *totem_config)
1416 struct knet_handle_compress_cfg compress_cfg;
1424 res = knet_handle_compress(instance->
knet_handle, &compress_cfg);
1430 #ifdef HAVE_LIBNOZZLE 1434 (void)setup_nozzle(instance);
1445 (void) knet_handle_clear_stats(instance->
knet_handle, KNET_CLEARSTATS_HANDLE_AND_LINK);
1450 knet_node_id_t node, uint8_t link_no,
1451 struct knet_link_status *status)
1457 if (!global_instance) {
1465 res = knet_link_get_status(global_instance->
knet_handle, node, link_no, status,
sizeof(
struct knet_link_status));
1487 struct knet_handle_stats *stats)
1490 if (!global_instance) {
1494 return knet_handle_get_stats(global_instance->
knet_handle, stats,
sizeof(
struct knet_handle_stats));
1497 static void timer_function_merge_detect_timeout (
1508 totemknet_start_merge_detect_timeout(instance);
1511 static void totemknet_start_merge_detect_timeout(
1520 timer_function_merge_detect_timeout,
1521 &instance->timer_merge_detect_timeout);
1525 static void totemknet_stop_merge_detect_timeout(
1534 static void log_flush_messages (
void *knet_context)
1544 pfd.events = POLLIN;
1547 if ((poll(&pfd, 1, 0) > 0) &&
1548 (pfd.revents & POLLIN) &&
1549 (log_deliver_fn(instance->
logpipes[0], POLLIN, instance) == 0)) {
1558 #ifdef HAVE_LIBNOZZLE 1559 #define NOZZLE_NAME "nozzle.name" 1560 #define NOZZLE_IPADDR "nozzle.ipaddr" 1561 #define NOZZLE_PREFIX "nozzle.ipprefix" 1562 #define NOZZLE_MACADDR "nozzle.macaddr" 1564 #define NOZZLE_CHANNEL 1 1567 static char *get_nozzle_script_dir(
void *knet_context)
1570 char filename[PATH_MAX + FILENAME_MAX + 1];
1571 static char updown_dirname[PATH_MAX + FILENAME_MAX + 1];
1573 const char *dirname_res;
1578 res = snprintf(filename,
sizeof(filename),
"%s",
1580 if (res >=
sizeof(filename)) {
1585 dirname_res = dirname(filename);
1587 res = snprintf(updown_dirname,
sizeof(updown_dirname),
"%s/%s",
1588 dirname_res,
"updown.d");
1589 if (res >=
sizeof(updown_dirname)) {
1593 return updown_dirname;
1605 res = nozzle_run_updown(instance->nozzle_handle, type, &exec_string);
1606 if (res == -1 && errno != ENOENT) {
1608 }
else if (res == -2) {
1623 const char *input_addr,
1624 const char *prefix,
int nodeid,
1625 char *output_addr,
size_t output_len)
1629 int max_prefix = 64;
1630 uint32_t nodeid_mask;
1632 uint32_t masked_nodeid;
1633 struct in_addr *
addr;
1636 coloncolon = strstr(input_addr,
"::");
1641 bits = atoi(prefix);
1642 if (bits < 8 || bits > max_prefix) {
1649 memcpy(output_addr, input_addr, coloncolon-input_addr);
1650 sprintf(output_addr + (coloncolon-input_addr),
"::%x", nodeid);
1657 nodeid_mask = UINT32_MAX & ((1<<(32 - bits)) - 1);
1658 addr_mask = UINT32_MAX ^ nodeid_mask;
1659 masked_nodeid = nodeid & nodeid_mask;
1665 addr = (
struct in_addr *)&totemip.
addr;
1666 addr->s_addr &= htonl(addr_mask);
1667 addr->s_addr |= htonl(masked_nodeid);
1669 inet_ntop(AF_INET, addr, output_addr, output_len);
1673 static int create_nozzle_device(
void *knet_context,
const char *name,
1674 const char *ipaddr,
const char *prefix,
1675 const char *macaddr)
1678 char device_name[IFNAMSIZ+1];
1679 size_t size = IFNAMSIZ;
1680 int8_t channel = NOZZLE_CHANNEL;
1681 nozzle_t nozzle_dev;
1685 char parsed_ipaddr[INET6_ADDRSTRLEN];
1688 memset(device_name, 0, size);
1689 memset(&mac, 0,
sizeof(mac));
1690 strncpy(device_name, name, size);
1692 updown_dir = get_nozzle_script_dir(knet_context);
1695 nozzle_dev = nozzle_open(device_name, size, updown_dir);
1700 instance->nozzle_handle = nozzle_dev;
1702 if (nozzle_set_mac(nozzle_dev, macaddr) < 0) {
1707 if (reparse_nozzle_ip_address(instance, ipaddr, prefix, instance->
our_nodeid, parsed_ipaddr,
sizeof(parsed_ipaddr))) {
1712 if (nozzle_add_ip(nozzle_dev, parsed_ipaddr, prefix) < 0) {
1717 nozzle_fd = nozzle_get_fd(nozzle_dev);
1720 res = knet_handle_add_datafd(instance->
knet_handle, &nozzle_fd, &channel);
1726 run_nozzle_script(instance, NOZZLE_PREUP,
"pre-up");
1728 res = nozzle_set_up(nozzle_dev);
1733 run_nozzle_script(instance, NOZZLE_UP,
"up");
1738 nozzle_close(nozzle_dev);
1742 static int remove_nozzle_device(
void *knet_context)
1748 res = knet_handle_get_datafd(instance->
knet_handle, NOZZLE_CHANNEL, &datafd);
1754 res = knet_handle_remove_datafd(instance->
knet_handle, datafd);
1760 run_nozzle_script(instance, NOZZLE_DOWN,
"pre-down");
1761 res = nozzle_set_down(instance->nozzle_handle);
1766 run_nozzle_script(instance, NOZZLE_POSTDOWN,
"post-down");
1768 res = nozzle_close(instance->nozzle_handle);
1779 free(instance->nozzle_name);
1780 free(instance->nozzle_ipaddr);
1781 free(instance->nozzle_prefix);
1782 free(instance->nozzle_macaddr);
1784 instance->nozzle_name = instance->nozzle_ipaddr = instance->nozzle_prefix =
1785 instance->nozzle_macaddr = NULL;
1788 static int setup_nozzle(
void *knet_context)
1791 char *ipaddr_str = NULL;
1792 char *name_str = NULL;
1793 char *prefix_str = NULL;
1794 char *macaddr_str = NULL;
1811 remove_nozzle_device(instance);
1812 free_nozzle(instance);
1831 if (macaddr_str && strlen(macaddr_str) != 17) {
1836 macaddr_str = (
char*)
"54:54:01:00:00:00";
1839 if (instance->nozzle_name &&
1840 (strcmp(name_str, instance->nozzle_name) == 0) &&
1841 (strcmp(ipaddr_str, instance->nozzle_ipaddr) == 0) &&
1842 (strcmp(prefix_str, instance->nozzle_prefix) == 0) &&
1843 (instance->nozzle_macaddr == NULL ||
1844 strcmp(macaddr_str, instance->nozzle_macaddr) == 0)) {
1851 memcpy(mac, macaddr_str, 12);
1852 snprintf(mac+12,
sizeof(mac) - 13,
"%02x:%02x",
1857 if (name_res ==
CS_OK && name_str) {
1859 if (instance->nozzle_name) {
1860 remove_nozzle_device(instance);
1861 free_nozzle(instance);
1864 res = create_nozzle_device(knet_context, name_str, ipaddr_str, prefix_str,
1867 instance->nozzle_name = strdup(name_str);
1868 instance->nozzle_ipaddr = strdup(ipaddr_str);
1869 instance->nozzle_prefix = strdup(prefix_str);
1870 instance->nozzle_macaddr = strdup(macaddr_str);
1871 if (!instance->nozzle_name || !instance->nozzle_ipaddr ||
1872 !instance->nozzle_prefix) {
1879 free_nozzle(instance);
1887 if (macaddr_res ==
CS_OK) {
1893 #endif // HAVE_LIBNOZZLE uint16_t ip_port[INTERFACE_MAX]
int totemknet_log_level_security
char * link_status[INTERFACE_MAX]
int totemknet_member_remove(void *knet_context, const struct totem_ip_address *token_target, int link_no)
#define LOGSYS_LEVEL_INFO
qb_loop_timer_handle timer_merge_detect_timeout
struct totem_interface * interfaces
void stats_knet_add_handle(void)
int totemknet_log_level_error
unsigned int merge_detect_messages_sent_before_timeout
#define libknet_log_printf(level, format, args...)
struct totem_ip_address my_ids[INTERFACE_MAX]
The totem_ip_address struct.
#define CFG_INTERFACE_STATUS_MAX_LEN
const char * totemip_print(const struct totem_ip_address *addr)
unsigned char addr[TOTEMIP_ADDRLEN]
#define knet_log_printf(level, format, args...)
int send_merge_detect_message
int totemknet_finalize(void *knet_context)
uint32_t knet_compression_threshold
void(* totemknet_iface_change_fn)(void *context, const struct totem_ip_address *iface_address, unsigned int link_no)
char link_mode[TOTEM_LINK_MODE_BYTES]
unsigned int knet_pmtud_interval
unsigned char addr[TOTEMIP_ADDRLEN]
int totemknet_link_get_status(knet_node_id_t node, uint8_t link_no, struct knet_link_status *status)
void totemknet_buffer_release(void *ptr)
void totemknet_stats_clear(void *knet_context)
#define KNET_LOGSYS_PERROR(err_num, level, fmt, args...)
void totemip_copy(struct totem_ip_address *addr1, const struct totem_ip_address *addr2)
void stats_knet_del_member(knet_node_id_t nodeid, uint8_t link)
int _logsys_subsys_create(const char *subsys, const char *filename)
_logsys_subsys_create
unsigned int private_key_len
int totemknet_log_level_notice
#define ICMAP_TRACK_DELETE
int totemknet_crypto_set(void *knet_context, const char *cipher_type, const char *hash_type)
unsigned int block_unlisted_ips
qb_loop_timer_handle timer_netif_check_timeout
int totemknet_mcast_flush_send(void *knet_context, const void *msg, unsigned int msg_len)
int totemknet_iface_check(void *knet_context)
void(*) void knet_context)
cs_error_t icmap_get_uint8(const char *key_name, uint8_t *u8)
#define LOGSYS_LEVEL_WARNING
#define ICMAP_TRACK_MODIFY
int totemknet_log_level_warning
char * knet_compression_model
const char * corosync_get_config_file(void)
int totemknet_token_target_set(void *knet_context, unsigned int nodeid)
struct totem_config * totem_config
int totemknet_reconfigure(void *knet_context, struct totem_config *totem_config)
int totemknet_iface_set(void *knet_context, const struct totem_ip_address *local_addr, unsigned short ip_port, unsigned int iface_no)
int totemknet_processor_count_set(void *knet_context, int processor_count)
#define LOGSYS_LEVEL_ERROR
int totemknet_recv_flush(void *knet_context)
int totemknet_send_flush(void *knet_context)
unsigned char private_key[TOTEM_PRIVATE_KEY_LEN_MAX]
cs_error_t
The cs_error_t enum.
#define LOGSYS_LEVEL_DEBUG
struct totem_ip_address boundto
cs_error_t icmap_get_uint32(const char *key_name, uint32_t *u32)
char iov_buffer[KNET_MAX_PACKET_SIZE]
void(* log_printf)(int level, int subsys, const char *function_name, const char *file_name, int file_line, const char *format,...) __attribute__((format(printf
int totemknet_handle_get_stats(struct knet_handle_stats *stats)
struct totemknet_instance * global_instance
struct totem_message_header header
int knet_compression_level
int totemip_parse(struct totem_ip_address *totemip, const char *addr, enum totem_ip_version_enum ip_version)
struct crypto_instance * crypto_inst
void(* totemknet_target_set_completed)(void *context)
struct totem_ip_address token_target
#define PROCESSOR_COUNT_MAX
int totemknet_member_add(void *knet_context, const struct totem_ip_address *local, const struct totem_ip_address *member, int link_no)
struct totemknet_instance * instance
cs_error_t icmap_get_string(const char *key_name, char **str)
Shortcut for icmap_get for string type.
#define LOGSYS_LEVEL_CRIT
void(* totemknet_deliver_fn)(void *context, const void *msg, unsigned int msg_len, const struct sockaddr_storage *system_from)
int totemip_totemip_to_sockaddr_convert(struct totem_ip_address *ip_addr, uint16_t port, struct sockaddr_storage *saddr, int *addrlen)
void(* totemknet_log_printf)(int level, int subsys, const char *function, const char *file, int line, const char *format,...) __attribute__((format(printf
struct totem_logging_configuration totem_logging_configuration
void(* totemknet_mtu_changed)(void *context, int net_mtu)
void stats_knet_add_member(knet_node_id_t nodeid, uint8_t link)
struct srp_addr system_from
char * crypto_cipher_type
void totemknet_net_mtu_adjust(void *knet_context, struct totem_config *totem_config)
int totemknet_member_list_rebind_ip(void *knet_context)
unsigned int merge_timeout
int totemknet_mcast_noflush_send(void *knet_context, const void *msg, unsigned int msg_len)
int totemknet_log_level_debug
int totemknet_token_send(void *knet_context, const void *msg, unsigned int msg_len)
struct totem_ip_address bindnet
int totemknet_recv_mcast_empty(void *knet_context)
int totemknet_initialize(qb_loop_t *poll_handle, void **knet_context, struct totem_config *totem_config, totemsrp_stats_t *stats, void *context, void(*deliver_fn)(void *context, const void *msg, unsigned int msg_len, const struct sockaddr_storage *system_from), void(*iface_change_fn)(void *context, const struct totem_ip_address *iface_address, unsigned int link_no), void(*mtu_changed)(void *context, int net_mtu), void(*target_set_completed)(void *context))
int totemknet_ifaces_get(void *knet_context, char ***status, unsigned int *iface_count)
Structure passed as new_value and old_value in change callback.
cs_error_t icmap_track_add(const char *key_name, int32_t track_type, icmap_notify_fn_t notify_fn, void *user_data, icmap_track_t *icmap_track)
Add tracking function for given key_name.
#define ICMAP_TRACK_PREFIX
Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem.nodeid", "totem.version", ...
void * totemknet_buffer_alloc(void)
knet_handle_t knet_handle