Auto-select RDMA device based on osd_network

This commit is contained in:
Vitaliy Filippov
2024-11-16 18:38:57 +03:00
parent 9c59d30e83
commit 7de38250ad
7 changed files with 258 additions and 57 deletions
+12
View File
@@ -1,10 +1,22 @@
#pragma once
#include <netinet/in.h>
#include <sys/socket.h>
#include <string>
#include <vector>
struct addr_mask_t
{
sa_family_t family;
in_addr ipv4;
in6_addr ipv6;
uint8_t bits;
};
bool string_to_addr(std::string str, bool parse_port, int default_port, struct sockaddr_storage *addr);
std::string addr_to_string(const sockaddr_storage &addr);
addr_mask_t cidr_parse(std::string mask);
bool cidr_match(const in_addr &address, const in_addr &network, uint8_t bits);
bool cidr6_match(const in6_addr &address, const in6_addr &network, uint8_t bits);
std::vector<std::string> getifaddr_list(std::vector<std::string> mask_cfg = std::vector<std::string>(), bool include_v6 = false);
int create_and_bind_socket(std::string bind_address, int bind_port, int listen_backlog, int *listening_port);