Ramon Fried | f6e296f | 2019-07-18 21:43:31 +0300 | [diff] [blame] | 1 | PCAP: |
| 2 | |
Michal Simek | 50fa118 | 2023-05-17 09:17:16 +0200 | [diff] [blame] | 3 | U-Boot supports live Ethernet packet capture in PCAP(2.4) format. |
Ramon Fried | f6e296f | 2019-07-18 21:43:31 +0300 | [diff] [blame] | 4 | This is enabled by CONFIG_CMD_PCAP. |
| 5 | |
| 6 | The capture is stored on physical memory, and should be copied to |
| 7 | a machine capable of parsing and displaying PCAP files (IE. wireshark) |
| 8 | If networking works properly one can copy the capture file from physical memory |
| 9 | using tftpput, or save it to local storage with (sf write, mmc write, fatwrite, etc) |
| 10 | |
| 11 | the pcap capturing requires maximum buffer size. |
| 12 | when the buffer is full an error message will be displayed and then packets |
| 13 | will silently drop. |
| 14 | the actual capture file size is populate in the environment variable "pcapsize". |
| 15 | |
| 16 | Usage example: |
| 17 | |
| 18 | # Initialize pcap capture to physical address (0x100000) with maximum size of |
| 19 | # 100000 bytes. |
| 20 | |
| 21 | # Start capture |
| 22 | pcap start |
| 23 | |
| 24 | # Initialize network activity |
| 25 | env set ipaddr 10.0.2.15; env set serverip 10.0.2.2; tftp uImage64 |
| 26 | |
| 27 | # Stop capture |
| 28 | pcap stop |
| 29 | |
| 30 | # pcap init 0x100000 100000 |
| 31 | PCAP capture initialized: addr: 0xffffffff80100000 max length: 100000 |
| 32 | |
| 33 | # pcap start |
| 34 | # env set ipaddr 10.0.2.15; env set serverip 10.0.2.2; tftp uImage64 |
| 35 | eth0@10000000: PHY present at 0 |
| 36 | eth0@10000000: link up, 1000Mbps full-duplex (lpa: 0x7c00) |
| 37 | Using eth0@10000000 device |
| 38 | TFTP from server 10.0.2.2; our IP address is 10.0.2.15 |
| 39 | Filename 'uImage64'. |
| 40 | Load address: 0xffffffff88000000 |
| 41 | Loading: ################################################################# |
| 42 | ################################################################# |
| 43 | ################################################################# |
| 44 | ################################################################# |
| 45 | !!! Buffer is full, consider increasing buffer size !!! |
| 46 | ################################################################# |
| 47 | ################################################################# |
| 48 | ################################################################# |
| 49 | ################################################################# |
| 50 | ################################################################# |
| 51 | # |
| 52 | 18.2 MiB/s |
| 53 | done |
| 54 | Bytes transferred = 8359376 (7f8dd0 hex) |
| 55 | PCAP status: |
| 56 | Initialized addr: 0xffffffff80100000 max length: 100000 |
| 57 | Status: Active. file size: 99991 |
| 58 | Incoming packets: 66 Outgoing packets: 67 |
| 59 | |
| 60 | # pcap stop |
| 61 | # tftpput 0xffffffff80100000 $pcapsize 10.0.2.2:capture.pcap |