aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Expand)AuthorFilesLines
2017-11-16Add Support of DHCP VSS Type 0 where VPN-ID is ASCIIJohn Lo9-220/+294
2017-11-15memif: fix uninitialized pointer read coverity errorSteven1-0/+2
2017-11-15BIER: coverity fixesNeale Ranns6-11/+22
2017-11-15Punt DNS request/reply traffic when name resolution disabledDave Barach3-5/+27
2017-11-15Revert "vnet: af_packet mark l3 offload cksum"Jakub Grajciar1-2/+1
2017-11-15armv8 crc32 - fix macro nameGabriel Ganne1-1/+1
2017-11-15Fix cosmetic issue in configure.acDamjan Marion1-1/+1
2017-11-15VOM: interface's handle() retreives from singular instanceNeale Ranns2-0/+11
2017-11-15VOM: interface RD update reconfigures L3 bindingsNeale Ranns4-21/+82
2017-11-14VOM: bridge-domain learning mode and route help commandsNeale Ranns8-7/+125
2017-11-14Ip6 dump not showing fib table names (VPP-1063)Neale Ranns2-9/+9
2017-11-14Fix typos in configure.ac and dpdk/buffer.cDamjan Marion2-10/+10
2017-11-14vppinfra: fix pool_get_aligned_will_expand for fixed poolsFlorin Coras1-3/+4
2017-11-14NULL-terminate load_balance_nsh_nodes[]Gabriel Ganne1-0/+1
2017-11-14bier - fix node table declarationGabriel Ganne3-3/+6
2017-11-14Fix builtin http server static request freeFlorin Coras1-0/+1
2017-11-14vnet: af_packet_set_l4_cksum_offload device class checkJakub Grajciar2-1/+5
2017-11-14vnet: af_packet mark l3 offload cksumJakub Grajciar1-1/+2
2017-11-14VCL-LDPRELOAD: add sendfile/sendfile64 implementation.Dave Wallace10-53/+301
2017-11-14l2-flood: fix restore vnet buffer's flags in the replication routineSteve Shin2-1/+7
2017-11-13dpdk: introduce AVX512 variants of node functionsDamjan Marion10-69/+259
2017-11-13Instead of a min term size, use a default (VPP-1061)Chris Luke1-16/+21
2017-11-13NAT: Buufer overflow for memcpy()Ole Troan1-3/+2
2017-11-12session: add handle to disconnect_session_reply api msg.Dave Wallace1-1/+1
2017-11-11VCL: clean up disconnect_session debug output.Dave Wallace1-14/+25
2017-11-12VCL/LDPRELOAD: Fix out-of-bounds access and inequality comparison coverity er...Steven2-56/+47
2017-11-11ACL: Add coding-style-patch-verification and indent.Jon Loeliger1-965/+1260
2017-11-11ACLs: Use better error return codes than "-1" everywhere.Jon Loeliger2-15/+17
2017-11-11MPLS disposition actions at the tail of unicast LSPsNeale Ranns6-31/+107
2017-11-11Update CPU listDamjan Marion1-17/+35
2017-11-11dpdk: optimize buffer alloc/freeDamjan Marion1-49/+118
2017-11-11Handle CPU flags from autotools projectDamjan Marion5-4/+15
2017-11-10VCL: Fix accept state machine, EPOLLET logic.Dave Wallace2-178/+258
2017-11-10Map SVM regions at a sane offset on arm64Brian Brooks1-1/+7
2017-11-10VCL-LDPRELOAD: Fix epoll_pwait timeout.Dave Wallace2-12/+17
2017-11-10Break up vpe.apiNeale Ranns29-2523/+2888
2017-11-10add warning control macro setGabriel Ganne2-11/+106
2017-11-10Further fix to SHG handling for ARP/ICMPv6 from BVI in a BDJohn Lo1-6/+25
2017-11-10add classify session action set-sr-policy-indexGabriel Ganne5-1/+41
2017-11-10Allow Openssl 1.1.0Marco Varlese5-12/+159
2017-11-10vppinfra: add 512-bit vector definitions and typesDamjan Marion1-0/+25
2017-11-10Fix bug in key calculation for IPsec tunnel interfaceMatthew Smith1-2/+2
2017-11-10session: add app ns index to ns create apiFlorin Coras3-4/+66
2017-11-10Add sw_if_index to the ip_neighbor_details_t response.Jon Loeliger2-4/+9
2017-11-10session: use listener logic for proxy rulesFlorin Coras5-53/+133
2017-11-10VOM: enum_base - not constexpr to appease coverityNeale Ranns1-23/+23
2017-11-10VOM: memset DHCP hostname in VPP APINeale Ranns1-0/+1
2017-11-10BIER: replace uintXX_t with uXXNeale Ranns4-12/+12
2017-11-10session: use pool for segment manager propertiesFlorin Coras5-37/+83
2017-11-09tcp: call accept notify after full connection initFlorin Coras1-9/+9
s="k">if (g->header.type == ELF_SEGMENT_INTERP) break; } if (g >= vec_end (em->segments)) return clib_error_return (0, "interpreter not found"); if (g->header.memory_size < 1 + strlen (interp)) return clib_error_return (0, "given interpreter does not fit; must be less than %d bytes (`%s' given)", g->header.memory_size, interp); error = elf_get_section_by_start_address (em, g->header.virtual_address, &s); if (error) return error; /* Put in new null terminated string. */ clib_memset (s->contents, 0, vec_len (s->contents)); clib_memcpy (s->contents, interp, strlen (interp)); return 0; } static void delete_rpath_for_section (elf_main_t * em, elf_section_t * s) { elf64_dynamic_entry_t * e; elf64_dynamic_entry_t * new_es = 0; vec_foreach (e, em->dynamic_entries) { switch (e->type) { case ELF_DYNAMIC_ENTRY_RPATH: case ELF_DYNAMIC_ENTRY_RUN_PATH: break; default: vec_add1 (new_es, e[0]); break; } } /* Pad so as to keep section size constant. */ { elf64_dynamic_entry_t e_end; e_end.type = ELF_DYNAMIC_ENTRY_END; e_end.data = 0; while (vec_len (new_es) < vec_len (em->dynamic_entries)) vec_add1 (new_es, e_end); } vec_free (em->dynamic_entries); em->dynamic_entries = new_es; elf_set_dynamic_entries (em); } static void delete_rpath (elf_main_t * em) { elf_section_t * s; vec_foreach (s, em->sections) { switch (s->header.type) { case ELF_SECTION_DYNAMIC: delete_rpath_for_section (em, s); break; default: break; } } } static clib_error_t * set_rpath_for_section (elf_main_t * em, elf_section_t * s, char * new_rpath) { elf64_dynamic_entry_t * e; char * old_rpath; int old_len, new_len = strlen (new_rpath); u8 * new_string_table = vec_dup (em->dynamic_string_table); vec_foreach (e, em->dynamic_entries) { switch (e->type) { case ELF_DYNAMIC_ENTRY_RPATH: case ELF_DYNAMIC_ENTRY_RUN_PATH: old_rpath = (char *) new_string_table + e->data; old_len = strlen (old_rpath); if (old_len < new_len) return clib_error_return (0, "rpath of `%s' does not fit (old rpath `%s')", new_rpath, old_rpath); strcpy (old_rpath, new_rpath); //NOSONAR break; default: break; } } elf_set_section_contents (em, em->dynamic_string_table_section_index, new_string_table, vec_bytes (new_string_table)); return 0; } static clib_error_t * set_rpath (elf_main_t * em, char * rpath) { clib_error_t * error = 0; elf_section_t * s; vec_foreach (s, em->sections) { switch (s->header.type) { case ELF_SECTION_DYNAMIC: error = set_rpath_for_section (em, s, rpath); if (error) return error; break; default: break; } } return error; } static clib_error_t * set_interpreter_rpath (elf_tool_main_t * tm) { int ifd = -1, ofd = -1; struct stat fd_stat; u8 *idp = 0; /* warning be gone */ u64 mmap_length = 0, i; u32 run_length; u8 in_run; u64 offset0 = 0, offset1 = 0; clib_error_t * error = 0; int fix_in_place = 0; if (!strcmp (tm->input_file, tm->output_file)) fix_in_place = 1; ifd = open (tm->input_file, O_RDWR); if (ifd < 0) { error = clib_error_return_unix (0, "open `%s'", tm->input_file); goto done; } if (fstat (ifd, &fd_stat) < 0) { error = clib_error_return_unix (0, "fstat `%s'", tm->input_file); goto done; } if (!(fd_stat.st_mode & S_IFREG)) { error = clib_error_return (0, "%s is not a regular file", tm->input_file); goto done; } mmap_length = fd_stat.st_size; if (mmap_length < 4) { error = clib_error_return (0, "%s too short", tm->input_file); goto done; } /* COW-mapping, since we intend to write the fixups */ if (fix_in_place) idp = mmap (0, mmap_length, PROT_READ | PROT_WRITE, MAP_SHARED, ifd, /* offset */ 0); else idp = mmap (0, mmap_length, PROT_READ | PROT_WRITE, MAP_PRIVATE, ifd, /* offset */ 0); if (~pointer_to_uword (idp) == 0) { mmap_length = 0; error = clib_error_return_unix (0, "mmap `%s'", tm->input_file); goto done; } if (idp[0] != 0x7f || idp[1] != 'E' || idp[2] != 'L' || idp[3] != 'F') { error = clib_error_return (0, "not an ELF file '%s'", tm->input_file); goto done; } in_run = 0; run_length = 0; for (i = 0; i < mmap_length; i++) { if (idp[i] == '/') { if (in_run) run_length++; else { in_run = 1; run_length = 1; } } else { if (in_run && run_length >= 16) { if (offset0 == 0) offset0 = (i - run_length); else if (offset1 == 0) { offset1 = (i - run_length); goto found_both; } } in_run = 0; run_length = 0; } } if (offset0 == 0) { error = clib_error_return (0, "no fixup markers in %s", tm->input_file); goto done; } found_both: if (0) clib_warning ("offset0 %lld (0x%llx), offset1 %lld (0x%llx)", offset0, offset0, offset1, offset1); /* Executable file case */ if (offset0 && offset1) { tm->interpreter_offset = offset0; tm->rpath_offset = offset1; } else /* shared library case */ { tm->interpreter_offset = 0; tm->rpath_offset = offset0; } if (tm->interpreter_offset) clib_memcpy (&idp[tm->interpreter_offset], tm->set_interpreter, strlen (tm->set_interpreter)+1); if (tm->rpath_offset) clib_memcpy (&idp[tm->rpath_offset], tm->set_rpath, strlen (tm->set_rpath)+1); /* Write the output file... */ if (fix_in_place == 0) { ofd = open (tm->output_file, O_RDWR | O_CREAT | O_TRUNC, 0644); if (ofd < 0) { error = clib_error_return_unix (0, "create `%s'", tm->output_file); goto done; } if (write (ofd, idp, mmap_length) != mmap_length) error = clib_error_return_unix (0, "write `%s'", tm->output_file); } done: if (mmap_length > 0 && idp) munmap (idp, mmap_length); if (ifd >= 0) close (ifd); if (ofd >= 0) close (ofd); return error; } int main (int argc, char * argv[]) { elf_tool_main_t _tm, * tm = &_tm; elf_main_t * em = &tm->elf_main; unformat_input_t i; clib_error_t * error = 0; clib_memset (tm, 0, sizeof (tm[0])); unformat_init_command_line (&i, argv); while (unformat_check_input (&i) != UNFORMAT_END_OF_INPUT) { if (unformat (&i, "in %s", &tm->input_file)) ; else if (unformat (&i, "out %s", &tm->output_file)) ; else if (unformat (&i, "set-interpreter %s", &tm->set_interpreter)) ; else if (unformat (&i, "set-rpath %s", &tm->set_rpath)) ; else if (unformat (&i, "unset-rpath")) tm->unset_rpath = 1; else if (unformat (&i, "verbose")) tm->verbose = ~0; else if (unformat (&i, "verbose-symbols")) tm->verbose |= FORMAT_ELF_MAIN_SYMBOLS; else if (unformat (&i, "verbose-relocations")) tm->verbose |= FORMAT_ELF_MAIN_RELOCATIONS; else if (unformat (&i, "verbose-dynamic")) tm->verbose |= FORMAT_ELF_MAIN_DYNAMIC; else if (unformat (&i, "quiet")) tm->quiet = 1; else if (unformat (&i, "allow-elf-shared")) tm->allow_elf_shared = 1; else { error = unformat_parse_error (&i); goto done; } } if (! tm->input_file) { error = clib_error_return (0, "no input file"); goto done; } /* Do the typical case a stone-simple way... */ if (tm->quiet && tm->set_interpreter && tm->set_rpath && tm->output_file) { error = set_interpreter_rpath (tm); goto done; } error = elf_read_file (em, tm->input_file); if (error) goto done; if (tm->verbose) fformat (stdout, "%U", format_elf_main, em, tm->verbose); if (tm->set_interpreter) { error = elf_set_interpreter (em, tm); if (error) goto done; } if (tm->set_rpath) { error = set_rpath (em, tm->set_rpath); if (error) goto done; } if (tm->unset_rpath) delete_rpath (em); if (tm->output_file) error = elf_write_file (em, tm->output_file); elf_main_free (em); done: if (error) { if (tm->quiet == 0) clib_error_report (error); return 1; } else return 0; }