|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
38 icmp6_neighbor_discovery_header_t neighbor;
39 icmp6_neighbor_discovery_ethernet_link_layer_address_option_t
41 }) icmp6_router_solicitation_header_t;
47 icmp6_router_advertisement_header_t router;
48 icmp6_neighbor_discovery_ethernet_link_layer_address_option_t
50 icmp6_neighbor_discovery_mtu_option_t mtu_option;
51 icmp6_neighbor_discovery_prefix_information_option_t
56 #define DEF_MAX_RADV_INTERVAL 200
57 #define DEF_MIN_RADV_INTERVAL .75 * DEF_MAX_RADV_INTERVAL
58 #define DEF_CURR_HOP_LIMIT 64
59 #define DEF_DEF_RTR_LIFETIME 3 * DEF_MAX_RADV_INTERVAL
60 #define MAX_DEF_RTR_LIFETIME 9000
62 #define MAX_INITIAL_RTR_ADVERT_INTERVAL 16
63 #define MAX_INITIAL_RTR_ADVERTISEMENTS 3
64 #define MIN_DELAY_BETWEEN_RAS 3
65 #define MAX_DELAY_BETWEEN_RAS 1800
66 #define MAX_RA_DELAY_TIME .5
88 #define MIN_ADV_VALID_LIFETIME 7203
89 #define DEF_ADV_VALID_LIFETIME 2592000
90 #define DEF_ADV_PREF_LIFETIME 604800
208 #define foreach_log_level \
210 _ (INFO, "INFORMATION") \
211 _ (NOTICE, "NOTICE") \
212 _ (WARNING, "WARNING") \
214 _ (CRIT, "CRITICAL") \
216 _ (EMERG, "EMERGENCY")
220 #define _(f,s) LOG_##f,
250 .format =
"ip6 nd: (%s): %s",.format_args =
"T4T4",};
285 u32 n_advertisements_sent = 0;
303 option_type = ICMP6_NEIGHBOR_DISCOVERY_OPTION_source_link_layer_address;
315 icmp6_neighbor_discovery_header_t *h0;
316 icmp6_neighbor_discovery_ethernet_link_layer_address_option_t *o0;
318 u32 bi0, options_len0, sw_if_index0, next0, error0;
319 u32 is_solicitation = 1, is_dropped = 0;
320 u32 is_unspecified, is_link_local;
322 bi0 = to_next[0] =
from[0];
338 error0 = ICMP6_ERROR_NONE;
346 if (!is_unspecified && !is_link_local)
354 error0 = (adj0->rewrite_header.sw_if_index != sw_if_index0
356 ICMP6_ERROR_ROUTER_SOLICITATION_SOURCE_NOT_ON_LINK
361 error0 = ICMP6_ERROR_ROUTER_SOLICITATION_SOURCE_NOT_ON_LINK;
366 o0 = (
void *) (h0 + 1);
367 o0 = ((options_len0 == 8
368 && o0->header.type == option_type
369 && o0->header.n_data_u64s == 1) ? o0 : 0);
372 if (
PREDICT_TRUE (error0 == ICMP6_ERROR_NONE && o0 != 0 &&
373 !is_unspecified && !is_link_local))
384 memcpy (&learn.
mac, o0->ethernet_address, sizeof (learn.
mac));
391 if (error0 == ICMP6_ERROR_NONE)
404 (!eth_if0) ? ICMP6_ERROR_ROUTER_SOLICITATION_UNSUPPORTED_INTF
407 if (error0 == ICMP6_ERROR_NONE)
412 sizeof (icmp6_neighbor_discovery_header_t));
416 error0 = ((!radv_info) ?
417 ICMP6_ERROR_ROUTER_SOLICITATION_RADV_NOT_CONFIG :
420 ICMP6_ERROR_ROUTER_SOLICITATION_RADV_NOT_CONFIG :
422 if (error0 == ICMP6_ERROR_NONE)
438 icmp6_router_advertisement_header_t rh;
440 rh.icmp.type = ICMP6_router_advertisement;
442 rh.icmp.checksum = 0;
445 rh.router_lifetime_in_sec =
449 time_in_msec_between_retransmitted_neighbor_solicitations
451 clib_host_to_net_u32 (radv_info->
452 adv_time_in_msec_between_retransmitted_neighbor_solicitations);
453 rh.neighbor_reachable_time_in_msec =
454 clib_host_to_net_u32 (radv_info->
455 adv_neighbor_reachable_time_in_msec);
468 sizeof (icmp6_router_advertisement_header_t);
471 (
vm, &bi0, (
void *) &rh,
472 sizeof (icmp6_router_advertisement_header_t)))
475 error0 = ICMP6_ERROR_ALLOC_FAILURE;
481 icmp6_neighbor_discovery_ethernet_link_layer_address_option_t
485 ICMP6_NEIGHBOR_DISCOVERY_OPTION_source_link_layer_address;
486 h.header.n_data_u64s = 1;
493 (
vm, &bi0, (
void *) &
h,
495 (icmp6_neighbor_discovery_ethernet_link_layer_address_option_t)))
497 error0 = ICMP6_ERROR_ALLOC_FAILURE;
503 (icmp6_neighbor_discovery_ethernet_link_layer_address_option_t);
509 icmp6_neighbor_discovery_mtu_option_t
h;
514 h.header.type = ICMP6_NEIGHBOR_DISCOVERY_OPTION_mtu;
515 h.header.n_data_u64s = 1;
518 sizeof (icmp6_neighbor_discovery_mtu_option_t);
521 (
vm, &bi0, (
void *) &
h,
523 (icmp6_neighbor_discovery_mtu_option_t)))
525 error0 = ICMP6_ERROR_ALLOC_FAILURE;
541 icmp6_neighbor_discovery_prefix_information_option_t
h;
543 h.header.type = ICMP6_NEIGHBOR_DISCOVERY_OPTION_prefix_information;
544 h.header.n_data_u64s = (
sizeof(icmp6_neighbor_discovery_prefix_information_option_t) >> 3);
554 h.preferred_time = 0;
573 if (0 && CLIB_DEBUG > 0)
575 (
"send RA for prefix %U/%d "
576 "sw_if_index %d valid %u preferred %u",
579 clib_net_to_host_u32 (
h.valid_time),
580 clib_net_to_host_u32 (
h.preferred_time));
582 if (
h.valid_time == 0)
587 payload_length +=
sizeof( icmp6_neighbor_discovery_prefix_information_option_t);
590 (
vm, &bi0, (
void *)&
h,
591 sizeof(icmp6_neighbor_discovery_prefix_information_option_t)))
593 error0 = ICMP6_ERROR_ALLOC_FAILURE;
613 IP6_MULTICAST_SCOPE_link_local,
614 IP6_MULTICAST_GROUP_ID_all_hosts);
624 clib_host_to_net_u16 (payload_length);
626 icmp6_router_advertisement_header_t *rh0 =
627 (icmp6_router_advertisement_header_t *) (ip0 + 1);
631 ASSERT (bogus_length == 0);
658 error0 = ICMP6_ERROR_DST_LOOKUP_MISS;
668 p0->
flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
673 if ((error0 == ICMP6_ERROR_NONE) && !is_dropped)
676 n_advertisements_sent++;
685 if (error0 != ICMP6_ERROR_NONE)
689 to_next, n_left_to_next,
699 ICMP6_ERROR_ROUTER_ADVERTISEMENTS_TX,
700 n_advertisements_sent);
702 return frame->n_vectors;
709 .name =
"icmp6-router-solicitation",
711 .vector_size =
sizeof (
u32),
733 u32 n_advertisements_rcvd = 0;
756 icmp6_router_advertisement_header_t *h0;
757 u32 bi0, options_len0, sw_if_index0, next0, error0;
759 bi0 = to_next[0] =
from[0];
772 error0 = ICMP6_ERROR_NONE;
777 ICMP6_ERROR_ROUTER_ADVERTISEMENT_SOURCE_NOT_LINK_LOCAL : error0;
782 n_advertisements_rcvd++;
784 if (error0 == ICMP6_ERROR_NONE)
796 (!eth_if0) ? ICMP6_ERROR_ROUTER_SOLICITATION_UNSUPPORTED_INTF
799 if (error0 == ICMP6_ERROR_NONE)
804 error0 = ((!radv_info) ?
805 ICMP6_ERROR_ROUTER_SOLICITATION_RADV_NOT_CONFIG :
808 if (error0 == ICMP6_ERROR_NONE)
814 r.sw_if_index = sw_if_index0;
816 r.current_hop_limit = h0->current_hop_limit;
818 r.router_lifetime_in_sec =
819 clib_net_to_host_u16 (h0->router_lifetime_in_sec);
820 r.neighbor_reachable_time_in_msec =
822 (h0->neighbor_reachable_time_in_msec);
823 r.time_in_msec_between_retransmitted_neighbor_solicitations = clib_net_to_host_u32 (h0->time_in_msec_between_retransmitted_neighbor_solicitations);
828 && (h0->current_hop_limit !=
832 "our AdvCurHopLimit on %U doesn't agree with %U",
844 "our AdvManagedFlag on %U doesn't agree with %U",
856 "our AdvOtherConfigFlag on %U doesn't agree with %U",
864 time_in_msec_between_retransmitted_neighbor_solicitations
866 adv_time_in_msec_between_retransmitted_neighbor_solicitations)
868 time_in_msec_between_retransmitted_neighbor_solicitations
870 clib_host_to_net_u32 (radv_info->
871 adv_time_in_msec_between_retransmitted_neighbor_solicitations)))
874 "our AdvRetransTimer on %U doesn't agree with %U",
881 if ((h0->neighbor_reachable_time_in_msec &&
883 (h0->neighbor_reachable_time_in_msec !=
888 "our AdvReachableTime on %U doesn't agree with %U",
896 u8 *opt_hdr = (
u8 *) (h0 + 1);
897 while (options_len0 > 0)
899 icmp6_neighbor_discovery_option_header_t *o0 =
900 (icmp6_neighbor_discovery_option_header_t *)
902 int opt_len = o0->n_data_u64s << 3;
906 if (options_len0 < 2)
909 "malformed RA packet on %U from %U",
920 " zero length option in RA on %U from %U",
927 else if (opt_len > options_len0)
930 "option length in RA packet greater than total length on %U from %U",
938 options_len0 -= opt_len;
943 case ICMP6_NEIGHBOR_DISCOVERY_OPTION_source_link_layer_address:
945 icmp6_neighbor_discovery_ethernet_link_layer_address_option_t
947 (icmp6_neighbor_discovery_ethernet_link_layer_address_option_t
950 if (opt_len <
sizeof (*
h))
953 memcpy (
r.slla,
h->ethernet_address, 6);
957 case ICMP6_NEIGHBOR_DISCOVERY_OPTION_mtu:
959 icmp6_neighbor_discovery_mtu_option_t *
h =
960 (icmp6_neighbor_discovery_mtu_option_t
963 if (opt_len <
sizeof (*
h))
966 r.mtu = clib_net_to_host_u32 (
h->mtu);
974 "our AdvLinkMTU on %U doesn't agree with %U",
983 case ICMP6_NEIGHBOR_DISCOVERY_OPTION_prefix_information:
985 icmp6_neighbor_discovery_prefix_information_option_t
987 (icmp6_neighbor_discovery_prefix_information_option_t
992 u32 preferred, valid;
994 if (opt_len <
sizeof (*
h))
1004 clib_net_to_host_u32 (
h->preferred_time);
1005 valid = clib_net_to_host_u32 (
h->valid_time);
1007 prefix->preferred_time = preferred;
1008 prefix->valid_time = valid;
1009 prefix->flags =
h->flags & 0xc0;
1010 prefix->prefix.fp_len =
h->dst_address_length;
1011 prefix->prefix.fp_addr.ip6 =
h->dst_address;
1031 "our ADV validlifetime on %U for %U does not agree with %U",
1039 "our ADV preferredlifetime on %U for %U does not agree with %U",
1061 if (error0 != ICMP6_ERROR_NONE)
1065 to_next, n_left_to_next,
1074 ICMP6_ERROR_ROUTER_ADVERTISEMENTS_RX,
1075 n_advertisements_rcvd);
1077 return frame->n_vectors;
1084 .name =
"icmp6-router-advertisement",
1086 .vector_size =
sizeof (
u32),
1100 static u32 seed = 0;
1101 static u8 seed_set = 0;
1126 icmp6_router_solicitation_header_t *rh;
1140 p0->
flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
1151 rh->neighbor.icmp.type = ICMP6_router_solicitation;
1152 rh->neighbor.icmp.code = 0;
1153 rh->neighbor.icmp.checksum = 0;
1154 rh->neighbor.reserved_must_be_zero = 0;
1156 rh->link_layer_option.header.type =
1157 ICMP6_NEIGHBOR_DISCOVERY_OPTION_source_link_layer_address;
1159 rh->link_layer_option.ethernet_address))
1161 clib_warning (
"interface with sw_if_index %u has no mac address",
1166 rh->link_layer_option.header.n_data_u64s = 1;
1168 payload_length =
sizeof (rh->neighbor) +
sizeof (
u64);
1170 rh->ip.ip_version_traffic_class_and_flow_label =
1171 clib_host_to_net_u32 (0x6 << 28);
1172 rh->ip.payload_length = clib_host_to_net_u16 (payload_length);
1173 rh->ip.protocol = IP_PROTOCOL_ICMP6;
1174 rh->ip.hop_limit = 255;
1178 rh->ip.dst_address.as_u64[0] = clib_host_to_net_u64 (0xff02ULL << 48);
1179 rh->ip.dst_address.as_u64[1] = clib_host_to_net_u64 (2);
1218 params = &radv_info->
params;
1220 if (radv_info->
due_time > current_time)
1242 if (params->
mrc != 0 && --radv_info->
n_left == 0)
1254 if (params->
mrd != 0
1268 uword *event_data = NULL;
1269 f64 sleep_time = 1e9;
1284 due_time = current_time + 1e9;
1295 while (due_time < current_time);
1297 sleep_time = due_time - current_time;
1307 .name =
"ip6-rs-process",
1405 sizeof (ip6_address_t));
1423 mhash_unset (&radv_info->address_to_prefix_index, &p->prefix, 0);
1436 u32 primary_sw_if_index,
1440 static u32 *radv_indices;
1464 if (radv_info->
sw_if_index == primary_sw_if_index)
1502 u32 n_this_frame = 0;
1503 u32 n_left_to_next = 0;
1506 icmp6_router_solicitation_header_t *h0;
1557 b0->
current_length =
sizeof( icmp6_router_solicitation_header_t);
1558 b0->
error = ICMP6_ERROR_NONE;
1563 clib_memset (h0, 0,
sizeof (icmp6_router_solicitation_header_t));
1565 h0->ip.ip_version_traffic_class_and_flow_label = clib_host_to_net_u32 (0x6 << 28);
1566 h0->ip.payload_length = clib_host_to_net_u16 (
sizeof (icmp6_router_solicitation_header_t)
1568 h0->ip.protocol = IP_PROTOCOL_ICMP6;
1569 h0->ip.hop_limit = 255;
1572 h0->ip.src_address.as_u64[0] = 0;
1573 h0->ip.src_address.as_u64[1] = 0;
1575 h0->ip.dst_address.as_u64[0] = 0;
1576 h0->ip.dst_address.as_u64[1] = 0;
1578 h0->neighbor.icmp.type = ICMP6_router_solicitation;
1628 uword *event_data = 0;
1639 if (event_type == ~0)
1649 r = (
void *) (event_data[
i]);
1655 return frame->n_vectors;
1662 .name =
"ip6-ra-process",
1693 u8 suppress,
u8 managed,
u8 other,
1694 u8 ll_option,
u8 send_unicast,
u8 cease,
1696 u32 initial_count,
u32 initial_interval,
1697 u32 max_interval,
u32 min_interval,
u8 is_no)
1705 return (VNET_API_ERROR_IP6_NOT_ENABLED);
1707 if ((max_interval != 0) && (min_interval == 0))
1708 min_interval = .75 * max_interval;
1729 return VNET_API_ERROR_INVALID_VALUE;
1732 if (min_interval != 0)
1734 if ((min_interval > .75 * max_interval) || (min_interval < 3))
1735 return VNET_API_ERROR_INVALID_VALUE;
1740 return VNET_API_ERROR_INVALID_VALUE;
1747 (suppress != 0) ? ((is_no != 0) ? 1 : 0) : radv_info->
send_radv;
1755 (send_unicast != 0) ? ((is_no) ? 0 : 1) : radv_info->
send_unicast;
1757 (cease != 0) ? ((is_no) ? 0 : 1) : radv_info->
cease_radv;
1768 (initial_interval !=
1773 if ((cease != 0) && (is_no))
1787 ip6_address_t * prefix_addr,
u8 prefix_len,
1788 u8 use_default,
u32 val_lifetime,
u32 pref_lifetime,
1789 u8 no_advertise,
u8 off_link,
u8 no_autoconfig,
1790 u8 no_onlink,
u8 is_no)
1798 return (VNET_API_ERROR_IP6_NOT_ENABLED);
1814 return VNET_API_ERROR_INVALID_VALUE;
1816 if (
prefix->prefix_len != prefix_len)
1817 return VNET_API_ERROR_INVALID_VALUE_2;
1846 prefix->prefix_len = prefix_len;
1850 prefix->adv_on_link_flag = 1;
1851 prefix->adv_autonomous_flag = 1;
1855 prefix->decrement_lifetime_flag = 1;
1856 prefix->deprecated_prefix_flag = 1;
1870 if (
prefix->prefix_len != prefix_len)
1871 return VNET_API_ERROR_INVALID_VALUE_2;
1880 if ((val_lifetime == ~0) || (pref_lifetime == ~0))
1882 prefix->adv_valid_lifetime_in_secs = ~0;
1883 prefix->adv_pref_lifetime_in_secs = ~0;
1884 prefix->decrement_lifetime_flag = 0;
1888 prefix->adv_valid_lifetime_in_secs = val_lifetime;;
1889 prefix->adv_pref_lifetime_in_secs = pref_lifetime;
1893 prefix->enabled = !(no_advertise != 0);
1894 prefix->adv_on_link_flag = !((off_link != 0) || (no_onlink != 0));
1895 prefix->adv_autonomous_flag = !(no_autoconfig != 0);
1900 prefix->valid_lifetime_expires =
now +
prefix->adv_valid_lifetime_in_secs;
1901 prefix->pref_lifetime_expires =
now +
prefix->adv_pref_lifetime_in_secs;
1918 u8 suppress = 0, managed = 0, other = 0;
1919 u8 suppress_ll_option = 0, send_unicast = 0, cease = 0;
1920 u8 use_lifetime = 0;
1922 0, ra_initial_interval = 0;
1923 u32 ra_max_interval = 0, ra_min_interval = 0;
1927 int add_radv_info = 1;
1928 ip6_address_t ip6_addr;
1970 else if (
unformat (line_input,
"prefix %U/%d",
1975 else if (
unformat (line_input,
"ra-managed-config-flag"))
1979 else if (
unformat (line_input,
"ra-other-config-flag"))
1983 else if (
unformat (line_input,
"ra-suppress") ||
1984 unformat (line_input,
"ra-surpress"))
1988 else if (
unformat (line_input,
"ra-suppress-link-layer") ||
1989 unformat (line_input,
"ra-surpress-link-layer"))
1991 suppress_ll_option = 1;
1993 else if (
unformat (line_input,
"ra-send-unicast"))
1997 else if (
unformat (line_input,
"ra-lifetime"))
1999 if (!
unformat (line_input,
"%d", &ra_lifetime))
2006 else if (
unformat (line_input,
"ra-initial"))
2009 (line_input,
"%d %d", &ra_initial_count, &ra_initial_interval))
2015 else if (
unformat (line_input,
"ra-interval"))
2017 if (!
unformat (line_input,
"%d", &ra_max_interval))
2023 if (!
unformat (line_input,
"%d", &ra_min_interval))
2024 ra_min_interval = 0;
2026 else if (
unformat (line_input,
"ra-cease"))
2040 suppress, managed, other,
2041 suppress_ll_option, send_unicast, cease,
2042 use_lifetime, ra_lifetime,
2043 ra_initial_count, ra_initial_interval,
2044 ra_max_interval, ra_min_interval, is_no);
2048 u32 valid_lifetime_in_secs = 0;
2049 u32 pref_lifetime_in_secs = 0;
2050 u8 use_prefix_default_values = 0;
2051 u8 no_advertise = 0;
2053 u8 no_autoconfig = 0;
2059 if (
unformat (line_input,
"default"))
2061 use_prefix_default_values = 1;
2064 else if (
unformat (line_input,
"infinite"))
2066 valid_lifetime_in_secs = ~0;
2067 pref_lifetime_in_secs = ~0;
2070 else if (
unformat (line_input,
"%d %d", &valid_lifetime_in_secs,
2071 &pref_lifetime_in_secs))
2079 while (!use_prefix_default_values &&
2082 if (
unformat (line_input,
"no-advertise"))
2084 else if (
unformat (line_input,
"off-link"))
2086 else if (
unformat (line_input,
"no-autoconfig"))
2088 else if (
unformat (line_input,
"no-onlink"))
2098 &ip6_addr, addr_len,
2099 use_prefix_default_values,
2100 valid_lifetime_in_secs,
2101 pref_lifetime_in_secs,
2102 no_advertise, off_link, no_autoconfig, no_onlink, is_no);
2115 u32 indent = va_arg (*args,
u32);
2128 s =
format (s,
"%Uprefix %U, length %d\n",
2134 s =
format (s,
"%UMTU is %d\n",
2136 s =
format (s,
"%UICMP error messages are unlimited\n",
2138 s =
format (s,
"%UICMP redirects are disabled\n",
2140 s =
format (s,
"%UICMP unreachables are not sent\n",
2144 s =
format (s,
"%UND advertised reachable time is %d\n",
2148 "%UND advertised retransmit interval is %d (msec)\n",
2151 adv_time_in_msec_between_retransmitted_neighbor_solicitations);
2154 "%UND router advertisements are sent every %0.1f seconds (min interval is %0.1f)\n",
2158 format (s,
"%UND router advertisements live for %d seconds\n",
2162 format (s,
"%UHosts %s stateless autoconfig for addresses\n",
2298 .short_help =
"ip6 nd <interface> ...",
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
#define MIN_DELAY_BETWEEN_RAS
int adv_link_layer_address
int ip6_ra_prefix(vlib_main_t *vm, u32 sw_if_index, ip6_address_t *prefix_addr, u8 prefix_len, u8 use_default, u32 val_lifetime, u32 pref_lifetime, u8 no_advertise, u8 off_link, u8 no_autoconfig, u8 no_onlink, u8 is_no)
#define pool_flush(VAR, POOL, BODY)
Remove all elements from a pool in a safe way.
static void ip6_ra_link_enable(u32 sw_if_index)
called when IP6 is enabled on an interface create and initialize router advertisement parameters with...
static clib_error_t * ip6_ra_init(vlib_main_t *vm)
static uword ip6_address_is_link_local_unicast(const ip6_address_t *a)
vnet_interface_main_t * im
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
icmp6_send_router_solicitation_params_t params
index_t ip6_link_delegate_get(u32 sw_if_index, ip6_link_delegate_id_t id)
vnet_sw_interface_type_t type
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
static ip6_ra_t * ip6_ra_get_itf(u32 sw_if_index)
@ ICMP6_ROUTER_SOLICITATION_NEXT_DROP
u16 ip6_tcp_udp_icmp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip6_header_t *ip0, int *bogus_lengthp)
static uword ip6_ra_process_timer_event(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
@ ICMP6_ROUTER_SOLICITATION_N_NEXT
static vlib_buffer_t * vlib_buffer_copy(vlib_main_t *vm, vlib_buffer_t *b)
#define clib_memcpy(d, s, n)
nat44_ei_hairpin_src_next_t next_index
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
enum icmp6_neighbor_discovery_option_type icmp6_neighbor_discovery_option_type_t
u16 adv_router_lifetime_in_sec
static void ip6_address_mask_from_width(ip6_address_t *a, u32 width)
#define DEF_CURR_HOP_LIMIT
static void ip6_ra_signal_report(ip6_ra_report_t *r)
#define MIN_ADV_VALID_LIFETIME
void vlib_trace_frame_buffers_only(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, uword n_buffers, uword next_buffer_stride, uword n_buffer_data_bytes_in_trace)
static void clib_mem_free(void *p)
u32 initial_adverts_count
vlib_main_t vlib_node_runtime_t * node
int deprecated_prefix_flag
#define clib_error_return(e, args...)
#define DEF_ADV_VALID_LIFETIME
icmp6_router_advertisement_packet_t
ip6_link_disable_fn_t ildv_disable
int ip6_ra_config(vlib_main_t *vm, u32 sw_if_index, u8 suppress, u8 managed, u8 other, u8 ll_option, u8 send_unicast, u8 cease, u8 use_lifetime, u32 lifetime, u32 initial_count, u32 initial_interval, u32 max_interval, u32 min_interval, u8 is_no)
bool ip6_link_delegate_update(u32 sw_if_index, ip6_link_delegate_id_t id, index_t ii)
typedef CLIB_PACKED(struct { ip6_header_t ip;icmp6_neighbor_discovery_header_t neighbor;icmp6_neighbor_discovery_ethernet_link_layer_address_option_t link_layer_option;})
#define vlib_call_init_function(vm, x)
#define pool_put(P, E)
Free an object E in pool P.
static uword * mhash_get(mhash_t *h, const void *key)
u32 n_advertisements_sent
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static int ip6_ra_publish(ip6_ra_report_t *r)
void icmp6_send_router_solicitation(vlib_main_t *vm, u32 sw_if_index, u8 stop, const icmp6_send_router_solicitation_params_t *params)
__clib_export u32 elog_string(elog_main_t *em, char *fmt,...)
add a string to the event-log string table
static uword ip6_address_is_unspecified(const ip6_address_t *a)
f64 pref_lifetime_expires
__clib_export void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
vnet_hw_if_output_node_runtime_t * r
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
static void * ip6_next_header(ip6_header_t *i)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
static f64 random_f64(u32 *seed)
Generate f64 random number in the interval [0,1].
static ip6_ra_report_notify_t * ip6_ra_listeners
#define DEF_MIN_RADV_INTERVAL
ip6_link_delegate_id_t ip6_link_delegate_register(const ip6_link_delegate_vft_t *vft)
#define foreach_log_level
static u32 random_u32(u32 *seed)
32-bit random number generator
void icmp6_register_type(vlib_main_t *vm, icmp6_type_t type, u32 node_index)
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type,...
#define STRUCT_OFFSET_OF(t, f)
static ip6_link_delegate_id_t ip6_ra_delegate_id
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
vlib_error_t * errors
Vector of errors for this node.
#define pool_foreach(VAR, POOL)
Iterate through pool.
static u8 get_mac_address(u32 sw_if_index, u8 *address)
static uword ip6_address_is_equal_masked(const ip6_address_t *a, const ip6_address_t *b, const ip6_address_t *mask)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define ELOG_TYPE_DECLARE(f)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static __clib_warn_unused_result u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
u32 adv_pref_lifetime_in_secs
static f64 random_f64_from_to(f64 from, f64 to)
const static ip6_link_delegate_vft_t ip6_ra_delegate_vft
VFT for registering as a delegate to an IP6 link.
const ip6_address_t * ip6_get_link_local_address(u32 sw_if_index)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
vnet_main_t * vnet_get_main(void)
#define VLIB_NODE_FLAG_TRACE
#define ICMP6_ROUTER_DISCOVERY_FLAG_ADDRESS_CONFIG_VIA_DHCP
static_always_inline uword icmp6_router_advertisement(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define MAX_DEF_RTR_LIFETIME
u32 ip6_link_delegate_id_t
static u32 vlib_get_buffer_index(vlib_main_t *vm, void *p)
Translate buffer pointer into buffer index.
#define MAX_DELAY_BETWEEN_RAS
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define ICMP6_NEIGHBOR_DISCOVERY_PREFIX_INFORMATION_FLAG_ON_LINK
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
static void stop_sending_rs(vlib_main_t *vm, ip6_ra_t *ra)
#define static_always_inline
vlib_node_registration_t ip6_rewrite_mcast_node
(constructor) VLIB_REGISTER_NODE (ip6_rewrite_mcast_node)
#define ICMP6_NEIGHBOR_DISCOVERY_PREFIX_INFORMATION_AUTO
#define vec_foreach_index(var, v)
Iterate over vector indices.
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
static clib_error_t * icmp6_init(vlib_main_t *vm)
u32 n_solicitations_dropped
#define MAX_INITIAL_RTR_ADVERT_INTERVAL
static elog_main_t * vlib_get_elog_main()
ip6_radv_prefix_t * adv_prefixes_pool
static vlib_cli_command_t ip6_nd_command
(constructor) VLIB_CLI_COMMAND (ip6_nd_command)
static u32 ip6_src_lookup_for_packet(ip6_main_t *im, vlib_buffer_t *b, ip6_header_t *i)
return the DPO that the LB stacks on.
ra_report_prefix_info_t * prefixes
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
manual_print typedef address
#define VLIB_CLI_COMMAND(x,...)
static u32 vnet_sw_interface_get_mtu(vnet_main_t *vnm, u32 sw_if_index, vnet_mtu_t af)
#define ICMP6_ROUTER_DISCOVERY_FLAG_OTHER_CONFIG_VIA_DHCP
u32 adv_time_in_msec_between_retransmitted_neighbor_solicitations
static void ip6_address_copy(ip6_address_t *dst, const ip6_address_t *src)
static uword ip6_ra_event_process(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u32 adv_valid_lifetime_in_secs
icmp6_router_solicitation_or_advertisement_next_t
struct _vlib_node_registration vlib_node_registration_t
void(* ip6_ra_report_notify_t)(const ip6_ra_report_t *rap)
#define DEF_DEF_RTR_LIFETIME
u16 current_length
Nbytes between current data and the end of this buffer.
static uword vnet_sw_interface_is_admin_up(vnet_main_t *vnm, u32 sw_if_index)
ethernet_interface_t * ethernet_get_interface(ethernet_main_t *em, u32 hw_if_index)
void ip6_ra_report_unregister(ip6_ra_report_notify_t fn)
format_function_t format_icmp6_input_trace
static void ip6_set_reserved_multicast_address(ip6_address_t *a, ip6_multicast_address_scope_t scope, u16 id)
clib_error_t * ip6_ra_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
u32 adv_neighbor_reachable_time_in_msec
bool ip6_link_is_enabled(u32 sw_if_index)
#define vec_free(V)
Free vector's memory (no header).
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
void ip6_ra_update_secondary_radv_info(ip6_address_t *address, u8 prefix_len, u32 primary_sw_if_index, u32 valid_time, u32 preferred_time)
u32 node_index
Node index.
static vlib_node_registration_t ip6_icmp_router_advertisement_node
(constructor) VLIB_REGISTER_NODE (ip6_icmp_router_advertisement_node)
static u8 * format_ip6_ra(u8 *s, va_list *args)
mhash_t address_to_prefix_index
u32 local_interface_sw_if_index
ethernet_main_t ethernet_main
f64 max_delay_between_radv
format_function_t format_vnet_sw_if_index_name
unformat_function_t unformat_vnet_sw_interface
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
description fragment has unexpected format
vlib_put_next_frame(vm, node, next_index, 0)
void ip_neighbor_learn_dp(const ip_neighbor_learn_t *l)
APIs invoked by neighbor implementation (i.s.
@ ICMP6_ROUTER_SOLICITATION_NEXT_REPLY_RW
struct ip6_ra_t_ ip6_ra_t
#define VLIB_INIT_FUNCTION(x)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
static_always_inline uword icmp6_router_solicitation(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define MAX_INITIAL_RTR_ADVERTISEMENTS
vlib_node_registration_t ip6_ra_process_node
(constructor) VLIB_REGISTER_NODE (ip6_ra_process_node)
static void ip6_ra_handle_report(ip6_ra_report_t *rap)
int decrement_lifetime_flag
#define vec_foreach(var, vec)
Vector iterator.
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
static vlib_buffer_t * create_buffer_for_rs(vlib_main_t *vm, ip6_ra_t *radv_info)
#define DEF_ADV_PREF_LIFETIME
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
static void ip6_ra_delegate_disable(index_t rai)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static vlib_node_registration_t ip6_icmp_router_solicitation_node
(constructor) VLIB_REGISTER_NODE (ip6_icmp_router_solicitation_node)
f64 min_delay_between_radv
static bool check_send_rs(vlib_main_t *vm, ip6_ra_t *radv_info, f64 current_time, f64 *due_time)
f64 max_rtr_default_lifetime
static uword send_rs_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f0)
static vlib_main_t * vlib_get_main(void)
#define pool_get_zero(P, E)
Allocate an object E from a pool P and zero it.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vnet_interface_output_runtime_t * rt
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
adj_index_t ip6_link_get_mcast_adj(u32 sw_if_index)
f64 valid_lifetime_expires
@ ICMP6_ROUTER_SOLICITATION_NEXT_REPLY_TX
#define pool_free(p)
Free a pool.
static ip6_ra_t * ip6_ra_pool
#define clib_warning(format, args...)
static void ip6_neighbor_syslog(vlib_main_t *vm, int priority, char *fmt,...)
void ip6_ra_report_register(ip6_ra_report_notify_t fn)
vlib_node_registration_t ip6_icmp_input_node
(constructor) VLIB_REGISTER_NODE (ip6_icmp_input_node)
static f64 vlib_time_now(vlib_main_t *vm)
@ VNET_SW_INTERFACE_TYPE_HARDWARE
int vlib_buffer_add_data(vlib_main_t *vm, u32 *buffer_index, void *data, u32 n_data_bytes)
static char * log_level_strings[]
static void vlib_buffer_reset(vlib_buffer_t *b)
Reset current header & length to state they were in when packet was received.
static vnet_sw_interface_t * vnet_get_sup_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
static u64 clib_cpu_time_now(void)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
vl_api_interface_index_t sw_if_index
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
ethernet_interface_address_t address
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
__clib_export uword mhash_unset(mhash_t *h, void *key, uword *old_value)
static void * clib_mem_alloc(uword size)
static void mhash_free(mhash_t *h)
vlib_node_registration_t ip6_rs_process_node
(constructor) VLIB_REGISTER_NODE (ip6_rs_process_node)
f64 initial_adverts_interval
#define vec_del1(v, i)
Delete the element at index I.
#define DEF_MAX_RADV_INTERVAL
static uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
static const ethernet_interface_t * ip6_ra_get_eth_itf(u32 sw_if_index)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)
static uword random_default_seed(void)
Default random seed (unix/linux user-mode)