Switch branches/tags
Nothing to show
Commits on Sep 19, 2017
  1. gen_icmp: use monotonic time in microseconds

    msantos committed Sep 19, 2017
    Switch to using monotonic time for calculating the elapsed time in
    versions of erlang that support it. Change the timestamp header from the
    12 byte value used for erlang:now/0 to an 8 byte value representing
    microseconds. Pad the payload with 4 extra bytes.
Commits on Sep 17, 2017
  1. Update deps

    msantos committed Sep 17, 2017
Commits on Sep 16, 2017
  1. rebar: specify ref tuple for deps

    msantos committed Sep 16, 2017
    Fix rebar3 warning:
    ===> WARNING: It is recommended to use {branch, Name}, {tag, Tag} or {ref, Ref}, otherwise updating the dep may not work as expected.
Commits on Jun 19, 2016
  1. Use os:timestamp/0 for elapsed time

    msantos committed Jun 19, 2016
    Commit 5b056e0 replaced the deprecated erlang:now/0 with
    os:timestamp/0. Using the system time is the way most versions of ping
    work. The disadvantage of the system time is that time skew may result
    in a negative number.
    To fix this, commit c424984 used erlang:monotonic_time/1.
    erlang:monotic_time/1 may return negative integers and the code did not
    take into account sign conversions when converting the value from an
    erlang timestamp to binary.
    Revert to using os:timestamp/0 for elapsed time calculations. The other
    option is using signed values in the binary pattern matching. However,
    use of the erlang timestamp() type should probably be replaced with an 8
    or 12 byte integer.
    Reported in:
    Thanks @vimal7370!
Commits on Apr 1, 2016
  1. Update dependencies

    msantos committed Apr 1, 2016
    Pin the dependency on the lastest procket to fix a build issue on OS X:
    Also update to the latest version of pkt.
    Since gen_icmp is still built using rebar2, if procket is pulled in,
    it will also be built using rebar2. The plan is to move gen_icmp to
    rebar3 after pkt has been converted to use rebar3.
    Thanks @kradalby!
