socsvn commit: r272169 - soc2014/shonali/head/contrib/bsnmp/snmpd

shonali at FreeBSD.org shonali at FreeBSD.org
Sun Aug 10 15:29:12 UTC 2014


Author: shonali
Date: Sun Aug 10 15:29:09 2014
New Revision: 272169
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=272169

Log:
  Added begemotSnmpdPortv6Table to BEGEMOT-SNMPD for IPv6, full compile
  

Modified:
  soc2014/shonali/head/contrib/bsnmp/snmpd/BEGEMOT-SNMPD.txt
  soc2014/shonali/head/contrib/bsnmp/snmpd/config.c
  soc2014/shonali/head/contrib/bsnmp/snmpd/snmpd.config
  soc2014/shonali/head/contrib/bsnmp/snmpd/snmpd.h
  soc2014/shonali/head/contrib/bsnmp/snmpd/trans_udpv6.c
  soc2014/shonali/head/contrib/bsnmp/snmpd/tree.def

Modified: soc2014/shonali/head/contrib/bsnmp/snmpd/BEGEMOT-SNMPD.txt
==============================================================================
--- soc2014/shonali/head/contrib/bsnmp/snmpd/BEGEMOT-SNMPD.txt	Sun Aug 10 14:55:39 2014	(r272168)
+++ soc2014/shonali/head/contrib/bsnmp/snmpd/BEGEMOT-SNMPD.txt	Sun Aug 10 15:29:09 2014	(r272169)
@@ -200,7 +200,7 @@
     ::= { begemotTrapSinkEntry 3 }
 
 --
--- SNMP port table
+-- SNMP port table for IPv4
 --
 begemotSnmpdPortTable OBJECT-TYPE
     SYNTAX	SEQUENCE OF BegemotSnmpdPortEntry
@@ -218,32 +218,23 @@
     DESCRIPTION
 	    "An entry in the table with descriptions of UDP ports to
 	    listen on for SNMP messages."
-    INDEX     { begemotSnmpdPortAddressType, begemotSnmpdPortAddress, begemotSnmpdPortPort }
+    INDEX     { begemotSnmpdPortAddress, begemotSnmpdPortPort }
     ::= { begemotSnmpdPortTable 1 }
 
 BegemotSnmpdPortEntry ::= SEQUENCE {
-    begemotSnmpdPortAddress     InetAddress,
-    begemotSnmpdPortAddressType InetAddressType,
+    begemotSnmpdPortAddress     InetAddressIPv4,
     begemotSnmpdPortPort	INTEGER,
     begemotSnmpdPortStatus	INTEGER
 }
 
 begemotSnmpdPortAddress OBJECT-TYPE
-    SYNTAX      InetAddress 
+    SYNTAX      InetAddressIPv4 
     MAX-ACCESS	not-accessible
     STATUS	current
     DESCRIPTION
-	    "The IP address to bind to."
+	    "The IPv4 address to bind to."
     ::= { begemotSnmpdPortEntry 1 }
 
-begemotSnmpdPortAddressType OBJECT-TYPE
-    SYNTAX      InetAddressType
-    MAX-ACCESS  not-accessible 
-    STATUS      current
-    DESCRIPTION
-	"The address type of the given host."
-    ::= { begemotSnmpdPortEntry 4 }
-
 begemotSnmpdPortPort OBJECT-TYPE
     SYNTAX	INTEGER (1..65535)
     MAX-ACCESS	not-accessible
@@ -579,4 +570,56 @@
 begemotSnmpdTransLsock	OBJECT IDENTIFIER ::= { begemotSnmpdTransportMappings 3 }
 begemotSnmpdTransIpv6Udp    OBJECT IDENTIFIER ::= { begemotSnmpdTransportMappings 4 }
 
+--
+-- SNMP port table for IPv6
+--
+begemotSnmpdPortv6Table OBJECT-TYPE
+    SYNTAX      SEQUENCE OF begemotSnmpdPortv6Entry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "A table with descriptions of UDP ports to listen on
+            for SNMP messages over IPv6."
+    ::= { begemotSnmpdObjects 11 }
+
+begemotSnmpdPortv6Entry OBJECT-TYPE
+    SYNTAX      begemotSnmpdPortv6Entry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "An entry in the table with descriptions of UDP ports to
+            listen on for SNMP messages over IPv6."
+    INDEX      { begemotSnmpdPortv6Address, begemotSnmpdPortv6Port }
+    ::= { begemotSnmpdPortv6Table 1 }
+
+begemotSnmpdPortv6Entry ::= SEQUENCE {
+    begemotSnmpdPortv6Address     InetAddressIPv6,
+    begemotSnmpdPortv6Port        INTEGER,
+    begemotSnmpdPortv6Status      INTEGER
+}
+
+begemotSnmpdPortv6Address OBJECT-TYPE
+    SYNTAX      InetAddressIPv6
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "The IPv6 address to bind to."
+    ::= { begemotSnmpdPortv6Entry 1 }
+
+begemotSnmpdPortv6Port OBJECT-TYPE
+    SYNTAX      INTEGER (1..65535)
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "The UDP port to listen on for SNMP messages over IPv6."
+    ::= { begemotSnmpdPortv6Entry 2 }
+
+begemotSnmpdPortv6Status OBJECT-TYPE
+    SYNTAX      INTEGER { valid(1), invalid(2) }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+            "Set status to 1 to create entry, set it to 2 to delete it."
+    ::= { begemotSnmpdPortv6Entry 3 }
+
 END

Modified: soc2014/shonali/head/contrib/bsnmp/snmpd/config.c
==============================================================================
--- soc2014/shonali/head/contrib/bsnmp/snmpd/config.c	Sun Aug 10 14:55:39 2014	(r272168)
+++ soc2014/shonali/head/contrib/bsnmp/snmpd/config.c	Sun Aug 10 15:29:09 2014	(r272169)
@@ -892,17 +892,17 @@
 			gethost(strval, ip);
 
                         if (addr_type == AF_INET){
-                                if (oid->len + 4 > ASN_MAXOIDLEN)
+                                if (oid->len + SNMP_IPv4_ADDR_SIZ > ASN_MAXOIDLEN)
                                 	report("index too long");
-				for (i = 0; i < 4; i++)
+				for (i = 0; i < SNMP_IPv4_ADDR_SIZ; i++)
 					oid->subs[oid->len++] = ip[i];
 				gettoken();
                         }
 
                         else if (addr_type == AF_INET6){
-                                if (oid->len + 16 > ASN_MAXOIDLEN)
+                                if (oid->len + SNMP_IPv6_ADDR_SIZ > ASN_MAXOIDLEN)
                                 	report("index too long");
-                                for (i = 0; i < 16; i++)
+                                for (i = 0; i < SNMP_IPv6_ADDR_SIZ; i++)
                                         oid->subs[oid->len++] = ip[i];
                                 gettoken();
                         }

Modified: soc2014/shonali/head/contrib/bsnmp/snmpd/snmpd.config
==============================================================================
--- soc2014/shonali/head/contrib/bsnmp/snmpd/snmpd.config	Sun Aug 10 14:55:39 2014	(r272168)
+++ soc2014/shonali/head/contrib/bsnmp/snmpd/snmpd.config	Sun Aug 10 15:29:09 2014	(r272169)
@@ -71,10 +71,10 @@
 begemotSnmpdCommunityDisable	= 1
 
 # open standard SNMP ports
-begemotSnmpdPortStatus.[$(host)].161.1 = 1
-begemotSnmpdPortStatus.127.0.0.1.161.1 = 1
-begemotSnmpdPortStatus.0:0:0:0:0:0:0:0.161.2 = 1
-begemotSnmpdPortStatus.0:0:0:0:0:0:0:1.161.2 = 1
+begemotSnmpdPortStatus.[$(host)].161 = 1
+begemotSnmpdPortStatus.127.0.0.1.161 = 1
+begemotSnmpdPortv6Status.0:0:0:0:0:0:0:0.161 = 1
+begemotSnmpdPortv6Status.0:0:0:0:0:0:0:1.161 = 1
 
 # open a unix domain socket
 begemotSnmpdLocalPortStatus."/var/run/snmpd.sock" = 1

