hoptracker 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e943633142712cddfbc966d763ce5c39f8bc7e6a7ff19f3684be188607f65c19
4
- data.tar.gz: 7753455c2d0b7da8fc1d4dd779f15a6b66394816700bbbe76ab1856c1c81b653
3
+ metadata.gz: dcab614c297cd2e8d0d256b65b6443fc16dd7e04661b571d1857aad5a1b3f526
4
+ data.tar.gz: 73607ff160dc26977f502965bc2b8ce5a55a610201ef2ee96cbfb4c319924795
5
5
  SHA512:
6
- metadata.gz: 4bdcf2c492bd372a45b34c1b3363704d6d723a248d062565c0cfc912107055523cf5bf80299616a02fe8fe3ca0c2c8d951b48ce15909bee81ebf2ea8dff5d833
7
- data.tar.gz: ba8e1a201c6c9ceaed1f5e9ff592e04b7bd50e3f13cc77dad975f1d51ab081b08d50f5cc9a4e0ffdf583261a297dbe339f7f14a5f4b6e9d62bca6bfde4bc399f
6
+ metadata.gz: ed96cc43e561c069b79bd3fee6b7083ee51ea00e9653d97c2d9f6d0f5df18d68eecf169bc3eb26e8929cb5b761b999e75fdf400f1ca412ebd2804533eaabb30b
7
+ data.tar.gz: faee9e84f34268c8389a899c01c9ed1163fc1d5c402a8f404a21b56a19734edad938a6de66d2d46bd7f2090fd7cd963223b315e3de2fae0af2ebf7d23d9c0f8e
data/bin/hoptracker CHANGED
@@ -4,6 +4,37 @@
4
4
 
5
5
  require 'hoptracker/prober'
6
6
 
7
+ # Remove this when Ruby 3.4 is released
8
+ if ! (defined?(Socket::IPV6_RECVERR) && defined?(Socket::IPV6_MTU_DISCOVER))
9
+ warn 'Your Ruby version seems to be outdated. hoptracker requires a Ruby version that has fixed bug #20258.'
10
+ warn 'Try to use fallback ... this may affect the functionality of hoptracker.'
11
+ class Socket
12
+ IPV6_RECVERR = 25
13
+ IPV6_MTU_DISCOVER = 23
14
+ ResolutionError = SocketError
15
+ end
16
+ end
17
+
18
+ if ! (
19
+ defined?(Socket::IPPROTO_IP) &&
20
+ defined?(Socket::IP_RECVERR) &&
21
+ defined?(Socket::IP_MTU_DISCOVER) &&
22
+ defined?(Socket::IP_RECVTTL)
23
+ )
24
+ warn 'Your Ruby version does not seem to support the required IPv4 functionalities. hoptracker can therefore not be executed.'
25
+ exit 1
26
+ end
27
+
28
+ if ! (
29
+ defined?(Socket::IPPROTO_IPV6) &&
30
+ defined?(Socket::IPV6_RECVERR) &&
31
+ defined?(Socket::IPV6_MTU_DISCOVER) &&
32
+ defined?(Socket::IPV6_RECVHOPLIMIT)
33
+ )
34
+ warn 'Your Ruby version does not seem to support the required IPv6 functionalities. hoptracker can therefore not be executed.'
35
+ exit 1
36
+ end
37
+
7
38
  prober = HopTracker::Prober.new ARGV[0]
8
39
 
9
40
  # Set the MTU to the maximum and the TTL counter to 1
@@ -46,20 +46,9 @@ module HopTracker
46
46
  @socket = @destination.connect
47
47
 
48
48
  # Next, we allow errors to be received, which means that we will later have ICMP error messages. Furthermore, we set the flag for MTU Discover so that packets are not fragmented. We also want to know the TTL of the packet we are receiving.
49
- # Requires patch for IPv6
50
49
  if @destination.ipv6?
51
- # Some constants are currently missing for IPv6. I have created both a bug report [1] and a PR [2] for this.
52
- # [1] https://bugs.ruby-lang.org/issues/20258
53
- # [2] https://github.com/ruby/ruby/pull/9930
54
- if defined?(Socket::IPV6_RECVERR) && defined?(Socket::IPV6_MTU_DISCOVER)
55
- @socket.setsockopt Socket::IPPROTO_IPV6, Socket::IPV6_RECVERR, 1
56
- @socket.setsockopt Socket::IPPROTO_IPV6, Socket::IPV6_MTU_DISCOVER, 3
57
- else
58
- # Since the program should still try to work, we use frequently used numbers as a fallback.
59
- warn "Please use a Ruby version that includes PR#9930 on GitHub or has closed bug #20258. Using fallback numbers... This can lead to errors."
60
- @socket.setsockopt Socket::IPPROTO_IPV6, 25, 1
61
- @socket.setsockopt Socket::IPPROTO_IPV6, 23, 3
62
- end
50
+ @socket.setsockopt Socket::IPPROTO_IPV6, Socket::IPV6_RECVERR, 1
51
+ @socket.setsockopt Socket::IPPROTO_IPV6, Socket::IPV6_MTU_DISCOVER, 3
63
52
  @socket.setsockopt Socket::IPPROTO_IPV6, Socket::IPV6_RECVHOPLIMIT, 1
64
53
  else
65
54
  @socket.setsockopt Socket::IPPROTO_IP, Socket::IP_RECVERR, 1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoptracker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Küthe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-22 00:00:00.000000000 Z
11
+ date: 2024-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack