[Midnightbsd-cvs] src [11021] sync

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Fri Jun 15 18:41:14 EDT 2018


Revision: 11021
          http://svnweb.midnightbsd.org/src/?rev=11021
Author:   laffer1
Date:     2018-06-15 18:41:13 -0400 (Fri, 15 Jun 2018)
Log Message:
-----------
sync

Modified Paths:
--------------
    trunk/usr.sbin/bsnmpd/modules/snmp_bridge/Makefile
    trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_addrs.c
    trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c
    trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_pf.c
    trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c
    trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_snmp.c
    trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c
    trunk/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3

Property Changed:
----------------
    trunk/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3

Modified: trunk/usr.sbin/bsnmpd/modules/snmp_bridge/Makefile
===================================================================
--- trunk/usr.sbin/bsnmpd/modules/snmp_bridge/Makefile	2018-06-15 22:40:09 UTC (rev 11020)
+++ trunk/usr.sbin/bsnmpd/modules/snmp_bridge/Makefile	2018-06-15 22:41:13 UTC (rev 11021)
@@ -1,6 +1,7 @@
-#
 # $MidnightBSD$
 #
+# $FreeBSD: stable/10/usr.sbin/bsnmpd/modules/snmp_bridge/Makefile 164997 2006-12-07 22:36:17Z syrinx $
+#
 
 MOD=	bridge
 SRCS=	bridge_snmp.c bridge_if.c bridge_port.c bridge_addrs.c \

Modified: trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_addrs.c
===================================================================
--- trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_addrs.c	2018-06-15 22:40:09 UTC (rev 11020)
+++ trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_addrs.c	2018-06-15 22:41:13 UTC (rev 11021)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006 Shteryana Shopova <syrinx at FreeBSD.org>
  * All rights reserved.
@@ -26,7 +27,7 @@
  * Bridge MIB implementation for SNMPd.
  * Bridge addresses.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_addrs.c 310903 2016-12-31 10:34:09Z ngie $
  */
 
 #include <sys/queue.h>
@@ -108,7 +109,7 @@
 /*
  * Insert an address entry in the bridge address TAILQ starting to search
  * for its place from the position of the first bridge address for the bridge
- * interface. Update the first bridge address if neccessary.
+ * interface. Update the first bridge address if necessary.
  */
 static void
 bridge_addrs_insert_at(struct tp_entries *headp,
@@ -136,7 +137,7 @@
 }
 
 /*
- * Find an address entry's possition in the address list
+ * Find an address entry's position in the address list
  * according to bridge interface name.
  */
 static struct tp_entry *