Modified: soc2014/shonali/head/contrib/bsnmp/snmpd/snmpd.h
==============================================================================
--- soc2014/shonali/head/contrib/bsnmp/snmpd/snmpd.h	Sun Aug 10 14:55:39 2014	(r272168)
+++ soc2014/shonali/head/contrib/bsnmp/snmpd/snmpd.h	Sun Aug 10 15:29:09 2014	(r272169)
@@ -180,6 +180,8 @@
  * Transport domain
  */
 #define TRANS_NAMELEN	64
+#define SNMP_IPv4_ADDR_SIZ              4
+#define SNMP_IPv6_ADDR_SIZ              16 
 
 struct transport_def {
 	const char	*name;		/* name of this transport */
@@ -239,10 +241,10 @@
 	int		auth_traps;
 
 	/* source address for V1 traps */
-	u_char		trap1addr[4];
+	u_char		trap1addr[SNMP_IPv4_ADDR_SIZ];
 
         /* ipv6 source address for V1 traps */
-        u_char          trap1addr6[16];
+        u_char          trap1addr6[SNMP_IPv6_ADDR_SIZ];
 
 	/* version enable flags */
 	uint32_t	version_enable;

Modified: soc2014/shonali/head/contrib/bsnmp/snmpd/trans_udpv6.c
==============================================================================
--- soc2014/shonali/head/contrib/bsnmp/snmpd/trans_udpv6.c	Sun Aug 10 14:55:39 2014	(r272168)
+++ soc2014/shonali/head/contrib/bsnmp/snmpd/trans_udpv6.c	Sun Aug 10 15:29:09 2014	(r272169)
@@ -351,7 +351,7 @@
  * Port table
  */
 int
-op_snmp_port(struct snmp_context *ctx, struct snmp_value *value,
+op_snmp_port_v6(struct snmp_context *ctx, struct snmp_value *value,
     u_int sub, u_int iidx, enum snmp_op op)
 {
 	asn_subid_t which = value->var.subs[sub-1];

Modified: soc2014/shonali/head/contrib/bsnmp/snmpd/tree.def
==============================================================================
--- soc2014/shonali/head/contrib/bsnmp/snmpd/tree.def	Sun Aug 10 14:55:39 2014	(r272168)
+++ soc2014/shonali/head/contrib/bsnmp/snmpd/tree.def	Sun Aug 10 15:29:09 2014	(r272169)
@@ -130,11 +130,10 @@
 #	Port table
 #
               (4 begemotSnmpdPortTable
-                (1 begemotSnmpdPortEntry : InetAddressType OCTETSTRING | InetAddress INTEGER op_snmp_port
-                  (1 begemotSnmpdPortAddress OCTETSTRING | InetAddress) 
+                (1 begemotSnmpdPortEntry : OCTETSTRING | InetAddressIPv4 INTEGER op_snmp_port 
+                  (1 begemotSnmpdPortAddress OCTETSTRING | InetAddressIPv4) 
                   (2 begemotSnmpdPortPort UNSIGNED32)
                   (3 begemotSnmpdPortStatus INTEGER GET SET)
-                  (4 begemotSnmpdPortAddressType InetAddressType)
               ))
 #
 #	Community table
@@ -192,6 +191,13 @@
                 (3 begemotSnmpdTransLsock OID op_transport_dummy)
                 (4 begemotSnmpdTransIpv6Udp OID op_transport_dummy)
               )
+
+	      (11 begemotSnmpdPortv6Table
+                (1 begemotSnmpdPortv6Entry : OCTETSTRING | InetAddressIPv6 INTEGER op_snmp_port_v6
+                  (1 begemotSnmpdPortv6Address OCTETSTRING | InetAddressIPv6)
+                  (2 begemotSnmpdPortv6Port UNSIGNED32)
+                  (3 begemotSnmpdPortv6Status INTEGER GET SET)
+                ))
  	    )
             (2 begemotSnmpdDefs
               (1 begemotSnmpdAgent


More information about the svn-soc-all mailing list