mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-09-13 02:05:43 +00:00
Some minor SNMPv3 related cleanups
This commit is contained in:
parent
dd4ded3978
commit
e15e504217
@ -55,6 +55,14 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#define SNMP_V3_AUTH_FLAG 0x01
|
||||||
|
#define SNMP_V3_PRIV_FLAG 0x02
|
||||||
|
|
||||||
|
/* Security levels */
|
||||||
|
#define SNMP_V3_NOAUTHNOPRIV 0x00
|
||||||
|
#define SNMP_V3_AUTHNOPRIV SNMP_V3_AUTH_FLAG
|
||||||
|
#define SNMP_V3_AUTHPRIV (SNMP_V3_AUTH_FLAG | SNMP_V3_PRIV_FLAG)
|
||||||
|
|
||||||
/* public (non-static) constants */
|
/* public (non-static) constants */
|
||||||
/** SNMP community string */
|
/** SNMP community string */
|
||||||
const char *snmp_community = SNMP_COMMUNITY;
|
const char *snmp_community = SNMP_COMMUNITY;
|
||||||
@ -306,44 +314,44 @@ snmp_receive(void *handle, struct pbuf *p, const ip_addr_t *source_ip, u16_t por
|
|||||||
switch (request.error_status) {
|
switch (request.error_status) {
|
||||||
case SNMP_ERR_AUTHORIZATIONERROR:
|
case SNMP_ERR_AUTHORIZATIONERROR:
|
||||||
{
|
{
|
||||||
struct snmp_obj_id oid = { 11, { 1, 3, 6, 1, 6, 3, 15, 1, 1, 5, 0 } };
|
static const u32_t oid[] = { 1, 3, 6, 1, 6, 3, 15, 1, 1, 5, 0 };
|
||||||
|
snmp_oid_assign(&vb.oid, oid, LWIP_ARRAYSIZE(oid));
|
||||||
vb.value = &snmp_stats.wrongdigests;
|
vb.value = &snmp_stats.wrongdigests;
|
||||||
MEMCPY(&vb.oid, &oid, sizeof(struct snmp_obj_id));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SNMP_ERR_UNKNOWN_ENGINEID:
|
case SNMP_ERR_UNKNOWN_ENGINEID:
|
||||||
{
|
{
|
||||||
struct snmp_obj_id oid = { 11, { 1, 3, 6, 1, 6, 3, 15, 1, 1, 4, 0 } };
|
static const u32_t oid[] = { 1, 3, 6, 1, 6, 3, 15, 1, 1, 4, 0 };
|
||||||
|
snmp_oid_assign(&vb.oid, oid, LWIP_ARRAYSIZE(oid));
|
||||||
vb.value = &snmp_stats.unknownengineids;
|
vb.value = &snmp_stats.unknownengineids;
|
||||||
MEMCPY(&vb.oid, &oid, sizeof(struct snmp_obj_id));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SNMP_ERR_UNKNOWN_SECURITYNAME:
|
case SNMP_ERR_UNKNOWN_SECURITYNAME:
|
||||||
{
|
{
|
||||||
struct snmp_obj_id oid = { 11, { 1, 3, 6, 1, 6, 3, 15, 1, 1, 3, 0 } };
|
static const u32_t oid[] = { 1, 3, 6, 1, 6, 3, 15, 1, 1, 3, 0 };
|
||||||
|
snmp_oid_assign(&vb.oid, oid, LWIP_ARRAYSIZE(oid));
|
||||||
vb.value = &snmp_stats.unknownusernames;
|
vb.value = &snmp_stats.unknownusernames;
|
||||||
MEMCPY(&vb.oid, &oid, sizeof(struct snmp_obj_id));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SNMP_ERR_UNSUPPORTED_SECLEVEL:
|
case SNMP_ERR_UNSUPPORTED_SECLEVEL:
|
||||||
{
|
{
|
||||||
struct snmp_obj_id oid = { 11, { 1, 3, 6, 1, 6, 3, 15, 1, 1, 1, 0 } };
|
static const u32_t oid[] = { 1, 3, 6, 1, 6, 3, 15, 1, 1, 1, 0 };
|
||||||
|
snmp_oid_assign(&vb.oid, oid, LWIP_ARRAYSIZE(oid));
|
||||||
vb.value = &snmp_stats.unsupportedseclevels;
|
vb.value = &snmp_stats.unsupportedseclevels;
|
||||||
MEMCPY(&vb.oid, &oid, sizeof(struct snmp_obj_id));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SNMP_ERR_NOTINTIMEWINDOW:
|
case SNMP_ERR_NOTINTIMEWINDOW:
|
||||||
{
|
{
|
||||||
struct snmp_obj_id oid = { 11, { 1, 3, 6, 1, 6, 3, 15, 1, 1, 2, 0 } };
|
static const u32_t oid[] = { 1, 3, 6, 1, 6, 3, 15, 1, 1, 2, 0 };
|
||||||
|
snmp_oid_assign(&vb.oid, oid, LWIP_ARRAYSIZE(oid));
|
||||||
vb.value = &snmp_stats.notintimewindows;
|
vb.value = &snmp_stats.notintimewindows;
|
||||||
MEMCPY(&vb.oid, &oid, sizeof(struct snmp_obj_id));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SNMP_ERR_DECRYIPTION_ERROR:
|
case SNMP_ERR_DECRYIPTION_ERROR:
|
||||||
{
|
{
|
||||||
struct snmp_obj_id oid = { 11, { 1, 3, 6, 1, 6, 3, 15, 1, 1, 6, 0 } };
|
static const u32_t oid[] = { 1, 3, 6, 1, 6, 3, 15, 1, 1, 6, 0 };
|
||||||
|
snmp_oid_assign(&vb.oid, oid, LWIP_ARRAYSIZE(oid));
|
||||||
vb.value = &snmp_stats.decryptionerrors;
|
vb.value = &snmp_stats.decryptionerrors;
|
||||||
MEMCPY(&vb.oid, &oid, sizeof(struct snmp_obj_id));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -49,14 +49,6 @@
|
|||||||
#define SNMP_V3_MAX_AUTH_PARAM_LENGTH 12
|
#define SNMP_V3_MAX_AUTH_PARAM_LENGTH 12
|
||||||
#define SNMP_V3_MAX_PRIV_PARAM_LENGTH 8
|
#define SNMP_V3_MAX_PRIV_PARAM_LENGTH 8
|
||||||
|
|
||||||
#define SNMP_V3_AUTH_FLAG 0x01
|
|
||||||
#define SNMP_V3_PRIV_FLAG 0x02
|
|
||||||
|
|
||||||
/* Security levels */
|
|
||||||
#define SNMP_V3_NOAUTHNOPRIV 0x00
|
|
||||||
#define SNMP_V3_AUTHNOPRIV SNMP_V3_AUTH_FLAG
|
|
||||||
#define SNMP_V3_AUTHPRIV (SNMP_V3_AUTH_FLAG | SNMP_V3_PRIV_FLAG)
|
|
||||||
|
|
||||||
#define SNMP_V3_MD5_LEN 16
|
#define SNMP_V3_MD5_LEN 16
|
||||||
#define SNMP_V3_SHA_LEN 20
|
#define SNMP_V3_SHA_LEN 20
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user