Skip to content

Commit

Permalink
Optimize support for SNMP v3 (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui Liu authored Jul 31, 2024
1 parent 7777b23 commit 4485d98
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion host/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies {
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.16.0-rc1")
implementation("org.snmp4j:snmp4j-agent:3.8.1")
implementation(files("libs/otel-dc-0.9.9.jar"))
implementation(files("libs/simp-snmp-0.1.2.jar"))
implementation(files("libs/simp-snmp-0.1.3.jar"))

testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.1")
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion internal/simp-snmp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "com.instana.dc"
version = "0.1.2"
version = "0.1.3"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public SimpSnmp(String endpoint, SnmpOption option) throws IOException {
protocol = new Snmp(transport);
if (option.getVersion() == SnmpConstants.version3) {
if (option.getSecurityLevel() != SecurityLevel.NOAUTH_NOPRIV) {
SecurityProtocols sp= new SecurityProtocols(SecurityProtocols.SecurityProtocolSet.maxCompatibility);
SecurityProtocols sp = new SecurityProtocols(SecurityProtocols.SecurityProtocolSet.maxCompatibility);
/*sp.addDefaultProtocols();
sp.addAuthenticationProtocol(new AuthSHA());
sp.addAuthenticationProtocol(new AuthMD5());
Expand Down Expand Up @@ -69,21 +69,16 @@ public SimpSnmp(String endpoint, SnmpOption option) throws IOException {
if (option.getVersion() != SnmpConstants.version3) {
myTarget = new CommunityTarget<>();
((CommunityTarget<?>) myTarget).setCommunity(new OctetString(option.getCommunity()));

myTarget.setAddress(GenericAddress.parse(this.endpoint));
myTarget.setRetries(option.getRetries());
myTarget.setTimeout(option.getTimeout());
myTarget.setVersion(option.getVersion());
} else {
myTarget = new UserTarget<>();
myTarget.setSecurityLevel(option.getSecurityLevel());
myTarget.setSecurityName(new OctetString(securityName));

myTarget.setAddress(GenericAddress.parse(this.endpoint));
myTarget.setRetries(option.getRetries());
myTarget.setTimeout(option.getTimeout());
myTarget.setVersion(option.getVersion());
}

myTarget.setAddress(GenericAddress.parse(this.endpoint));
myTarget.setRetries(option.getRetries());
myTarget.setTimeout(option.getTimeout());
myTarget.setVersion(option.getVersion());
}

public SimpSnmp(String endpoint) throws IOException {
Expand Down

0 comments on commit 4485d98

Please sign in to comment.