summaryrefslogtreecommitdiff
path: root/src/network/networkd-neighbor.h
blob: 8feb515e05d7bedfba59cd4ee85c0c1be34f9627 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once

#include <stdbool.h>

#include "sd-netlink.h"

#include "conf-parser.h"
#include "ether-addr-util.h"
#include "in-addr-util.h"
#include "networkd-util.h"

typedef struct Link Link;
typedef struct Manager Manager;
typedef struct Network Network;
typedef struct Request Request;

union lladdr_union {
        struct ether_addr mac;
        union in_addr_union ip;
};

typedef struct Neighbor {
        Network *network;
        Link *link;
        NetworkConfigSection *section;

        int family;
        union in_addr_union in_addr;
        union lladdr_union lladdr;
        size_t lladdr_size;
} Neighbor;

Neighbor *neighbor_free(Neighbor *neighbor);

void neighbor_hash_func(const Neighbor *neighbor, struct siphash *state);
int neighbor_compare_func(const Neighbor *a, const Neighbor *b);

void network_drop_invalid_neighbors(Network *network);

int link_drop_neighbors(Link *link);
int link_drop_foreign_neighbors(Link *link);

int link_request_static_neighbors(Link *link);
int request_process_neighbor(Request *req);

int manager_rtnl_process_neighbor(sd_netlink *rtnl, sd_netlink_message *message, Manager *m);

CONFIG_PARSER_PROTOTYPE(config_parse_neighbor_address);
CONFIG_PARSER_PROTOTYPE(config_parse_neighbor_hwaddr);
CONFIG_PARSER_PROTOTYPE(config_parse_neighbor_lladdr);