ip-neighbor: Use ip_address_t rather than ip46_address_t
Type: improvement Change-Id: Ica5f395075677bda5f38d28e704f65350af88610 Signed-off-by: Neale Ranns <nranns@cisco.com>
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
#include <vnet/l2/l2_fib.h>
|
||||
#include <vnet/fib/fib_table.h>
|
||||
#include <vnet/ip-neighbor/ip_neighbor.h>
|
||||
#include <vnet/ip-neighbor/ip4_neighbor.h>
|
||||
#include <vnet/ip-neighbor/ip6_neighbor.h>
|
||||
#include <vnet/fib/fib_walk.h>
|
||||
#include <vnet/vxlan-gbp/vxlan_gbp.h>
|
||||
|
||||
@@ -768,11 +770,16 @@ gbb_endpoint_fwd_recalc (gbp_endpoint_t * ge)
|
||||
{
|
||||
gbp_endpoint_add_itf (gbp_itf_get_sw_if_index (gef->gef_itf),
|
||||
gei);
|
||||
ip_neighbor_advertise (vlib_get_main (),
|
||||
(FIB_PROTOCOL_IP4 == pfx->fp_proto ?
|
||||
IP46_TYPE_IP4 :
|
||||
IP46_TYPE_IP6),
|
||||
&pfx->fp_addr, gg->gg_uplink_sw_if_index);
|
||||
if (FIB_PROTOCOL_IP4 == pfx->fp_proto)
|
||||
ip4_neighbor_advertise (vlib_get_main (),
|
||||
vnet_get_main (),
|
||||
gg->gg_uplink_sw_if_index,
|
||||
&pfx->fp_addr.ip4);
|
||||
else
|
||||
ip6_neighbor_advertise (vlib_get_main (),
|
||||
vnet_get_main (),
|
||||
gg->gg_uplink_sw_if_index,
|
||||
&pfx->fp_addr.ip6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ handle_get_mactime (http_builtin_method_type_t reqtype,
|
||||
|
||||
/* Walk all ip4 neighbours on all interfaces */
|
||||
vec_reset_length (mm->arp_cache_copy);
|
||||
ip_neighbor_walk (IP46_TYPE_IP4, ~0, mactime_ip_neighbor_copy, mm);
|
||||
ip_neighbor_walk (AF_IP4, ~0, mactime_ip_neighbor_copy, mm);
|
||||
|
||||
now = clib_timebase_now (&mm->timebase);
|
||||
|
||||
|
||||
@@ -561,7 +561,7 @@ show_mactime_command_fn (vlib_main_t * vm,
|
||||
|
||||
vec_reset_length (mm->arp_cache_copy);
|
||||
/* Walk all ip4 neighbours on all interfaces */
|
||||
ip_neighbor_walk (IP46_TYPE_IP4, ~0, mactime_ip_neighbor_copy, mm);
|
||||
ip_neighbor_walk (AF_IP4, ~0, mactime_ip_neighbor_copy, mm);
|
||||
|
||||
now = clib_timebase_now (&mm->timebase);
|
||||
|
||||
|
||||
+7
-3
@@ -189,12 +189,16 @@ always_inline u32
|
||||
arp_learn (u32 sw_if_index,
|
||||
const ethernet_arp_ip4_over_ethernet_address_t * addr)
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
ip_neighbor_learn_t l = {
|
||||
.ip.ip4 = addr->ip4,
|
||||
.type = IP46_TYPE_IP4,
|
||||
.ip = {
|
||||
.ip.ip4 = addr->ip4,
|
||||
.version = AF_IP4,
|
||||
},
|
||||
.mac = addr->mac,
|
||||
.sw_if_index = sw_if_index,
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
ip_neighbor_learn_dp (&l);
|
||||
|
||||
@@ -906,7 +910,7 @@ ethernet_arp_init (vlib_main_t * vm)
|
||||
vec_add1 (im->enable_disable_interface_callbacks, cb);
|
||||
}
|
||||
|
||||
ip_neighbor_register (IP46_TYPE_IP4, &arp_vft);
|
||||
ip_neighbor_register (AF_IP4, &arp_vft);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include <vppinfra/lb_hash_hash.h>
|
||||
#include <vnet/ip/ip.h>
|
||||
#include <vnet/ip-neighbor/ip_neighbor.h>
|
||||
#include <vnet/ip-neighbor/ip4_neighbor.h>
|
||||
#include <vnet/ip-neighbor/ip6_neighbor.h>
|
||||
|
||||
#define foreach_bond_tx_error \
|
||||
_(NONE, "no error") \
|
||||
@@ -801,7 +803,8 @@ bond_active_interface_switch_cb (vnet_main_t * vnm, u32 sw_if_index,
|
||||
{
|
||||
bond_main_t *bm = &bond_main;
|
||||
|
||||
ip_neighbor_advertise (bm->vlib_main, IP46_TYPE_BOTH, NULL, sw_if_index);
|
||||
ip4_neighbor_advertise (bm->vlib_main, bm->vnet_main, sw_if_index, NULL);
|
||||
ip6_neighbor_advertise (bm->vlib_main, bm->vnet_main, sw_if_index, NULL);
|
||||
|
||||
return (WALK_CONTINUE);
|
||||
}
|
||||
|
||||
+223
-207
File diff suppressed because it is too large
Load Diff
@@ -30,25 +30,24 @@ void ip_neighbor_scan_enable_disable (ip_neighbor_scan_arg_t * arg);
|
||||
*/
|
||||
|
||||
extern ip_neighbor_t *ip_neighbor_get (index_t ipni);
|
||||
extern int ip_neighbor_add (const ip46_address_t * ip,
|
||||
ip46_type_t type,
|
||||
extern int ip_neighbor_add (const ip_address_t * ip,
|
||||
const mac_address_t * mac,
|
||||
u32 sw_if_index,
|
||||
ip_neighbor_flags_t flags, u32 * stats_index);
|
||||
extern int ip_neighbor_del (const ip46_address_t * ip,
|
||||
ip46_type_t type, u32 sw_if_index);
|
||||
extern int ip_neighbor_del (const ip_address_t * ip, u32 sw_if_index);
|
||||
|
||||
extern int ip_neighbor_config (ip46_type_t type, u32 limit, u32 age,
|
||||
bool recycle);
|
||||
extern int ip_neighbor_config (ip_address_family_t af,
|
||||
u32 limit, u32 age, bool recycle);
|
||||
|
||||
extern void ip_neighbor_del_all (ip46_type_t type, u32 sw_if_index);
|
||||
extern void ip_neighbor_del_all (ip_address_family_t af, u32 sw_if_index);
|
||||
|
||||
typedef walk_rc_t (*ip_neighbor_walk_cb_t) (index_t ipni, void *ctx);
|
||||
extern void ip_neighbor_walk (ip46_type_t type,
|
||||
extern void ip_neighbor_walk (ip_address_family_t af,
|
||||
u32 sw_if_index,
|
||||
ip_neighbor_walk_cb_t fn, void *ctx);
|
||||
|
||||
extern const ip46_address_t *ip_neighbor_get_ip (const ip_neighbor_t * ipn);
|
||||
extern const ip_address_t *ip_neighbor_get_ip (const ip_neighbor_t * ipn);
|
||||
extern ip_address_family_t ip_neighbor_get_af (const ip_neighbor_t * ipn);
|
||||
extern const mac_address_t *ip_neighbor_get_mac (const ip_neighbor_t * ipn);
|
||||
extern const u32 ip_neighbor_get_sw_if_index (const ip_neighbor_t * ipn);
|
||||
|
||||
@@ -56,16 +55,12 @@ extern void ip_neighbor_learn (const ip_neighbor_learn_t * l);
|
||||
|
||||
extern void ip_neighbor_update (vnet_main_t * vnm, adj_index_t ai);
|
||||
|
||||
extern void ip_neighbor_advertise (vlib_main_t * vm,
|
||||
ip46_type_t tyoe,
|
||||
const ip46_address_t * addr,
|
||||
u32 sw_if_index);
|
||||
extern void ip_neighbor_probe (const ip_adjacency_t * adj);
|
||||
extern void ip_neighbor_probe_dst (const ip_adjacency_t * adj,
|
||||
const ip46_address_t * ip);
|
||||
|
||||
extern void ip_neighbor_mark (ip46_type_t type);
|
||||
extern void ip_neighbor_sweep (ip46_type_t type);
|
||||
extern void ip_neighbor_mark (ip_address_family_t af);
|
||||
extern void ip_neighbor_sweep (ip_address_family_t af);
|
||||
|
||||
/**
|
||||
* From the watcher to the API to publish a new neighbor
|
||||
@@ -114,7 +109,7 @@ typedef struct ip_neighbor_vft_t_
|
||||
ip6_neighbor_proxy_cfg_t inv_proxy6_del;
|
||||
} ip_neighbor_vft_t;
|
||||
|
||||
extern void ip_neighbor_register (ip46_type_t type,
|
||||
extern void ip_neighbor_register (ip_address_family_t af,
|
||||
const ip_neighbor_vft_t * vft);
|
||||
|
||||
|
||||
|
||||
@@ -37,13 +37,6 @@ static u16 msg_id_base;
|
||||
|
||||
#include <vnet/format_fns.h>
|
||||
|
||||
|
||||
static ip46_type_t
|
||||
ip46_type_from_af (ip_address_family_t af)
|
||||
{
|
||||
return (AF_IP4 == af ? IP46_TYPE_IP4 : IP46_TYPE_IP6);
|
||||
}
|
||||
|
||||
static vl_api_ip_neighbor_flags_t
|
||||
ip_neighbor_flags_encode (ip_neighbor_flags_t f)
|
||||
{
|
||||
@@ -63,8 +56,7 @@ ip_neighbor_encode (vl_api_ip_neighbor_t * api, const ip_neighbor_t * ipn)
|
||||
api->sw_if_index = htonl (ipn->ipn_key->ipnk_sw_if_index);
|
||||
api->flags = ip_neighbor_flags_encode (ipn->ipn_flags);
|
||||
|
||||
ip_address_encode (&ipn->ipn_key->ipnk_ip,
|
||||
ipn->ipn_key->ipnk_type, &api->ip_address);
|
||||
ip_address_encode2 (&ipn->ipn_key->ipnk_ip, &api->ip_address);
|
||||
mac_address_encode (&ipn->ipn_mac, api->mac_address);
|
||||
}
|
||||
|
||||
@@ -108,8 +100,8 @@ ip_neighbor_handle_event (const ip_neighbor_event_t * ipne)
|
||||
if (vlib_time_now (vlib_get_main ()) > last_time + 10.0)
|
||||
{
|
||||
clib_warning ("ip6 nd event for %U to pid %d: queue stuffed!",
|
||||
format_ip46_address, &ipn->ipn_key->ipnk_ip,
|
||||
IP46_TYPE_ANY, ipne->ipne_watch.ipw_pid);
|
||||
format_ip_address, &ipn->ipn_key->ipnk_ip,
|
||||
ipne->ipne_watch.ipw_pid);
|
||||
last_time = vlib_time_now (vlib_get_main ());
|
||||
}
|
||||
}
|
||||
@@ -167,10 +159,7 @@ vl_api_ip_neighbor_dump_t_handler (vl_api_ip_neighbor_dump_t * mp)
|
||||
};
|
||||
|
||||
// walk all neighbours on all interfaces
|
||||
ip_neighbor_walk ((af == AF_IP4 ?
|
||||
IP46_TYPE_IP4 :
|
||||
IP46_TYPE_IP6),
|
||||
sw_if_index, send_ip_neighbor_details, &ctx);
|
||||
ip_neighbor_walk (af, sw_if_index, send_ip_neighbor_details, &ctx);
|
||||
}
|
||||
|
||||
static ip_neighbor_flags_t
|
||||
@@ -193,15 +182,14 @@ vl_api_ip_neighbor_add_del_t_handler (vl_api_ip_neighbor_add_del_t * mp,
|
||||
vl_api_ip_neighbor_add_del_reply_t *rmp;
|
||||
ip_neighbor_flags_t flags;
|
||||
u32 stats_index = ~0;
|
||||
ip46_address_t ip = ip46_address_initializer;
|
||||
ip_address_t ip = ip_address_initializer;
|
||||
mac_address_t mac;
|
||||
ip46_type_t type;
|
||||
int rv;
|
||||
|
||||
VALIDATE_SW_IF_INDEX ((&mp->neighbor));
|
||||
|
||||
flags = ip_neighbor_flags_decode (mp->neighbor.flags);
|
||||
type = ip_address_decode (&mp->neighbor.ip_address, &ip);
|
||||
ip_address_decode2 (&mp->neighbor.ip_address, &ip);
|
||||
mac_address_decode (mp->neighbor.mac_address, &mac);
|
||||
|
||||
/* must be static or dynamic, default to dynamic */
|
||||
@@ -215,11 +203,11 @@ vl_api_ip_neighbor_add_del_t_handler (vl_api_ip_neighbor_add_del_t * mp,
|
||||
* will come of adding bogus entries.
|
||||
*/
|
||||
if (mp->is_add)
|
||||
rv = ip_neighbor_add (&ip, type, &mac,
|
||||
rv = ip_neighbor_add (&ip, &mac,
|
||||
ntohl (mp->neighbor.sw_if_index),
|
||||
flags, &stats_index);
|
||||
else
|
||||
rv = ip_neighbor_del (&ip, type, ntohl (mp->neighbor.sw_if_index));
|
||||
rv = ip_neighbor_del (&ip, ntohl (mp->neighbor.sw_if_index));
|
||||
|
||||
BAD_SW_IF_INDEX_LABEL;
|
||||
|
||||
@@ -236,13 +224,12 @@ vl_api_want_ip_neighbor_events_t_handler (vl_api_want_ip_neighbor_events_t *
|
||||
mp)
|
||||
{
|
||||
vl_api_want_ip_neighbor_events_reply_t *rmp;
|
||||
ip46_address_t ip;
|
||||
ip46_type_t itype;
|
||||
ip_address_t ip;
|
||||
int rv = 0;
|
||||
|
||||
if (mp->sw_if_index != ~0)
|
||||
VALIDATE_SW_IF_INDEX (mp);
|
||||
itype = ip_address_decode (&mp->ip, &ip);
|
||||
ip_address_decode2 (&mp->ip, &ip);
|
||||
|
||||
ip_neighbor_watcher_t watch = {
|
||||
.ipw_client = mp->client_index,
|
||||
@@ -250,9 +237,9 @@ vl_api_want_ip_neighbor_events_t_handler (vl_api_want_ip_neighbor_events_t *
|
||||
};
|
||||
|
||||
if (mp->enable)
|
||||
ip_neighbor_watch (&ip, itype, ntohl (mp->sw_if_index), &watch);
|
||||
ip_neighbor_watch (&ip, ntohl (mp->sw_if_index), &watch);
|
||||
else
|
||||
ip_neighbor_unwatch (&ip, itype, ntohl (mp->sw_if_index), &watch);
|
||||
ip_neighbor_unwatch (&ip, ntohl (mp->sw_if_index), &watch);
|
||||
|
||||
BAD_SW_IF_INDEX_LABEL;
|
||||
REPLY_MACRO (VL_API_WANT_IP_NEIGHBOR_EVENTS_REPLY);
|
||||
@@ -268,7 +255,7 @@ vl_api_ip_neighbor_config_t_handler (vl_api_ip_neighbor_config_t * mp)
|
||||
rv = ip_address_family_decode (mp->af, &af);
|
||||
|
||||
if (!rv)
|
||||
rv = ip_neighbor_config (ip46_type_from_af (af),
|
||||
rv = ip_neighbor_config (af,
|
||||
ntohl (mp->max_number),
|
||||
ntohl (mp->max_age), mp->recycle);
|
||||
|
||||
@@ -282,8 +269,8 @@ vl_api_ip_neighbor_replace_begin_t_handler (vl_api_ip_neighbor_replace_begin_t
|
||||
vl_api_ip_neighbor_replace_begin_reply_t *rmp;
|
||||
int rv = 0;
|
||||
|
||||
ip_neighbor_mark (IP46_TYPE_IP4);
|
||||
ip_neighbor_mark (IP46_TYPE_IP6);
|
||||
ip_neighbor_mark (AF_IP4);
|
||||
ip_neighbor_mark (AF_IP6);
|
||||
|
||||
REPLY_MACRO (VL_API_IP_NEIGHBOR_REPLACE_BEGIN_REPLY);
|
||||
}
|
||||
@@ -295,8 +282,8 @@ vl_api_ip_neighbor_replace_end_t_handler (vl_api_ip_neighbor_replace_end_t *
|
||||
vl_api_ip_neighbor_replace_end_reply_t *rmp;
|
||||
int rv = 0;
|
||||
|
||||
ip_neighbor_sweep (IP46_TYPE_IP4);
|
||||
ip_neighbor_sweep (IP46_TYPE_IP6);
|
||||
ip_neighbor_sweep (AF_IP4);
|
||||
ip_neighbor_sweep (AF_IP6);
|
||||
|
||||
REPLY_MACRO (VL_API_IP_NEIGHBOR_REPLACE_END_REPLY);
|
||||
}
|
||||
@@ -314,7 +301,7 @@ vl_api_ip_neighbor_flush_t_handler (vl_api_ip_neighbor_flush_t * mp)
|
||||
rv = ip_address_family_decode (mp->af, &af);
|
||||
|
||||
if (!rv)
|
||||
ip_neighbor_del_all (ip46_type_from_af (af), ntohl (mp->sw_if_index));
|
||||
ip_neighbor_del_all (af, ntohl (mp->sw_if_index));
|
||||
|
||||
BAD_SW_IF_INDEX_LABEL;
|
||||
REPLY_MACRO (VL_API_IP_NEIGHBOR_FLUSH_REPLY);
|
||||
|
||||
@@ -37,8 +37,7 @@ format_ip_neighbor_key (u8 * s, va_list * va)
|
||||
|
||||
return (format (s, "[%U, %U]",
|
||||
format_vnet_sw_if_index_name, vnet_get_main (),
|
||||
key->ipnk_sw_if_index,
|
||||
format_ip46_address, &key->ipnk_ip, key->ipnk_type));
|
||||
key->ipnk_sw_if_index, format_ip_address, &key->ipnk_ip));
|
||||
}
|
||||
|
||||
u8 *
|
||||
@@ -62,7 +61,7 @@ format_ip_neighbor (u8 * s, va_list * va)
|
||||
return (format (s, "%=12U%=40U%=6U%=20U%U",
|
||||
format_vlib_time, vlib_get_main (),
|
||||
ipn->ipn_time_last_updated,
|
||||
format_ip46_address, &ipn->ipn_key->ipnk_ip, IP46_TYPE_ANY,
|
||||
format_ip_address, &ipn->ipn_key->ipnk_ip,
|
||||
format_ip_neighbor_flags, ipn->ipn_flags,
|
||||
format_mac_address_t, &ipn->ipn_mac,
|
||||
format_vnet_sw_if_index_name, vnet_get_main (),
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef __INCLUDE_IP_NEIGHBOR_TYPES_H__
|
||||
#define __INCLUDE_IP_NEIGHBOR_TYPES_H__
|
||||
|
||||
#include <vnet/ip/ip6_packet.h>
|
||||
#include <vnet/ip/ip_types.h>
|
||||
#include <vnet/ethernet/mac_address.h>
|
||||
#include <vnet/fib/fib_types.h>
|
||||
|
||||
@@ -62,10 +62,10 @@ extern u8 *format_ip_neighbor_watcher (u8 * s, va_list * args);
|
||||
|
||||
typedef struct ip_neighbor_key_t_
|
||||
{
|
||||
ip46_address_t ipnk_ip;
|
||||
ip46_type_t ipnk_type;
|
||||
ip_address_t ipnk_ip;
|
||||
u8 __pad[3];
|
||||
u32 ipnk_sw_if_index;
|
||||
} ip_neighbor_key_t;
|
||||
} __clib_packed ip_neighbor_key_t;
|
||||
|
||||
/**
|
||||
* A representation of an IP neighbour/peer
|
||||
@@ -110,8 +110,7 @@ extern ip_neighbor_t *ip_neighbor_get (index_t ipni);
|
||||
|
||||
typedef struct ip_neighbor_learn_t_
|
||||
{
|
||||
ip46_address_t ip;
|
||||
ip46_type_t type;
|
||||
ip_address_t ip;
|
||||
mac_address_t mac;
|
||||
u32 sw_if_index;
|
||||
} ip_neighbor_learn_t;
|
||||
|
||||
@@ -114,15 +114,13 @@ ip_neighbor_watch_cmp (const ip_neighbor_watcher_t * w1,
|
||||
}
|
||||
|
||||
void
|
||||
ip_neighbor_watch (const ip46_address_t * ip,
|
||||
ip46_type_t type,
|
||||
ip_neighbor_watch (const ip_address_t * ip,
|
||||
u32 sw_if_index,
|
||||
const ip_neighbor_watcher_t * watch)
|
||||
{
|
||||
ip_neighbor_key_t key = {
|
||||
.ipnk_ip = *ip,
|
||||
.ipnk_sw_if_index = (sw_if_index == 0 ? ~0 : sw_if_index),
|
||||
.ipnk_type = type,
|
||||
};
|
||||
ip_neighbor_watcher_t *ipws = NULL;
|
||||
uword *p;
|
||||
@@ -145,15 +143,13 @@ ip_neighbor_watch (const ip46_address_t * ip,
|
||||
}
|
||||
|
||||
void
|
||||
ip_neighbor_unwatch (const ip46_address_t * ip,
|
||||
ip46_type_t type,
|
||||
ip_neighbor_unwatch (const ip_address_t * ip,
|
||||
u32 sw_if_index,
|
||||
const ip_neighbor_watcher_t * watch)
|
||||
{
|
||||
ip_neighbor_key_t key = {
|
||||
.ipnk_ip = *ip,
|
||||
.ipnk_sw_if_index = (sw_if_index == 0 ? ~0 : sw_if_index),
|
||||
.ipnk_type = type,
|
||||
};
|
||||
ip_neighbor_watcher_t *ipws = NULL;
|
||||
uword *p;
|
||||
@@ -211,7 +207,7 @@ ip_neighbor_publish (index_t ipni)
|
||||
ip_neighbor_signal ((ip_neighbor_watcher_t*) p[0], ipni);
|
||||
}
|
||||
|
||||
ip46_address_reset (&key.ipnk_ip);
|
||||
ip_address_reset (&key.ipnk_ip);
|
||||
p = mhash_get (&ipnw_db.ipnwdb_hash, &key);
|
||||
|
||||
if (p) {
|
||||
|
||||
@@ -20,12 +20,10 @@
|
||||
|
||||
#include <vnet/ip-neighbor/ip_neighbor_types.h>
|
||||
|
||||
extern void ip_neighbor_watch (const ip46_address_t * ip,
|
||||
ip46_type_t type,
|
||||
extern void ip_neighbor_watch (const ip_address_t * ip,
|
||||
u32 sw_if_index,
|
||||
const ip_neighbor_watcher_t * watch);
|
||||
extern void ip_neighbor_unwatch (const ip46_address_t * ip,
|
||||
ip46_type_t type,
|
||||
extern void ip_neighbor_unwatch (const ip_address_t * ip,
|
||||
u32 sw_if_index,
|
||||
const ip_neighbor_watcher_t * watch);
|
||||
|
||||
|
||||
@@ -956,7 +956,10 @@ format_ip6_forward_next_trace (u8 * s, va_list * args)
|
||||
ip6_forward_next_trace_t *t = va_arg (*args, ip6_forward_next_trace_t *);
|
||||
u32 indent = format_get_indent (s);
|
||||
|
||||
s = format (s, "%U%U",
|
||||
s = format (s, "%Ufib:%d adj:%d flow:%d",
|
||||
format_white_space, indent,
|
||||
t->fib_index, t->adj_index, t->flow_hash);
|
||||
s = format (s, "\n%U%U",
|
||||
format_white_space, indent,
|
||||
format_ip6_header, t->packet_data, sizeof (t->packet_data));
|
||||
return s;
|
||||
|
||||
@@ -288,6 +288,19 @@ ip_address_to_fib_prefix (const ip_address_t * addr, fib_prefix_t * prefix)
|
||||
prefix->___fp___pad = 0;
|
||||
}
|
||||
|
||||
void
|
||||
ip_address_increment (ip_address_t * ip)
|
||||
{
|
||||
ip46_address_increment ((ip_addr_version (ip) == AF_IP4 ?
|
||||
IP46_TYPE_IP4 : IP46_TYPE_IP6), &ip_addr_46 (ip));
|
||||
}
|
||||
|
||||
void
|
||||
ip_address_reset (ip_address_t * ip)
|
||||
{
|
||||
clib_memset (ip, 0, sizeof (*ip));
|
||||
}
|
||||
|
||||
static void
|
||||
ip_prefix_normalize_ip4 (ip4_address_t * ip4, u8 preflen)
|
||||
{
|
||||
|
||||
@@ -26,8 +26,6 @@ typedef enum ip_address_family_t_
|
||||
|
||||
#define N_AF (AF_IP6+1)
|
||||
|
||||
#define N_AF (AF_IP6+1)
|
||||
|
||||
extern uword unformat_ip_address_family (unformat_input_t * input,
|
||||
va_list * args);
|
||||
extern u8 *format_ip_address_family (u8 * s, va_list * args);
|
||||
@@ -76,6 +74,8 @@ extern fib_protocol_t ip_address_to_46 (const ip_address_t * addr,
|
||||
ip46_address_t * a);
|
||||
extern void ip_address_from_46 (const ip46_address_t * a,
|
||||
fib_protocol_t fproto, ip_address_t * addr);
|
||||
extern void ip_address_increment (ip_address_t * ip);
|
||||
extern void ip_address_reset (ip_address_t * ip);
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
typedef struct ip_prefix
|
||||
|
||||
@@ -157,12 +157,17 @@ icmp6_neighbor_solicitation_or_advertisement (vlib_main_t * vm,
|
||||
if (PREDICT_TRUE (error0 == ICMP6_ERROR_NONE && o0 != 0 &&
|
||||
!ip6_sadd_unspecified))
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
ip_neighbor_learn_t learn = {
|
||||
.sw_if_index = sw_if_index0,
|
||||
.type = IP46_TYPE_IP6,
|
||||
.ip.ip6 = (is_solicitation ?
|
||||
ip0->src_address : h0->target_address),
|
||||
.ip = {
|
||||
.version = AF_IP6,
|
||||
.ip.ip6 = (is_solicitation ?
|
||||
ip0->src_address :
|
||||
h0->target_address),
|
||||
}
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
memcpy (&learn.mac, o0->ethernet_address, sizeof (learn.mac));
|
||||
ip_neighbor_learn_dp (&learn);
|
||||
}
|
||||
@@ -459,7 +464,7 @@ ip6_nd_init (vlib_main_t * vm)
|
||||
icmp6_register_type (vm, ICMP6_neighbor_advertisement,
|
||||
ip6_icmp_neighbor_advertisement_node.index);
|
||||
|
||||
ip_neighbor_register (IP46_TYPE_IP6, &ip6_nd_impl_vft);
|
||||
ip_neighbor_register (AF_IP6, &ip6_nd_impl_vft);
|
||||
|
||||
ip6_nd_delegate_id = ip6_link_delegate_register (&ip6_nd_delegate_vft);
|
||||
|
||||
|
||||
@@ -52,7 +52,11 @@ ip6_nd_proxy_add_del (u32 sw_if_index, const ip6_address_t * addr, u8 is_del)
|
||||
sw_if_index,
|
||||
~0, 1, FIB_ROUTE_PATH_FLAG_NONE);
|
||||
/* flush the ND cache of this address if it's there */
|
||||
ip_neighbor_del (&nh, IP46_TYPE_IP6, sw_if_index);
|
||||
ip_address_t ip = {
|
||||
.ip = nh,
|
||||
.version = AF_IP6,
|
||||
};
|
||||
ip_neighbor_del (&ip, sw_if_index);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -368,11 +368,15 @@ icmp6_router_solicitation (vlib_main_t * vm,
|
||||
if (PREDICT_TRUE (error0 == ICMP6_ERROR_NONE && o0 != 0 &&
|
||||
!is_unspecified && !is_link_local))
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
ip_neighbor_learn_t learn = {
|
||||
.type = IP46_TYPE_IP6,
|
||||
.sw_if_index = sw_if_index0,
|
||||
.ip.ip6 = ip0->src_address,
|
||||
.ip = {
|
||||
.ip.ip6 = ip0->src_address,
|
||||
.version = AF_IP6,
|
||||
},
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
memcpy (&learn.mac, o0->ethernet_address, sizeof (learn.mac));
|
||||
ip_neighbor_learn_dp (&learn);
|
||||
}
|
||||
|
||||
@@ -204,6 +204,8 @@ class ARPTestCase(VppTestCase):
|
||||
dyn_arp.add_vpp_config()
|
||||
self.assertTrue(dyn_arp.query_vpp_config())
|
||||
|
||||
self.logger.info(self.vapi.cli("show ip neighbor-watcher"))
|
||||
|
||||
# this matches all of the listnerers
|
||||
es = [self.vapi.wait_for_event(1, "ip_neighbor_event")
|
||||
for i in range(3)]
|
||||
|
||||
@@ -190,6 +190,7 @@ class P2PEthernetIPV6(VppTestCase):
|
||||
"""standard routing without p2p subinterfaces"""
|
||||
self.logger.info("FFP_TEST_START_0001")
|
||||
|
||||
self.pg0.config_ip6()
|
||||
route_8000 = VppIpRoute(self, "8000::", 64,
|
||||
[VppRoutePath(self.pg0.remote_ip6,
|
||||
self.pg0.sw_if_index)])
|
||||
@@ -202,6 +203,7 @@ class P2PEthernetIPV6(VppTestCase):
|
||||
Raw(b'\xa5' * 100))]
|
||||
self.send_packets(self.pg1, self.pg0)
|
||||
|
||||
self.pg0.unconfig_ip6()
|
||||
self.logger.info("FFP_TEST_FINISH_0001")
|
||||
|
||||
def test_ip6_rx_p2p_subif(self):
|
||||
@@ -273,8 +275,10 @@ class P2PEthernetIPV6(VppTestCase):
|
||||
"""send packet via p2p subinterface"""
|
||||
self.logger.info("FFP_TEST_START_0005")
|
||||
|
||||
self.pg0.config_ip6()
|
||||
|
||||
route_8000 = VppIpRoute(self, "8000::", 64,
|
||||
[VppRoutePath(self.pg0.remote_ip6,
|
||||
[VppRoutePath(self.pg0.remote_hosts[0].ip6,
|
||||
self.pg0.sw_if_index)])
|
||||
route_8000.add_vpp_config()
|
||||
route_8001 = VppIpRoute(self, "8001::", 64,
|
||||
@@ -301,6 +305,7 @@ class P2PEthernetIPV6(VppTestCase):
|
||||
route_8001.remove_vpp_config()
|
||||
route_8002.remove_vpp_config()
|
||||
|
||||
self.pg0.unconfig_ip6()
|
||||
self.logger.info("FFP_TEST_FINISH_0005")
|
||||
|
||||
def test_ip6_tx_p2p_subif_drop(self):
|
||||
|
||||
Reference in New Issue
Block a user