]> git.proxmox.com Git - ceph.git/blame - ceph/src/common/pick_address.h
update sources to v12.2.0
[ceph.git] / ceph / src / common / pick_address.h
CommitLineData
7c673cae
FG
1#ifndef CEPH_PICK_ADDRESS_H
2#define CEPH_PICK_ADDRESS_H
3
4#include "common/config.h"
5
6class CephContext;
7
8
9#define CEPH_PICK_ADDRESS_PUBLIC 0x01
10#define CEPH_PICK_ADDRESS_CLUSTER 0x02
11
12/*
13 Pick addresses based on subnets if needed.
14
15 If an address is not explicitly given, and a list of subnets is
16 given, find an assigned IP address in the subnets and set that.
17
18 cluster_addr is set based on cluster_network, public_addr is set
19 based on public_network.
20
21 cluster_network and public_network are a list of ip/prefix pairs.
22
23 All IP addresses assigned to all local network interfaces are
24 potential matches.
25
26 If multiple IP addresses match the subnet, one of them will be
27 picked, effectively randomly.
28
29 This function will exit on error.
30 */
31void pick_addresses(CephContext *cct, int needs);
32
b5b8bbf5
FG
33/**
34 * Find a network interface whose address matches the address/netmask
35 * in `network`.
36 */
37std::string pick_iface(CephContext *cct, const struct sockaddr_storage &network);
38
7c673cae
FG
39/**
40 * check for a locally configured address
41 *
42 * check if any of the listed addresses is configured on the local host.
43 *
44 * @param cct context
45 * @param ls list of addresses
46 * @param match [out] pointer to match, if an item in @a ls is found configured locally.
47 */
48bool have_local_addr(CephContext *cct, const list<entity_addr_t>& ls, entity_addr_t *match);
49
50#endif