EtherScope is a monitoring tool that analyzes the Ethernet traffic. It runs on a STM32F746 board, reads the Ethernet packets, do some realtime analysis and displays the results on the 480x272 touch panel.
The EtherScope interface allows to filter the results at different levels and report various kind of information.
EtherScope is a monitoring tool that analyzes the Ethernet traffic. It runs on a STM32F746 board, reads the Ethernet packets, do some realtime analysis and displays the results on the 480x272 touch panel.
The EtherScope interface allows to filter the results at different levels and report various kind of information.
The project is split in two parts:
Ada Embedded Network StackThis library is a small network stack that implements ARP, IPv4 protocols on top of an Ethernet driver. It can be compiled for a STM32F746 board to provide IPv4 network access to your project. The Ethernet driver manages a transmit queue and a receive queue
Sources of this library are available in: https://github.com/stcarrez/ada-enet
EtherScope ApplicationThe EtherScope application has a first task that waits for network packets and do the analysis.
The main EtherScope task manages the display with the user's interaction through the touch panel.
Sources of the EtherScope application are available in: https://github.com/stcarrez/etherscope
Ada STM32 Ethernet DriverAt the heart of EtherScope is the Ethernet driver that reads packets from the network. The Ethernet driver has a simple but very efficient design that allows to avoid memory copies on both the transmit and receive side. The Ethernet driver has internally two protected objects for the management of the transmit and receive queues. The driver implementation has reached a very stable stage and is able to sustain up to 95 Mbps of traffic, as analyzed by EtherScope.
The article below explains more into details how the driver works Using the Ada Embedded Network STM32 Ethernet Driver
EtherScope in ActionTo better illustrate what EtherScope is doing, I've recorded a short video which shows how to get the sources from GitHub, build the application and flash the image. Then I'm showing various analysis supported by EtherScope, including SCP transfer and IPtv stream identification.
EtherScope an Ethernet Traffic Monitor
Ethernet Traffic Monitor on a STM32F746To explain what EtherScope really is, I wrote a small article that describes the project, shows how to setup a network in order to use it and see EtherScope in action. The article terminates by a high level description of the internal architecture used for the project and proposes a number of future protocol analysis.
Ethernet Traffic Monitor on a STM32F746
SummaryThe EtherScope submission is made on two separate GitHub projects, one being the application itself and the second being a re-usable library for other Open Source projects. Both projects are under the Apache License version 2 allowing anybody to reuse these projects in proprietary or open source situations.
The EtherScope contribution is using a number of Open Source tools:
- The GNAT ARM Ada compiler is used to build the project.
- The Jenkins automated build is used to automatically enforce build rules. The build badge in the GitHub readme gives a live status of the build and allows to access the build system.
- The EtherScope documentation is generated from the Ada 2012 source by using the dynamo project.
The EtherScope and the Ethernet Driver are described in two blog articles. Both article try to explain the features provided by the two projects, and it also explains the design and some implementation consideration in order to help users to better understand and be able to re-use them. A 4 minutes video shows how to quickly build EtherScope and see it in action through real case situations (scp copy running at 92 Mbps and a 12.4 Mbps IPtv HD flow).
The implementation is documented and serves as a basis for the documentation. Several packages contain documentation headers which are collected and merged by the dynamo documentation generator. Therefore, the EtherScope documentation was generated from the sources and then published on the GitHub wiki.
The implementation of the Ada Embedded Network Stack is using pre
and post
conditions on several operations (mostly the network buffer and the Ethernet driver's interface). Strong typing was used wherever it was possible and many types have been declared limited to further avoid miss uses. The two projects are not formally proven and SPARK is not used (I must admit I have no experience in using SPARK nor in formally proving software).
The Ethernet driver design and implementation is probably something interesting to the Ada community. It certifies that we can write low level drivers and control hardware using Ada 2012 language and still get high performance. The use of protected object for the implementation of such low level driver is interesting and easier to understand (as compared for standard Linux/BSD kernel drivers in C). The Ethernet driver as such is easier to understand than an equivalent driver written in C. It is also, by design, a lot safer.
The protocol analysis is simple and it is quite easy to implement in Ada. The language make it easier to architect and understand (again, as compared to C).
The project will continue after the Make with Ada competition in the following directions:
- The Ada Embedded Network stack will be completed to have IPv4 support (there is some preliminary work but it is not finished).
- The EtherScope protocol analyzer will be completed to recognize: DNS, DHCP, ARP and provide interesting reports (list of DNS queries, allocated DHCP IPs, unanswered DNS, DHCP or ARP requests).
Comments
Please log in or sign up to comment.