From ffda7d1b2a2435a6953ad18657812d2a30f5a79e Mon Sep 17 00:00:00 2001 From: Vojtech Vilimek Date: Fri, 26 Jul 2024 12:28:33 +0200 Subject: [PATCH] SNMP: AgentX master agent can have IPv6 addr --- proto/snmp/config.Y | 4 ++-- proto/snmp/snmp.c | 6 +++--- proto/snmp/snmp.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/proto/snmp/config.Y b/proto/snmp/config.Y index e7fe5364..3610bdce 100644 --- a/proto/snmp/config.Y +++ b/proto/snmp/config.Y @@ -45,7 +45,7 @@ snmp_proto_item: if (SNMP_CFG->trans_type != SNMP_TRANS_DEFAULT) cf_error("Duplicit option remote address"); } - | REMOTE ADDRESS IP4 { + | REMOTE ADDRESS ipa { if (SNMP_CFG->trans_type != SNMP_TRANS_DEFAULT) cf_error("Duplicit option remote address"); @@ -105,7 +105,7 @@ snmp_proto_start: proto_start SNMP SNMP_CFG->bonds = 0; SNMP_CFG->local_ip = IP4_NONE; - SNMP_CFG->remote_ip = IP4_NONE; + SNMP_CFG->remote_ip = IPA_NONE; SNMP_CFG->remote_path = agentx_master_addr; SNMP_CFG->trans_type = SNMP_TRANS_DEFAULT; SNMP_CFG->bgp_local_id = IP4_NONE; diff --git a/proto/snmp/snmp.c b/proto/snmp/snmp.c index 900c62d1..889e486d 100644 --- a/proto/snmp/snmp.c +++ b/proto/snmp/snmp.c @@ -235,8 +235,8 @@ snmp_set_state(struct snmp_proto *p, enum snmp_proto_state state) * lock->iface * lock->vrf */ - lock->addr = ipa_from_ip4(cf->remote_ip); - lock->port = cf->remote_port; + lock->addr = p->remote_ip; + lock->port = p->remote_port; lock->type = OBJLOCK_TCP; lock->hook = snmp_start_locked; lock->data = p; @@ -256,7 +256,7 @@ snmp_set_state(struct snmp_proto *p, enum snmp_proto_state state) { s->type = SK_TCP_ACTIVE; s->saddr = ipa_from_ip4(p->local_ip); - s->daddr = ipa_from_ip4(p->remote_ip); + s->daddr = p->remote_ip; s->dport = p->remote_port; s->rbsize = SNMP_RX_BUFFER_SIZE; s->tbsize = SNMP_TX_BUFFER_SIZE; diff --git a/proto/snmp/snmp.h b/proto/snmp/snmp.h index f1fc5e21..23b74d3b 100644 --- a/proto/snmp/snmp.h +++ b/proto/snmp/snmp.h @@ -59,7 +59,7 @@ struct snmp_config { enum snmp_transport_type trans_type; ip4_addr local_ip; u16 local_port; - ip4_addr remote_ip; /* master agentx IP address for TCP transport */ + ip_addr remote_ip; /* master agentx IP address for TCP transport */ u16 remote_port; const char *remote_path; /* master agentx UNIX socket name */ @@ -104,7 +104,7 @@ struct snmp_proto { enum snmp_proto_state state; ip4_addr local_ip; - ip4_addr remote_ip; + ip_addr remote_ip; u16 local_port; u16 remote_port;