[erlang-questions] low level packet access from erlang

Garry Hodgson <>
Wed Apr 3 21:48:27 CEST 2013


thanks to all for your suggestions.
i was hoping the answer would be
"just run inet:get_all_the_info_garry_needs( Sock )"
oh well, looks like i have some studying to do.


On 04/03/2013 03:31 PM, Geoff Cant wrote:
> It's a bit of a rewrite I think - you get a port program enet_tap that opens the tap device and then does {packet, 2} to/from erlang for forwarding the frames. It uses libevent, but I haven't worked out how fast/slow it goes. It works on OSX and linux.
>
> enet_tap is the erlang module responsible for opening the port and decoding the 'running' vs {'frame', Data} messages. (The 'running' message lets you know when you can ifconfig the device).
>
> enet_eth_iface is my current crazy attempt at representing an ethernet interface in erlang with pubsub for subscribing to ethernet frame types. You don't need to use it to send/receive frames. It's overly complicated right now imo.
>
> -G
>
> On 2013-04-03, at 11:56 , Matthias Lang <> wrote:
>
>> I have a copy of Luke's TUN/TAP code. I successfully used it many
>> years ago for some experiments, IIRC to study what TCP did on a lossy
>> network. Worked fine for me.
>>
>> Luke's code is a thin layer over TUN/TAP, it's just one C file and one
>> .erl file. It lets you do two things: receive all packets on an
>> ethernet interface and send packets on an ethernet interface. It comes
>> with an example to get you started.
>>
>> After a _quick_ look at Geoff's code, I think it's _functionally_ a
>> superset of Luke's. Geoff's "enet_eth_iface.erl" does pretty much the
>> same thing as Luke's "tuntap.erl". The rest of Geoff's code seems to
>> be more of the IP stack to let you do more complicated decoding, e.g. TCP.
>>
>> Here's Luke's code, it'll be there until next time I clean up:
>>
>>   http://corelatus.se/~matthias/luke_tuntap.tgz
>>
>> Matt
>


-- 
Garry Hodgson
AT&T Chief Security Office (CSO)

"This e-mail and any files transmitted with it are AT&T property, are confidential, and are intended solely for the use of the individual or entity to whom this e-mail is addressed. If you are not one of the named recipient(s) or otherwise have reason to believe that you have received this message in error, please notify the sender and delete this message immediately from your computer. Any other use, retention, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited."




More information about the erlang-questions mailing list