From owner-svn-soc-all@FreeBSD.ORG Mon Aug 18 04:58:05 2014 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 80E7B3B2 for ; Mon, 18 Aug 2014 04:58:05 +0000 (UTC) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52B82393F for ; Mon, 18 Aug 2014 04:58:05 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7I4w5bm060442 for ; Mon, 18 Aug 2014 04:58:05 GMT (envelope-from shonali@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.9/8.14.9/Submit) id s7I4w46x060439 for svn-soc-all@FreeBSD.org; Mon, 18 Aug 2014 04:58:04 GMT (envelope-from shonali@FreeBSD.org) Date: Mon, 18 Aug 2014 04:58:04 GMT Message-Id: <201408180458.s7I4w46x060439@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to shonali@FreeBSD.org using -f From: shonali@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r272592 - soc2014/shonali/head/contrib/bsnmp/snmpd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Aug 2014 04:58:05 -0000 Author: shonali Date: Mon Aug 18 04:58:04 2014 New Revision: 272592 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=272592 Log: Incorporated constants SNMP_IPv4_ADDR_SIZ & SNMP_IPv6_ADDR_SIZ Modified: soc2014/shonali/head/contrib/bsnmp/snmpd/export.c Modified: soc2014/shonali/head/contrib/bsnmp/snmpd/export.c ============================================================================== --- soc2014/shonali/head/contrib/bsnmp/snmpd/export.c Mon Aug 18 04:50:02 2014 (r272591) +++ soc2014/shonali/head/contrib/bsnmp/snmpd/export.c Mon Aug 18 04:58:04 2014 (r272592) @@ -154,14 +154,14 @@ ip_save(struct snmp_value *value, struct snmp_context *ctx, u_char *valp) { ctx->scratch->int1 = (valp[0] << 24) | (valp[1] << 16) | (valp[2] << 8) - | valp[3]; + | valp[3]; valp[0] = value->v.ipaddress[0]; valp[1] = value->v.ipaddress[1]; valp[2] = value->v.ipaddress[2]; valp[3] = value->v.ipaddress[3]; - return (0); + return (0); } /* @@ -172,10 +172,10 @@ int ip6_save(struct snmp_value *value, struct snmp_context *ctx, u_char *valp) { - if ((ctx->scratch->ptr1 = malloc(sizeof(u_int8_t)*16)) == NULL) + if ((ctx->scratch->ptr1 = malloc(sizeof(u_int8_t)*SNMP_IPv6_ADDR_SIZ)) == NULL) return (SNMP_ERR_RES_UNAVAIL); ctx->scratch->ptr1 = *valp; - for (int i = 0; i < 16; i++) + for (int i = 0; i < SNMP_IPv6_ADDR_SIZ; i++) valp[i] = value->v.ipaddress6[i]; return (0); } @@ -211,7 +211,7 @@ } /* - * Nothing to do for IPv6 commit + * IPv6 commit */ void ip6_commit(struct snmp_context *ctx __unused) @@ -239,7 +239,7 @@ int ip6_get(struct snmp_value *value, u_char *valp) { - for (int i = 0; i < 16; i++) { + for (int i = 0; i < SNMP_IPv6_ADDR_SIZ; i++) { value->v.ipaddress6[i] = valp[i]; } return (SNMP_ERR_NOERROR); @@ -366,7 +366,7 @@ if (sub + SNMP_IPv4_ADDR_SIZ > oid->len) goto err; pval = va_arg(ap, u_int8_t *); - for (i = 0; i < 4; i++) { + for (i = 0; i < SNMP_IPv4_ADDR_SIZ; i++) { if (oid->subs[sub] > 0xff) goto err; pval[i] = oid->subs[sub++]; @@ -380,7 +380,7 @@ if (sub + SNMP_IPv6_ADDR_SIZ > oid->len) goto err; pval = va_arg(ap, u_int8_t *); - for (i = 0; i < 16; i++) { + for (i = 0; i < SNMP_IPv6_ADDR_SIZ; i++) { pval[i] = oid->subs[sub++]; } break;