Commits on Feb 16, 2016
Commits on Feb 15, 2016
  1. Remove the dedup option

    msantos committed Feb 15, 2016
    Do not minimize the list of hosts passed in to gen_icmp:ping/1,2.
    The 'dedup' option made sense when the host list was constant. Hosts
    could be pulled out of the results using the proplists functions.
    When name resolution is used, the interaction of the host list with the
    dedup option is ambiguous. For example:
        % =
        % Should dedup be based on hostname or resolved IP address?
        gen_icmp:ping(["", "", {173,194,46,34}],
    Name resolution failures make the situation even worse:
        % e.g., returns:, nxdomain,
        % which should be used: one of the successful name resolutions,
        % the resolution failure or all three?
        gen_icmp:ping(["", "", ""], [dedup])
    When resolving hostnames, do not sort the response: choose the first out
    of the list.
Commits on Feb 14, 2016
  1. tests: move to using common test

    msantos committed Feb 14, 2016
Commits on Feb 13, 2016
  1. Return name resolution errors

    msantos committed Feb 13, 2016
    ping/1,2 would fail with a badmatch exception if the host failed to
    resolve. A temporary name resolution error in one of a list of hosts
    would cause the entire operation to abort:
    Since tracert:host/1 does not return an ok/error tuple, continue to crash
    on name resolution failures.
    Thanks @tchoutri!
Commits on Feb 7, 2016
  1. Use monotonic values for calculating elapsed time

    msantos committed Feb 7, 2016
    On newer versions of erlang, support monotonically increasing values for
    calculating the ping response time and fallback to os:timestamp/0.
    For now, continue using time in the erlang timestamp format. A future
    change can embed the microseconds directly as an 8 byte value in the
    ICMP payload.
Commits on Feb 4, 2016
  1. Use os:timestamp/0

    msantos committed Feb 4, 2016
    Switch from using the deprecated erlang:now/0 to os:timestamp/0 as
    suggested by @tchoutri in #9
    The erlang docs recommend using monotonically increasing values for
    calculating elapsed time to avoid problems with time drift. Further work
    should be done to use erlang:monotonic_time/0 where supported, falling
    back to os:timestamp/0 on older erlang versions.
    This behaviour follows "classic" versions of ping which rely on the
    system clock and so may return impossible (negative) values for elapsed
    time. OpenBSD's ping uses monotonically increasing values for the time.
Commits on Feb 5, 2015
  1. Fix compile failures caused by changes in pkt

    msantos committed Feb 5, 2015
    Removing the PF_INET6 macro from pkt broke building tracert.
    Conditionally include a macro that figures out the value of PF_INET6 at
    runtime. A side effect of this change is that tracrt should now work on
    platforms other than Linux.
    The function to determine the value of PF_INET6 (tracert:family/1) should
    be centralized in procket in the future. procket has a similar function
    but it is not exported.
    Pin the dependencies to tags on procket and pkt as suggested by
    @divolgin in:
    Reported by @tnt-dev in:
    Thanks divolgin/tnt-dev!
  2. Suppress informational messages from gen_server

    msantos committed Feb 5, 2015
    At some point, the erlang open_port mechanism for passing in file
    descriptors seems to have changed. When the fd is closed, an exit
    message is generated.
    It also seems that a port is opened for each fd:
        erlang:open_port({fd,1,1}, [binary,stream])
    One of the ports exits immediately.
    Modify the info callback to ignore exit messages.
Commits on Feb 14, 2014
  1. makefile: add dialyzer target

    msantos committed Feb 14, 2014
Commits on Dec 2, 2013
Commits on May 22, 2013
Commits on May 21, 2013
  1. ping: simplify cleanup

    msantos committed May 21, 2013
  2. icmp6: reverse RFC3542 on linux

    msantos committed May 21, 2013
    Linux reverses the filter macros in RFC3542. OpenBSD, FreeBSD and Solaris
    follow the RFC.
    Add option to retrieve the filter setting on the socket.
  3. icmp6: enforce ICMPv6 filters

    msantos committed May 21, 2013
    Allow setting ICMPv6 filters on a socket.
    Filters appear to be working but broken: using icmp6_filter_setpassall/0
    blocks all the packets and setting icmp6_filter_setblockall/0 allows
    all packets.
Commits on May 19, 2013
  1. ptun: remove guard

    msantos committed May 19, 2013
  2. ptun: macro cleanup

    msantos committed May 19, 2013
  3. ptun: fix ping tunnel client/server

    msantos committed May 19, 2013
    The ptun example has been broken since ping/3 was changed to flush all
    the remaining ICMP messages in the mailbox. This resulted in some of the
    packets being lost.
Commits on May 18, 2013
  1. Open ICMP socket in passive mode by default

    msantos committed May 18, 2013
    To prevent mailbox flooding, open the socket in passive mode. ping/3
    will automatically put the socket into active mode when it runs, so no
    change to code calling ping/1,2,3 is required.
Commits on May 17, 2013
  1. Correct IPv6 traceroute example

    msantos committed May 17, 2013
  2. Consistenly use milliseconds

    msantos committed May 17, 2013
    Return the elapsed time in milliseconds, to be consistent with timeout
    option and with ping(8).
  3. Suppress unused variable warning

    msantos committed May 17, 2013
  4. Merge branch 'dev'

    msantos committed May 17, 2013
  5. Retrieve the TTL for IPv6 sockets

    msantos committed May 17, 2013
    Display the IPV6_UNICAST_HOPS setting for the socket. This is not the
    TTL contained in the packet; it is the max ttl for the socket.
  6. Fix ICMP6 error messages

    msantos committed May 17, 2013
  7. Add option to set the socket TTL

    msantos committed May 17, 2013
    Works for IPv4. For IPv6, the IPV6_UNICAST_HOPS is properly set, but the
    ICMP6 time exceeded is dropped by gen_icmp (timeout error is returned