[erlang-questions] packet sniffing

Michael Santos <>
Wed Feb 3 23:11:51 CET 2010


On Wed, Feb 03, 2010 at 10:32:12PM +0100, Gleb Peregud wrote:
> On Wed, Feb 3, 2010 at 22:19, Angel <> wrote:
> > Hi i came across this page:
> >
> > http://xumingyong.javaeye.com/blog/585229
> >
> > He is using erl_nif
> 
> This solution looks very flawed, since it employs busy waiting on
> capture/0. AFAIK right now there is no way to implement anything
> asynchronous/event-based/callback-based using NIFs, so they are not
> really usable for this purpose. Please correct me if I'm wrong

There's also a buffer overflow in opendevice/1, which is sort of
unsettling since erlang has to run as root for this to work.  But, still,
the idea is cool for playing around with. If a short timeout were used
in pcap_open_live(), an erlang process could call capture/0 to poll the
pcap device.

For completeness, I have another erlang interface for pcap on github:

http://github.com/msantos/epcap

epcap runs as a port.





More information about the erlang-questions mailing list