Changes in / [e846bec:325ea9c] in mainline
- Location:
- uspace
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/pcapctl/main.c
re846bec r325ea9c 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 ) 42 49 43 50 pcapctl_sess_t sess; -
uspace/drv/nic/e1k/e1k.c
re846bec r325ea9c 49 49 #include <nic.h> 50 50 #include <ops/nic.h> 51 #include <pcapdump_iface.h>52 51 #include "e1k.h" 53 52 53 #include "pcapdump_iface.h" 54 #include "pcap_iface.h" 54 55 #define NAME "e1k" 55 56 … … 1191 1192 if (frame != NULL) { 1192 1193 memcpy(frame->data, e1000->rx_frame_virt[next_tail], frame_size); 1194 pcapdump_packet(nic_get_pcap_iface(nic), frame->data, frame->size); 1193 1195 1194 1196 nic_received_frame(nic, frame); … … 2206 2208 goto err_add_to_cat; 2207 2209 2210 errno_t pcap_rc = pcapdump_init(nic_get_pcap_iface(nic)); 2211 2212 if (pcap_rc != EOK) { 2213 printf("Failed creating pcapdump port\n"); 2214 } 2208 2215 rc = ddf_fun_add_to_category(fun, "pcap"); 2209 if (rc != EOK) { 2210 ddf_msg(LVL_ERROR, "Failed adding function to category pcap"); 2216 if (rc != EOK) 2211 2217 goto err_add_to_cat; 2212 }2213 2218 2214 2219 return EOK; … … 2375 2380 2376 2381 memcpy(e1000->tx_frame_virt[tdt], data, size); 2382 pcapdump_packet(nic_get_pcap_iface(nic), data, size); 2377 2383 tx_descriptor_addr->phys_addr = PTR_TO_U64(e1000->tx_frame_phys[tdt]); 2378 2384 tx_descriptor_addr->length = size; -
uspace/drv/nic/virtio-net/virtio-net.c
re846bec r325ea9c 43 43 44 44 #include <virtio-pci.h> 45 #include <pcapdump_iface.h>46 45 #include "pcapdump_iface.h" 46 #include "pcap_iface.h" 47 47 #define NAME "virtio-net" 48 48 … … 93 93 if (frame) { 94 94 memcpy(frame->data, &hdr[1], len - sizeof(*hdr)); 95 pcapdump_packet(nic_get_pcap_iface(nic), frame->data, frame->size); 95 96 nic_received_frame(nic, frame); 96 97 } else { … … 352 353 /* Copy packet data into the buffer just past the header */ 353 354 memcpy(&hdr[1], data, size); 354 355 pcapdump_packet(nic_get_pcap_iface(nic), data, size); 355 356 /* 356 357 * Set the descriptor, put it into the virtqueue and notify the device … … 432 433 ddf_dev_get_name(dev)); 433 434 435 errno_t pcap_rc = pcapdump_init(nic_get_pcap_iface(nic)); 436 437 if (pcap_rc != EOK) { 438 printf("Failed creating pcapdump port\n"); 439 } 434 440 rc = ddf_fun_add_to_category(fun, "pcap"); 435 if (rc != EOK) { 436 ddf_msg(LVL_ERROR, "Failed adding function to category pcap"); 441 if (rc != EOK) 437 442 goto unbind; 438 }439 443 440 444 return EOK; -
uspace/lib/nic/include/nic.h
re846bec r325ea9c 44 44 #include <device/hw_res_parsed.h> 45 45 #include <ops/nic.h> 46 #include <pcap_iface.h> 46 47 #include "pcap_iface.h" 47 48 48 49 #define DEVICE_CATEGORY_NIC "nic" -
uspace/lib/nic/src/nic_driver.c
re846bec r325ea9c 47 47 #include <ops/nic.h> 48 48 #include <errno.h> 49 #include <pcapdump_iface.h>50 49 51 50 #include "nic_driver.h" … … 523 522 * calls it inside send_frame handler (with locked main lock) 524 523 */ 525 pcapdump_packet(nic_get_pcap_iface(nic_data), frame->data, frame->size);526 524 fibril_rwlock_read_lock(&nic_data->rxc_lock); 527 525 nic_frame_type_t frame_type; … … 562 560 fibril_rwlock_write_unlock(&nic_data->stats_lock); 563 561 } 564 //pcapdump_packet(nic_get_pcap_iface(nic_data), frame->data, frame->size);565 562 nic_release_frame(nic_data, frame); 566 563 } … … 650 647 651 648 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 }657 649 658 650 return nic_data; -
uspace/lib/nic/src/nic_impl.c
re846bec r325ea9c 40 40 #include <ipc/services.h> 41 41 #include <ns.h> 42 #include <pcapdump_iface.h>43 42 #include "nic_driver.h" 44 43 #include "nic_ev.h" … … 180 179 return EBUSY; 181 180 } 182 pcapdump_packet(nic_get_pcap_iface(nic_data), data, size); 181 183 182 nic_data->send_frame(nic_data, data, size); 184 183 fibril_rwlock_read_unlock(&nic_data->main_lock); -
uspace/lib/pcap/include/pcap.h
re846bec r325ea9c 64 64 uint32_t snaplen; 65 65 uint32_t additional; /** The LinkType and additional information field is in the form */ 66 } pcap_file_header_t;66 } __attribute__((packed, aligned(4))) pcap_file_header_t; 67 67 68 68 typedef struct pcap_packet_header { -
uspace/lib/pcap/src/pcap.c
re846bec r325ea9c 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 ) 37 44 38 45 #include "pcap.h" … … 101 108 if (writer->data == NULL) { 102 109 rc = EINVAL; 110 LOGGER("Failed to create %s: %s.", filename, str_error(rc)); 103 111 return rc; 104 112 } -
uspace/lib/pcap/src/pcap_iface.c
re846bec r325ea9c 82 82 } 83 83 84 void pcap_close_file( void)84 void pcap_close_file() 85 85 { 86 86 pcap_writer.ops->close(&pcap_writer);
Note:
See TracChangeset
for help on using the changeset viewer.