File: route.h

package info (click to toggle)
ovn 25.09.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,492 kB
  • sloc: ansic: 106,060; xml: 23,314; sh: 3,322; python: 1,838; makefile: 836
file content (89 lines) | stat: -rw-r--r-- 2,808 bytes parent folder | download
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
 * Copyright (c) 2025, Canonical, Ltd.
 * Copyright (c) 2025, STACKIT GmbH & Co. KG
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ROUTE_H
#define ROUTE_H 1

#include <stdbool.h>
#include <netinet/in.h>
#include <net/if.h>
#include "openvswitch/hmap.h"
#include "sset.h"
#include "smap.h"

struct hmap;
struct ovsdb_idl_index;
struct sbrec_chassis;
struct sbrec_port_binding;

struct route_ctx_in {
    const struct sbrec_advertised_route_table *advertised_route_table;
    struct ovsdb_idl_index *sbrec_port_binding_by_name;
    const struct sbrec_chassis *chassis;
    const char *dynamic_routing_port_mapping;
    const struct hmap *local_datapaths;
    struct shash *local_bindings;
};

struct route_ctx_out {
    struct hmap *tracked_re_datapaths;

    /* Contains the tracked_ports that in the last run were bound locally. */
    struct sset *tracked_ports_local;

    /* Contains the tracked_ports that in the last run were not bound
     * locally. */
    struct sset *tracked_ports_remote;

    /* Contains struct advertise_datapath_entry */
    struct hmap *announce_routes;
};

struct advertise_datapath_entry {
    struct hmap_node node;

    const struct sbrec_datapath_binding *db;
    bool maintain_vrf;
    char vrf_name[IFNAMSIZ + 1];
    struct hmap routes;

    /* The name of the port bindings locally bound for this datapath and
     * running route exchange logic.
     * The key is the port name and the value is the ifname if set. This may
     * be empty if the all ports specified dynamic-routing-port-name, but no
     * such referenced port is local. In this case we should only advertise
     * routes but not learn them. */
    struct smap bound_ports;
};

struct advertise_route_entry {
    struct hmap_node node;
    struct in6_addr addr;
    unsigned int plen;
    unsigned int priority;
};

const struct sbrec_port_binding *route_exchange_find_port(
    struct ovsdb_idl_index *sbrec_port_binding_by_name,
    const struct sbrec_chassis *chassis,
    const struct sbrec_port_binding *pb,
    const char **dynamic_routing_port_name);
uint32_t advertise_route_hash(const struct in6_addr *dst, unsigned int plen);
void route_run(struct route_ctx_in *, struct route_ctx_out *);
void route_cleanup(struct hmap *announce_routes);

#endif /* ROUTE_H */