Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | /* |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 2 | * Copyright (c) 2016 Cisco and/or its affiliates. |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 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 | */ |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 15 | /** |
| 16 | * @file |
| 17 | * @brief Common utility functions for IPv4, IPv6 and L2 LISP-GPE tunnels. |
| 18 | * |
| 19 | */ |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 20 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 21 | #include <vnet/lisp-gpe/lisp_gpe.h> |
Neale Ranns | 5e575b1 | 2016-10-03 09:40:25 +0100 | [diff] [blame] | 22 | #include <vnet/lisp-gpe/lisp_gpe_fwd_entry.h> |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 23 | #include <vnet/lisp-gpe/lisp_gpe_adjacency.h> |
Neale Ranns | 5e575b1 | 2016-10-03 09:40:25 +0100 | [diff] [blame] | 24 | #include <vnet/lisp-gpe/lisp_gpe_tenant.h> |
Florin Coras | a4e63e5 | 2017-06-07 21:50:57 -0700 | [diff] [blame] | 25 | #include <vnet/fib/fib_path_list.h> |
| 26 | #include <vnet/fib/fib_table.h> |
| 27 | #include <vnet/fib/fib_internal.h> |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 28 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 29 | /** LISP-GPE global state */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 30 | lisp_gpe_main_t lisp_gpe_main; |
| 31 | |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 32 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 33 | /** CLI command to add/del forwarding entry. */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 34 | static clib_error_t * |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 35 | lisp_gpe_add_del_fwd_entry_command_fn (vlib_main_t * vm, |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 36 | unformat_input_t * input, |
| 37 | vlib_cli_command_t * cmd) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 38 | { |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 39 | unformat_input_t _line_input, *line_input = &_line_input; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 40 | u8 is_add = 1; |
Florin Coras | bb5c22f | 2016-08-02 02:31:03 +0200 | [diff] [blame] | 41 | ip_address_t lloc, rloc; |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 42 | clib_error_t *error = 0; |
| 43 | gid_address_t _reid, *reid = &_reid, _leid, *leid = &_leid; |
Filip Tehlar | c3af7bf | 2017-01-13 14:13:09 +0100 | [diff] [blame] | 44 | u8 reid_set = 0, leid_set = 0, is_negative = 0, dp_table_set = 0, |
| 45 | vni_set = 0; |
| 46 | u32 vni = 0, dp_table = 0, action = ~0, w; |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 47 | locator_pair_t pair, *pairs = 0; |
Andrej Kozemcak | 8ebb2a1 | 2016-06-07 12:25:20 +0200 | [diff] [blame] | 48 | int rv; |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 49 | |
Filip Tehlar | c3af7bf | 2017-01-13 14:13:09 +0100 | [diff] [blame] | 50 | memset (leid, 0, sizeof (*leid)); |
| 51 | memset (reid, 0, sizeof (*reid)); |
| 52 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 53 | /* Get a line of input. */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 54 | if (!unformat_user (input, unformat_line_input, line_input)) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 55 | return 0; |
| 56 | |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 57 | while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) |
| 58 | { |
| 59 | if (unformat (line_input, "del")) |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 60 | is_add = 0; |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 61 | else if (unformat (line_input, "add")) |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 62 | is_add = 1; |
| 63 | else if (unformat (line_input, "leid %U", unformat_gid_address, leid)) |
| 64 | { |
| 65 | leid_set = 1; |
| 66 | } |
| 67 | else if (unformat (line_input, "reid %U", unformat_gid_address, reid)) |
| 68 | { |
| 69 | reid_set = 1; |
| 70 | } |
Florin Coras | 03c4f99 | 2016-07-19 15:27:58 +0200 | [diff] [blame] | 71 | else if (unformat (line_input, "vni %u", &vni)) |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 72 | { |
| 73 | gid_address_vni (leid) = vni; |
| 74 | gid_address_vni (reid) = vni; |
| 75 | vni_set = 1; |
| 76 | } |
Filip Tehlar | c3af7bf | 2017-01-13 14:13:09 +0100 | [diff] [blame] | 77 | else if (unformat (line_input, "vrf %u", &dp_table)) |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 78 | { |
Filip Tehlar | c3af7bf | 2017-01-13 14:13:09 +0100 | [diff] [blame] | 79 | dp_table_set = 1; |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 80 | } |
Filip Tehlar | c3af7bf | 2017-01-13 14:13:09 +0100 | [diff] [blame] | 81 | else if (unformat (line_input, "bd %u", &dp_table)) |
Neale Ranns | 5e575b1 | 2016-10-03 09:40:25 +0100 | [diff] [blame] | 82 | { |
Filip Tehlar | c3af7bf | 2017-01-13 14:13:09 +0100 | [diff] [blame] | 83 | dp_table_set = 1; |
Neale Ranns | 5e575b1 | 2016-10-03 09:40:25 +0100 | [diff] [blame] | 84 | } |
Florin Coras | 03c4f99 | 2016-07-19 15:27:58 +0200 | [diff] [blame] | 85 | else if (unformat (line_input, "negative action %U", |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 86 | unformat_negative_mapping_action, &action)) |
| 87 | { |
| 88 | is_negative = 1; |
| 89 | } |
Filip Tehlar | c3af7bf | 2017-01-13 14:13:09 +0100 | [diff] [blame] | 90 | else if (unformat (line_input, "loc-pair %U %U w %d", |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 91 | unformat_ip_address, &lloc, |
Filip Tehlar | c3af7bf | 2017-01-13 14:13:09 +0100 | [diff] [blame] | 92 | unformat_ip_address, &rloc, &w)) |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 93 | { |
| 94 | pair.lcl_loc = lloc; |
| 95 | pair.rmt_loc = rloc; |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 96 | pair.weight = w; |
Florin Coras | 42e480d | 2017-01-16 00:57:02 -0800 | [diff] [blame] | 97 | pair.priority = 0; |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 98 | vec_add1 (pairs, pair); |
| 99 | } |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 100 | else |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 101 | { |
| 102 | error = unformat_parse_error (line_input); |
Filip Tehlar | c3af7bf | 2017-01-13 14:13:09 +0100 | [diff] [blame] | 103 | vlib_cli_output (vm, "parse error: '%U'", |
| 104 | format_unformat_error, line_input); |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 105 | goto done; |
| 106 | } |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 107 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 108 | |
Florin Coras | 03c4f99 | 2016-07-19 15:27:58 +0200 | [diff] [blame] | 109 | if (!reid_set) |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 110 | { |
Filip Tehlar | c3af7bf | 2017-01-13 14:13:09 +0100 | [diff] [blame] | 111 | vlib_cli_output (vm, "remote eid must be set!"); |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 112 | goto done; |
| 113 | } |
| 114 | |
Florin Coras | b69111e | 2017-02-13 23:55:27 -0800 | [diff] [blame] | 115 | if (gid_address_type (reid) != GID_ADDR_NSH && (!vni_set || !dp_table_set)) |
| 116 | { |
| 117 | vlib_cli_output (vm, "vni and vrf/bd must be set!"); |
| 118 | goto done; |
| 119 | } |
| 120 | |
Florin Coras | 03c4f99 | 2016-07-19 15:27:58 +0200 | [diff] [blame] | 121 | if (is_negative) |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 122 | { |
Florin Coras | 03c4f99 | 2016-07-19 15:27:58 +0200 | [diff] [blame] | 123 | if (~0 == action) |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 124 | { |
Filip Tehlar | c3af7bf | 2017-01-13 14:13:09 +0100 | [diff] [blame] | 125 | vlib_cli_output (vm, "no action set for negative tunnel!"); |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 126 | goto done; |
| 127 | } |
Florin Coras | 03c4f99 | 2016-07-19 15:27:58 +0200 | [diff] [blame] | 128 | } |
| 129 | else |
| 130 | { |
Florin Coras | bb5c22f | 2016-08-02 02:31:03 +0200 | [diff] [blame] | 131 | if (vec_len (pairs) == 0) |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 132 | { |
Filip Tehlar | c3af7bf | 2017-01-13 14:13:09 +0100 | [diff] [blame] | 133 | vlib_cli_output (vm, "expected ip4/ip6 locators"); |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 134 | goto done; |
| 135 | } |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 136 | } |
| 137 | |
Florin Coras | 03c4f99 | 2016-07-19 15:27:58 +0200 | [diff] [blame] | 138 | if (!leid_set) |
| 139 | { |
| 140 | /* if leid not set, make sure it's the same AFI like reid */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 141 | gid_address_type (leid) = gid_address_type (reid); |
Florin Coras | 03c4f99 | 2016-07-19 15:27:58 +0200 | [diff] [blame] | 142 | if (GID_ADDR_IP_PREFIX == gid_address_type (reid)) |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 143 | gid_address_ip_version (leid) = gid_address_ip_version (reid); |
Florin Coras | 03c4f99 | 2016-07-19 15:27:58 +0200 | [diff] [blame] | 144 | } |
| 145 | |
| 146 | /* add fwd entry */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 147 | vnet_lisp_gpe_add_del_fwd_entry_args_t _a, *a = &_a; |
| 148 | memset (a, 0, sizeof (a[0])); |
Florin Coras | 03c4f99 | 2016-07-19 15:27:58 +0200 | [diff] [blame] | 149 | |
| 150 | a->is_add = is_add; |
Florin Coras | 82bf7cd | 2016-09-26 18:59:44 +0300 | [diff] [blame] | 151 | a->is_negative = is_negative; |
Florin Coras | 03c4f99 | 2016-07-19 15:27:58 +0200 | [diff] [blame] | 152 | a->vni = vni; |
Filip Tehlar | c3af7bf | 2017-01-13 14:13:09 +0100 | [diff] [blame] | 153 | a->table_id = dp_table; |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 154 | gid_address_copy (&a->lcl_eid, leid); |
| 155 | gid_address_copy (&a->rmt_eid, reid); |
Florin Coras | bb5c22f | 2016-08-02 02:31:03 +0200 | [diff] [blame] | 156 | a->locator_pairs = pairs; |
Florin Coras | ce1b4c7 | 2017-01-26 14:25:34 -0800 | [diff] [blame] | 157 | a->action = action; |
Florin Coras | 03c4f99 | 2016-07-19 15:27:58 +0200 | [diff] [blame] | 158 | |
| 159 | rv = vnet_lisp_gpe_add_del_fwd_entry (a, 0); |
| 160 | if (0 != rv) |
| 161 | { |
Filip Tehlar | c3af7bf | 2017-01-13 14:13:09 +0100 | [diff] [blame] | 162 | vlib_cli_output (vm, "failed to %s gpe tunnel!", |
| 163 | is_add ? "add" : "delete"); |
Florin Coras | 03c4f99 | 2016-07-19 15:27:58 +0200 | [diff] [blame] | 164 | } |
| 165 | |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 166 | done: |
Filip Tehlar | c3af7bf | 2017-01-13 14:13:09 +0100 | [diff] [blame] | 167 | unformat_free (line_input); |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 168 | vec_free (pairs); |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 169 | return error; |
| 170 | } |
| 171 | |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 172 | /* *INDENT-OFF* */ |
Florin Coras | ed09a05 | 2016-05-06 14:22:40 +0200 | [diff] [blame] | 173 | VLIB_CLI_COMMAND (lisp_gpe_add_del_fwd_entry_command, static) = { |
Filip Tehlar | 82786c4 | 2017-02-20 15:20:37 +0100 | [diff] [blame] | 174 | .path = "gpe entry", |
| 175 | .short_help = "gpe entry add/del vni <vni> vrf/bd <id> [leid <leid>]" |
Filip Tehlar | c3af7bf | 2017-01-13 14:13:09 +0100 | [diff] [blame] | 176 | "reid <reid> [loc-pair <lloc> <rloc> w <weight>] " |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 177 | "[negative action <action>]", |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 178 | .function = lisp_gpe_add_del_fwd_entry_command_fn, |
| 179 | }; |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 180 | /* *INDENT-ON* */ |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 181 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 182 | /** Check if LISP-GPE is enabled. */ |
Andrej Kozemcak | a9edd85 | 2016-05-02 12:14:33 +0200 | [diff] [blame] | 183 | u8 |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 184 | vnet_lisp_gpe_enable_disable_status (void) |
Andrej Kozemcak | a9edd85 | 2016-05-02 12:14:33 +0200 | [diff] [blame] | 185 | { |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 186 | lisp_gpe_main_t *lgm = &lisp_gpe_main; |
Andrej Kozemcak | a9edd85 | 2016-05-02 12:14:33 +0200 | [diff] [blame] | 187 | |
| 188 | return lgm->is_en; |
| 189 | } |
| 190 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 191 | /** Enable/disable LISP-GPE. */ |
Florin Coras | 577c355 | 2016-04-21 00:45:40 +0200 | [diff] [blame] | 192 | clib_error_t * |
| 193 | vnet_lisp_gpe_enable_disable (vnet_lisp_gpe_enable_disable_args_t * a) |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 194 | { |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 195 | lisp_gpe_main_t *lgm = &lisp_gpe_main; |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 196 | |
Florin Coras | 577c355 | 2016-04-21 00:45:40 +0200 | [diff] [blame] | 197 | if (a->is_en) |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 198 | { |
Andrej Kozemcak | a9edd85 | 2016-05-02 12:14:33 +0200 | [diff] [blame] | 199 | lgm->is_en = 1; |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 200 | } |
| 201 | else |
| 202 | { |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 203 | /* remove all entries */ |
Neale Ranns | 5e575b1 | 2016-10-03 09:40:25 +0100 | [diff] [blame] | 204 | vnet_lisp_gpe_fwd_entry_flush (); |
Florin Coras | 577c355 | 2016-04-21 00:45:40 +0200 | [diff] [blame] | 205 | |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 206 | /* disable all l3 ifaces */ |
Neale Ranns | 5e575b1 | 2016-10-03 09:40:25 +0100 | [diff] [blame] | 207 | lisp_gpe_tenant_flush (); |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 208 | |
Andrej Kozemcak | a9edd85 | 2016-05-02 12:14:33 +0200 | [diff] [blame] | 209 | lgm->is_en = 0; |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 210 | } |
Florin Coras | 577c355 | 2016-04-21 00:45:40 +0200 | [diff] [blame] | 211 | |
| 212 | return 0; |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 213 | } |
| 214 | |
Filip Tehlar | 3e7b5693 | 2017-02-21 18:28:34 +0100 | [diff] [blame] | 215 | /** Set GPE encapsulation mode. */ |
| 216 | int |
| 217 | vnet_gpe_set_encap_mode (gpe_encap_mode_t mode) |
| 218 | { |
| 219 | lisp_gpe_main_t *lgm = &lisp_gpe_main; |
| 220 | |
| 221 | if (mode >= GPE_ENCAP_COUNT) |
| 222 | return VNET_API_ERROR_INVALID_GPE_MODE; |
| 223 | |
| 224 | if (pool_elts (lgm->lisp_fwd_entry_pool) != 0) |
| 225 | return VNET_API_ERROR_LISP_GPE_ENTRIES_PRESENT; |
| 226 | |
| 227 | lgm->encap_mode = mode; |
| 228 | return 0; |
| 229 | } |
| 230 | |
| 231 | /** CLI command to set GPE encap */ |
| 232 | static clib_error_t * |
| 233 | gpe_set_encap_mode_command_fn (vlib_main_t * vm, |
| 234 | unformat_input_t * input, |
| 235 | vlib_cli_command_t * cmd) |
| 236 | { |
| 237 | unformat_input_t _line_input, *line_input = &_line_input; |
| 238 | gpe_encap_mode_t mode = GPE_ENCAP_COUNT; |
| 239 | vnet_api_error_t rv; |
| 240 | |
| 241 | /* Get a line of input. */ |
| 242 | if (!unformat_user (input, unformat_line_input, line_input)) |
| 243 | return 0; |
| 244 | |
| 245 | while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) |
| 246 | { |
| 247 | if (unformat (line_input, "lisp")) |
| 248 | mode = GPE_ENCAP_LISP; |
| 249 | else if (unformat (line_input, "vxlan")) |
| 250 | mode = GPE_ENCAP_VXLAN; |
| 251 | else |
| 252 | { |
| 253 | return clib_error_return (0, "parse error: '%U'", |
| 254 | format_unformat_error, line_input); |
| 255 | } |
| 256 | } |
| 257 | rv = vnet_gpe_set_encap_mode (mode); |
| 258 | if (rv) |
| 259 | { |
| 260 | return clib_error_return (0, |
| 261 | "Error: invalid mode or GPE entries are present!"); |
| 262 | } |
| 263 | |
| 264 | return 0; |
| 265 | } |
| 266 | |
| 267 | /* *INDENT-OFF* */ |
| 268 | VLIB_CLI_COMMAND (gpe_set_encap_mode_command, static) = { |
| 269 | .path = "gpe encap", |
| 270 | .short_help = "gpe encap [lisp|vxlan]", |
| 271 | .function = gpe_set_encap_mode_command_fn, |
| 272 | }; |
| 273 | /* *INDENT-ON* */ |
| 274 | |
| 275 | /** Format GPE encap mode. */ |
| 276 | u8 * |
| 277 | format_vnet_gpe_encap_mode (u8 * s, va_list * args) |
| 278 | { |
| 279 | lisp_gpe_main_t *lgm = &lisp_gpe_main; |
| 280 | |
| 281 | switch (lgm->encap_mode) |
| 282 | { |
| 283 | case GPE_ENCAP_LISP: |
| 284 | return format (s, "lisp"); |
| 285 | case GPE_ENCAP_VXLAN: |
| 286 | return format (s, "vxlan"); |
| 287 | default: |
| 288 | return 0; |
| 289 | } |
| 290 | return 0; |
| 291 | } |
| 292 | |
| 293 | /** CLI command to show GPE encap */ |
| 294 | static clib_error_t * |
| 295 | gpe_show_encap_mode_command_fn (vlib_main_t * vm, |
| 296 | unformat_input_t * input, |
| 297 | vlib_cli_command_t * cmd) |
| 298 | { |
| 299 | vlib_cli_output (vm, "encap mode: %U", format_vnet_gpe_encap_mode); |
| 300 | return 0; |
| 301 | } |
| 302 | |
| 303 | /* *INDENT-OFF* */ |
| 304 | VLIB_CLI_COMMAND (gpe_show_encap_mode_command, static) = { |
| 305 | .path = "show gpe encap", |
| 306 | .short_help = "show GPE encapulation mode", |
| 307 | .function = gpe_show_encap_mode_command_fn, |
| 308 | }; |
| 309 | /* *INDENT-ON* */ |
| 310 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 311 | /** CLI command to enable/disable LISP-GPE. */ |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 312 | static clib_error_t * |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 313 | lisp_gpe_enable_disable_command_fn (vlib_main_t * vm, |
| 314 | unformat_input_t * input, |
| 315 | vlib_cli_command_t * cmd) |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 316 | { |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 317 | unformat_input_t _line_input, *line_input = &_line_input; |
Florin Coras | 577c355 | 2016-04-21 00:45:40 +0200 | [diff] [blame] | 318 | u8 is_en = 1; |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 319 | vnet_lisp_gpe_enable_disable_args_t _a, *a = &_a; |
Billy McFall | a9a20e7 | 2017-02-15 11:39:12 -0500 | [diff] [blame] | 320 | clib_error_t *error = NULL; |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 321 | |
| 322 | /* Get a line of input. */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 323 | if (!unformat_user (input, unformat_line_input, line_input)) |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 324 | return 0; |
| 325 | |
| 326 | while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) |
| 327 | { |
Florin Coras | 577c355 | 2016-04-21 00:45:40 +0200 | [diff] [blame] | 328 | if (unformat (line_input, "enable")) |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 329 | is_en = 1; |
Florin Coras | 577c355 | 2016-04-21 00:45:40 +0200 | [diff] [blame] | 330 | else if (unformat (line_input, "disable")) |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 331 | is_en = 0; |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 332 | else |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 333 | { |
Billy McFall | a9a20e7 | 2017-02-15 11:39:12 -0500 | [diff] [blame] | 334 | error = clib_error_return (0, "parse error: '%U'", |
| 335 | format_unformat_error, line_input); |
| 336 | goto done; |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 337 | } |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 338 | } |
Florin Coras | 577c355 | 2016-04-21 00:45:40 +0200 | [diff] [blame] | 339 | a->is_en = is_en; |
Billy McFall | a9a20e7 | 2017-02-15 11:39:12 -0500 | [diff] [blame] | 340 | error = vnet_lisp_gpe_enable_disable (a); |
| 341 | |
| 342 | done: |
| 343 | unformat_free (line_input); |
| 344 | |
| 345 | return error; |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 346 | } |
| 347 | |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 348 | /* *INDENT-OFF* */ |
Florin Coras | 577c355 | 2016-04-21 00:45:40 +0200 | [diff] [blame] | 349 | VLIB_CLI_COMMAND (enable_disable_lisp_gpe_command, static) = { |
Filip Tehlar | 82786c4 | 2017-02-20 15:20:37 +0100 | [diff] [blame] | 350 | .path = "gpe", |
| 351 | .short_help = "gpe [enable|disable]", |
Florin Coras | 577c355 | 2016-04-21 00:45:40 +0200 | [diff] [blame] | 352 | .function = lisp_gpe_enable_disable_command_fn, |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 353 | }; |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 354 | /* *INDENT-ON* */ |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 355 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 356 | /** CLI command to show LISP-GPE interfaces. */ |
Filip Tehlar | 53f09e3 | 2016-05-19 14:25:44 +0200 | [diff] [blame] | 357 | static clib_error_t * |
| 358 | lisp_show_iface_command_fn (vlib_main_t * vm, |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 359 | unformat_input_t * input, |
| 360 | vlib_cli_command_t * cmd) |
Filip Tehlar | 53f09e3 | 2016-05-19 14:25:44 +0200 | [diff] [blame] | 361 | { |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 362 | lisp_gpe_main_t *lgm = &lisp_gpe_main; |
| 363 | hash_pair_t *p; |
Filip Tehlar | 53f09e3 | 2016-05-19 14:25:44 +0200 | [diff] [blame] | 364 | |
| 365 | vlib_cli_output (vm, "%=10s%=12s", "vrf", "hw_if_index"); |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 366 | |
| 367 | /* *INDENT-OFF* */ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 368 | hash_foreach_pair (p, lgm->l3_ifaces.hw_if_index_by_dp_table, ({ |
Filip Tehlar | 53f09e3 | 2016-05-19 14:25:44 +0200 | [diff] [blame] | 369 | vlib_cli_output (vm, "%=10d%=10d", p->key, p->value[0]); |
| 370 | })); |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 371 | /* *INDENT-ON* */ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 372 | |
| 373 | if (0 != lgm->l2_ifaces.hw_if_index_by_dp_table) |
| 374 | { |
| 375 | vlib_cli_output (vm, "%=10s%=12s", "bd_id", "hw_if_index"); |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 376 | /* *INDENT-OFF* */ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 377 | hash_foreach_pair (p, lgm->l2_ifaces.hw_if_index_by_dp_table, ({ |
| 378 | vlib_cli_output (vm, "%=10d%=10d", p->key, p->value[0]); |
| 379 | })); |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 380 | /* *INDENT-ON* */ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 381 | } |
Filip Tehlar | 53f09e3 | 2016-05-19 14:25:44 +0200 | [diff] [blame] | 382 | return 0; |
| 383 | } |
| 384 | |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 385 | /* *INDENT-OFF* */ |
Filip Tehlar | 53f09e3 | 2016-05-19 14:25:44 +0200 | [diff] [blame] | 386 | VLIB_CLI_COMMAND (lisp_show_iface_command) = { |
Filip Tehlar | 82786c4 | 2017-02-20 15:20:37 +0100 | [diff] [blame] | 387 | .path = "show gpe interface", |
| 388 | .short_help = "show gpe interface", |
Filip Tehlar | 53f09e3 | 2016-05-19 14:25:44 +0200 | [diff] [blame] | 389 | .function = lisp_show_iface_command_fn, |
| 390 | }; |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 391 | /* *INDENT-ON* */ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 392 | |
Florin Coras | a4e63e5 | 2017-06-07 21:50:57 -0700 | [diff] [blame] | 393 | /** CLI command to show GPE fwd native route path. */ |
| 394 | static clib_error_t * |
| 395 | gpe_show_native_fwd_rpath_command_fn (vlib_main_t * vm, |
| 396 | unformat_input_t * input, |
| 397 | vlib_cli_command_t * cmd) |
| 398 | { |
| 399 | lisp_gpe_main_t *lgm = &lisp_gpe_main; |
| 400 | fib_route_path_t *rpath; |
| 401 | |
| 402 | if (vec_len (lgm->native_fwd_rpath[IP4])) |
| 403 | { |
| 404 | vec_foreach (rpath, lgm->native_fwd_rpath[IP4]) |
| 405 | { |
| 406 | vlib_cli_output (vm, "nh: %U fib_index %u sw_if_index %u", |
| 407 | format_ip46_address, &rpath->frp_addr, 1, |
| 408 | rpath->frp_fib_index, rpath->frp_sw_if_index); |
| 409 | } |
| 410 | } |
| 411 | if (vec_len (lgm->native_fwd_rpath[IP6])) |
| 412 | { |
| 413 | vec_foreach (rpath, lgm->native_fwd_rpath[IP6]) |
| 414 | { |
| 415 | vlib_cli_output (vm, "nh: %U fib_index %u sw_if_index %u", |
| 416 | format_ip46_address, &rpath->frp_addr, 1, |
| 417 | rpath->frp_fib_index, rpath->frp_sw_if_index); |
| 418 | } |
| 419 | } |
| 420 | return 0; |
| 421 | } |
| 422 | |
| 423 | /* *INDENT-OFF* */ |
| 424 | VLIB_CLI_COMMAND (gpe_show_native_fwd_rpath_command) = { |
| 425 | .path = "show gpe native-forward", |
| 426 | .short_help = "show gpe native-forward", |
| 427 | .function = gpe_show_native_fwd_rpath_command_fn, |
| 428 | }; |
| 429 | /* *INDENT-ON* */ |
| 430 | |
| 431 | void |
| 432 | gpe_update_native_fwd_path (u8 ip_version) |
| 433 | { |
| 434 | lisp_gpe_main_t *lgm = vnet_lisp_gpe_get_main (); |
| 435 | lisp_gpe_fwd_entry_t *lfe; |
| 436 | fib_prefix_t fib_prefix; |
| 437 | u32 *lfei; |
| 438 | |
| 439 | vec_foreach (lfei, lgm->native_fwd_lfes[ip_version]) |
| 440 | { |
| 441 | lfe = pool_elt_at_index (lgm->lisp_fwd_entry_pool, lfei[0]); |
| 442 | ip_prefix_to_fib_prefix (&lfe->key->rmt.ippref, &fib_prefix); |
| 443 | fib_table_entry_update (lfe->eid_fib_index, &fib_prefix, FIB_SOURCE_LISP, |
| 444 | FIB_ENTRY_FLAG_NONE, |
| 445 | lgm->native_fwd_rpath[ip_version]); |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | int |
| 450 | vnet_gpe_add_del_native_fwd_rpath (vnet_gpe_native_fwd_rpath_args_t * a) |
| 451 | { |
| 452 | lisp_gpe_main_t *lgm = vnet_lisp_gpe_get_main (); |
| 453 | fib_route_path_t *rpath; |
| 454 | u8 ip_version; |
| 455 | |
| 456 | ip_version = a->rpath.frp_proto == FIB_PROTOCOL_IP4 ? IP4 : IP6; |
| 457 | |
| 458 | if (a->is_add) |
| 459 | { |
| 460 | vec_add1 (lgm->native_fwd_rpath[ip_version], a->rpath); |
| 461 | } |
| 462 | else |
| 463 | { |
| 464 | vec_foreach (rpath, lgm->native_fwd_rpath[ip_version]) |
| 465 | { |
| 466 | if (!fib_route_path_cmp (rpath, &a->rpath)) |
| 467 | { |
| 468 | vec_del1 (lgm->native_fwd_rpath[ip_version], |
| 469 | rpath - lgm->native_fwd_rpath[ip_version]); |
| 470 | break; |
| 471 | } |
| 472 | } |
| 473 | } |
| 474 | gpe_update_native_fwd_path (ip_version); |
| 475 | return 0; |
| 476 | } |
| 477 | |
| 478 | /** |
| 479 | * CLI command to add action for native forward. |
| 480 | */ |
| 481 | static clib_error_t * |
| 482 | gpe_native_forward_command_fn (vlib_main_t * vm, unformat_input_t * input, |
| 483 | vlib_cli_command_t * cmd) |
| 484 | { |
| 485 | vnet_main_t *vnm = vnet_get_main (); |
| 486 | unformat_input_t _line_input, *line_input = &_line_input; |
| 487 | vnet_api_error_t rv; |
| 488 | fib_route_path_t rpath; |
| 489 | u32 table_id = ~0; |
| 490 | vnet_gpe_native_fwd_rpath_args_t _a, *a = &_a; |
| 491 | u8 is_add = 1; |
| 492 | clib_error_t *error = 0; |
| 493 | |
| 494 | /* Get a line of input. */ |
| 495 | if (!unformat_user (input, unformat_line_input, line_input)) |
| 496 | return 0; |
| 497 | |
| 498 | memset (&rpath, 0, sizeof (rpath)); |
| 499 | |
| 500 | while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) |
| 501 | { |
| 502 | if (unformat (line_input, "table %d", &table_id)) |
| 503 | ; |
| 504 | else if (unformat (line_input, "del")) |
| 505 | is_add = 0; |
| 506 | else if (unformat (line_input, "via %U %U", |
| 507 | unformat_ip4_address, |
| 508 | &rpath.frp_addr.ip4, |
| 509 | unformat_vnet_sw_interface, vnm, |
| 510 | &rpath.frp_sw_if_index)) |
| 511 | { |
| 512 | rpath.frp_weight = 1; |
| 513 | rpath.frp_proto = FIB_PROTOCOL_IP4; |
| 514 | } |
| 515 | else if (unformat (line_input, "via %U %U", |
| 516 | unformat_ip6_address, |
| 517 | &rpath.frp_addr.ip6, |
| 518 | unformat_vnet_sw_interface, vnm, |
| 519 | &rpath.frp_sw_if_index)) |
| 520 | { |
| 521 | rpath.frp_weight = 1; |
| 522 | rpath.frp_proto = FIB_PROTOCOL_IP6; |
| 523 | } |
| 524 | else if (unformat (line_input, "via %U", |
| 525 | unformat_ip4_address, &rpath.frp_addr.ip4)) |
| 526 | { |
| 527 | rpath.frp_weight = 1; |
| 528 | rpath.frp_sw_if_index = ~0; |
| 529 | rpath.frp_proto = FIB_PROTOCOL_IP4; |
| 530 | } |
| 531 | else if (unformat (line_input, "via %U", |
| 532 | unformat_ip6_address, &rpath.frp_addr.ip6)) |
| 533 | { |
| 534 | rpath.frp_weight = 1; |
| 535 | rpath.frp_sw_if_index = ~0; |
| 536 | rpath.frp_proto = FIB_PROTOCOL_IP6; |
| 537 | } |
| 538 | else |
| 539 | { |
| 540 | return clib_error_return (0, "parse error: '%U'", |
| 541 | format_unformat_error, line_input); |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | if ((u32) ~ 0 == table_id) |
| 546 | { |
| 547 | rpath.frp_fib_index = 0; |
| 548 | } |
| 549 | else |
| 550 | { |
| 551 | rpath.frp_fib_index = fib_table_find (rpath.frp_proto, table_id); |
| 552 | if ((u32) ~ 0 == rpath.frp_fib_index) |
| 553 | { |
| 554 | error = clib_error_return (0, "Nonexistent table id %d", table_id); |
| 555 | goto done; |
| 556 | } |
| 557 | } |
| 558 | |
| 559 | a->rpath = rpath; |
| 560 | a->is_add = is_add; |
| 561 | |
| 562 | rv = vnet_gpe_add_del_native_fwd_rpath (a); |
| 563 | if (rv) |
| 564 | { |
| 565 | return clib_error_return (0, "Error: couldn't add path!"); |
| 566 | } |
| 567 | |
| 568 | done: |
| 569 | return error; |
| 570 | } |
| 571 | |
| 572 | /* *INDENT-OFF* */ |
| 573 | VLIB_CLI_COMMAND (gpe_native_forward_command) = { |
| 574 | .path = "gpe native-forward", |
| 575 | .short_help = "gpe native-forward [del] via <nh-ip-addr> [iface] " |
| 576 | "[table <table>]", |
| 577 | .function = gpe_native_forward_command_fn, |
| 578 | }; |
| 579 | /* *INDENT-ON* */ |
| 580 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 581 | /** Format LISP-GPE status. */ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 582 | u8 * |
| 583 | format_vnet_lisp_gpe_status (u8 * s, va_list * args) |
| 584 | { |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 585 | lisp_gpe_main_t *lgm = &lisp_gpe_main; |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 586 | return format (s, "%s", lgm->is_en ? "enabled" : "disabled"); |
| 587 | } |
| 588 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 589 | /** LISP-GPE init function. */ |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 590 | clib_error_t * |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 591 | lisp_gpe_init (vlib_main_t * vm) |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 592 | { |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 593 | lisp_gpe_main_t *lgm = &lisp_gpe_main; |
| 594 | clib_error_t *error = 0; |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 595 | |
| 596 | if ((error = vlib_call_init_function (vm, ip_main_init))) |
| 597 | return error; |
| 598 | |
| 599 | if ((error = vlib_call_init_function (vm, ip4_lookup_init))) |
| 600 | return error; |
| 601 | |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 602 | lgm->vnet_main = vnet_get_main (); |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 603 | lgm->vlib_main = vm; |
| 604 | lgm->im4 = &ip4_main; |
Florin Coras | 02655bd | 2016-04-26 00:17:24 +0200 | [diff] [blame] | 605 | lgm->im6 = &ip6_main; |
| 606 | lgm->lm4 = &ip4_main.lookup_main; |
| 607 | lgm->lm6 = &ip6_main.lookup_main; |
Filip Tehlar | 3e7b5693 | 2017-02-21 18:28:34 +0100 | [diff] [blame] | 608 | lgm->encap_mode = GPE_ENCAP_LISP; |
Florin Coras | 577c355 | 2016-04-21 00:45:40 +0200 | [diff] [blame] | 609 | |
Neale Ranns | 5e575b1 | 2016-10-03 09:40:25 +0100 | [diff] [blame] | 610 | lgm->lisp_gpe_fwd_entries = |
| 611 | hash_create_mem (0, sizeof (lisp_gpe_fwd_entry_key_t), sizeof (uword)); |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 612 | |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 613 | udp_register_dst_port (vm, UDP_DST_PORT_lisp_gpe, |
| 614 | lisp_gpe_ip4_input_node.index, 1 /* is_ip4 */ ); |
Florin Coras | 02655bd | 2016-04-26 00:17:24 +0200 | [diff] [blame] | 615 | udp_register_dst_port (vm, UDP_DST_PORT_lisp_gpe6, |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 616 | lisp_gpe_ip6_input_node.index, 0 /* is_ip4 */ ); |
Florin Coras | 263440e | 2017-02-22 23:38:08 -0800 | [diff] [blame] | 617 | |
Filip Tehlar | 4868ff6 | 2017-03-09 16:48:39 +0100 | [diff] [blame] | 618 | lgm->lisp_stats_index_by_key = |
| 619 | hash_create_mem (0, sizeof (lisp_stats_key_t), sizeof (uword)); |
Filip Tehlar | 2151191 | 2017-04-07 10:41:42 +0200 | [diff] [blame] | 620 | memset (&lgm->counters, 0, sizeof (lgm->counters)); |
| 621 | lgm->counters.name = "LISP counters"; |
| 622 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 623 | return 0; |
| 624 | } |
| 625 | |
Filip Tehlar | 3e7b5693 | 2017-02-21 18:28:34 +0100 | [diff] [blame] | 626 | gpe_encap_mode_t |
| 627 | vnet_gpe_get_encap_mode (void) |
| 628 | { |
| 629 | lisp_gpe_main_t *lgm = &lisp_gpe_main; |
| 630 | return lgm->encap_mode; |
| 631 | } |
| 632 | |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 633 | VLIB_INIT_FUNCTION (lisp_gpe_init); |
| 634 | |
| 635 | /* |
| 636 | * fd.io coding-style-patch-verification: ON |
| 637 | * |
| 638 | * Local Variables: |
| 639 | * eval: (c-set-style "gnu") |
| 640 | * End: |
| 641 | */ |