Alexander Afanasyev | 357c205 | 2015-08-10 21:26:52 -0700 | [diff] [blame] | 1 | NDN Packet Dissector for Wireshark |
| 2 | ================================== |
Alexander Afanasyev | 6fbb7b4 | 2015-08-10 11:53:49 -0700 | [diff] [blame] | 3 | |
Alexander Afanasyev | 357c205 | 2015-08-10 21:26:52 -0700 | [diff] [blame] | 4 | **NDN packet dissector requires at least version 1.12.6 of Wireshark with LUA support enabled** |
Alexander Afanasyev | 6fbb7b4 | 2015-08-10 11:53:49 -0700 | [diff] [blame] | 5 | |
Alexander Afanasyev | 357c205 | 2015-08-10 21:26:52 -0700 | [diff] [blame] | 6 | The dissection of [Named Data Networking (NDN) packets](http://named-data.net/doc/ndn-tlv/) is |
| 7 | supported in the following cases: |
Alexander Afanasyev | 6fbb7b4 | 2015-08-10 11:53:49 -0700 | [diff] [blame] | 8 | |
Alexander Afanasyev | 357c205 | 2015-08-10 21:26:52 -0700 | [diff] [blame] | 9 | - NDN packets are encapsulated in IPv4/IPv6 UDP packets with source or destination port |
| 10 | 6363 or 56363. |
Alexander Afanasyev | 6fbb7b4 | 2015-08-10 11:53:49 -0700 | [diff] [blame] | 11 | |
Alexander Afanasyev | 357c205 | 2015-08-10 21:26:52 -0700 | [diff] [blame] | 12 | - NDN packets are encapsulated in IPv4/IPv6 TCP segments with source or destination |
| 13 | port 6363. |
| 14 | |
| 15 | - NDN packets are encapsulated in IPv4/IPv6 TCP/HTTP WebSocket packets with source or |
| 16 | destination port 9696. |
| 17 | |
Alexander Afanasyev | 7f43c53 | 2015-08-12 15:28:51 -0700 | [diff] [blame] | 18 | - NDN packets are encapsulated in Ethernet frames with EtherType 0x8624. |
| 19 | |
Alexander Afanasyev | 4fb67ea | 2018-08-02 08:18:28 -0600 | [diff] [blame] | 20 | - NDN packets are encapsulated in PPP frames with protocol type 0x0077. |
| 21 | |
Alexander Afanasyev | 357c205 | 2015-08-10 21:26:52 -0700 | [diff] [blame] | 22 | ## Available dissection features |
| 23 | |
| 24 | - When UDP packet is fragmented, the dissection is performed after the full IP reassembly. |
| 25 | If the full reassembly is not possible (e.g., a wrong checksum or missing segments), |
| 26 | dissection is not performed. |
| 27 | |
| 28 | - When multiple NDN packets are part of a single UDP datagram, TCP segment, or WebSocket |
| 29 | payload, all NDN packets are dissected. |
| 30 | |
| 31 | - When a single NDN packet is scattered across multiple TCP segments or WebSocket |
| 32 | payloads, it is dissected after the successful reconstruction of the necessary portion |
| 33 | of the TCP stream. If the reconstruction of the necessary portion of the TCP stream is |
| 34 | not possible (e.g., missing segments), the dissection is not performed. |
| 35 | |
| 36 | - When an NDN packet is not aligned to the segment or payload boundary, the dissector |
| 37 | searches for any valid NDN packet within the segment using heuristics defined by the |
| 38 | following pseudocode: |
| 39 | |
| 40 | for each offset in range (0, packet length) |
| 41 | type <- read TLV VarNumber from (buffer + offset) |
| 42 | length <- read TLV VarNumber from (buffer + offset + length of type field) |
| 43 | |
| 44 | if type is either 5 or 6 // Type of NDN Interest of Data packet) |
| 45 | and length is less 8800 // Current (soft) limit for NDN packet size |
| 46 | then |
| 47 | dissect NDN packet from (buffer + offset) |
| 48 | end if |
| 49 | |
| 50 | Currently, the dissector does not support NDNLPv2 packets. |
Alexander Afanasyev | 6fbb7b4 | 2015-08-10 11:53:49 -0700 | [diff] [blame] | 51 | |
| 52 | ## Usage |
| 53 | |
| 54 | By default, the dissector script `ndn.lua` is installed into `/usr/local/share/ndn-dissect-wireshark`. |
| 55 | On some platforms, it may also be installed in `/usr/share/ndn-dissect-wireshark` or |
| 56 | `/opt/local/share/ndn-dissect-wireshark`. To enable the dissector for Wireshark session, |
| 57 | use `-X` command line option, specifying the full path to the `ndn.lua` script: |
| 58 | |
| 59 | wireshark -X lua_script:/usr/local/share/ndn-dissect-wireshark/ndn.lua |
| 60 | |
| 61 | Similarly, NDN packets dissector can be enabled when using `tshark`: |
| 62 | |
| 63 | tshark shark -X lua_script:/usr/local/share/ndn-dissect-wireshark/ndn.lua |
| 64 | |
| 65 | To enable NDN packets dissector for all future Wireshark sessions, you can create/edit |
| 66 | Wireshark's `init.lua` script, which located in `/usr/share/wireshark`, |
| 67 | `/usr/local/share/wireshark`, `/Applications/Wireshark.app/Contents/Resources/share/wireshark`, |
| 68 | or similar location depending on the platform and the way Wireshark is installed. The |
| 69 | `dofile` command should be added to the end of `init.lua` file: |
| 70 | |
| 71 | -- dofile("/full/path/to/ndn.lua") |
| 72 | dofile("/usr/local/share/ndn-dissect-wireshark/ndn.lua") |
| 73 | |
| 74 | For more detailed information about how to use Lua refer to [Lua wiki](https://wiki.wireshark.org/Lua). |
| 75 | |
| 76 | ## Known issues |
| 77 | |
| 78 | Due to security issues, customized lua scripts are not allowed to be loaded when Wireshark |
| 79 | is started with root privileges. There are two workarounds: |
| 80 | |
| 81 | - run Wireshark, `dumpcap`, or `tcpdump` with root privileges to capture traffic to a file, later |
| 82 | running Wireshark without root privileges and to analyze the captured traffic. |
| 83 | |
| 84 | - (beware of potential security implications) allow non-root users to capture packets: |
| 85 | |
| 86 | * On Linux platform, you can use `setcap` |
| 87 | |
| 88 | sudo setcap cap_net_raw,cap_net_admin=eip /full/path/to/wireshark |
| 89 | |
| 90 | You may need to install a package to use setcap (e.g., `sudo apt-get install libcap2-bin` on Ubuntu) |
| 91 | |
| 92 | * On Debian/Ubuntu Linux, capturing traffic with Wireshark by a non-root user can be enabled by adding |
| 93 | this user to the `wireshark` group. |
| 94 | |
| 95 | See [Wireshark Debian README](http://anonscm.debian.org/viewvc/collab-maint/ext-maint/wireshark/trunk/debian/README.Debian?view=markup) |
| 96 | for more details. |
| 97 | |
| 98 | * On OSX platform, `/dev/bpf*` devices need to be assigned proper permissions |
| 99 | |
| 100 | Automatically using ChmodBPF app |
| 101 | |
| 102 | curl https://bugs.wireshark.org/bugzilla/attachment.cgi?id=3373 -o ChmodBPF.tar.gz |
| 103 | tar zxvf ChmodBPF.tar.gz |
| 104 | open ChmodBPF/Install\ ChmodBPF.app |
| 105 | |
| 106 | or manually: |
| 107 | |
| 108 | sudo chgrp admin /dev/bpf* |
| 109 | sudo chmod g+rw /dev/bpf* |