netsnmp 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/netsnmp/message.rb +2 -1
- data/lib/netsnmp/pdu.rb +1 -1
- data/lib/netsnmp/session.rb +3 -3
- data/lib/netsnmp/version.rb +1 -1
- data/spec/handlers/celluloid_spec.rb +1 -1
- data/spec/support/celluloid.rb +11 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5119f7e6ec751a4d3ba54076e5597b0667de904eda86802e5e3544e40a753172
|
4
|
+
data.tar.gz: 35924abe6afc24d8a41c8b6429a0566644d6bf4674b2b83704ac3f215e217487
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7662ff27d3242840034b7e72f0a85132fa7007ef44ab4e207ac79f13cfdc29c3709884b098bba97d83e0f157618a8ca8c4dab5d8919bc6686aba4452b990213f
|
7
|
+
data.tar.gz: 673c3ce56ca0154f5efc6247204ffebbd9d0966d43ba4371ba2cee98d10f1496e579eef84acf24349109315d35febb7c42716a8b88c432200cee3eeddd63cca3
|
data/lib/netsnmp/message.rb
CHANGED
@@ -120,7 +120,8 @@ module NETSNMP
|
|
120
120
|
log { "signing V3 message..." }
|
121
121
|
auth_salt = OpenSSL::ASN1::OctetString.new(signature).with_label(:auth)
|
122
122
|
log(level: 2) { auth_salt.to_hex }
|
123
|
-
|
123
|
+
none_der = AUTHNONE.to_der
|
124
|
+
encoded[encoded.index(none_der), none_der.size] = auth_salt.to_der
|
124
125
|
log { Hexdump.dump(encoded) }
|
125
126
|
end
|
126
127
|
encoded
|
data/lib/netsnmp/pdu.rb
CHANGED
data/lib/netsnmp/session.rb
CHANGED
@@ -75,7 +75,7 @@ module NETSNMP
|
|
75
75
|
|
76
76
|
def initialize(host, port, timeout:)
|
77
77
|
@socket = UDPSocket.new
|
78
|
-
@
|
78
|
+
@destaddr = Socket.sockaddr_in(port, host)
|
79
79
|
@timeout = timeout
|
80
80
|
end
|
81
81
|
|
@@ -90,13 +90,13 @@ module NETSNMP
|
|
90
90
|
|
91
91
|
def write(payload)
|
92
92
|
perform_io do
|
93
|
-
@socket.
|
93
|
+
@socket.sendmsg(payload, Socket::MSG_DONTWAIT | Socket::MSG_NOSIGNAL, @destaddr)
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
97
|
def recv(bytesize = MAXPDUSIZE)
|
98
98
|
perform_io do
|
99
|
-
datagram, = @socket.
|
99
|
+
datagram, = @socket.recvmsg_nonblock(bytesize, Socket::MSG_DONTWAIT)
|
100
100
|
datagram
|
101
101
|
end
|
102
102
|
end
|
data/lib/netsnmp/version.rb
CHANGED
@@ -4,7 +4,7 @@ require "celluloid/io"
|
|
4
4
|
require_relative "../support/request_examples"
|
5
5
|
require_relative "../support/celluloid"
|
6
6
|
|
7
|
-
RSpec.describe "with cellulloid", type: :celluloid
|
7
|
+
RSpec.describe "with cellulloid", type: :celluloid do
|
8
8
|
include CelluloidHelpers
|
9
9
|
let(:user_options) do
|
10
10
|
{ username: "authprivmd5des", auth_password: "maplesyrup",
|
data/spec/support/celluloid.rb
CHANGED
@@ -26,7 +26,7 @@ module CelluloidHelpers
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
class Proxy
|
29
|
+
class Proxy
|
30
30
|
MAXPDUSIZE = 0xffff + 1
|
31
31
|
|
32
32
|
def initialize(host, port)
|
@@ -35,18 +35,22 @@ module CelluloidHelpers
|
|
35
35
|
@timeout = 2
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
39
|
-
@socket.
|
38
|
+
def send(payload)
|
39
|
+
@socket.send(payload, 0)
|
40
|
+
recv
|
40
41
|
end
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
def wait(mode)
|
43
|
+
def recv(bytesize = MAXPDUSIZE)
|
45
44
|
Celluloid.timeout(@timeout) do
|
46
|
-
@socket.
|
45
|
+
datagram, = @socket.recvfrom(bytesize)
|
46
|
+
datagram
|
47
47
|
end
|
48
48
|
rescue Celluloid::TaskTimeout
|
49
49
|
raise Timeout::Error, "Timeout after #{@timeout} seconds"
|
50
50
|
end
|
51
|
+
|
52
|
+
def close
|
53
|
+
@socket.close
|
54
|
+
end
|
51
55
|
end
|
52
56
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netsnmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parslet
|