mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
common/ipaddr: expose netmask_ipv[46]
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
0ef08e1ba9
commit
52bed1e72b
@ -11,7 +11,7 @@
|
||||
|
||||
#include "include/ipaddr.h"
|
||||
|
||||
static void netmask_ipv4(const struct in_addr *addr,
|
||||
void netmask_ipv4(const struct in_addr *addr,
|
||||
unsigned int prefix_len,
|
||||
struct in_addr *out) {
|
||||
uint32_t mask;
|
||||
@ -57,9 +57,9 @@ const struct ifaddrs *find_ipv4_in_subnet(const struct ifaddrs *addrs,
|
||||
}
|
||||
|
||||
|
||||
static void netmask_ipv6(const struct in6_addr *addr,
|
||||
unsigned int prefix_len,
|
||||
struct in6_addr *out) {
|
||||
void netmask_ipv6(const struct in6_addr *addr,
|
||||
unsigned int prefix_len,
|
||||
struct in6_addr *out) {
|
||||
if (prefix_len > 128)
|
||||
prefix_len = 128;
|
||||
|
||||
|
@ -24,4 +24,11 @@ const struct ifaddrs *find_ip_in_subnet(const struct ifaddrs *addrs,
|
||||
*/
|
||||
bool parse_network(const char *s, struct sockaddr_storage *network, unsigned int *prefix_len);
|
||||
|
||||
void netmask_ipv6(const struct in6_addr *addr,
|
||||
unsigned int prefix_len,
|
||||
struct in6_addr *out);
|
||||
|
||||
void netmask_ipv4(const struct in_addr *addr,
|
||||
unsigned int prefix_len,
|
||||
struct in_addr *out);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user