Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Sep 2005 11:41:46 GMT
From:      Victor Cruceru <soc-victor@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 83391 for review
Message-ID:  <200509111141.j8BBfkZv031709@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=83391

Change 83391 by soc-victor@soc-victor_82.76.158.176 on 2005/09/11 11:41:43

	BSNMP: Integrate from the latest CVS changes.

Affected files ...

.. //depot/projects/soc2005/bsnmp/lib/libbegemot/Makefile#2 integrate
.. //depot/projects/soc2005/bsnmp/lib/libbsnmp/Makefile.inc#2 integrate
.. //depot/projects/soc2005/bsnmp/usr.sbin/bsnmpd/modules/Makefile.inc#2 integrate
.. //depot/projects/soc2005/bsnmp/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.3#2 integrate
.. //depot/projects/soc2005/bsnmp/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c#2 integrate

Differences ...

==== //depot/projects/soc2005/bsnmp/lib/libbegemot/Makefile#2 (text+ko) ====

@@ -1,11 +1,11 @@
-# $FreeBSD: src/lib/libbegemot/Makefile,v 1.2 2004/11/04 08:25:03 ru Exp $
+# $FreeBSD: src/lib/libbegemot/Makefile,v 1.3 2005/07/22 17:18:59 kensmith Exp $
 
 LIBBEGEMOT_DIR=${.CURDIR}/../../contrib/libbegemot
 
 .PATH: ${LIBBEGEMOT_DIR}
 
 LIB=	begemot
-SHLIB_MAJOR= 1
+SHLIB_MAJOR= 2
 SHLIBDIR?= /lib
 
 # WARNS?=	6

==== //depot/projects/soc2005/bsnmp/lib/libbsnmp/Makefile.inc#2 (text+ko) ====

@@ -1,6 +1,6 @@
-# $FreeBSD: src/lib/libbsnmp/Makefile.inc,v 1.5 2004/10/24 15:32:30 ru Exp $
+# $FreeBSD: src/lib/libbsnmp/Makefile.inc,v 1.6 2005/07/22 17:18:59 kensmith Exp $
 
-SHLIB_MAJOR=	2
+SHLIB_MAJOR=	3
 WARNS?=		6
 NO_WERROR=
 INCSDIR=	${INCLUDEDIR}/bsnmp

==== //depot/projects/soc2005/bsnmp/usr.sbin/bsnmpd/modules/Makefile.inc#2 (text+ko) ====

@@ -1,6 +1,6 @@
-# $FreeBSD: src/usr.sbin/bsnmpd/modules/Makefile.inc,v 1.9 2005/05/23 11:22:54 harti Exp $
+# $FreeBSD: src/usr.sbin/bsnmpd/modules/Makefile.inc,v 1.10 2005/07/22 17:18:57 kensmith Exp $
 
-SHLIB_MAJOR=	3
+SHLIB_MAJOR=	4
 WARNS?=		6
 INCSDIR=	${INCLUDEDIR}/bsnmp
 

==== //depot/projects/soc2005/bsnmp/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.3#2 (text+ko) ====

@@ -27,7 +27,7 @@
 .\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.3,v 1.8 2005/02/13 23:23:30 ru Exp $
+.\" $FreeBSD: src/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.3,v 1.9 2005/07/31 03:30:47 keramida Exp $
 .\"
 .Dd November 14, 2003
 .Dt snmp_netgraph 3
@@ -170,7 +170,7 @@
 .It Fa cookie
 is the node specific command cookie,
 .It Fa opcode
-is the node specific code for the operation to performa,
+is the node specific code for the operation to perform,
 .It Fa arg
 is a pointer to the message itself.
 This message must start with a
@@ -208,7 +208,7 @@
 All three functions take the same arguments as the
 .Fn ng_output*
 functions.
-The functions return the reponse message in a buffer allocated by
+The functions return the response message in a buffer allocated by
 .Xr malloc 3
 or NULL in case of an error.
 The maximum size of the response buffer can be
@@ -223,14 +223,14 @@
 the size of the message.
 It returns -1 if an error happens.
 .Ss ASYNCHRONOUS CONTROL AND DATA MESSAGES
-A module can register functions to asynchronuosly receive control and data
+A module can register functions to asynchronously receive control and data
 message.
 .Pp
 The function
 .Fn ng_register_cookie
 registers a control message receive function.
 If a control message is
-received, that is not consumed by the dialog functions, the list of registerred
+received, that is not consumed by the dialog functions, the list of registered
 control message receive functions is scanned.
 If the cookie in the received
 message is the same as the
@@ -256,7 +256,7 @@
 A control message registration can be undone by calling
 .Fn ng_unregister_cookie
 with the return value of the registration call.
-If an error occures while registering,
+If an error occurs while registering,
 .Fn ng_register_cookie
 returns NULL.
 .Pp
@@ -275,7 +275,7 @@
 A data message registration can be undone by calling
 .Fn ng_unregister_hook
 with the return value of the registration call.
-If an error occures while registering,
+If an error occurs while registering,
 .Fn ng_register_hook
 returns NULL.
 .Pp
@@ -348,7 +348,7 @@
 .Fa type .
 The function skips intermediate tee nodes (see
 .Xr ng_tee 4 ) .
-It returns the node id of the peer node or 0 if an error occurres or the
+It returns the node id of the peer node or 0 if an error occurs or the
 types do not match.
 .Ss CHANGING THE GRAPH
 A number of functions can be used to create or destroy nodes and hooks.