@@ -330,7 +331,7 @@
  */
 
 /*
- * Construct the SNMP index from the address DST Mac. 
+ * Construct the SNMP index from the address DST Mac.
  */
 static void
 bridge_addrs_index_append(struct asn_oid *oid, uint sub,
@@ -449,7 +450,7 @@
 
 /*
  * Construct the SNMP index from the bridge interface name
- * and the address DST Mac. 
+ * and the address DST Mac.
  */
 static int
 bridge_addrs_begemot_index_append(struct asn_oid *oid, uint sub,
@@ -477,7 +478,7 @@
 
 /*
  * Find a bridge address entry by the bridge interface name
- * and the address DST Mac. 
+ * and the address DST Mac.
  */
 static struct tp_entry *
 bridge_addrs_begemot_get(const struct asn_oid *oid, uint sub)
@@ -507,7 +508,7 @@
 
 /*
  * Find the next bridge address entry by the bridge interface name
- * and the address DST Mac. 
+ * and the address DST Mac.
  */
 static struct tp_entry *
 bridge_addrs_begemot_getnext(const struct asn_oid *oid, uint sub)

Modified: trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c
===================================================================
--- trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c	2018-06-15 22:40:09 UTC (rev 11020)
+++ trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c	2018-06-15 22:41:13 UTC (rev 11021)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006 Shteryana Shopova <syrinx at FreeBSD.org>
  * All rights reserved.
@@ -26,7 +27,7 @@
  * Bridge MIB implementation for SNMPd.
  * Bridge interface objects.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c 310903 2016-12-31 10:34:09Z ngie $
  */
 
 #include <sys/queue.h>
@@ -378,7 +379,7 @@
  * Return:
  * 1, if successful
  * 0, if the interface was deleted
- * -1, error occured while fetching the info from the kernel.
+ * -1, error occurred while fetching the info from the kernel.
  */
 static int
 bridge_update_bif(struct bridge_if *bif)
@@ -433,7 +434,7 @@
 }
 
 /*
- * Update all bridge interfaces' ports only - 
+ * Update all bridge interfaces' ports only -
  * make sure each bridge interface exists first.
  */
 void

Modified: trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_pf.c
===================================================================
--- trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_pf.c	2018-06-15 22:40:09 UTC (rev 11020)
+++ trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_pf.c	2018-06-15 22:41:13 UTC (rev 11021)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006 Shteryana Shopova <syrinx at FreeBSD.org>
  * All rights reserved.
@@ -26,7 +27,7 @@
  * Bridge MIB implementation for SNMPd.
  * Bridge pfil controls.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_pf.c 165253 2006-12-15 20:01:57Z syrinx $
  */
 
 #include <sys/types.h>

Modified: trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c
===================================================================
--- trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c	2018-06-15 22:40:09 UTC (rev 11020)
+++ trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c	2018-06-15 22:41:13 UTC (rev 11021)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006 Shteryana Shopova <syrinx at FreeBSD.org>
  * All rights reserved.
@@ -26,7 +27,7 @@
  * Bridge MIB implementation for SNMPd.
  * Bridge ports.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c 310903 2016-12-31 10:34:09Z ngie $
  */
 
 #include <sys/queue.h>
@@ -87,7 +88,7 @@
 /*
  * Insert a port entry in the base port TAILQ starting to search
  * for its place from the position of the first bridge port for the bridge
- * interface. Update the first bridge port if neccessary.
+ * interface. Update the first bridge port if necessary.
  */
 static void
 bridge_port_insert_at(struct bridge_ports *headp,
@@ -119,7 +120,7 @@
 }
 
 /*
- * Find a port entry's possition in the ports list according
+ * Find a port entry's position in the ports list according
  * to it's parent bridge interface name. Returns a NULL if
  * we should be at the TAILQ head, otherwise the entry after
  * which we should be inserted.
@@ -626,7 +627,7 @@
 			    return (SNMP_ERR_NOERROR);
 
 			case LEAF_dot1dStpPortAdminPointToPoint:
-			    if (val->v.integer < 0 || val->v.integer > 
+			    if (val->v.integer < 0 || val->v.integer >
 				StpPortAdminPointToPointType_auto)
 				return (SNMP_ERR_WRONG_VALUE);
 
@@ -864,7 +865,7 @@
 		for (i = 0; i < oid->subs[sub]; i++)
 			bif_name[i] = oid->subs[sub + i + 1];
 		bif_name[i] = '\0';
-	
+
 		port_no = oid->subs[sub + i + 1];
 
 		if ((bif = bridge_if_find_ifname(bif_name)) == NULL ||
@@ -937,7 +938,7 @@
 		ctx->scratch->int1 = bp->status;
 		bp->status = RowStatus_active;
 		break;
-		
+
 	    case RowStatus_notInService:
 		if (bp == NULL || bp->span_enable == 0 ||
 		    bp->status == RowStatus_active)

Modified: trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_snmp.c
===================================================================
--- trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_snmp.c	2018-06-15 22:40:09 UTC (rev 11020)
+++ trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_snmp.c	2018-06-15 22:41:13 UTC (rev 11021)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006 Shteryana Shopova <syrinx at FreeBSD.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  *
  * Bridge MIB implementation for SNMPd.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_snmp.c 165253 2006-12-15 20:01:57Z syrinx $
  */
 
 #include <sys/param.h>

Modified: trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c
===================================================================
--- trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c	2018-06-15 22:40:09 UTC (rev 11020)
+++ trunk/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c	2018-06-15 22:41:13 UTC (rev 11021)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006 Shteryana Shopova <syrinx at FreeBSD.org>
  * All rights reserved.
@@ -26,7 +27,7 @@
  * Bridge MIB implementation for SNMPd.
  * Bridge OS specific ioctls.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c 312044 2017-01-13 08:51:46Z ngie $
  */
 
 #include <sys/ioctl.h>
@@ -295,7 +296,7 @@
 
 	/*
 	 * Re-fetching the data from the driver after that might be a good
-	 * idea, since changing our bridge's priority should invoke 
+	 * idea, since changing our bridge's priority should invoke
 	 * recalculation of the active spanning tree topology in the network.
 	 */
 	bif->priority = priority;
@@ -485,7 +486,7 @@
 	struct ifreq ifr;
 
 	bzero(&ifr, sizeof(ifr));
-	strcpy(ifr.ifr_name, b_name);
+	strlcpy(ifr.ifr_name, b_name, sizeof(ifr.ifr_name));
 	if (ioctl(sock, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
 		syslog(LOG_ERR, "set bridge up: ioctl(SIOCGIFFLAGS) "
 		    "failed: %s", strerror(errno));
@@ -516,7 +517,7 @@
 	struct ifreq ifr;
 
 	bzero(&ifr, sizeof(ifr));
-	strcpy(ifr.ifr_name, b_name);
+	strlcpy(ifr.ifr_name, b_name, sizeof(ifr.ifr_name));
 
 	if (ioctl(sock, SIOCIFCREATE, &ifr) < 0) {
 		syslog(LOG_ERR, "create bridge: ioctl(SIOCIFCREATE) "
@@ -549,7 +550,7 @@
 	struct ifreq ifr;
 
 	bzero(&ifr, sizeof(ifr));
-	strcpy(ifr.ifr_name, b_name);
+	strlcpy(ifr.ifr_name, b_name, sizeof(ifr.ifr_name));
 
 	if (ioctl(sock, SIOCIFDESTROY, &ifr) < 0) {
 		syslog(LOG_ERR, "destroy bridge: ioctl(SIOCIFDESTROY) "
@@ -1167,7 +1168,7 @@
 /*
  * Read the initial info for all members of a bridge interface.
  * Returns the number of ports, 0 - if none, otherwise
- * -1 if some other error occured.
+ * -1 if some other error occurred.
  */
 int
 bridge_getinfo_bif_ports(struct bridge_if *bif)
@@ -1319,7 +1320,7 @@
 	struct ifbaconf bac;
 	struct ifdrv ifd;
 
-	*buf = NULL; 
+	*buf = NULL;
 	strlcpy(ifd.ifd_name, bif->bif_name, IFNAMSIZ);
 	ifd.ifd_cmd = BRDGRTS;
 	ifd.ifd_len = sizeof(bac);
@@ -1358,7 +1359,7 @@
 /*
  * Read the initial info for all addresses on a bridge interface.
  * Returns the number of addresses, 0 - if none, otherwise
- * -1 if some other error occured.
+ * -1 if some other error occurred.
  */
 int
 bridge_getinfo_bif_addrs(struct bridge_if *bif)
@@ -1449,8 +1450,8 @@
 int32_t
 bridge_get_pfval(uint8_t which)
 {
-	if (which > sizeof(bridge_pf_sysctl) / sizeof(bridge_pf_sysctl[0])
-	    || which < 1)
+
+	if (which > nitems(bridge_pf_sysctl) || which < 1)
 		return (-1);
 
 	return (bridge_pf_sysctl[which - 1].val);
@@ -1459,9 +1460,9 @@
 int32_t
 bridge_do_pfctl(int32_t bridge_ctl, enum snmp_op op, int32_t *val)
 {
-	char mib_name[100];
+	char *mib_oid;
+	size_t len, s_len;
 	int32_t i, s_i;
-	size_t len, s_len;
 
 	if (bridge_ctl >= LEAF_begemotBridgeLayer2PfStatus)
 		return (-2);
@@ -1472,15 +1473,18 @@
 	} else
 		s_len = 0;
 
-        len = sizeof(i);
+	len = sizeof(i);
 
-	strcpy(mib_name, bridge_sysctl);
+	asprintf(&mib_oid, "%s%s", bridge_sysctl,
+	    bridge_pf_sysctl[bridge_ctl].name);
+	if (mib_oid == NULL)
+		return (-1);
 
-	if (sysctlbyname(strcat(mib_name,
-	    bridge_pf_sysctl[bridge_ctl].name), &i, &len,
-	    (op == SNMP_OP_SET ? &s_i : NULL), s_len) == -1) {
-		syslog(LOG_ERR, "sysctl(%s%s) failed - %s", bridge_sysctl,
-		    bridge_pf_sysctl[bridge_ctl].name, strerror(errno));
+	if (sysctlbyname(mib_oid, &i, &len, (op == SNMP_OP_SET ? &s_i : NULL),
+	    s_len) == -1) {
+		syslog(LOG_ERR, "sysctl(%s) failed - %s", mib_oid,
+		    strerror(errno));
+		free(mib_oid);
 		return (-1);
 	}
 
@@ -1487,6 +1491,8 @@
 	bridge_pf_sysctl[bridge_ctl].val = i;
 	*val = i;
 
+	free(mib_oid);
+
 	return (i);
 }
 
@@ -1495,8 +1501,7 @@
 {
 	uint8_t i;
 
-	for (i = 0; i < sizeof(bridge_pf_sysctl) / sizeof(bridge_pf_sysctl[0]);
-	    i++) {
+	for (i = 0; i < nitems(bridge_pf_sysctl); i++) {
 		syslog(LOG_ERR, "%s%s = %d", bridge_sysctl,
 		    bridge_pf_sysctl[i].name, bridge_pf_sysctl[i].val);
 	}

Modified: trunk/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3
===================================================================
--- trunk/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3	2018-06-15 22:40:09 UTC (rev 11020)
+++ trunk/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3	2018-06-15 22:41:13 UTC (rev 11021)
@@ -1,7 +1,8 @@
+.\" $MidnightBSD$
 .\"-
 .\" Copyright (C) 2006 Shteryana Shopova <syrinx at FreeBSD.org>
 .\" All rights reserved.
-.\" 
+.\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
@@ -10,7 +11,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3 310903 2016-12-31 10:34:09Z ngie $
 .\"
 .Dd August 6, 2007
 .Dt SNMP_BRIDGE 3


Property changes on: trunk/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property


More information about the Midnightbsd-cvs mailing list