Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 Cisco and/or its affiliates. |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | |
| 16 | /** |
| 17 | * @brief Glean Adjacency |
| 18 | * |
| 19 | * A gleean adjacency represent the need to discover new peers on an |
| 20 | * attached link. Packets that hit a glean adjacency will generate an |
| 21 | * ARP/ND packet addessesed to the packet's destination address. |
| 22 | * Note this is different to an incomplete neighbour adjacency, which |
| 23 | * does not send ARP/ND requests to the packet's destination address, |
| 24 | * but instead to the next-hop address of the adjacency itself. |
| 25 | */ |
| 26 | |
| 27 | #ifndef __ADJ_GLEAN_H__ |
| 28 | #define __ADJ_GLEAN_H__ |
| 29 | |
| 30 | #include <vnet/adj/adj_types.h> |
| 31 | |
| 32 | /** |
| 33 | * @brief |
| 34 | * Add (and lock) a new or lock an existing glean adjacency |
| 35 | * |
| 36 | * @param proto |
| 37 | * The protocol for the neighbours that we wish to glean |
| 38 | * |
| 39 | * @param sw_if_index |
| 40 | * The interface on which to glean |
| 41 | * |
| 42 | * @param nh_addr |
| 43 | * the address applied to the interface on which to glean. This |
| 44 | * as the source address in packets when the ARP/ND packet is sent |
| 45 | */ |
| 46 | extern adj_index_t adj_glean_add_or_lock(fib_protocol_t proto, |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 47 | vnet_link_t linkt, |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 48 | u32 sw_if_index, |
| 49 | const ip46_address_t *nh_addr); |
| 50 | |
| 51 | /** |
Neale Ranns | c819fc6 | 2018-02-16 02:44:05 -0800 | [diff] [blame] | 52 | * @brief Get an existing glean |
| 53 | * |
| 54 | * @return INVALID if it does not exist |
| 55 | */ |
| 56 | extern adj_index_t adj_glean_get(fib_protocol_t proto, |
| 57 | u32 sw_if_index); |
| 58 | |
| 59 | /** |
| 60 | * adj_glean_update_rewrite |
| 61 | * |
| 62 | * Called by an adjacency provider (an interface type) to configure |
| 63 | * a glean adj (i.e. and adjacency linked to a connected prefix) to |
| 64 | * its default behaviour. |
| 65 | * Other interface types (i.e. 6RD tunnels) can can choose not to use |
| 66 | * glean behaviour on an adjacency liked to a connected prefix. |
| 67 | */ |
| 68 | extern void adj_glean_update_rewrite(adj_index_t adj_index); |
| 69 | |
| 70 | /** |
Neale Ranns | b80c536 | 2016-10-08 13:03:40 +0100 | [diff] [blame] | 71 | * @brief Format/display a glean adjacency. |
| 72 | */ |
| 73 | extern u8* format_adj_glean(u8* s, va_list *ap); |
| 74 | |
| 75 | /** |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 76 | * @brief |
| 77 | * Module initialisation |
| 78 | */ |
| 79 | extern void adj_glean_module_init(void); |
| 80 | |
| 81 | #endif |