Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Mar 11, 2012
Commits on Dec 5, 2011
  1. Align structure used for LSF on a word

    The Linux Socket Filter uses a struct sock_fprog composed of a 2 byte
    length followed by a pointer. Pad the length field to a word.
    Thanks to Stuart Berman for the bug report!
Commits on Aug 24, 2011
  1. Correct value for IPPROTO_RAW

Commits on Jun 27, 2011
  1. packet: add bind/2

    Binding a PF_PACKET socket to an interface will return packets only for
    that device (rather than all interfaces on the host).
Commits on May 15, 2011
Commits on May 13, 2011
  1. Simplify pad calculation

Commits on Apr 29, 2011
  1. packet: remove filter program limit

    Instead of throwing an exception when the max program instruction length
    has been reached, return setsockopt's errno value (out of memory).
Commits on Apr 28, 2011
Commits on Apr 27, 2011
  1. packet: pasto in endian conversion

    2 byte family field was inadvervently made into a 4 byte field and
    byte swapped.
Commits on Apr 17, 2011
  1. Initial support for BPF on BSDs

    Add support for sending and receiving raw frames on BSD systems.
    Only tested on Mac OS X. The bpf module calls the C interface with
    the appropriate parameters.
Commits on Feb 20, 2011
  1. Call SO_BINDTODEVICE from Erlang

    Only available in the Linux-specific PF_PACKET module.  Requires beam
    to have CAP_NET_RAW privs.
Commits on Dec 15, 2010
  1. Communicate with Unix sockets

    Break out socket primitives (socket, listen, accept, ...) to allow Erlang
    to create and access Unix sockets. Any type of unprivileged socket can
    be created without spawning the setuid helper.
    Warning: because listen/2 is now a wrapper around the listen(2), the
    procket:listen/1,2 has been renamed to procket:open/1,2.
Commits on Nov 5, 2010
  1. Explicitly call list_to_integer/2

    Older versions of Erlang didn't automatically import list_to_integer/2
Commits on Oct 23, 2010
  1. Lookup default route and default interface

    Add support for finding the gateway on Linux using /proc. Since the
    default gateway is known, retrieve the default interface as well.
    Clean up the arp lookups and add some comments.
Commits on Sep 25, 2010
  1. Use inet module to get list of interfaces

    Use inet:getiflist/0 instead of parsing the Linux /proc/net/dev.
Commits on Jul 1, 2010
Commits on Jun 27, 2010
Commits on Jun 26, 2010
  1. Retrieve a list of interfaces on Linux

    Retrieve a list of interfaces by parsing the output of /proc/net/dev.
    The device list can also be retrieved by using ioctl(SIOCGIFCONF), but
    this requires passing in a struct with a pointer to a buffer. Possibly
    there could be an NIF allocator that returns the integer pointing to
    the memory and a corresponding free().
  2. Find interface MAC address and ARP cache lookup

    Add functions to return the MAC address of a device or lookup an IP
    address in the ARP cache. Since I couldn't get the ioctl(SIOCGARP)
    version to work, packet simply parses the output of /proc/net/arp.
    packet:arplookup(Socket, Device, IP) is sort of hacky; it throws away
    the first 2 arguments. I left them in since they'll probably be needed
    for the BSD version.
Commits on Jun 25, 2010
  1. Retrieve a device's IP address

    Add ipv4address/2, a function to return the device's IPv4 address:
    {192,168,1,100} = packet:ipv4address(Socket, "eth0").
Commits on Jun 24, 2010
  1. Add an NIF setsockopt for promiscous mode

    Add an interface to setsockopt(). procket:setsockopt/4 can be used for
    putting the interface into promiscous mode.  Add packet:promiscuous/2
    convenience function to do that:
    packet:promiscuous(Socket, Ifindex)
Commits on Jun 20, 2010
  1. Add functions for sending raw packets

    Add some functions for sending out packets using the PF_PACKET socket
Something went wrong with that request. Please try again.