summaryrefslogtreecommitdiffstats
path: root/src/vnet/interface_cli.c
AgeCommit message (Expand)AuthorFilesLines
2019-05-17Add a debug-CLI leak-checkerDave Barach1-26/+14
2019-05-03mp_safe SW_INTERFACE_DUMP, SW_INTERFACE_DETAILS, SW_INTERFACE_TAG_ADD_DEL,Steven Luong1-0/+1
2019-04-16vpp-1647: fix typo in pcap_trace_command_internalDave Barach1-1/+1
2019-04-05fix pcap_trace cli output issueJack Xu1-2/+4
2019-02-26Move pcap rx/tx trace code out of the dpdk pluginDave Barach1-0/+286
2018-11-13L2 feautre bitmaps output verbose/non-verbose modeNeale Ranns1-2/+3
2018-10-23c11 safe string handling supportDave Barach1-1/+1
2018-09-26vnet: show interface rx-placement may display garbage charactersSteven1-1/+1
2018-09-24Trivial: Clean up some typos.Paul Vinciguerra1-4/+4
2018-08-24rx-placement: Add API call for interface rx-placementMohsin Kazmi1-23/+42
2018-07-20IP directed broadcastNeale Ranns1-0/+40
2018-06-11MTU: Software interface / Per-protocol MTU supportOle Troan1-14/+36
2018-05-27VPP-1294: add missing feature arc constraintDave Barach1-39/+51
2018-04-13Revert "MTU: Setting of MTU on software interface (instead of hardware interf...Damjan Marion1-20/+23
2018-04-13MTU: Setting of MTU on software interface (instead of hardware interface)Ole Troan1-23/+20
2018-03-18Remove unnumbered configuration on interface deleteNeale Ranns1-41/+13
2018-02-12Improve MTU handlingNeale Ranns1-6/+1
2018-01-13Improve "show xxx tunnel" and "show int addr" outputJohn Lo1-65/+45
2017-10-31Fix set interface mac address API to be endian neutralJohn Lo1-2/+2
2017-10-29devices: Add binary API for set interface <interface> rx-modeSteven1-18/+31
2017-10-04Set MAC address needs the HW interface indexNeale Ranns1-1/+3
2017-09-07Devices: Set interface rx-mode may cause SIGSEGV with nonexistent queueSteven1-2/+7
2017-08-15VPP-939: Update CLI Helptext for rx-placement commandsBilly McFall1-94/+264
2017-07-31CLI:add l2 input/outut to "sh int features"Eyal Bari1-14/+28
2017-07-06devices: show interface rx-placement displays the wrong information (VPP-894)Steven1-1/+3
2017-06-21Introduce default rx mode for device driversDamjan Marion1-6/+12
2017-06-16Add missing barrier sync to rx placement infra codeDamjan Marion1-1/+3
2017-05-10device: Add callback for set interface rx-modeSteven1-18/+54
2017-05-02Add interface rx mode commands, unify rx mode and placement CLIDamjan Marion1-0/+238
2017-04-27vnet: update help message for intfc stateRay Kinsella1-1/+1
2017-03-29Coverity Error: logically dead code in IP unnumbered CLINeale Ranns1-4/+0
2017-03-26Rename "show interfaces" -> "show interface"Dave Barach1-2/+2
2017-03-18Check change in unnumbered setting before updating IP enabled stateNeale Ranns1-4/+15
2017-03-17Attached hostsNeale Ranns1-0/+12
2017-03-07CLI: hide deleted interfacesEyal Bari1-2/+3
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion1-0/+1165
class="n">fh; int n; if (!pm->file_name) pm->file_name = "/tmp/vnet.pcap"; pm->file_descriptor = open (pm->file_name, O_CREAT | O_TRUNC | O_WRONLY, 0664); if (pm->file_descriptor < 0) { error = clib_error_return_unix (0, "failed to open `%s'", pm->file_name); goto done; } pm->flags |= PCAP_MAIN_INIT_DONE; pm->n_packets_captured = 0; pm->n_pcap_data_written = 0; clib_spinlock_init (&pm->lock); /* Write file header. */ clib_memset (&fh, 0, sizeof (fh)); fh.magic = 0xa1b2c3d4; fh.major_version = 2; fh.minor_version = 4; fh.time_zone = 0; fh.max_packet_size_in_bytes = 1 << 16; fh.packet_type = pm->packet_type; n = write (pm->file_descriptor, &fh, sizeof (fh)); if (n != sizeof (fh)) { if (n < 0) error = clib_error_return_unix (0, "write file header `%s'", pm->file_name); else error = clib_error_return (0, "short write of file header `%s'", pm->file_name); goto done; } } while (vec_len (pm->pcap_data) > pm->n_pcap_data_written) { int n = vec_len (pm->pcap_data) - pm->n_pcap_data_written; n = write (pm->file_descriptor, vec_elt_at_index (pm->pcap_data, pm->n_pcap_data_written), n); if (n < 0 && unix_error_is_fatal (errno)) { error = clib_error_return_unix (0, "write `%s'", pm->file_name); goto done; } pm->n_pcap_data_written += n; } if (pm->n_pcap_data_written >= vec_len (pm->pcap_data)) { vec_reset_length (pm->pcap_data); pm->n_pcap_data_written = 0; } done: if (error) { if (pm->file_descriptor >= 0) close (pm->file_descriptor); } return error; } /** * @brief Read PCAP file * * @return rc - clib_error_t * */ __clib_export clib_error_t * pcap_read (pcap_main_t * pm) { clib_error_t *error = 0; int fd, need_swap, n; pcap_file_header_t fh; pcap_packet_header_t ph; fd = open (pm->file_name, O_RDONLY); if (fd < 0) { error = clib_error_return_unix (0, "open `%s'", pm->file_name); goto done; } if (read (fd, &fh, sizeof (fh)) != sizeof (fh)) { error = clib_error_return_unix (0, "read file header `%s'", pm->file_name); goto done; } need_swap = 0; if (fh.magic == 0xd4c3b2a1) { need_swap = 1; #define _(t,f) fh.f = clib_byte_swap_##t (fh.f); foreach_pcap_file_header; #undef _ } if (fh.magic != 0xa1b2c3d4) { error = clib_error_return (0, "bad magic `%s'", pm->file_name); goto done; } pm->min_packet_bytes = 0; pm->max_packet_bytes = 0; while ((n = read (fd, &ph, sizeof (ph))) != 0) { u8 *data; u64 timestamp; u32 timestamp_sec; u32 timestamp_usec; if (need_swap) { #define _(t,f) ph.f = clib_byte_swap_##t (ph.f); foreach_pcap_packet_header; #undef _ } data = vec_new (u8, ph.n_bytes_in_packet); if (read (fd, data, ph.n_packet_bytes_stored_in_file) != ph.n_packet_bytes_stored_in_file) { error = clib_error_return (0, "short read `%s'", pm->file_name); goto done; } if (vec_len (pm->packets_read) == 0) pm->min_packet_bytes = pm->max_packet_bytes = ph.n_bytes_in_packet; else { pm->min_packet_bytes = clib_min (pm->min_packet_bytes, ph.n_bytes_in_packet); pm->max_packet_bytes = clib_max (pm->max_packet_bytes, ph.n_bytes_in_packet); } timestamp_sec = ph.time_in_sec; timestamp_usec = ph.time_in_usec; timestamp = ((u64) timestamp_sec) * 1000000 + (u64) timestamp_usec; vec_add1 (pm->packets_read, data); vec_add1 (pm->timestamps, timestamp); } done: if (fd >= 0) close (fd); return error; } /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */