diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/igmp/igmp_pkt.c | 4 | ||||
-rw-r--r-- | src/plugins/ping/ping.c | 18 | ||||
-rw-r--r-- | src/plugins/unittest/fib_test.c | 14 | ||||
-rw-r--r-- | src/plugins/vrrp/node.c | 4 | ||||
-rw-r--r-- | src/plugins/vrrp/vrrp_packet.c | 7 |
5 files changed, 23 insertions, 24 deletions
diff --git a/src/plugins/igmp/igmp_pkt.c b/src/plugins/igmp/igmp_pkt.c index e93dd9c2667..8912e5af882 100644 --- a/src/plugins/igmp/igmp_pkt.c +++ b/src/plugins/igmp/igmp_pkt.c @@ -16,6 +16,7 @@ */ #include <igmp/igmp_pkt.h> +#include <vnet/fib/fib_sas.h> static void vlib_buffer_append (vlib_buffer_t * b, uword l) @@ -76,8 +77,7 @@ igmp_pkt_build_ip_header (igmp_pkt_build_t * bk, ip4->protocol = IP_PROTOCOL_IGMP; ip4->tos = 0xc0; - ip4_src_address_for_packet (&ip4_main.lookup_main, - bk->sw_if_index, &ip4->src_address); + fib_sas4_get (bk->sw_if_index, NULL, &ip4->src_address); vlib_buffer_append (b, sizeof (*ip4)); bk->n_avail -= sizeof (*ip4); diff --git a/src/plugins/ping/ping.c b/src/plugins/ping/ping.c index 0ce4f9698f0..98add533407 100644 --- a/src/plugins/ping/ping.c +++ b/src/plugins/ping/ping.c @@ -18,7 +18,7 @@ #include <vlib/vlib.h> #include <vnet/fib/ip6_fib.h> #include <vnet/fib/ip4_fib.h> -#include <vnet/fib/fib_entry.h> +#include <vnet/fib/fib_sas.h> #include <vnet/ip/ip6_link.h> #include <vnet/plugin/plugin.h> #include <vpp/app/version.h> @@ -725,24 +725,22 @@ ip46_fill_l3_header (ip46_address_t * pa46, vlib_buffer_t * b0, int is_ip6) } } -static int +static bool ip46_set_src_address (u32 sw_if_index, vlib_buffer_t * b0, int is_ip6) { - int res; + bool res = false; + if (is_ip6) { ip6_header_t *ip6 = vlib_buffer_get_current (b0); - res = ip6_src_address_for_packet (sw_if_index, - &ip6->dst_address, &ip6->src_address); + + res = fib_sas6_get (sw_if_index, &ip6->dst_address, &ip6->src_address); } else { - ip4_main_t *im = &ip4_main; ip4_header_t *ip4 = vlib_buffer_get_current (b0); - res = ip4_src_address_for_packet (&im->lookup_main, - sw_if_index, &ip4->src_address); - /* IP4 and IP6 paths have the inverse logic. Harmonize. */ - res = !res; + + res = fib_sas4_get (sw_if_index, &ip4->dst_address, &ip4->src_address); } return res; } diff --git a/src/plugins/unittest/fib_test.c b/src/plugins/unittest/fib_test.c index 3244b8a3001..1a2ba4a4b00 100644 --- a/src/plugins/unittest/fib_test.c +++ b/src/plugins/unittest/fib_test.c @@ -898,9 +898,6 @@ fib_test_v4 (void) adj = adj_get(ai); FIB_TEST((IP_LOOKUP_NEXT_GLEAN == adj->lookup_next_index), "attached interface adj is glean"); - FIB_TEST((0 == ip46_address_cmp(&local_pfx.fp_addr, - &adj->sub_type.glean.receive_addr)), - "attached interface adj is receive ok"); local_pfx.fp_len = 32; fib_table_entry_update_one_path(fib_index, &local_pfx, @@ -937,6 +934,9 @@ fib_test_v4 (void) FIB_PROTOCOL_IP4, FIB_SOURCE_INTERFACE)), "2 Interface Source'd prefixes"); + FIB_TEST((0 == ip46_address_cmp(&local_pfx.fp_addr, + &adj->sub_type.glean.rx_pfx.fp_addr)), + "attached interface adj is receive ok"); /* * +2 interface routes +2 non-shared path-lists @@ -4495,9 +4495,6 @@ fib_test_v6 (void) adj = adj_get(ai); FIB_TEST((IP_LOOKUP_NEXT_GLEAN == adj->lookup_next_index), "attached interface adj is glean"); - FIB_TEST((0 == ip46_address_cmp(&local_pfx.fp_addr, - &adj->sub_type.glean.receive_addr)), - "attached interface adj is receive ok"); dpo = fib_entry_contribute_ip_forwarding(fei); FIB_TEST((dpo->dpoi_index == ip6_fib_table_fwding_lookup( 1, @@ -4535,6 +4532,9 @@ fib_test_v6 (void) 1, &local_pfx.fp_addr.ip6)), "local-route; fwd and non-fwd tables match"); + FIB_TEST((0 == ip46_address_cmp(&local_pfx.fp_addr, + &adj->sub_type.glean.rx_pfx.fp_addr)), + "attached interface adj is receive ok"); /* * +2 entries. +2 unshared path-lists @@ -5257,6 +5257,8 @@ fib_test_v6 (void) FIB_TEST((0 == adj_nbr_db_size()), "ADJ DB size is %d", adj_nbr_db_size()); + FIB_TEST((0 == adj_glean_db_size()), "ADJ DB size is %d", + adj_glean_db_size()); return (res); } diff --git a/src/plugins/vrrp/node.c b/src/plugins/vrrp/node.c index 486c1a819c2..7ba18c4f75c 100644 --- a/src/plugins/vrrp/node.c +++ b/src/plugins/vrrp/node.c @@ -12,6 +12,7 @@ #include <vnet/ip/ip4_packet.h> #include <vnet/ip/ip6_link.h> #include <vnet/ethernet/arp_packet.h> +#include <vnet/fib/fib_sas.h> #include <vppinfra/error.h> #include <vrrp/vrrp.h> #include <vrrp/vrrp_packet.h> @@ -119,8 +120,7 @@ vrrp_vr_addr_cmp (vrrp_vr_t * vr, vrrp_header_t * pkt) peer_addr = &(((ip4_header_t *) pkt) - 1)->src_address; local_addr = &addr.ip4; addr_size = 4; - ip4_src_address_for_packet (&ip4_main.lookup_main, - vrc->sw_if_index, local_addr); + fib_sas4_get (vrc->sw_if_index, NULL, local_addr); } return memcmp (local_addr, peer_addr, addr_size); diff --git a/src/plugins/vrrp/vrrp_packet.c b/src/plugins/vrrp/vrrp_packet.c index 6b0d4c96c2d..b77f336930a 100644 --- a/src/plugins/vrrp/vrrp_packet.c +++ b/src/plugins/vrrp/vrrp_packet.c @@ -14,6 +14,7 @@ #include <vnet/adj/adj.h> #include <vnet/adj/adj_mcast.h> #include <vnet/fib/fib_table.h> +#include <vnet/fib/fib_sas.h> #include <vnet/ip/igmp_packet.h> #include <vnet/ip/ip6_link.h> #include <vnet/ethernet/arp_packet.h> @@ -107,8 +108,7 @@ vrrp_adv_l3_build (vrrp_vr_t * vr, vlib_buffer_t * b, ip4->ttl = 255; ip4->protocol = IP_PROTOCOL_VRRP; clib_memcpy (&ip4->dst_address, &dst->ip4, sizeof (dst->ip4)); - ip4_src_address_for_packet (&ip4_main.lookup_main, - vr->config.sw_if_index, &ip4->src_address); + fib_sas4_get (vr->config.sw_if_index, NULL, &ip4->src_address); ip4->length = clib_host_to_net_u16 (sizeof (*ip4) + vrrp_adv_payload_len (vr)); ip4->checksum = ip4_header_checksum (ip4); @@ -541,8 +541,7 @@ vrrp_igmp_pkt_build (vrrp_vr_t * vr, vlib_buffer_t * b) ip4 = vlib_buffer_get_current (b); clib_memcpy (ip4, &igmp_ip4_mcast, sizeof (*ip4)); - ip4_src_address_for_packet (&ip4_main.lookup_main, vr->config.sw_if_index, - &ip4->src_address); + fib_sas4_get (vr->config.sw_if_index, NULL, &ip4->src_address); vlib_buffer_chain_increase_length (b, b, sizeof (*ip4)); vlib_buffer_advance (b, sizeof (*ip4)); |