Date: Mon, 18 Aug 2014 04:58:04 GMT From: shonali@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r272592 - soc2014/shonali/head/contrib/bsnmp/snmpd Message-ID: <201408180458.s7I4w46x060439@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408180458.s7I4w46x060439>