2 * Copyright (c) 2020 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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @brief FIB Source Address selection
19 * Use the FIB for source address selection on an interface
25 #include <vnet/fib/fib_types.h>
26 #include <vnet/ip/ip_types.h>
29 * @brief Get a Source address to use in a packet being sent out
32 * @param sw_if_index The interface on which the packet is to be sent
33 * @param af The address family of the packet
34 * @param dst The destination of the packet (can be NULL in which case any
35 * of the available address will be returned)
36 * @param src OUT the source address to use
38 * @return True if an address is available False (and src is unset) otherwise
40 extern bool fib_sas_get (u32 sw_if_index,
41 ip_address_family_t af,
42 const ip46_address_t *dst,
46 * @brief Get an IPv4 Source address to use in a packet being sent out
49 * @param sw_if_index The interface on which the packet is to be sent
50 * @param dst The destination of the packet (can be NULL in which case any
51 * of the available address will be returned)
52 * @param src OUT the source address to use
54 * @return True if an address is available False (and src is unset) otherwise
56 extern bool fib_sas4_get (u32 sw_if_index,
57 const ip4_address_t *dst,
61 * @brief Get an IPv6 Source address to use in a packet being sent out
64 * @param sw_if_index The interface on which the packet is to be sent
65 * @param dst The destination of the packet (can be NULL in which case any
66 * of the available address will be returned)
67 * @param src OUT the source address to use
69 * @return True if an address is available False (and src is unset) otherwise
71 extern bool fib_sas6_get (u32 sw_if_index,
72 const ip6_address_t *dst,