aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/lisp-gpe/lisp_gpe_adjacency.h
blob: adc3acaee3c9fe1241a8160a4570fcdd5f713448 (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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
 * Copyright (c) 2016 Cisco and/or its affiliates.
 * 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.
 */
/**
 * @file
 * @brief Common utility functions for IPv4, IPv6 and L2 LISP-GPE adjacencys.
 *
 */

#ifndef LISP_GPE_ADJACENCY_H__
#define LISP_GPE_ADJACENCY_H__

#include <vnet/fib/fib_node.h>
#include <vnet/lisp-gpe/lisp_gpe.h>

/**
 * @brief A LISP GPE Adjacency.
 *
 * A adjacency represents peer on an L3 sub-interface to which to send traffic.
 * adjacencies are thus present in the EID space.
 * The peer is identified by the key:{remote-rloc, sub-interface}, which is
 * equivalent to the usal adjacency key {next-hop, interface}. So curiously
 * the rloc address from the underlay is used as a next hop address in the overlay
 * This is OK because:
 *  1 - the RLOC is unique in the underlay AND there is only one underlay VRF per
 *      overlay
 *  2 - the RLOC may overlap with an address in the overlay, but we do not create
 *      an adj-fib (i.e. a route in the overlay FIB for the rloc)
 *
 *
 */
typedef struct lisp_gpe_adjacency_t_
{
  /**
   * The LISP adj is a part of the FIB control plane graph.
   */
  fib_node_t fib_node;

  /**
   * remote RLOC. The adjacency's next-hop
   */
  ip_address_t remote_rloc;

  /**
   * The VNI. Used in combination with the local-rloc to get the sub-interface
   */
  u32 vni;

  /**
   * The number of locks/reference counts on the adjacency.
   */
  u32 locks;

  /**
   * The index of the LISP L3 subinterface
   */
  u32 lisp_l3_sub_index;

  /**
   * The SW IF index of the sub-interface this adjacency uses.
   * Cached for convenience from the LISP L3 sub-interface
   */
  u32 sw_if_index;

  /**
   * The index of the LISP GPE tunnel that provides the transport
   * in the underlay.
   */
  u32 tunnel_index;

  /**
   * This adjacency is a child of the FIB entry to reach the RLOC.
   * This is so when the reachability of that RLOC changes, we can restack
   * the FIB adjacnecies.
   */
  u32 fib_entry_child_index;

  /**
   * LISP header fields in HOST byte order
   */
  u8 flags;
  u8 ver_res;
  u8 res;
  u8 next_protocol;

} lisp_gpe_adjacency_t;

extern index_t lisp_gpe_adjacency_find_or_create_and_lock (const
							   locator_pair_t *
							   pair,
							   u32 rloc_fib_index,
							   u32 vni);

extern void lisp_gpe_adjacency_unlock (index_t l3si);

extern const lisp_gpe_adjacency_t *lisp_gpe_adjacency_get (index_t l3si);

extern void lisp_gpe_update_adjacency (vnet_main_t * vnm,
				       u32 sw_if_index, adj_index_t ai);
extern u8 *lisp_gpe_build_rewrite (vnet_main_t * vnm,
				   u32 sw_if_index,
				   vnet_link_t link_type,
				   const void *dst_address);


/**
 * @brief Flags for displaying the adjacency
 */
typedef enum lisp_gpe_adjacency_format_flags_t_
{
  LISP_GPE_ADJ_FORMAT_FLAG_NONE,
  LISP_GPE_ADJ_FORMAT_FLAG_DETAIL,
} lisp_gpe_adjacency_format_flags_t;

extern u8 *format_lisp_gpe_adjacency (u8 * s, va_list * args);

#endif

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */
the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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.