==== //depot/projects/soc2005/bsnmp/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c,v 1.5 2005/05/23 11:41:14 philip Exp $
+ * $FreeBSD: src/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c,v 1.6 2005/08/29 10:08:04 philip Exp $
  */
 
 #include <bsnmp/snmpmod.h>
@@ -899,7 +899,7 @@
 pfi_refresh(void)
 {
 	struct pfioc_iface io;
-	struct pfi_if *p;
+	struct pfi_if *p = NULL;
 	struct pfi_entry *e;
 	int i, numifs = 1;
 
@@ -913,19 +913,23 @@
 	}
 
 	bzero(&io, sizeof(io));
-	p = malloc(sizeof(struct pfi_if));
 	io.pfiio_flags = PFI_FLAG_INSTANCE;
 	io.pfiio_esize = sizeof(struct pfi_if);
 
 	for (;;) {
-		p = realloc(p, numifs * sizeof(struct pfi_if));
+		p = reallocf(p, numifs * sizeof(struct pfi_if));
+		if (p == NULL) {
+			syslog(LOG_ERR, "pfi_refresh(): reallocf() numifs=%d: %s",
+			    numifs, strerror(errno));
+			goto err2;
+		}
 		io.pfiio_size = numifs;
 		io.pfiio_buffer = p;
 
 		if (ioctl(dev, DIOCIGETIFACES, &io)) {
 			syslog(LOG_ERR, "pfi_refresh(): ioctl(): %s",
 			    strerror(errno));
-			return (-1);
+			goto err2;
 		}
 
 		if (numifs >= io.pfiio_size)
@@ -936,6 +940,8 @@
 
 	for (i = 0; i < numifs; i++) {
 		e = malloc(sizeof(struct pfi_entry));
+		if (e == NULL)
+			goto err1;
 		e->index = i + 1;
 		memcpy(&e->pfi, p+i, sizeof(struct pfi_if));
 		TAILQ_INSERT_TAIL(&pfi_table, e, link);
@@ -947,6 +953,16 @@
 
 	free(p);
 	return (0);
+
+err1:
+	while (!TAILQ_EMPTY(&pfi_table)) {
+		e = TAILQ_FIRST(&pfi_table);
+		TAILQ_REMOVE(&pfi_table, e, link);
+		free(e);
+	}
+err2:
+	free(p);
+	return(-1);
 }
 
 static int
@@ -978,6 +994,12 @@
 
 	for (i = 0; i < numqs; i++) {
 		e = malloc(sizeof(struct pfq_entry));
+		if (e == NULL) {
+			syslog(LOG_ERR, "pfq_refresh(): "
+			    "malloc(): %s",
+			    strerror(errno));
+			goto err;
+		}
 		pa.ticket = ticket;
 		pa.nr = i;
 
@@ -985,7 +1007,7 @@
 			syslog(LOG_ERR, "pfq_refresh(): "
 			    "ioctl(DIOCGETALTQ): %s",
 			    strerror(errno));
-			return (-1);
+			goto err;
 		}
 
 		if (pa.altq.qid > 0) {
@@ -1000,6 +1022,14 @@
 	pf_tick = this_tick;
 
 	return (0);
+err:
+	free(e);
+	while (!TAILQ_EMPTY(&pfq_table)) {
+		e = TAILQ_FIRST(&pfq_table);
+		TAILQ_REMOVE(&pfq_table, e, link);
+		free(e);
+	}
+	return(-1);
 }
 
 static int
@@ -1024,7 +1054,7 @@
 pft_refresh(void)
 {
 	struct pfioc_table io;
-	struct pfr_tstats *t;
+	struct pfr_tstats *t = NULL;
 	struct pft_entry *e;
 	int i, numtbls = 1;
 
@@ -1038,18 +1068,22 @@
 	}
 
 	bzero(&io, sizeof(io));
-	t = malloc(sizeof(struct pfr_tstats));
 	io.pfrio_esize = sizeof(struct pfr_tstats);
 
 	for (;;) {
-		t = realloc(t, numtbls * sizeof(struct pfr_tstats));
+		t = reallocf(t, numtbls * sizeof(struct pfr_tstats));
+		if (t == NULL) {
+			syslog(LOG_ERR, "pft_refresh(): reallocf() numtbls=%d: %s",
+			    numtbls, strerror(errno));
+			goto err2;
+		}
 		io.pfrio_size = numtbls;
 		io.pfrio_buffer = t;
 
 		if (ioctl(dev, DIOCRGETTSTATS, &io)) {
 			syslog(LOG_ERR, "pft_refresh(): ioctl(): %s",
 			    strerror(errno));
-			return (-1);
+			goto err2;
 		}
 
 		if (numtbls >= io.pfrio_size)
@@ -1060,6 +1094,8 @@
 
 	for (i = 0; i < numtbls; i++) {
 		e = malloc(sizeof(struct pfr_tstats));
+		if (e == NULL)
+			goto err1;
 		e->index = i + 1;
 		memcpy(&e->pft, t+i, sizeof(struct pfr_tstats));
 		TAILQ_INSERT_TAIL(&pft_table, e, link);
@@ -1071,6 +1107,15 @@
 
 	free(t);
 	return (0);
+err1:
+	while (!TAILQ_EMPTY(&pft_table)) {
+		e = TAILQ_FIRST(&pft_table);
+		TAILQ_REMOVE(&pft_table, e, link);
+		free(e);
+	}
+err2:
+	free(t);
+	return(-1);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200509111141.j8BBfkZv031709>