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> 62 #include <qb/qbdefs.h> 63 #include <qb/qbloop.h> 66 #include <libnozzle.h> 83 #define MSG_NOSIGNAL 0 87 static int setup_nozzle(
void *knet_context);
91 #define CFG_INTERFACE_STATUS_MAX_LEN 512 107 unsigned int msg_len,
113 unsigned int link_no);
141 const char *
function,
177 #ifdef HAVE_LIBNOZZLE 181 char *nozzle_macaddr;
182 nozzle_t nozzle_handle;
198 static void totemknet_start_merge_detect_timeout(
201 static void totemknet_stop_merge_detect_timeout(
204 static void log_flush_messages (
212 res = pthread_mutex_init(&instance->
log_mutex, NULL);
219 #define knet_log_printf_lock(level, subsys, function, file, line, format, args...) \ 221 (void)pthread_mutex_lock(&instance->log_mutex); \ 222 instance->totemknet_log_printf ( \ 223 level, subsys, function, file, line, \ 224 (const char *)format, ##args); \ 225 (void)pthread_mutex_unlock(&instance->log_mutex); \ 228 #define knet_log_printf(level, format, args...) \ 230 knet_log_printf_lock ( \ 231 level, instance->totemknet_subsys_id, \ 232 __FUNCTION__, __FILE__, __LINE__, \ 233 (const char *)format, ##args); \ 236 #define libknet_log_printf(level, format, args...) \ 238 knet_log_printf_lock ( \ 239 level, instance->knet_subsys_id, \ 240 __FUNCTION__, "libknet.h", __LINE__, \ 241 (const char *)format, ##args); \ 244 #define KNET_LOGSYS_PERROR(err_num, level, fmt, args...) \ 246 char _error_str[LOGSYS_MAX_PERROR_MSG_LEN]; \ 247 const char *_error_ptr = qb_strerror_r(err_num, _error_str, sizeof(_error_str)); \ 248 instance->totemknet_log_printf ( \ 249 level, instance->totemknet_subsys_id, \ 250 __FUNCTION__, __FILE__, __LINE__, \ 251 fmt ": %s (%d)", ##args, _error_ptr, err_num); \ 255 #ifdef HAVE_LIBNOZZLE 256 static inline int is_ether_addr_multicast(
const uint8_t *
addr)
258 return (addr[0] & 0x01);
260 static inline int is_ether_addr_zero(
const uint8_t *
addr)
262 return (!addr[0] && !addr[1] && !addr[2] && !addr[3] && !addr[4] && !addr[5]);
265 static int ether_host_filter_fn(
void *private_data,
266 const unsigned char *outdata,
269 knet_node_id_t this_host_id,
270 knet_node_id_t src_host_id,
272 knet_node_id_t *dst_host_ids,
273 size_t *dst_host_ids_entries)
275 struct ether_header *eth_h = (
struct ether_header *)outdata;
276 uint8_t *dst_mac = (uint8_t *)eth_h->ether_dhost;
277 uint16_t dst_host_id;
279 if (is_ether_addr_zero(dst_mac))
282 if (is_ether_addr_multicast(dst_mac)) {
286 memmove(&dst_host_id, &dst_mac[4], 2);
288 dst_host_ids[0] = ntohs(dst_host_id);
289 *dst_host_ids_entries = 1;
295 static int dst_host_filter_callback_fn(
void *private_data,
296 const unsigned char *outdata,
299 knet_node_id_t this_host_id,
300 knet_node_id_t src_host_id,
302 knet_node_id_t *dst_host_ids,
303 size_t *dst_host_ids_entries)
308 #ifdef HAVE_LIBNOZZLE 310 return ether_host_filter_fn(private_data,
311 outdata, outdata_len,
313 this_host_id, src_host_id,
316 dst_host_ids_entries);
321 *dst_host_ids_entries = 1;
325 *dst_host_ids_entries = 0;
331 static void socket_error_callback_fn(
void *private_data,
int datafd, int8_t channel, uint8_t tx_rx,
int error,
int errorno)
336 if ((error == -1 && errorno != EAGAIN) || (error == 0)) {
337 knet_handle_remove_datafd(instance->
knet_handle, datafd);
341 static void host_change_callback_fn(
void *private_data, knet_node_id_t host_id, uint8_t reachable, uint8_t remote, uint8_t external)
349 static void pmtu_change_callback_fn(
void *private_data,
unsigned int data_mtu)
360 const char *cipher_type,
361 const char *hash_type)
367 static inline void ucast_sendmsg (
371 unsigned int msg_len)
375 struct msghdr msg_ucast;
380 iovec.iov_base = (
void *)msg;
381 iovec.iov_len = msg_len;
386 memset(&msg_ucast, 0,
sizeof(msg_ucast));
387 msg_ucast.msg_iov = (
void *)&iovec;
388 msg_ucast.msg_iovlen = 1;
389 #ifdef HAVE_MSGHDR_CONTROL 390 msg_ucast.msg_control = 0;
392 #ifdef HAVE_MSGHDR_CONTROLLEN 393 msg_ucast.msg_controllen = 0;
395 #ifdef HAVE_MSGHDR_FLAGS 396 msg_ucast.msg_flags = 0;
398 #ifdef HAVE_MSGHDR_ACCRIGHTS 399 msg_ucast.msg_accrights = NULL;
401 #ifdef HAVE_MSGHDR_ACCRIGHTSLEN 402 msg_ucast.msg_accrightslen = 0;
413 "sendmsg(ucast) failed (non-critical)");
417 static inline void mcast_sendmsg (
420 unsigned int msg_len,
425 struct msghdr msg_mcast;
428 iovec.iov_base = (
void *)msg;
429 iovec.iov_len = msg_len;
436 memset(&msg_mcast, 0,
sizeof(msg_mcast));
437 msg_mcast.msg_iov = (
void *)&iovec;
438 msg_mcast.msg_iovlen = 1;
439 #ifdef HAVE_MSGHDR_CONTROL 440 msg_mcast.msg_control = 0;
442 #ifdef HAVE_MSGHDR_CONTROLLEN 443 msg_mcast.msg_controllen = 0;
445 #ifdef HAVE_MSGHDR_FLAGS 446 msg_mcast.msg_flags = 0;
448 #ifdef HAVE_MSGHDR_ACCRIGHTS 449 msg_mcast.msg_accrights = NULL;
451 #ifdef HAVE_MSGHDR_ACCRIGHTSLEN 452 msg_mcast.msg_accrightslen = 0;
472 static int node_compare(
const void *aptr,
const void *bptr)
476 a = *(uint16_t *)aptr;
477 b = *(uint16_t *)bptr;
482 #ifndef OWN_INDEX_NONE 483 #define OWN_INDEX_NONE -1 488 unsigned int *iface_count)
491 struct knet_link_status link_status;
492 knet_node_id_t host_list[KNET_MAX_HOST];
493 uint8_t link_list[KNET_MAX_LINK];
508 res = knet_host_get_host_list(instance->
knet_handle,
509 host_list, &num_hosts);
513 qsort(host_list, num_hosts,
sizeof(uint16_t), node_compare);
515 for (j=0; j<num_hosts; j++) {
533 for (j=0; j<num_hosts; j++) {
538 res = knet_link_get_link_list(instance->
knet_handle,
539 host_list[j], link_list, &num_links);
545 for (i=0; i < num_links; i++) {
560 sizeof(link_status));
562 ptr[j] =
'0' + (link_status.enabled |
563 link_status.connected<<1 |
564 link_status.dynconnected<<2);
568 "totemknet_ifaces_get: Cannot get link status: %s", strerror(errno));
587 static knet_node_id_t nodes[KNET_MAX_HOST];
588 uint8_t links[KNET_MAX_LINK];
600 res = knet_handle_setfwd(instance->
knet_handle, 0);
605 res = knet_host_get_host_list(instance->
knet_handle, nodes, &num_nodes);
613 for (i=0; i<num_nodes; i++) {
615 res = knet_link_get_link_list(instance->
knet_handle, nodes[i], links, &num_links);
620 for (j=0; j<num_links; j++) {
621 res = knet_link_set_enable(instance->
knet_handle, nodes[i], links[j], 0);
625 res = knet_link_clear_config(instance->
knet_handle, nodes[i], links[j]);
630 res = knet_host_remove(instance->
knet_handle, nodes[i]);
642 totemknet_stop_merge_detect_timeout(instance);
644 log_flush_messages(instance);
649 (void)pthread_mutex_destroy(&instance->
log_mutex);
654 static int log_deliver_fn (
660 char buffer[
sizeof(
struct knet_log_msg)*4];
661 char *bufptr = buffer;
665 len = read(fd, buffer,
sizeof(buffer));
667 struct knet_log_msg *msg = (
struct knet_log_msg *)bufptr;
668 switch (msg->msglevel) {
671 knet_log_get_subsystem_name(msg->subsystem),
676 knet_log_get_subsystem_name(msg->subsystem),
681 knet_log_get_subsystem_name(msg->subsystem),
686 knet_log_get_subsystem_name(msg->subsystem),
690 bufptr +=
sizeof(
struct knet_log_msg);
691 done +=
sizeof(
struct knet_log_msg);
696 static int data_deliver_fn (
702 struct msghdr msg_hdr;
703 struct iovec iov_recv;
704 struct sockaddr_storage system_from;
706 int truncated_packet;
709 iov_recv.iov_len = KNET_MAX_PACKET_SIZE;
712 msg_hdr.msg_namelen =
sizeof (
struct sockaddr_storage);
713 msg_hdr.msg_iov = &iov_recv;
714 msg_hdr.msg_iovlen = 1;
715 #ifdef HAVE_MSGHDR_CONTROL 716 msg_hdr.msg_control = 0;
718 #ifdef HAVE_MSGHDR_CONTROLLEN 719 msg_hdr.msg_controllen = 0;
721 #ifdef HAVE_MSGHDR_FLAGS 722 msg_hdr.msg_flags = 0;
724 #ifdef HAVE_MSGHDR_ACCRIGHTS 725 msg_hdr.msg_accrights = NULL;
727 #ifdef HAVE_MSGHDR_ACCRIGHTSLEN 728 msg_hdr.msg_accrightslen = 0;
731 msg_len = recvmsg (fd, &msg_hdr,
MSG_NOSIGNAL | MSG_DONTWAIT);
736 truncated_packet = 0;
738 #ifdef HAVE_MSGHDR_FLAGS 739 if (msg_hdr.msg_flags & MSG_TRUNC) {
740 truncated_packet = 1;
747 if (bytes_received == KNET_MAX_PACKET_SIZE) {
748 truncated_packet = 1;
752 if (truncated_packet) {
754 "Received too big message. This may be because something bad is happening" 755 "on the network (attack?), or you tried join more nodes than corosync is" 756 "compiled with (%u) or bug in the code (bad estimation of " 773 static void timer_function_netif_check_timeout (
791 #ifdef HAVE_KNET_ACCESS_LIST 798 err = knet_handle_enable_access_lists(instance->
knet_handle, value);
807 static void totemknet_refresh_config(
809 const char *key_name,
818 knet_node_id_t host_ids[KNET_MAX_HOST];
829 if (
icmap_get_uint8(
"config.totemconfig_reload_in_progress", &reloading) ==
CS_OK && reloading) {
833 knet_set_access_list_config(instance);
846 err = knet_host_get_host_list(instance->
knet_handle, host_ids, &num_nodes);
851 for (i=0; i<num_nodes; i++) {
857 err = knet_link_set_ping_timers(instance->
knet_handle, host_ids[i], link_no,
864 err = knet_link_set_pong_count(instance->
knet_handle, host_ids[i], link_no,
869 err = knet_link_set_priority(instance->
knet_handle, host_ids[i], link_no,
890 totemknet_refresh_config,
896 totemknet_refresh_config,
898 &icmap_track_reload);
907 qb_loop_t *poll_handle,
916 unsigned int msg_len,
919 void (*iface_change_fn) (
922 unsigned int link_no),
924 void (*mtu_changed) (
928 void (*target_set_completed) (
937 if (instance == NULL) {
941 totemknet_instance_initialize (instance);
991 if (fcntl(instance->
logpipes[0], F_SETFL, O_NONBLOCK) == -1 ||
992 fcntl(instance->
logpipes[1], F_SETFL, O_NONBLOCK) == -1) {
998 #if !defined(KNET_API_VER) || (KNET_API_VER == 1) 1001 #if KNET_API_VER == 2 1010 knet_set_access_list_config(instance);
1016 res = knet_handle_enable_filter(instance->
knet_handle, instance, dst_host_filter_callback_fn);
1020 res = knet_handle_enable_sock_notify(instance->
knet_handle, instance, socket_error_callback_fn);
1024 res = knet_host_enable_status_change_notify(instance->
knet_handle, instance, host_change_callback_fn);
1028 res = knet_handle_enable_pmtud_notify(instance->
knet_handle, instance, pmtu_change_callback_fn);
1032 global_instance = instance;
1038 knet_log_printf(LOG_DEBUG,
"knet_handle_add_datafd failed: %s", strerror(errno));
1044 struct knet_handle_crypto_cfg crypto_cfg;
1059 res = knet_handle_crypto(instance->
knet_handle, &crypto_cfg);
1068 knet_log_printf(LOG_INFO,
"kronosnet crypto initialized: %s/%s", crypto_cfg.crypto_cipher_type, crypto_cfg.crypto_hash_type);
1076 instance->
link_mode = KNET_LINK_POLICY_PASSIVE;
1078 instance->
link_mode = KNET_LINK_POLICY_ACTIVE;
1081 instance->
link_mode = KNET_LINK_POLICY_RR;
1094 POLLIN, instance, log_deliver_fn);
1099 POLLIN, instance, data_deliver_fn);
1107 100*QB_TIME_NS_IN_MSEC,
1109 timer_function_netif_check_timeout,
1110 &instance->timer_netif_check_timeout);
1112 totemknet_start_merge_detect_timeout(instance);
1115 totemknet_add_config_notifications(instance);
1121 *knet_context = instance;
1126 log_flush_messages(instance);
1134 return malloc(KNET_MAX_PACKET_SIZE + 512);
1144 int processor_count)
1162 unsigned int msg_len)
1167 ucast_sendmsg (instance, &instance->
token_target, msg, msg_len);
1174 unsigned int msg_len)
1179 mcast_sendmsg (instance, msg, msg_len, 0);
1187 unsigned int msg_len)
1192 mcast_sendmsg (instance, msg, msg_len, 1);
1234 struct sockaddr_storage system_from;
1235 struct msghdr msg_hdr;
1236 struct iovec iov_recv;
1239 int msg_processed = 0;
1242 iov_recv.iov_len = KNET_MAX_PACKET_SIZE;
1245 msg_hdr.msg_namelen =
sizeof (
struct sockaddr_storage);
1246 msg_hdr.msg_iov = &iov_recv;
1247 msg_hdr.msg_iovlen = 1;
1248 #ifdef HAVE_MSGHDR_CONTROL 1249 msg_hdr.msg_control = 0;
1251 #ifdef HAVE_MSGHDR_CONTROLLEN 1252 msg_hdr.msg_controllen = 0;
1254 #ifdef HAVE_MSGHDR_FLAGS 1255 msg_hdr.msg_flags = 0;
1257 #ifdef HAVE_MSGHDR_ACCRIGHTS 1258 msg_msg_hdr.msg_accrights = NULL;
1260 #ifdef HAVE_MSGHDR_ACCRIGHTSLEN 1261 msg_msg_hdr.msg_accrightslen = 0;
1266 ufd.events = POLLIN;
1267 nfds = poll (&ufd, 1, 0);
1268 if (nfds == 1 && ufd.revents & POLLIN) {
1276 }
while (nfds == 1);
1278 return (msg_processed);
1284 unsigned int iface_no)
1306 int port = instance->
ip_port[link_no];
1307 struct sockaddr_storage remote_ss;
1308 struct sockaddr_storage local_ss;
1312 knet_node_id_t host_ids[KNET_MAX_HOST];
1313 size_t num_host_ids;
1331 err = knet_host_get_host_list(instance->
knet_handle, host_ids, &num_host_ids);
1336 for (i=0; i<num_host_ids; i++) {
1337 if (host_ids[i] == member->
nodeid) {
1344 if (err != 0 && errno != EEXIST) {
1360 memset(&local_ss, 0,
sizeof(local_ss));
1361 memset(&remote_ss, 0,
sizeof(remote_ss));
1370 KNET_TRANSPORT_LOOPBACK,
1371 &local_ss, &remote_ss, KNET_LINK_FLAG_TRAFFICHIPRIO);
1376 &local_ss, &remote_ss, KNET_LINK_FLAG_TRAFFICHIPRIO);
1427 uint8_t link_list[KNET_MAX_LINK];
1441 res = knet_link_set_enable(instance->
knet_handle, token_target->
nodeid, link_no, 0);
1447 res = knet_link_clear_config(instance->
knet_handle, token_target->
nodeid, link_no);
1454 res = knet_link_get_link_list(instance->
knet_handle,
1455 token_target->
nodeid, link_list, &num_links);
1460 if (num_links == 0) {
1474 struct totem_config *totem_config)
1477 struct knet_handle_compress_cfg compress_cfg;
1487 res = knet_handle_compress(instance->
knet_handle, &compress_cfg);
1493 #ifdef HAVE_LIBNOZZLE 1497 (void)setup_nozzle(instance);
1508 (void) knet_handle_clear_stats(instance->
knet_handle, KNET_CLEARSTATS_HANDLE_AND_LINK);
1513 knet_node_id_t node, uint8_t link_no,
1514 struct knet_link_status *status)
1520 if (!global_instance) {
1528 res = knet_link_get_status(global_instance->
knet_handle, node, link_no, status,
sizeof(
struct knet_link_status));
1550 struct knet_handle_stats *stats)
1555 if (!global_instance) {
1559 res = knet_handle_get_stats(global_instance->
knet_handle, stats,
sizeof(
struct knet_handle_stats));
1567 static void timer_function_merge_detect_timeout (
1578 totemknet_start_merge_detect_timeout(instance);
1581 static void totemknet_start_merge_detect_timeout(
1590 timer_function_merge_detect_timeout,
1591 &instance->timer_merge_detect_timeout);
1595 static void totemknet_stop_merge_detect_timeout(
1604 static void log_flush_messages (
void *knet_context)
1614 pfd.events = POLLIN;
1617 if ((poll(&pfd, 1, 0) > 0) &&
1618 (pfd.revents & POLLIN) &&
1619 (log_deliver_fn(instance->
logpipes[0], POLLIN, instance) == 0)) {
1628 #ifdef HAVE_LIBNOZZLE 1629 #define NOZZLE_NAME "nozzle.name" 1630 #define NOZZLE_IPADDR "nozzle.ipaddr" 1631 #define NOZZLE_PREFIX "nozzle.ipprefix" 1632 #define NOZZLE_MACADDR "nozzle.macaddr" 1634 #define NOZZLE_CHANNEL 1 1637 static char *get_nozzle_script_dir(
void *knet_context)
1640 char filename[PATH_MAX + FILENAME_MAX + 1];
1641 static char updown_dirname[PATH_MAX + FILENAME_MAX + 1];
1643 const char *dirname_res;
1648 res = snprintf(filename,
sizeof(filename),
"%s",
1650 if (res >=
sizeof(filename)) {
1655 dirname_res = dirname(filename);
1657 res = snprintf(updown_dirname,
sizeof(updown_dirname),
"%s/%s",
1658 dirname_res,
"updown.d");
1659 if (res >=
sizeof(updown_dirname)) {
1663 return updown_dirname;
1675 res = nozzle_run_updown(instance->nozzle_handle, type, &exec_string);
1676 if (res == -1 && errno != ENOENT) {
1678 }
else if (res == -2) {
1693 const char *input_addr,
1694 const char *prefix,
int nodeid,
1695 char *output_addr,
size_t output_len)
1699 int max_prefix = 64;
1700 uint32_t nodeid_mask;
1702 uint32_t masked_nodeid;
1703 struct in_addr *
addr;
1706 coloncolon = strstr(input_addr,
"::");
1711 bits = atoi(prefix);
1712 if (bits < 8 || bits > max_prefix) {
1719 memcpy(output_addr, input_addr, coloncolon-input_addr);
1720 sprintf(output_addr + (coloncolon-input_addr),
"::%x", nodeid);
1727 nodeid_mask = UINT32_MAX & ((1<<(32 - bits)) - 1);
1728 addr_mask = UINT32_MAX ^ nodeid_mask;
1729 masked_nodeid = nodeid & nodeid_mask;
1735 addr = (
struct in_addr *)&totemip.
addr;
1736 addr->s_addr &= htonl(addr_mask);
1737 addr->s_addr |= htonl(masked_nodeid);
1739 inet_ntop(AF_INET, addr, output_addr, output_len);
1743 static int create_nozzle_device(
void *knet_context,
const char *name,
1744 const char *ipaddr,
const char *prefix,
1745 const char *macaddr)
1748 char device_name[IFNAMSIZ+1];
1749 size_t size = IFNAMSIZ;
1750 int8_t channel = NOZZLE_CHANNEL;
1751 nozzle_t nozzle_dev;
1755 char parsed_ipaddr[INET6_ADDRSTRLEN];
1758 memset(device_name, 0, size);
1759 memset(&mac, 0,
sizeof(mac));
1760 strncpy(device_name, name, size);
1762 updown_dir = get_nozzle_script_dir(knet_context);
1765 nozzle_dev = nozzle_open(device_name, size, updown_dir);
1770 instance->nozzle_handle = nozzle_dev;
1772 if (nozzle_set_mac(nozzle_dev, macaddr) < 0) {
1777 if (reparse_nozzle_ip_address(instance, ipaddr, prefix, instance->
our_nodeid, parsed_ipaddr,
sizeof(parsed_ipaddr))) {
1782 if (nozzle_add_ip(nozzle_dev, parsed_ipaddr, prefix) < 0) {
1787 nozzle_fd = nozzle_get_fd(nozzle_dev);
1790 res = knet_handle_add_datafd(instance->
knet_handle, &nozzle_fd, &channel);
1796 run_nozzle_script(instance, NOZZLE_PREUP,
"pre-up");
1798 res = nozzle_set_up(nozzle_dev);
1803 run_nozzle_script(instance, NOZZLE_UP,
"up");
1808 nozzle_close(nozzle_dev);
1812 static int remove_nozzle_device(
void *knet_context)
1818 res = knet_handle_get_datafd(instance->
knet_handle, NOZZLE_CHANNEL, &datafd);
1824 res = knet_handle_remove_datafd(instance->
knet_handle, datafd);
1830 run_nozzle_script(instance, NOZZLE_DOWN,
"pre-down");
1831 res = nozzle_set_down(instance->nozzle_handle);
1836 run_nozzle_script(instance, NOZZLE_POSTDOWN,
"post-down");
1838 res = nozzle_close(instance->nozzle_handle);
1849 free(instance->nozzle_name);
1850 free(instance->nozzle_ipaddr);
1851 free(instance->nozzle_prefix);
1852 free(instance->nozzle_macaddr);
1854 instance->nozzle_name = instance->nozzle_ipaddr = instance->nozzle_prefix =
1855 instance->nozzle_macaddr = NULL;
1858 static int setup_nozzle(
void *knet_context)
1861 char *ipaddr_str = NULL;
1862 char *name_str = NULL;
1863 char *prefix_str = NULL;
1864 char *macaddr_str = NULL;
1881 remove_nozzle_device(instance);
1882 free_nozzle(instance);
1901 if (macaddr_str && strlen(macaddr_str) != 17) {
1906 macaddr_str = (
char*)
"54:54:01:00:00:00";
1909 if (instance->nozzle_name &&
1910 (strcmp(name_str, instance->nozzle_name) == 0) &&
1911 (strcmp(ipaddr_str, instance->nozzle_ipaddr) == 0) &&
1912 (strcmp(prefix_str, instance->nozzle_prefix) == 0) &&
1913 (instance->nozzle_macaddr == NULL ||
1914 strcmp(macaddr_str, instance->nozzle_macaddr) == 0)) {
1921 memcpy(mac, macaddr_str, 12);
1922 snprintf(mac+12,
sizeof(mac) - 13,
"%02x:%02x",
1927 if (name_res ==
CS_OK && name_str) {
1929 if (instance->nozzle_name) {
1930 remove_nozzle_device(instance);
1931 free_nozzle(instance);
1934 res = create_nozzle_device(knet_context, name_str, ipaddr_str, prefix_str,
1937 instance->nozzle_name = strdup(name_str);
1938 instance->nozzle_ipaddr = strdup(ipaddr_str);
1939 instance->nozzle_prefix = strdup(prefix_str);
1940 instance->nozzle_macaddr = strdup(macaddr_str);
1941 if (!instance->nozzle_name || !instance->nozzle_ipaddr ||
1942 !instance->nozzle_prefix) {
1949 free_nozzle(instance);
1957 if (macaddr_res ==
CS_OK) {
1963 #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
pthread_mutex_t log_mutex
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)
cs_error_t qb_to_cs_error(int result)
qb_to_cs_error
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