summaryrefslogtreecommitdiffstats
path: root/src/vnet/CMakeLists.txt
AgeCommit message (Expand)AuthorFilesLines
2020-10-28misc: Break the big IP header files to improve compile timeNeale Ranns1-0/+5
2020-10-21virtio: run process to send interrupts to input nodesMohsin Kazmi1-0/+1
2020-10-21misc: minimize dependencies on udp.hFlorin Coras1-0/+2
2020-10-08tcp: custom geometry for timer wheelFlorin Coras1-0/+1
2020-10-08l2: input performanceNeale Ranns1-1/+2
2020-09-28virtio: add packet buffering on txMohsin Kazmi1-0/+1
2020-09-22lisp: Move to pluginNeale Ranns1-58/+0
2020-09-21geneve: Move to pluginNeale Ranns1-23/+0
2020-09-21misc: Move l2tp to pluginNeale Ranns1-23/+0
2020-09-21lldp: Move to pluginNeale Ranns1-18/+0
2020-09-04virtio: remove kernel virtio header dependenciesMohsin Kazmi1-1/+5
2020-09-03crypto: Add async crypto APIsNathan Skrzypczak1-0/+3
2020-08-25flow: add vnet/flow formal APIChenmin Sun1-0/+3
2020-08-20virtio: add modern device supportMohsin Kazmi1-0/+2
2020-08-20virtio: refactor pci device codeMohsin Kazmi1-0/+2
2020-08-14gso: packet coalesce libraryMohsin Kazmi1-0/+2
2020-08-14ip: add VNET_IP_TABLE_ADD_DEL_FUNCTIONSteven Luong1-0/+1
2020-07-21ipsec: Dedicated IPSec interface typeNeale Ranns1-0/+1
2020-07-16adl: move allow/deny list function to pluginDave Barach1-16/+3
2020-05-04fib: midchain adjacency optimisationsNeale Ranns1-0/+1
2020-04-30crypto: introduce async crypto infraFan Zhang1-0/+3
2020-04-28lisp: API cleanupJakub Grajciar1-0/+3
2020-04-23ip: Replace Sematics for Interface IP addressesNeale Ranns1-0/+2
2020-04-22gso: add vxlan tunnel supportMohsin Kazmi1-0/+1
2020-04-15misc: refactor calc_checksumsDave Barach1-0/+1
2020-04-14urpf: Unicast reverse Path Forwarding (plugin)Neale Ranns1-2/+0
2020-04-13session: cleanup debug codeFlorin Coras1-0/+1
2020-04-07udp: move cli to separate fileFlorin Coras1-0/+1
2020-04-02tcp: move features to separate filesFlorin Coras1-1/+8
2020-03-31vlib: move pci api types from vnet/pci to vlib/pciJakub Grajciar1-14/+0
2020-03-23sr: srv6 API cleanupJakub Grajciar1-2/+8
2020-03-12policer: API cleanupJakub Grajciar1-1/+4
2020-03-06build: building applications outside of vpp is missing header filesIJsbrand Wijnands1-0/+3
2020-03-03geneve gtpu vxlan vxlan-gpe: VRF-aware bypass nodeNick Zavaritsky1-0/+1
2020-02-04teib: Rename NHRP to TEIBNeale Ranns1-6/+6
2020-01-30misc: deprecate netmap and ixge driversDamjan Marion1-20/+0
2020-01-30gre: Tunnel encap/decap flagsNeale Ranns1-0/+1
2020-01-27tunnel: Common types for IP tunnelsNeale Ranns1-3/+16
2020-01-17lb: fix that lb_add_del_vip and lb_add_del_as api doesn't work correctlyYulong Pei1-0/+9
2020-01-15build: Add missing version.h dependency in vnetChris Luke1-1/+1
2020-01-03devices: virtio API cleanupJakub Grajciar1-0/+14
2019-12-17ipsec: bind an SA to a workerNeale Ranns1-0/+2
2019-12-17ip: Protocol Independent IP NeighborsNeale Ranns1-10/+55
2019-12-11devices: vhost API cleanupJakub Grajciar1-0/+3
2019-12-04fib: Decouple source from priority and behaviourNeale Ranns1-6/+8
2019-12-04gre: Multi-point interfacesNeale Ranns1-0/+16
2019-12-03ipip: Tunnel flags controlling copying data to/from payload/encapNeale Ranns1-1/+6
2019-12-03ipsec: Changes to make ipsec encoder/decoders reusable by the pluginsPrashant Maheshwari1-0/+3
2019-11-14virtio: refactor virtio-pci loggingDamjan Marion1-2/+3
2019-11-12ip: IP address and prefix types (moved from LISP)Neale Ranns1-0/+2
">; vlib_buffer_t *b; u32 bi; ip6_header_t *ip; udp_header_t *udp; dhcpv6_header_t *dhcp; const ip6_address_t *src_addr; u32 dhcp_opt_len = 0; client_state->transaction_start = vlib_time_now (vm); u32 n_prefixes; u32 i; /* * Note: do NOT psychoanalyze link-state here. * If the interface is down, let the driver turf the packet. */ /* Get a link-local address */ src_addr = ip6_get_link_local_address (sw_if_index); if (src_addr->as_u8[0] != 0xfe) { clib_warning ("Could not find source address to send DHCPv6 packet"); return NULL; } if (vlib_buffer_alloc (vm, &bi, 1) != 1) { clib_warning ("Buffer allocation failed"); return NULL; } b = vlib_get_buffer (vm, bi); vnet_buffer (b)->sw_if_index[VLIB_RX] = sw_if_index; vnet_buffer (b)->sw_if_index[VLIB_TX] = sw_if_index; client_state->adj_index = adj_mcast_add_or_lock (FIB_PROTOCOL_IP6, VNET_LINK_IP6, sw_if_index); vnet_buffer (b)->ip.adj_index[VLIB_TX] = client_state->adj_index; b->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED; ip = (ip6_header_t *) vlib_buffer_get_current (b); udp = (udp_header_t *) (ip + 1); dhcp = (dhcpv6_header_t *) (udp + 1); ip->src_address = *src_addr; ip->hop_limit = 255; ip->ip_version_traffic_class_and_flow_label = clib_host_to_net_u32 (0x6 << 28); ip->payload_length = 0; ip->protocol = IP_PROTOCOL_UDP; udp->src_port = clib_host_to_net_u16 (DHCPV6_CLIENT_PORT); udp->dst_port = clib_host_to_net_u16 (DHCPV6_SERVER_PORT); udp->checksum = 0; udp->length = 0; dhcp->msg_type = type; dhcp->xid[0] = (client_state->transaction_id & 0x00ff0000) >> 16; dhcp->xid[1] = (client_state->transaction_id & 0x0000ff00) >> 8; dhcp->xid[2] = (client_state->transaction_id & 0x000000ff) >> 0; void *d = (void *) dhcp->data; dhcpv6_option_t *duid; dhcpv6_elapsed_t *elapsed; dhcpv6_ia_header_t *ia_hdr; dhcpv6_ia_opt_pd_t *opt_pd; if (type == DHCPV6_MSG_SOLICIT || type == DHCPV6_MSG_REQUEST || type == DHCPV6_MSG_RENEW || type == DHCPV6_MSG_REBIND || type == DHCPV6_MSG_RELEASE) { duid = (dhcpv6_option_t *) d; duid->option = clib_host_to_net_u16 (DHCPV6_OPTION_CLIENTID); duid->length = clib_host_to_net_u16 (CLIENT_DUID_LENGTH); clib_memcpy (duid + 1, client_duid.bin_string, CLIENT_DUID_LENGTH); d += sizeof (*duid) + CLIENT_DUID_LENGTH; if (client_state->params.server_index != ~0) { server_id_t *se = &ccm->server_ids[client_state->params.server_index]; duid = (dhcpv6_option_t *) d; duid->option = clib_host_to_net_u16 (DHCPV6_OPTION_SERVERID); duid->length = clib_host_to_net_u16 (se->len); clib_memcpy (duid + 1, se->data, se->len); d += sizeof (*duid) + se->len; } elapsed = (dhcpv6_elapsed_t *) d; elapsed->opt.option = clib_host_to_net_u16 (DHCPV6_OPTION_ELAPSED_TIME); elapsed->opt.length = clib_host_to_net_u16 (sizeof (*elapsed) - sizeof (elapsed->opt)); elapsed->elapsed_10ms = 0; client_state->elapsed_pos = (char *) &elapsed->elapsed_10ms - (char *) vlib_buffer_get_current (b); d += sizeof (*elapsed); ia_hdr = (dhcpv6_ia_header_t *) d; ia_hdr->opt.option = clib_host_to_net_u16 (DHCPV6_OPTION_IA_PD); ia_hdr->iaid = clib_host_to_net_u32 (DHCPV6_CLIENT_IAID); ia_hdr->t1 = clib_host_to_net_u32 (client_state->params.T1); ia_hdr->t2 = clib_host_to_net_u32 (client_state->params.T2); d += sizeof (*ia_hdr); n_prefixes = vec_len (client_state->params.prefixes); ia_hdr->opt.length = clib_host_to_net_u16 (sizeof (*ia_hdr) + n_prefixes * sizeof (*opt_pd) - sizeof (ia_hdr->opt)); for (i = 0; i < n_prefixes; i++) { dhcp6_pd_send_client_message_params_prefix_t *pref = &client_state->params.prefixes[i]; opt_pd = (dhcpv6_ia_opt_pd_t *) d; opt_pd->opt.option = clib_host_to_net_u16 (DHCPV6_OPTION_IAPREFIX); opt_pd->opt.length = clib_host_to_net_u16 (sizeof (*opt_pd) - sizeof (opt_pd->opt)); opt_pd->addr = pref->prefix; opt_pd->prefix = pref->prefix_length; opt_pd->valid = clib_host_to_net_u32 (pref->valid_lt); opt_pd->preferred = clib_host_to_net_u32 (pref->preferred_lt); d += sizeof (*opt_pd); } } else { clib_warning ("State not implemented"); } dhcp_opt_len = ((u8 *) d) - dhcp->data; udp->length = clib_host_to_net_u16 (sizeof (*udp) + sizeof (*dhcp) + dhcp_opt_len); ip->payload_length = udp->length; b->current_length = sizeof (*ip) + sizeof (*udp) + sizeof (*dhcp) + dhcp_opt_len; ip->dst_address = all_dhcp6_relay_agents_and_servers; return b; } static inline u8 check_pd_send_client_message (vlib_main_t * vm, dhcp6_pd_client_state_t * client_state, f64 current_time, f64 * due_time) { vlib_buffer_t *p0; vlib_frame_t *f; u32 *to_next; u32 next_index; vlib_buffer_t *c0; ip6_header_t *ip; udp_header_t *udp; u32 ci0; int bogus_length = 0; dhcp6_pd_send_client_message_params_t *params; f64 now = vlib_time_now (vm); if (!client_state->keep_sending_client_message) return false; params = &client_state->params; if (client_state->due_time > current_time) { *due_time = client_state->due_time; return true; } p0 = client_state->buffer; next_index = ip6_rewrite_mcast_node.index; c0 = vlib_buffer_copy (vm, p0); if (c0 == NULL) return client_state->keep_sending_client_message; ci0 = vlib_get_buffer_index (vm, c0); ip = (ip6_header_t *) vlib_buffer_get_current (c0); udp = (udp_header_t *) (ip + 1); u16 *elapsed_field = (u16 *) ((void *) ip + client_state->elapsed_pos); *elapsed_field = clib_host_to_net_u16 ((u16) ((now - client_state->transaction_start) * 100)); udp->checksum = 0; udp->checksum = ip6_tcp_udp_icmp_compute_checksum (vm, 0, ip, &bogus_length); f = vlib_get_frame_to_node (vm, next_index); to_next = vlib_frame_vector_args (f); to_next[0] = ci0; f->n_vectors = 1; vlib_put_frame_to_node (vm, next_index, f); if (params->mrc != 0 && --client_state->n_left == 0) stop_sending_client_message (vm, client_state); else { client_state->sleep_interval = (2.0 + random_f64_from_to (-0.1, 0.1)) * client_state->sleep_interval; if (client_state->sleep_interval > params->mrt) client_state->sleep_interval = (1.0 + random_f64_from_to (-0.1, 0.1)) * params->mrt; client_state->due_time = current_time + client_state->sleep_interval; if (params->mrd != 0 && current_time > client_state->start_time + params->mrd) stop_sending_client_message (vm, client_state); else *due_time = client_state->due_time; } return client_state->keep_sending_client_message; } static uword send_dhcp6_pd_client_message_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f0) { dhcp6_pd_client_main_t *cm = &dhcp6_pd_client_main; dhcp6_pd_client_state_t *client_state; uword *event_data = 0; f64 sleep_time = 1e9; f64 current_time; f64 due_time; f64 dt = 0; int i; while (true) { vlib_process_wait_for_event_or_clock (vm, sleep_time); vlib_process_get_events (vm, &event_data); vec_reset_length (event_data); current_time = vlib_time_now (vm); do { due_time = current_time + 1e9; for (i = 0; i < vec_len (cm->client_state_by_sw_if_index); i++) { client_state = &cm->client_state_by_sw_if_index[i]; if (!client_state->entry_valid) continue; if (check_pd_send_client_message (vm, client_state, current_time, &dt) && (dt < due_time)) due_time = dt; } current_time = vlib_time_now (vm); } while (due_time < current_time); sleep_time = due_time - current_time; } return 0; } /* *INDENT-OFF* */ VLIB_REGISTER_NODE (send_dhcp6_pd_client_message_process_node, static) = { .function = send_dhcp6_pd_client_message_process, .type = VLIB_NODE_TYPE_PROCESS, .name = "send-dhcp6-pd-client-message-process", }; /* *INDENT-ON* */ void dhcp6_pd_send_client_message (vlib_main_t * vm, u32 sw_if_index, u8 stop, dhcp6_pd_send_client_message_params_t * params) { dhcp6_pd_client_main_t *cm = &dhcp6_pd_client_main; dhcp6_pd_client_state_t *client_state = 0; dhcp6_pd_client_state_t empty_state = { 0, }; ASSERT (~0 != sw_if_index); vec_validate_init_empty (cm->client_state_by_sw_if_index, sw_if_index, empty_state); client_state = &cm->client_state_by_sw_if_index[sw_if_index]; if (!client_state->entry_valid) { client_state->entry_valid = 1; client_state->adj_index = ~0; } stop_sending_client_message (vm, client_state); if (!stop) { client_state->keep_sending_client_message = 1; vec_free (client_state->params.prefixes); client_state->params = *params; client_state->params.prefixes = vec_dup (params->prefixes); client_state->n_left = params->mrc; client_state->start_time = vlib_time_now (vm); client_state->sleep_interval = (1 + random_f64_from_to (-0.1, 0.1)) * params->irt; client_state->due_time = 0; /* send first packet ASAP */ client_state->transaction_id = random_u32 (&cm->seed) & 0x00ffffff; client_state->buffer = create_buffer_for_client_message (vm, sw_if_index, client_state, params->msg_type); if (client_state->buffer) vlib_process_signal_event (vm, send_dhcp6_pd_client_message_process_node.index, 1, 0); } } static clib_error_t * dhcp6_pd_client_init (vlib_main_t * vm) { dhcp6_pd_client_main_t *cm = &dhcp6_pd_client_main; cm->vlib_main = vm; cm->vnet_main = vnet_get_main (); cm->publisher_node = ~0; cm->seed = (u32) clib_cpu_time_now (); return 0; } VLIB_INIT_FUNCTION (dhcp6_pd_client_init); /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */