[erlang-questions] IP packet manipulation within Erlang

Zoltan Lajos Kis <>
Fri Jan 8 08:48:27 CET 2010


> Martti Kuparinen <> writes:
>
>> Hi,
>>
>> How suitable is Erlang for a small project where I'd like to
>>
>> - grab all incoming IP packets
>> - perform some IP header manipulation
>> - send out the modified packets
>>
>> I'm aware I need some kind of bpf/pcap driver to get the packets into
>> Erlang (or does Erlang now have something in this front).
>>
>> Do you guys have any idea how fast this whole thing would be compared
>> to doing same in normal userland C program? Or even compared to doing
>> the manipulation within Linux kernel.
>>
>> Martti
>
> Hi there, I've been working on a project which sounds like it could be
> suitable for the packet manipulation you want to do. Enet
> (http://github.com/archaelus/enet) is a very early stage network stack
> written in Erlang. The project also includes a port program that
> connects to a TAP device to send and receive raw ethernet frames to and
> from the host operating system.
>
> The tap program I have has only been tested on OS X, but I suspect it
> could work on Linux with small modifications.
>
> Enet can currently handle arp/icmp/ip and some aspects of udp for
> en/decoding.
>
> Cheers,
> --
> Geoff Cant
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>

Do you have any figures on how the TAP device solution compares to others
like PF_RING sockets and MMAP-ing in terms of required CPU power for a
given traffic?

BTW, how "efficient" is Erlang for IP packet defragmentation (RFC815)? I
can't imagine reassembling a packet without some hipe wizardry at least.




More information about the erlang-questions mailing list