Permalink
Commits on Jun 19, 2016
  1. Use os:timestamp/0 for elapsed time

    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:
    
    #12
    
    Thanks @vimal7370!
    committed Jun 19, 2016
Commits on Apr 1, 2016
  1. Update dependencies

    Pin the dependency on the lastest procket to fix a build issue on OS X:
    
    #11
    
    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!
    committed Apr 1, 2016
Commits on Feb 16, 2016
Commits on Feb 15, 2016
  1. Remove the dedup option

    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:
    
        % google.com = 173.194.46.34
        % Should dedup be based on hostname or resolved IP address?
        gen_icmp:ping(["google.com", "173.194.46.34", {173,194,46,34}],
                [dedup])
    
    Name resolution failures make the situation even worse:
    
        % e.g., returns: 1.1.1.1, nxdomain, 1.1.1.2
        % which should be used: one of the successful name resolutions,
        % the resolution failure or all three?
        gen_icmp:ping(["google.com", "google.com", "google.com"], [dedup])
    
    When resolving hostnames, do not sort the response: choose the first out
    of the list.
    committed Feb 15, 2016
Commits on Feb 14, 2016
  1. tests: move to using common test

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

    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:
    
    #10
    
    Since tracert:host/1 does not return an ok/error tuple, continue to crash
    on name resolution failures.
    
    Thanks @tchoutri!
    committed Feb 13, 2016
Commits on Feb 7, 2016
  1. Use monotonic values for calculating elapsed time

    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.
    committed Feb 7, 2016
Commits on Feb 4, 2016
  1. Use os:timestamp/0

    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.
    committed Feb 4, 2016
Commits on Feb 5, 2015
  1. Fix compile failures caused by changes in pkt

    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:
    
    msantos/pkt@41a9907
    
    Reported by @tnt-dev in:
    
    #7
    
    Thanks divolgin/tnt-dev!
    committed Feb 5, 2015
  2. Suppress informational messages from gen_server

    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.
    committed Feb 5, 2015
Commits on Feb 14, 2014
  1. makefile: add dialyzer target

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

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

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

    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.
    committed May 21, 2013
Commits on May 19, 2013
  1. ptun: remove guard

    committed May 19, 2013
  2. ptun: macro cleanup

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

    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.
    committed May 19, 2013
Commits on May 18, 2013
  1. Open ICMP socket in passive mode by default

    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.
    committed May 18, 2013
Commits on May 17, 2013
  1. Correct IPv6 traceroute example

    committed May 17, 2013
  2. Consistenly use milliseconds

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

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

    Conflicts:
    	src/gen_icmp.app.src
    committed May 17, 2013
  5. Retrieve the TTL for IPv6 sockets

    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.
    committed May 17, 2013
  6. Fix ICMP6 error messages

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

    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
    instead).
    committed May 17, 2013
  8. Include TTL from IP header

    For IPv4 packets, include the TTL from the IP header. For IPv6 packets,
    the inet driver does not return the header so the atom 'undefined' is
    returned instead.
    committed May 17, 2013
  9. ping/1,2,3: convert ICMP details into a tuple

    Use a constant arity-3 tuple for the ping attributes (id, sequence
    number and elapsed time). In the case of an ICMP error, not enough of
    the packet header may be returned to calculate the time, so the atom
    'undefined' is returned.
    committed May 17, 2013
  10. Merge branch 'flatten-tuple' into tuple

    Conflicts:
    	README.md
    	test/gen_icmp_tests.erl
    committed May 17, 2013