Detecting NIC incoming/outgoing packets

I'm about to standup a pfSense box which has six NICs installed in it. Since pfSense is based on FreeBSD, I thought I'd ask this here.

None of the NICs have a pin header to attach front-panel activity lights, and I don't want to go soldering on the cards (my soldering-fu, combined with my diminishing eye sight ain't all that good, so I've halfway decided to create an arduino-based solution to moving the lights to the front of the box.

I want to somehow capture the NIC activity on each interface, and relay that to the arduino device which will flash it's own set of LEDs. To accomplish this, I'm assuming that I'm going to have to either write a driver, or create an application that runs when the system starts up, either of which would be used to actually detect the activity, and relay it via serial or usb connection to the arduino board.

I've been a programmer for almost 30 years, and a Windows programmer for almost 20 years. I've never done any development on Unix/Linux/BSD, nor have I done any driver development, but I want to this a shot. What I'm looking for is advice, code, or both regarding the detection of activity on a network interface, as well whether you think I should write a driver or an app.

Any guidance would be greatly appreciated. I will be contributing whatever I come up with back to the pfSense/FreeBSD projects, including the hardware instructions necessary to implement my ideas.
 
DutchDaemon said:

But my question isn't *about* pfSense - it's about developing a piece of software that works in a BSD system. I merely provided the information about pfSense so that everyone would have a complete picture of what I was trying to do. After all, BSD is essentially BSD, regardless of which flavor we're talking about, right?

So, is this the wrong place to ask a question about developing a driver/application for a BSD system?
 
You can run tcpdump on each interface, redirecting its output to a serial port - something like "tcpdump -lp -i em0 > /dev/cuau0" and make Arduino blink the LED on each received line of text.
 
The link I gave says something about 'derivatives' of FreeBSD, which may differ from FreeBSD in fundamental ways; Open/Net/Dragon/Free are all 'essentially BSD', but you'll find some interesting differences when you try to cross-pollinate stuff between them ... That was all the warning was about. What works in FreeBSD will not, by default, work in derivatives of FreeBSD.
 
Back
Top