summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
AgeCommit message (Expand)AuthorFilesLines
2022-02-15tcp: Do not include the tcp_packet.h file in the ip4_packet.hNeale Ranns3-96/+2
2022-02-07igmp: make sure fib_index is set before delivering to ip4-localBenoît Ganne1-0/+2
2022-02-03ip nat: use ip rx sw_if_index in ip-local arc startFlorin Coras2-9/+8
2022-01-31ip: reassembly - add a way to disable for forusKlement Sekera11-34/+305
2022-01-31ip: fix length calculation in ip6-receiveKlement Sekera1-1/+1
2022-01-25ip: reassembly - fix missing ip6 owner thread initKlement Sekera1-0/+1
2022-01-12ip: coverity illegal access in ip6_ext_header_walkOle Troan1-9/+2
2022-01-09fib: multiple memory leaks upon deleting a VRF tableSteven Luong1-0/+1
2021-12-24ip: remove archaic vector code from mtrieDamjan Marion2-86/+12
2021-12-20ip: SVR fix race conditionKlement Sekera2-2/+14
2021-12-14api: verify message size on receiptKlement Sekera2-1/+7
2021-12-14ip: reassembly: drop zero length fragmentsKlement Sekera3-0/+17
2021-12-10ip: reassembly: handle atomic fragments correctlyKlement Sekera2-45/+93
2021-12-03ip: extension header parsing fails for fragment headerOle Troan7-291/+263
2021-12-03fib: Fix the display (or lack of) for fib node types in dependent children listsNeale Ranns1-1/+2
2021-11-23vxlan: multiarch optimization of vxlanRay Kinsella1-1/+1
2021-11-23ip: unlock_fib on if deleteNathan Skrzypczak3-0/+20
2021-11-18ip: comparing IP prefixes should not modify themNeale Ranns4-7/+33
2021-11-17ip6: ip6_not_enabled_node is a sibling of ip6-dropPaul Atkins1-6/+2
2021-11-12session: add support for DSCPFilip Tehlar1-5/+6
2021-11-10vppinfra: new vectorized ip checksum functions incl. csum_and_copyDamjan Marion3-98/+11
2021-11-10ip: crash in ip_csum_fold due to illegal instruction shrxSteven Luong1-1/+1
2021-11-10ip: always set ip rx_sw_if_indexFlorin Coras2-6/+11
2021-11-05ip: remove dead codeDamjan Marion1-3/+0
2021-11-04ip: speed up reassembly code compilationKlement Sekera4-50/+36
2021-11-04ip: reassembly: avoid reading truncated L4 headersKlement Sekera2-80/+149
2021-11-02ip: fix coverity warningKlement Sekera1-1/+1
2021-11-02ip: fix build without vector unitDamjan Marion1-0/+13
2021-10-28ip: improve csum fold on x86_64Damjan Marion1-1/+15
2021-10-21fib: respect mfib entry flags on create with pathsPaul Atkins2-5/+4
2021-10-21ip: Add ip46-local node for local swif[rx]Nathan Skrzypczak2-34/+108
2021-10-21ip6: set local flag on outbound echo replyMatthew Smith1-0/+4
2021-10-20ip6: fix IPv6 address calculation error using "ip route add" CLIJieqiang Wang1-20/+3
2021-10-18interface: add api test fileFilip Tehlar1-15/+8
2021-10-12fib: fix the drop counter for ipv6 RPF failuresNeale Ranns1-0/+6
2021-10-11ip: fix fib and mfib locksNathan Skrzypczak3-17/+10
2021-10-07ip: fix path MTU node errors definitionBenoît Ganne3-3/+7
2021-10-06ip: check if interface has link-local address (addition)Artem Glazychev1-1/+6
2021-10-06docs: vnet comment nitfixesNathan Skrzypczak1-3/+4
2021-10-06ip: add classifier-based ACLs support on ip puntBenoît Ganne1-234/+184
2021-10-04ip: fix punt for ipv6Benoît Ganne1-4/+9
2021-10-01devices: add support for pseudo header checksumMohsin Kazmi1-0/+54
2021-09-27misc: api move continuedFlorin Coras1-0/+1
2021-09-27ip: fix ip table allocation randomnessAloys Augustin1-1/+1
2021-09-27misc: move part of vpe apis to vlibmemoryFlorin Coras1-2/+0
2021-09-24ip: set error number on failed intf addrMatthew Smith2-2/+8
2021-09-22ip: add ip_table_allocate to apiAloys Augustin5-15/+111
2021-09-16vxlan: improve to use the hardware offloadMohsin Kazmi1-1/+2
2021-09-13interface: fix init fib_index_by_sw_if_indexNathan Skrzypczak2-17/+18
2021-09-13ip: show ip table CLINathan Skrzypczak1-0/+77
>->fp_src_addr.ip4, &prefix->fp_grp_addr.ip4, prefix->fp_len)); case FIB_PROTOCOL_IP6: return (ip6_mfib_table_lookup(&mfib_table->v6, &prefix->fp_src_addr.ip6, &prefix->fp_grp_addr.ip6, prefix->fp_len)); case FIB_PROTOCOL_MPLS: break; } return (FIB_NODE_INDEX_INVALID); } fib_node_index_t mfib_table_lookup (u32 fib_index, const mfib_prefix_t *prefix) { return (mfib_table_lookup_i(mfib_table_get(fib_index, prefix->fp_proto), prefix)); } static inline fib_node_index_t mfib_table_lookup_exact_match_i (const mfib_table_t *mfib_table, const mfib_prefix_t *prefix) { switch (prefix->fp_proto) { case FIB_PROTOCOL_IP4: return (ip4_mfib_table_lookup_exact_match(&mfib_table->v4, &prefix->fp_grp_addr.ip4, &prefix->fp_src_addr.ip4, prefix->fp_len)); case FIB_PROTOCOL_IP6: return (ip6_mfib_table_lookup_exact_match(&mfib_table->v6, &prefix->fp_grp_addr.ip6, &prefix->fp_src_addr.ip6, prefix->fp_len)); case FIB_PROTOCOL_MPLS: break; } return (FIB_NODE_INDEX_INVALID); } fib_node_index_t mfib_table_lookup_exact_match (u32 fib_index, const mfib_prefix_t *prefix) { return (mfib_table_lookup_exact_match_i(mfib_table_get(fib_index, prefix->fp_proto), prefix)); } static void mfib_table_entry_remove (mfib_table_t *mfib_table, const mfib_prefix_t *prefix, fib_node_index_t fib_entry_index) { vlib_smp_unsafe_warning(); mfib_table->mft_total_route_counts--; switch (prefix->fp_proto) { case FIB_PROTOCOL_IP4: ip4_mfib_table_entry_remove(&mfib_table->v4, &prefix->fp_grp_addr.ip4, &prefix->fp_src_addr.ip4, prefix->fp_len); break; case FIB_PROTOCOL_IP6: ip6_mfib_table_entry_remove(&mfib_table->v6, &prefix->fp_grp_addr.ip6, &prefix->fp_src_addr.ip6, prefix->fp_len); break; case FIB_PROTOCOL_MPLS: ASSERT(0); break; } mfib_entry_unlock(fib_entry_index); } static void mfib_table_entry_insert (mfib_table_t *mfib_table, const mfib_prefix_t *prefix, fib_node_index_t mfib_entry_index) { vlib_smp_unsafe_warning(); mfib_entry_lock(mfib_entry_index); mfib_table->mft_total_route_counts++; switch (prefix->fp_proto) { case FIB_PROTOCOL_IP4: ip4_mfib_table_entry_insert(&mfib_table->v4, &prefix->fp_grp_addr.ip4, &prefix->fp_src_addr.ip4, prefix->fp_len, mfib_entry_index); break; case FIB_PROTOCOL_IP6: ip6_mfib_table_entry_insert(&mfib_table->v6, &prefix->fp_grp_addr.ip6, &prefix->fp_src_addr.ip6, prefix->fp_len, mfib_entry_index); break; case FIB_PROTOCOL_MPLS: break; } } fib_node_index_t mfib_table_entry_update (u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, fib_rpf_id_t rpf_id, mfib_entry_flags_t entry_flags) { fib_node_index_t mfib_entry_index; mfib_table_t *mfib_table; mfib_table = mfib_table_get(fib_index, prefix->fp_proto); mfib_entry_index = mfib_table_lookup_exact_match_i(mfib_table, prefix); if (FIB_NODE_INDEX_INVALID == mfib_entry_index) { if (MFIB_ENTRY_FLAG_NONE != entry_flags) { /* * update to a non-existing entry with non-zero flags */ mfib_entry_index = mfib_entry_create(fib_index, source, prefix, rpf_id, entry_flags); mfib_table_entry_insert(mfib_table, prefix, mfib_entry_index); } /* * else * the entry doesn't exist and the request is to set no flags * the result would be an entry that doesn't exist - so do nothing */ } else { mfib_entry_lock(mfib_entry_index); if (mfib_entry_update(mfib_entry_index, source, entry_flags, rpf_id, INDEX_INVALID)) { /* * this update means we can now remove the entry. */ mfib_table_entry_remove(mfib_table, prefix, mfib_entry_index); } mfib_entry_unlock(mfib_entry_index); } return (mfib_entry_index); } fib_node_index_t mfib_table_entry_path_update (u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, const fib_route_path_t *rpath, mfib_itf_flags_t itf_flags) { fib_node_index_t mfib_entry_index; mfib_table_t *mfib_table; mfib_table = mfib_table_get(fib_index, prefix->fp_proto); mfib_entry_index = mfib_table_lookup_exact_match_i(mfib_table, prefix); if (FIB_NODE_INDEX_INVALID == mfib_entry_index) { mfib_entry_index = mfib_entry_create(fib_index, source, prefix, MFIB_RPF_ID_NONE, MFIB_ENTRY_FLAG_NONE); mfib_table_entry_insert(mfib_table, prefix, mfib_entry_index); } mfib_entry_path_update(mfib_entry_index, source, rpath, itf_flags); return (mfib_entry_index); } void mfib_table_entry_path_remove (u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, const fib_route_path_t *rpath) { fib_node_index_t mfib_entry_index; mfib_table_t *mfib_table; mfib_table = mfib_table_get(fib_index, prefix->fp_proto); mfib_entry_index = mfib_table_lookup_exact_match_i(mfib_table, prefix); if (FIB_NODE_INDEX_INVALID == mfib_entry_index) { /* * removing an etry that does not exist. i'll allow it. */ } else { int no_more_sources; /* * don't nobody go nowhere */ mfib_entry_lock(mfib_entry_index); no_more_sources = mfib_entry_path_remove(mfib_entry_index, source, rpath); if (no_more_sources) { /* * last source gone. remove from the table */ mfib_table_entry_remove(mfib_table, prefix, mfib_entry_index); } mfib_entry_unlock(mfib_entry_index); } } fib_node_index_t mfib_table_entry_special_add (u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, mfib_entry_flags_t entry_flags, index_t rep_dpo) { fib_node_index_t mfib_entry_index; mfib_table_t *mfib_table; mfib_table = mfib_table_get(fib_index, prefix->fp_proto); mfib_entry_index = mfib_table_lookup_exact_match_i(mfib_table, prefix); if (FIB_NODE_INDEX_INVALID == mfib_entry_index) { mfib_entry_index = mfib_entry_create(fib_index, source, prefix, MFIB_RPF_ID_NONE, MFIB_ENTRY_FLAG_NONE); mfib_table_entry_insert(mfib_table, prefix, mfib_entry_index); } mfib_entry_update(mfib_entry_index, source, (MFIB_ENTRY_FLAG_EXCLUSIVE | entry_flags), MFIB_RPF_ID_NONE, rep_dpo); return (mfib_entry_index); } static void mfib_table_entry_delete_i (u32 fib_index, fib_node_index_t mfib_entry_index, const mfib_prefix_t *prefix, mfib_source_t source) { mfib_table_t *mfib_table; mfib_table = mfib_table_get(fib_index, prefix->fp_proto); /* * don't nobody go nowhere */ mfib_entry_lock(mfib_entry_index); if (mfib_entry_delete(mfib_entry_index, source)) { /* * last source gone. remove from the table */ mfib_table_entry_remove(mfib_table, prefix, mfib_entry_index); } /* * else * still has sources, leave it be. */ mfib_entry_unlock(mfib_entry_index); } void mfib_table_entry_delete (u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source) { fib_node_index_t mfib_entry_index; mfib_entry_index = mfib_table_lookup_exact_match(fib_index, prefix); if (FIB_NODE_INDEX_INVALID == mfib_entry_index) { /* * removing an etry that does not exist. * i'll allow it, but i won't like it. */ clib_warning("%U not in FIB", format_mfib_prefix, prefix); } else { mfib_table_entry_delete_i(fib_index, mfib_entry_index, prefix, source); } } void mfib_table_entry_delete_index (fib_node_index_t mfib_entry_index, mfib_source_t source) { mfib_prefix_t prefix; mfib_entry_get_prefix(mfib_entry_index, &prefix); mfib_table_entry_delete_i(mfib_entry_get_fib_index(mfib_entry_index), mfib_entry_index, &prefix, source); } u32 mfib_table_get_index_for_sw_if_index (fib_protocol_t proto, u32 sw_if_index) { switch (proto) { case FIB_PROTOCOL_IP4: return (ip4_mfib_table_get_index_for_sw_if_index(sw_if_index)); case FIB_PROTOCOL_IP6: return (ip6_mfib_table_get_index_for_sw_if_index(sw_if_index)); case FIB_PROTOCOL_MPLS: ASSERT(0); break; } return (~0); } u32 mfib_table_find (fib_protocol_t proto, u32 table_id) { switch (proto) { case FIB_PROTOCOL_IP4: return (ip4_mfib_index_from_table_id(table_id)); case FIB_PROTOCOL_IP6: return (ip6_mfib_index_from_table_id(table_id)); case FIB_PROTOCOL_MPLS: ASSERT(0); break; } return (~0); } u32 mfib_table_find_or_create_and_lock (fib_protocol_t proto, u32 table_id) { mfib_table_t *mfib_table; fib_node_index_t fi; switch (proto) { case FIB_PROTOCOL_IP4: fi = ip4_mfib_table_find_or_create_and_lock(table_id); break; case FIB_PROTOCOL_IP6: fi = ip6_mfib_table_find_or_create_and_lock(table_id); break; case FIB_PROTOCOL_MPLS: default: return (~0); } mfib_table = mfib_table_get(fi, proto); mfib_table->mft_desc = format(NULL, "%U-VRF:%d", format_fib_protocol, proto, table_id); return (fi); } static void mfib_table_destroy (mfib_table_t *mfib_table) { vec_free(mfib_table->mft_desc); switch (mfib_table->mft_proto) { case FIB_PROTOCOL_IP4: ip4_mfib_table_destroy(&mfib_table->v4); break; case FIB_PROTOCOL_IP6: ip6_mfib_table_destroy(&mfib_table->v6); break; case FIB_PROTOCOL_MPLS: ASSERT(0); break; } } void mfib_table_unlock (u32 fib_index, fib_protocol_t proto) { mfib_table_t *mfib_table; mfib_table = mfib_table_get(fib_index, proto); mfib_table->mft_locks--; if (0 == mfib_table->mft_locks) { mfib_table_destroy(mfib_table); } } void mfib_table_lock (u32 fib_index, fib_protocol_t proto) { mfib_table_t *mfib_table; mfib_table = mfib_table_get(fib_index, proto); mfib_table->mft_locks++; } void mfib_table_walk (u32 fib_index, fib_protocol_t proto, mfib_table_walk_fn_t fn, void *ctx) { switch (proto) { case FIB_PROTOCOL_IP4: ip4_mfib_table_walk(ip4_mfib_get(fib_index), fn, ctx); break; case FIB_PROTOCOL_IP6: ip6_mfib_table_walk(ip6_mfib_get(fib_index), fn, ctx); break; case FIB_PROTOCOL_MPLS: break; } } u8* format_mfib_table_name (u8* s, va_list ap) { fib_node_index_t fib_index = va_arg(ap, fib_node_index_t); fib_protocol_t proto = va_arg(ap, int); // int promotion mfib_table_t *mfib_table; mfib_table = mfib_table_get(fib_index, proto); s = format(s, "%v", mfib_table->mft_desc); return (s); } static clib_error_t * mfib_module_init (vlib_main_t * vm) { clib_error_t * error; if ((error = vlib_call_init_function (vm, fib_module_init))) return (error); if ((error = vlib_call_init_function (vm, rn_module_init))) return (error); mfib_entry_module_init(); mfib_signal_module_init(); return (error); } VLIB_INIT_FUNCTION(mfib_module_init);