Changeset 9ce251c7 in mainline
- Timestamp:
- 2024-12-13T08:32:55Z (10 months ago)
- Children:
- 8765039
- Parents:
- 91042127
- git-author:
- Nataliia Korop <n.corop08@…> (2024-03-10 09:38:44)
- git-committer:
- Nataliia Korop <n.corop08@…> (2024-12-13 08:32:55)
- Location:
- uspace
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/pcapctl/main.c
r91042127 r9ce251c7 40 40 41 41 #define NAME "pcapctl" 42 43 #define LOGGER(msg, ...) \44 fprintf(stderr, \45 "[PCAP %s:%d]: " msg "\n", \46 __FILE__, __LINE__, \47 ##__VA_ARGS__\48 )49 42 50 43 pcapctl_sess_t sess; -
uspace/drv/nic/e1k/e1k.c
r91042127 r9ce251c7 49 49 #include <nic.h> 50 50 #include <ops/nic.h> 51 #include <pcapdump_iface.h> 51 52 #include "e1k.h" 52 53 53 #include "pcapdump_iface.h"54 #include "pcap_iface.h"55 54 #define NAME "e1k" 56 55 … … 1192 1191 if (frame != NULL) { 1193 1192 memcpy(frame->data, e1000->rx_frame_virt[next_tail], frame_size); 1194 pcapdump_packet(nic_get_pcap_iface(nic), frame->data, frame->size);1195 1193 1196 1194 nic_received_frame(nic, frame); … … 2207 2205 goto err_add_to_cat; 2208 2206 2209 errno_t pcap_rc = pcapdump_init(nic_get_pcap_iface(nic));2210 2211 if (pcap_rc != EOK) {2212 printf("Failed creating pcapdump port\n");2213 }2214 2207 rc = ddf_fun_add_to_category(fun, "pcap"); 2215 if (rc != EOK) 2208 if (rc != EOK) { 2209 ddf_msg(LVL_ERROR, "Failed adding function to category pcap"); 2216 2210 goto err_add_to_cat; 2211 } 2217 2212 2218 2213 return EOK; … … 2379 2374 2380 2375 memcpy(e1000->tx_frame_virt[tdt], data, size); 2381 pcapdump_packet(nic_get_pcap_iface(nic), data, size);2382 2376 tx_descriptor_addr->phys_addr = PTR_TO_U64(e1000->tx_frame_phys[tdt]); 2383 2377 tx_descriptor_addr->length = size; -
uspace/drv/nic/virtio-net/virtio-net.c
r91042127 r9ce251c7 43 43 44 44 #include <virtio-pci.h> 45 #include "pcapdump_iface.h"46 #include "pcap_iface.h" 45 #include <pcapdump_iface.h> 46 47 47 #define NAME "virtio-net" 48 48 … … 98 98 if (frame) { 99 99 memcpy(frame->data, &hdr[1], len - sizeof(*hdr)); 100 pcapdump_packet(nic_get_pcap_iface(nic), frame->data, frame->size);101 100 nic_received_frame(nic, frame); 102 101 } else { … … 359 358 /* Copy packet data into the buffer just past the header */ 360 359 memcpy(&hdr[1], data, size); 361 pcapdump_packet(nic_get_pcap_iface(nic), data, size); 360 362 361 /* 363 362 * Set the descriptor, put it into the virtqueue and notify the device … … 439 438 ddf_dev_get_name(dev)); 440 439 441 errno_t pcap_rc = pcapdump_init(nic_get_pcap_iface(nic));442 443 if (pcap_rc != EOK) {444 printf("Failed creating pcapdump port\n");445 }446 440 rc = ddf_fun_add_to_category(fun, "pcap"); 447 if (rc != EOK) 441 if (rc != EOK) { 442 ddf_msg(LVL_ERROR, "Failed adding function to category pcap"); 448 443 goto unbind; 444 } 449 445 450 446 return EOK; -
uspace/lib/nic/include/nic.h
r91042127 r9ce251c7 44 44 #include <device/hw_res_parsed.h> 45 45 #include <ops/nic.h> 46 47 #include "pcap_iface.h" 46 #include <pcap_iface.h> 48 47 49 48 #define DEVICE_CATEGORY_NIC "nic" -
uspace/lib/nic/src/nic_driver.c
r91042127 r9ce251c7 47 47 #include <ops/nic.h> 48 48 #include <errno.h> 49 #include <pcapdump_iface.h> 49 50 50 51 #include "nic_driver.h" … … 522 523 * calls it inside send_frame handler (with locked main lock) 523 524 */ 525 pcapdump_packet(nic_get_pcap_iface(nic_data), frame->data, frame->size); 524 526 fibril_rwlock_read_lock(&nic_data->rxc_lock); 525 527 nic_frame_type_t frame_type; … … 560 562 fibril_rwlock_write_unlock(&nic_data->stats_lock); 561 563 } 564 //pcapdump_packet(nic_get_pcap_iface(nic_data), frame->data, frame->size); 562 565 nic_release_frame(nic_data, frame); 563 566 } … … 647 650 648 651 nic_data->dev = device; 652 errno_t pcap_rc = pcapdump_init(nic_get_pcap_iface(nic_data)); 653 654 if (pcap_rc != EOK) { 655 printf("Failed creating pcapdump port\n"); 656 } 649 657 650 658 return nic_data; -
uspace/lib/nic/src/nic_impl.c
r91042127 r9ce251c7 40 40 #include <ipc/services.h> 41 41 #include <ns.h> 42 #include <pcapdump_iface.h> 42 43 #include "nic_driver.h" 43 44 #include "nic_ev.h" … … 179 180 return EBUSY; 180 181 } 181 182 pcapdump_packet(nic_get_pcap_iface(nic_data), data, size); 182 183 nic_data->send_frame(nic_data, data, size); 183 184 fibril_rwlock_read_unlock(&nic_data->main_lock); -
uspace/lib/pcap/include/pcap.h
r91042127 r9ce251c7 64 64 uint32_t snaplen; 65 65 uint32_t additional; /** The LinkType and additional information field is in the form */ 66 } __attribute__((packed, aligned(4)))pcap_file_header_t;66 } pcap_file_header_t; 67 67 68 68 typedef struct pcap_packet_header { -
uspace/lib/pcap/src/pcap.c
r91042127 r9ce251c7 35 35 * @brief Headers and functions for .pcap file and packets to be dumped 36 36 */ 37 38 #define LOGGER(msg, ...) \39 fprintf(stderr, \40 "[PCAP %s:%d]: " msg "\n", \41 __FILE__, __LINE__, \42 ##__VA_ARGS__\43 )44 37 45 38 #include "pcap.h" … … 108 101 if (writer->data == NULL) { 109 102 rc = EINVAL; 110 LOGGER("Failed to create %s: %s.", filename, str_error(rc));111 103 return rc; 112 104 } -
uspace/lib/pcap/src/pcap_iface.c
r91042127 r9ce251c7 82 82 } 83 83 84 void pcap_close_file( )84 void pcap_close_file(void) 85 85 { 86 86 pcap_writer.ops->close(&pcap_writer);
Note:
See TracChangeset
for help on using the changeset viewer.