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 186 if (ip6_ra_listeners[ii] == fn)
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, 240 if ((priority > LOG_EMERG) || !(logmask & (1 << priority)))
250 .format =
"ip6 nd: (%s): %s",.format_args =
"T4T4",};
280 u32 n_left_from, n_left_to_next, next_index;
290 n_left_from = n_packets;
299 option_type = ICMP6_NEIGHBOR_DISCOVERY_OPTION_source_link_layer_address;
301 while (n_left_from > 0)
305 while (n_left_from > 0 && n_left_to_next > 0)
311 icmp6_neighbor_discovery_header_t *h0;
312 icmp6_neighbor_discovery_ethernet_link_layer_address_option_t *o0;
314 u32 bi0, options_len0, sw_if_index0, next0, error0;
315 u32 is_solicitation = 1, is_dropped = 0;
316 u32 is_unspecified, is_link_local;
318 bi0 = to_next[0] = from[0];
334 error0 = ICMP6_ERROR_NONE;
342 if (!is_unspecified && !is_link_local)
350 error0 = (adj0->rewrite_header.sw_if_index != sw_if_index0
352 ICMP6_ERROR_ROUTER_SOLICITATION_SOURCE_NOT_ON_LINK
357 error0 = ICMP6_ERROR_ROUTER_SOLICITATION_SOURCE_NOT_ON_LINK;
362 o0 = (
void *) (h0 + 1);
363 o0 = ((options_len0 == 8
364 && o0->header.type == option_type
365 && o0->header.n_data_u64s == 1) ? o0 : 0);
368 if (
PREDICT_TRUE (error0 == ICMP6_ERROR_NONE && o0 != 0 &&
369 !is_unspecified && !is_link_local))
373 .sw_if_index = sw_if_index0,
376 memcpy (&learn.
mac, o0->ethernet_address, sizeof (learn.
mac));
383 if (error0 == ICMP6_ERROR_NONE)
396 (!eth_if0) ? ICMP6_ERROR_ROUTER_SOLICITATION_UNSUPPORTED_INTF
399 if (error0 == ICMP6_ERROR_NONE)
404 sizeof (icmp6_neighbor_discovery_header_t));
408 error0 = ((!radv_info) ?
409 ICMP6_ERROR_ROUTER_SOLICITATION_RADV_NOT_CONFIG :
412 if (error0 == ICMP6_ERROR_NONE)
428 icmp6_router_advertisement_header_t rh;
430 rh.icmp.type = ICMP6_router_advertisement;
432 rh.icmp.checksum = 0;
435 rh.router_lifetime_in_sec =
439 time_in_msec_between_retransmitted_neighbor_solicitations
441 clib_host_to_net_u32 (radv_info->
443 rh.neighbor_reachable_time_in_msec =
444 clib_host_to_net_u32 (radv_info->
458 sizeof (icmp6_router_advertisement_header_t);
461 (vm, &bi0, (
void *) &rh,
462 sizeof (icmp6_router_advertisement_header_t)))
465 error0 = ICMP6_ERROR_ALLOC_FAILURE;
471 icmp6_neighbor_discovery_ethernet_link_layer_address_option_t
475 ICMP6_NEIGHBOR_DISCOVERY_OPTION_source_link_layer_address;
476 h.header.n_data_u64s = 1;
483 (vm, &bi0, (
void *) &h,
485 (icmp6_neighbor_discovery_ethernet_link_layer_address_option_t)))
487 error0 = ICMP6_ERROR_ALLOC_FAILURE;
493 (icmp6_neighbor_discovery_ethernet_link_layer_address_option_t);
499 icmp6_neighbor_discovery_mtu_option_t
h;
504 h.header.type = ICMP6_NEIGHBOR_DISCOVERY_OPTION_mtu;
505 h.header.n_data_u64s = 1;
508 sizeof (icmp6_neighbor_discovery_mtu_option_t);
511 (vm, &bi0, (
void *) &h,
513 (icmp6_neighbor_discovery_mtu_option_t)))
515 error0 = ICMP6_ERROR_ALLOC_FAILURE;
526 if(pr_info->enabled &&
527 (!pr_info->decrement_lifetime_flag
528 || (pr_info->pref_lifetime_expires >0)))
531 icmp6_neighbor_discovery_prefix_information_option_t h;
533 h.header.type = ICMP6_NEIGHBOR_DISCOVERY_OPTION_prefix_information;
534 h.header.n_data_u64s = (sizeof(icmp6_neighbor_discovery_prefix_information_option_t) >> 3);
536 h.dst_address_length = pr_info->prefix_len;
538 h.flags = (pr_info->adv_on_link_flag) ? ICMP6_NEIGHBOR_DISCOVERY_PREFIX_INFORMATION_FLAG_ON_LINK : 0;
539 h.flags |= (pr_info->adv_autonomous_flag) ? ICMP6_NEIGHBOR_DISCOVERY_PREFIX_INFORMATION_AUTO : 0;
541 if(radv_info->cease_radv && pr_info->deprecated_prefix_flag)
543 h.valid_time = clib_host_to_net_u32(MIN_ADV_VALID_LIFETIME);
544 h.preferred_time = 0;
548 if(pr_info->decrement_lifetime_flag)
550 pr_info->adv_valid_lifetime_in_secs = ((pr_info->valid_lifetime_expires > now)) ?
551 (pr_info->valid_lifetime_expires - now) : 0;
553 pr_info->adv_pref_lifetime_in_secs = ((pr_info->pref_lifetime_expires > now)) ?
554 (pr_info->pref_lifetime_expires - now) : 0;
557 h.valid_time = clib_host_to_net_u32(pr_info->adv_valid_lifetime_in_secs);
558 h.preferred_time = clib_host_to_net_u32(pr_info->adv_pref_lifetime_in_secs) ;
563 if (0 && CLIB_DEBUG > 0)
565 (
"send RA for prefix %U/%d " 566 "sw_if_index %d valid %u preferred %u",
567 format_ip6_address, &pr_info->prefix,
568 pr_info->prefix_len, sw_if_index0,
569 clib_net_to_host_u32 (h.valid_time),
570 clib_net_to_host_u32 (h.preferred_time));
572 if (h.valid_time == 0)
573 clib_warning (
"BUG: send RA with valid_time 0");
575 clib_memcpy(&h.dst_address, &pr_info->prefix, sizeof(ip6_address_t));
577 payload_length += sizeof( icmp6_neighbor_discovery_prefix_information_option_t);
579 if (vlib_buffer_add_data
580 (vm, &bi0, (void *)&h,
581 sizeof(icmp6_neighbor_discovery_prefix_information_option_t)))
583 error0 = ICMP6_ERROR_ALLOC_FAILURE;
603 IP6_MULTICAST_SCOPE_link_local,
604 IP6_MULTICAST_GROUP_ID_all_hosts);
614 clib_host_to_net_u16 (payload_length);
616 icmp6_router_advertisement_header_t *rh0 =
617 (icmp6_router_advertisement_header_t *) (ip0 + 1);
621 ASSERT (bogus_length == 0);
648 error0 = ICMP6_ERROR_DST_LOOKUP_MISS;
658 p0->
flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
663 if ((error0 == ICMP6_ERROR_NONE) && !is_dropped)
666 n_advertisements_sent++;
673 p0->error = error_node->
errors[error0];
675 if (error0 != ICMP6_ERROR_NONE)
679 to_next, n_left_to_next,
689 ICMP6_ERROR_ROUTER_ADVERTISEMENTS_TX,
692 return frame->n_vectors;
699 .name =
"icmp6-router-solicitation",
701 .vector_size =
sizeof (
u32),
722 u32 n_left_from, n_left_to_next, next_index;
723 u32 n_advertisements_rcvd = 0;
729 n_left_from = n_packets;
737 while (n_left_from > 0)
741 while (n_left_from > 0 && n_left_to_next > 0)
746 icmp6_router_advertisement_header_t *h0;
747 u32 bi0, options_len0, sw_if_index0, next0, error0;
749 bi0 = to_next[0] = from[0];
762 error0 = ICMP6_ERROR_NONE;
767 ICMP6_ERROR_ROUTER_ADVERTISEMENT_SOURCE_NOT_LINK_LOCAL : error0;
772 n_advertisements_rcvd++;
774 if (error0 == ICMP6_ERROR_NONE)
786 (!eth_if0) ? ICMP6_ERROR_ROUTER_SOLICITATION_UNSUPPORTED_INTF
789 if (error0 == ICMP6_ERROR_NONE)
794 error0 = ((!radv_info) ?
795 ICMP6_ERROR_ROUTER_SOLICITATION_RADV_NOT_CONFIG :
798 if (error0 == ICMP6_ERROR_NONE)
809 clib_net_to_host_u16 (h0->router_lifetime_in_sec);
812 (h0->neighbor_reachable_time_in_msec);
818 && (h0->current_hop_limit !=
822 "our AdvCurHopLimit on %U doesn't agree with %U",
834 "our AdvManagedFlag on %U doesn't agree with %U",
846 "our AdvOtherConfigFlag on %U doesn't agree with %U",
854 time_in_msec_between_retransmitted_neighbor_solicitations
858 time_in_msec_between_retransmitted_neighbor_solicitations
860 clib_host_to_net_u32 (radv_info->
864 "our AdvRetransTimer on %U doesn't agree with %U",
871 if ((h0->neighbor_reachable_time_in_msec &&
873 (h0->neighbor_reachable_time_in_msec !=
878 "our AdvReachableTime on %U doesn't agree with %U",
886 u8 *opt_hdr = (
u8 *) (h0 + 1);
887 while (options_len0 > 0)
889 icmp6_neighbor_discovery_option_header_t *o0 =
890 (icmp6_neighbor_discovery_option_header_t *)
892 int opt_len = o0->n_data_u64s << 3;
896 if (options_len0 < 2)
899 "malformed RA packet on %U from %U",
910 " zero length option in RA on %U from %U",
917 else if (opt_len > options_len0)
920 "option length in RA packet greater than total length on %U from %U",
928 options_len0 -= opt_len;
933 case ICMP6_NEIGHBOR_DISCOVERY_OPTION_source_link_layer_address:
935 icmp6_neighbor_discovery_ethernet_link_layer_address_option_t
937 (icmp6_neighbor_discovery_ethernet_link_layer_address_option_t
940 if (opt_len <
sizeof (*h))
943 memcpy (r.
slla, h->ethernet_address, 6);
947 case ICMP6_NEIGHBOR_DISCOVERY_OPTION_mtu:
949 icmp6_neighbor_discovery_mtu_option_t *
h =
950 (icmp6_neighbor_discovery_mtu_option_t
953 if (opt_len <
sizeof (*h))
956 r.
mtu = clib_net_to_host_u32 (h->mtu);
964 "our AdvLinkMTU on %U doesn't agree with %U",
973 case ICMP6_NEIGHBOR_DISCOVERY_OPTION_prefix_information:
975 icmp6_neighbor_discovery_prefix_information_option_t
977 (icmp6_neighbor_discovery_prefix_information_option_t
982 u32 preferred, valid;
984 if (opt_len <
sizeof (*h))
994 clib_net_to_host_u32 (h->preferred_time);
995 valid = clib_net_to_host_u32 (h->valid_time);
999 prefix->
flags = h->flags & 0xc0;
1010 ip6_address_mask_from_width(&mask, pr_info->prefix_len);
1012 if(pr_info->enabled &&
1013 (pr_info->prefix_len == h->dst_address_length) &&
1014 ip6_address_is_equal_masked (&pr_info->prefix, &h->dst_address, &mask))
1017 if(!pr_info->decrement_lifetime_flag &&
1018 valid != pr_info->adv_valid_lifetime_in_secs)
1020 ip6_neighbor_syslog(vm, LOG_WARNING,
1021 "our ADV validlifetime on %U for %U does not agree with %U",
1022 format_vnet_sw_if_index_name, vnm, sw_if_index0,format_ip6_address, &pr_info->prefix,
1023 format_ip6_address, &h->dst_address);
1025 if(!pr_info->decrement_lifetime_flag &&
1026 preferred != pr_info->adv_pref_lifetime_in_secs)
1028 ip6_neighbor_syslog(vm, LOG_WARNING,
1029 "our ADV preferredlifetime on %U for %U does not agree with %U",
1030 format_vnet_sw_if_index_name, vnm, sw_if_index0,format_ip6_address, &pr_info->prefix,
1031 format_ip6_address, &h->dst_address);
1049 p0->error = error_node->
errors[error0];
1051 if (error0 != ICMP6_ERROR_NONE)
1055 to_next, n_left_to_next,
1064 ICMP6_ERROR_ROUTER_ADVERTISEMENTS_RX,
1065 n_advertisements_rcvd);
1067 return frame->n_vectors;
1074 .name =
"icmp6-router-advertisement",
1076 .vector_size =
sizeof (
u32),
1091 static u8 seed_set = 0;
1097 return random_f64 (&seed) * (to - from) + from;
1116 icmp6_router_solicitation_header_t *rh;
1131 p0->
flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
1142 rh->neighbor.icmp.type = ICMP6_router_solicitation;
1143 rh->neighbor.icmp.code = 0;
1144 rh->neighbor.icmp.checksum = 0;
1145 rh->neighbor.reserved_must_be_zero = 0;
1147 rh->link_layer_option.header.type =
1148 ICMP6_NEIGHBOR_DISCOVERY_OPTION_source_link_layer_address;
1150 rh->link_layer_option.ethernet_address))
1152 clib_warning (
"interface with sw_if_index %u has no mac address",
1157 rh->link_layer_option.header.n_data_u64s = 1;
1159 payload_length =
sizeof (rh->neighbor) +
sizeof (
u64);
1161 rh->ip.ip_version_traffic_class_and_flow_label =
1162 clib_host_to_net_u32 (0x6 << 28);
1163 rh->ip.payload_length = clib_host_to_net_u16 (payload_length);
1164 rh->ip.protocol = IP_PROTOCOL_ICMP6;
1165 rh->ip.hop_limit = 255;
1169 rh->ip.dst_address.as_u64[0] = clib_host_to_net_u64 (0xff02ULL << 48);
1170 rh->ip.dst_address.as_u64[1] = clib_host_to_net_u64 (2);
1209 params = &radv_info->
params;
1211 if (radv_info->
due_time > current_time)
1233 if (params->
mrc != 0 && --radv_info->
n_left == 0)
1245 if (params->
mrd != 0
1259 uword *event_data = NULL;
1260 f64 sleep_time = 1e9;
1275 due_time = current_time + 1e9;
1286 while (due_time < current_time);
1288 sleep_time = due_time - current_time;
1298 .name =
"ip6-rs-process",
1309 ASSERT (~0 != sw_if_index);
1396 sizeof (ip6_address_t));
1414 mhash_unset (&radv_info->address_to_prefix_index, &p->prefix, 0);
1427 u32 primary_sw_if_index,
1431 static u32 *radv_indices;
1449 for (i = 0; i <
vec_len (radv_indices); i++)
1455 if (radv_info->
sw_if_index == primary_sw_if_index)
1461 if (this_prefix->prefix_len == prefix_len
1462 && ip6_address_is_equal_masked (&this_prefix->prefix, address,
1465 int rv = ip6_ra_prefix (vm,
1466 radv_info->sw_if_index,
1478 clib_warning (
"ip6_neighbor_ra_prefix returned %d", rv);
1493 u32 n_this_frame = 0;
1494 u32 n_left_to_next = 0;
1497 icmp6_router_solicitation_header_t *h0;
1507 radv_info->initial_adverts_sent = radv_info->initial_adverts_count-1;
1508 radv_info->next_multicast_time = now;
1509 radv_info->last_multicast_time = now;
1510 radv_info->last_radv_time = 0;
1520 f64 rfn = (radv_info->max_radv_interval - radv_info->min_radv_interval) *
1521 random_f64 (&radv_info->seed) + radv_info->min_radv_interval;
1524 if( radv_info->initial_adverts_sent > 0)
1526 radv_info->initial_adverts_sent--;
1527 if(rfn > radv_info->initial_adverts_interval)
1528 rfn = radv_info->initial_adverts_interval;
1531 if( radv_info->initial_adverts_sent == 0)
1532 if(radv_info->cease_radv)
1533 radv_info->send_radv = 0;
1548 b0->
current_length =
sizeof( icmp6_router_solicitation_header_t);
1549 b0->
error = ICMP6_ERROR_NONE;
1554 clib_memset (h0, 0,
sizeof (icmp6_router_solicitation_header_t));
1556 h0->ip.ip_version_traffic_class_and_flow_label = clib_host_to_net_u32 (0x6 << 28);
1557 h0->ip.payload_length = clib_host_to_net_u16 (
sizeof (icmp6_router_solicitation_header_t)
1559 h0->ip.protocol = IP_PROTOCOL_ICMP6;
1560 h0->ip.hop_limit = 255;
1563 h0->ip.src_address.as_u64[0] = 0;
1564 h0->ip.src_address.as_u64[1] = 0;
1566 h0->ip.dst_address.as_u64[0] = 0;
1567 h0->ip.dst_address.as_u64[1] = 0;
1569 h0->neighbor.icmp.type = ICMP6_router_solicitation;
1597 f->n_vectors = n_this_frame;
1672 u8 suppress,
u8 managed,
u8 other,
1674 u8 use_lifetime,
u32 lifetime,
1675 u32 initial_count,
u32 initial_interval,
1676 u32 max_interval,
u32 min_interval,
u8 is_no)
1684 return (VNET_API_ERROR_IP6_NOT_ENABLED);
1686 if ((max_interval != 0) && (min_interval == 0))
1687 min_interval = .75 * max_interval;
1707 if (lifetime <= max_interval)
1708 return VNET_API_ERROR_INVALID_VALUE;
1711 if (min_interval != 0)
1713 if ((min_interval > .75 * max_interval) || (min_interval < 3))
1714 return VNET_API_ERROR_INVALID_VALUE;
1719 return VNET_API_ERROR_INVALID_VALUE;
1726 (suppress != 0) ? ((is_no != 0) ? 1 : 0) : radv_info->
send_radv;
1734 (send_unicast != 0) ? ((is_no) ? 0 : 1) : radv_info->
send_unicast;
1736 (cease != 0) ? ((is_no) ? 0 : 1) : radv_info->
cease_radv;
1747 (initial_interval !=
1752 if ((cease != 0) && (is_no))
1766 ip6_address_t * prefix_addr,
u8 prefix_len,
1767 u8 use_default,
u32 val_lifetime,
u32 pref_lifetime,
1768 u8 no_advertise,
u8 off_link,
u8 no_autoconfig,
1769 u8 no_onlink,
u8 is_no)
1777 return (VNET_API_ERROR_IP6_NOT_ENABLED);
1793 return VNET_API_ERROR_INVALID_VALUE;
1796 return VNET_API_ERROR_INVALID_VALUE_2;
1850 return VNET_API_ERROR_INVALID_VALUE_2;
1859 if ((val_lifetime == ~0) || (pref_lifetime == ~0))
1872 prefix->
enabled = !(no_advertise != 0);
1897 u8 suppress = 0, managed = 0, other = 0;
1899 u8 use_lifetime = 0;
1901 0, ra_initial_interval = 0;
1902 u32 ra_max_interval = 0, ra_min_interval = 0;
1906 int add_radv_info = 1;
1907 ip6_address_t ip6_addr;
1949 else if (
unformat (line_input,
"prefix %U/%d",
1954 else if (
unformat (line_input,
"ra-managed-config-flag"))
1958 else if (
unformat (line_input,
"ra-other-config-flag"))
1962 else if (
unformat (line_input,
"ra-suppress") ||
1963 unformat (line_input,
"ra-surpress"))
1967 else if (
unformat (line_input,
"ra-suppress-link-layer") ||
1968 unformat (line_input,
"ra-surpress-link-layer"))
1970 suppress_ll_option = 1;
1972 else if (
unformat (line_input,
"ra-send-unicast"))
1976 else if (
unformat (line_input,
"ra-lifetime"))
1978 if (!
unformat (line_input,
"%d", &ra_lifetime))
1985 else if (
unformat (line_input,
"ra-initial"))
1988 (line_input,
"%d %d", &ra_initial_count, &ra_initial_interval))
1994 else if (
unformat (line_input,
"ra-interval"))
1996 if (!
unformat (line_input,
"%d", &ra_max_interval))
2002 if (!
unformat (line_input,
"%d", &ra_min_interval))
2003 ra_min_interval = 0;
2005 else if (
unformat (line_input,
"ra-cease"))
2019 suppress, managed, other,
2021 use_lifetime, ra_lifetime,
2022 ra_initial_count, ra_initial_interval,
2023 ra_max_interval, ra_min_interval, is_no);
2027 u32 valid_lifetime_in_secs = 0;
2028 u32 pref_lifetime_in_secs = 0;
2029 u8 use_prefix_default_values = 0;
2030 u8 no_advertise = 0;
2032 u8 no_autoconfig = 0;
2038 if (
unformat (line_input,
"default"))
2040 use_prefix_default_values = 1;
2043 else if (
unformat (line_input,
"infinite"))
2045 valid_lifetime_in_secs = ~0;
2046 pref_lifetime_in_secs = ~0;
2049 else if (
unformat (line_input,
"%d %d", &valid_lifetime_in_secs,
2050 &pref_lifetime_in_secs))
2058 while (!use_prefix_default_values &&
2061 if (
unformat (line_input,
"no-advertise"))
2063 else if (
unformat (line_input,
"off-link"))
2065 else if (
unformat (line_input,
"no-autoconfig"))
2067 else if (
unformat (line_input,
"no-onlink"))
2077 &ip6_addr, addr_len,
2078 use_prefix_default_values,
2079 valid_lifetime_in_secs,
2080 pref_lifetime_in_secs,
2081 no_advertise, off_link, no_autoconfig, no_onlink, is_no);
2094 u32 indent = va_arg (*args,
u32);
2107 s = format (s,
"%Uprefix %U, length %d\n",
2108 format_white_space, indent+2,
2109 format_ip6_address, &p->prefix, p->prefix_len);
2113 s =
format (s,
"%UMTU is %d\n",
2115 s =
format (s,
"%UICMP error messages are unlimited\n",
2117 s =
format (s,
"%UICMP redirects are disabled\n",
2119 s =
format (s,
"%UICMP unreachables are not sent\n",
2123 s =
format (s,
"%UND advertised reachable time is %d\n",
2127 "%UND advertised retransmit interval is %d (msec)\n",
2133 "%UND router advertisements are sent every %0.1f seconds (min interval is %0.1f)\n",
2137 format (s,
"%UND router advertisements live for %d seconds\n",
2141 format (s,
"%UHosts %s stateless autoconfig for addresses\n",
2277 .short_help =
"ip6 nd <interface> ...",
void ip6_ra_report_register(ip6_ra_report_notify_t fn)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
fib_protocol_t fp_proto
protocol type
struct ip6_ra_t_ ip6_ra_t
#define vec_foreach_index(var, v)
Iterate over vector indices.
#define DEF_ADV_VALID_LIFETIME
static uword ip6_ra_process_timer_event(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define ICMP6_ROUTER_DISCOVERY_FLAG_OTHER_CONFIG_VIA_DHCP
static uword random_default_seed(void)
Default random seed (unix/linux user-mode)
static void vlib_buffer_reset(vlib_buffer_t *b)
Reset current header & length to state they were in when packet was received.
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...
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
static int ip6_ra_publish(ip6_ra_report_t *r)
vnet_main_t * vnet_get_main(void)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
#define pool_get_zero(P, E)
Allocate an object E from a pool P and zero it.
#define DEF_MAX_RADV_INTERVAL
static ip6_ra_report_notify_t * ip6_ra_listeners
void ip_neighbor_learn_dp(const ip_neighbor_learn_t *l)
APIs invoked by neighbor implementation (i.s.
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
u32 initial_adverts_count
u16 router_lifetime_in_sec
uword mhash_unset(mhash_t *h, void *key, uword *old_value)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static f64 vlib_time_now(vlib_main_t *vm)
static ip6_ra_t * ip6_ra_get_itf(u32 sw_if_index)
u32 time_in_msec_between_retransmitted_neighbor_solicitations
int vlib_buffer_add_data(vlib_main_t *vm, u32 *buffer_index, void *data, u32 n_data_bytes)
#define MIN_DELAY_BETWEEN_RAS
u16 current_length
Nbytes between current data and the end of this buffer.
u32 adv_time_in_msec_between_retransmitted_neighbor_solicitations
#define foreach_log_level
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static u64 clib_cpu_time_now(void)
static ip6_link_delegate_id_t ip6_ra_delegate_id
void icmp6_send_router_solicitation(vlib_main_t *vm, u32 sw_if_index, u8 stop, const icmp6_send_router_solicitation_params_t *params)
#define STRUCT_OFFSET_OF(t, f)
u32 adv_pref_lifetime_in_secs
u32 n_solicitations_dropped
static u32 vnet_sw_interface_get_mtu(vnet_main_t *vnm, u32 sw_if_index, vnet_mtu_t af)
unformat_function_t unformat_vnet_sw_interface
adj_index_t ip6_link_get_mcast_adj(u32 sw_if_index)
vlib_error_t * errors
Vector of errors for this node.
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)
format_function_t format_vnet_sw_if_index_name
static vlib_buffer_t * vlib_buffer_copy(vlib_main_t *vm, vlib_buffer_t *b)
icmp6_router_advertisement_packet_t
static f64 random_f64_from_to(f64 from, f64 to)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
#define clib_memcpy(d, s, n)
vlib_node_registration_t ip6_rewrite_mcast_node
(constructor) VLIB_REGISTER_NODE (ip6_rewrite_mcast_node)
ethernet_main_t ethernet_main
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
#define DEF_CURR_HOP_LIMIT
#define static_always_inline
static void ip6_ra_signal_report(ip6_ra_report_t *r)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
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...
u32 local_interface_sw_if_index
#define DEF_MIN_RADV_INTERVAL
icmp6_send_router_solicitation_params_t params
ip6_radv_prefix_t * adv_prefixes_pool
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 vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static vnet_sw_interface_t * vnet_get_sup_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
#define clib_error_return(e, args...)
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.
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
u32 n_advertisements_sent
static void ip6_ra_handle_report(const ip6_ra_report_t *rap)
static clib_error_t * icmp6_init(vlib_main_t *vm)
u16 fp_len
The mask length.
#define vlib_call_init_function(vm, x)
ip6_address_t router_address
static u32 vlib_get_buffer_index(vlib_main_t *vm, void *p)
Translate buffer pointer into buffer index.
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define pool_flush(VAR, POOL, BODY)
Remove all elements from a pool in a safe way.
f64 pref_lifetime_expires
#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.
#define DEF_DEF_RTR_LIFETIME
void ip6_ra_report_unregister(ip6_ra_report_notify_t fn)
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
static u8 get_mac_address(u32 sw_if_index, u8 *address)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define pool_put(P, E)
Free an object E in pool P.
enum icmp6_neighbor_discovery_option_type icmp6_neighbor_discovery_option_type_t
static void * vlib_process_signal_event_data(vlib_main_t *vm, uword node_index, uword type_opaque, uword n_data_elts, uword n_data_elt_bytes)
#define vec_del1(v, i)
Delete the element at index I.
f64 min_delay_between_radv
#define MAX_DELAY_BETWEEN_RAS
f64 max_delay_between_radv
icmp6_router_solicitation_or_advertisement_next_t
u32 node_index
Node index.
#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.
static vlib_node_registration_t ip6_icmp_router_advertisement_node
(constructor) VLIB_REGISTER_NODE (ip6_icmp_router_advertisement_node)
static uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
#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).
ip6_link_delegate_id_t ip6_link_delegate_register(const ip6_link_delegate_vft_t *vft)
vlib_node_registration_t ip6_icmp_input_node
(constructor) VLIB_REGISTER_NODE (ip6_icmp_input_node)
int adv_link_layer_address
#define pool_free(p)
Free a pool.
#define VLIB_REGISTER_NODE(x,...)
void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
u32 neighbor_reachable_time_in_msec
static_always_inline uword icmp6_router_advertisement(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
sll srl srl sll sra u16x4 i
static void stop_sending_rs(vlib_main_t *vm, ip6_ra_t *ra)
static u8 * format_ip6_ra(u8 *s, va_list *args)
#define MAX_DEF_RTR_LIFETIME
#define clib_warning(format, args...)
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
static vlib_node_registration_t ip6_icmp_router_solicitation_node
(constructor) VLIB_REGISTER_NODE (ip6_icmp_router_solicitation_node)
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
#define MAX_INITIAL_RTR_ADVERT_INTERVAL
#define ELOG_TYPE_DECLARE(f)
index_t ip6_link_delegate_get(u32 sw_if_index, ip6_link_delegate_id_t id)
f64 initial_adverts_interval
ra_report_prefix_info_t * prefixes
vlib_main_t vlib_node_runtime_t * node
static void * ip6_next_header(ip6_header_t *i)
static bool check_send_rs(vlib_main_t *vm, ip6_ra_t *radv_info, f64 current_time, f64 *due_time)
#define VLIB_CLI_COMMAND(x,...)
u16 ip6_tcp_udp_icmp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip6_header_t *ip0, int *bogus_lengthp)
f64 valid_lifetime_expires
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
mhash_t address_to_prefix_index
u32 ip6_link_delegate_id_t
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)
static void ip6_neighbor_syslog(vlib_main_t *vm, int priority, char *fmt,...)
manual_print typedef address
static uword * mhash_get(mhash_t *h, const void *key)
static void mhash_free(mhash_t *h)
static ip6_ra_t * ip6_ra_pool
void(* ip6_ra_report_notify_t)(const ip6_ra_report_t *rap)
static uword ip6_ra_event_process(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static f64 random_f64(u32 *seed)
Generate f64 random number in the interval [0,1].
int deprecated_prefix_flag
static void ip6_ra_delegate_disable(index_t rai)
static uword ip6_address_is_link_local_unicast(const ip6_address_t *a)
static vlib_main_t * vlib_get_main(void)
static_always_inline uword icmp6_router_solicitation(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static uword vnet_sw_interface_is_admin_up(vnet_main_t *vnm, u32 sw_if_index)
ip6_link_disable_fn_t ildv_disable
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)
clib_error_t * ip6_ra_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
vlib_node_registration_t ip6_rs_process_node
(constructor) VLIB_REGISTER_NODE (ip6_rs_process_node)
static void * vlib_process_get_event_data(vlib_main_t *vm, uword *return_event_type_opaque)
ethernet_interface_t * ethernet_get_interface(ethernet_main_t *em, u32 hw_if_index)
u32 elog_string(elog_main_t *em, char *fmt,...)
add a string to the event-log string table
void icmp6_register_type(vlib_main_t *vm, icmp6_type_t type, u32 node_index)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
const ip6_address_t * ip6_get_link_local_address(u32 sw_if_index)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
VLIB buffer representation.
u32 adv_neighbor_reachable_time_in_msec
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
f64 max_rtr_default_lifetime
static const ethernet_interface_t * ip6_ra_get_eth_itf(u32 sw_if_index)
static char * log_level_strings[]
static uword send_rs_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f0)
static void ip6_address_copy(ip6_address_t *dst, const ip6_address_t *src)
bool ip6_link_is_enabled(u32 sw_if_index)
#define ICMP6_ROUTER_DISCOVERY_FLAG_ADDRESS_CONFIG_VIA_DHCP
vlib_node_registration_t ip6_ra_process_node
(constructor) VLIB_REGISTER_NODE (ip6_ra_process_node)
int decrement_lifetime_flag
static void ip6_address_mask_from_width(ip6_address_t *a, u32 width)
static uword ip6_address_is_unspecified(const ip6_address_t *a)
#define MAX_INITIAL_RTR_ADVERTISEMENTS
static u32 random_u32(u32 *seed)
32-bit random number generator
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)
vnet_sw_interface_type_t type
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)
#define vec_foreach(var, vec)
Vector iterator.
#define DEF_ADV_PREF_LIFETIME
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
u16 flags
Copy of main node flags.
u32 adv_valid_lifetime_in_secs
static vlib_buffer_t * create_buffer_for_rs(vlib_main_t *vm, ip6_ra_t *radv_info)
#define VLIB_NODE_FLAG_TRACE
static u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
u16 adv_router_lifetime_in_sec
bool ip6_link_delegate_update(u32 sw_if_index, ip6_link_delegate_id_t id, index_t ii)
static void ip6_set_reserved_multicast_address(ip6_address_t *a, ip6_multicast_address_scope_t scope, u16 id)
format_function_t format_icmp6_input_trace