inetmib1: Return SNMP_ERRORSTATUS_NOSUCHNAME for an interface's physical address if it has none.

This commit is contained in:
Juan Lang 2009-12-07 13:18:02 -08:00 committed by Alexandre Julliard
parent 632b759ffe
commit 91d62162da
1 changed files with 18 additions and 1 deletions

View File

@ -553,13 +553,30 @@ static INT setOidWithItemAndInteger(AsnObjectIdentifier *dst,
return ret; return ret;
} }
static DWORD copyIfRowPhysAddr(AsnAny *value, void *src)
{
PMIB_IFROW row = (PMIB_IFROW)((BYTE *)src -
FIELD_OFFSET(MIB_IFROW, dwPhysAddrLen));
DWORD ret;
if (row->dwPhysAddrLen)
{
setStringValue(value, ASN_OCTETSTRING, row->dwPhysAddrLen,
row->bPhysAddr);
ret = SNMP_ERRORSTATUS_NOERROR;
}
else
ret = SNMP_ERRORSTATUS_NOSUCHNAME;
return ret;
}
static struct structToAsnValue mib2IfEntryMap[] = { static struct structToAsnValue mib2IfEntryMap[] = {
{ FIELD_OFFSET(MIB_IFROW, dwIndex), copyInt }, { FIELD_OFFSET(MIB_IFROW, dwIndex), copyInt },
{ FIELD_OFFSET(MIB_IFROW, dwDescrLen), copyLengthPrecededString }, { FIELD_OFFSET(MIB_IFROW, dwDescrLen), copyLengthPrecededString },
{ FIELD_OFFSET(MIB_IFROW, dwType), copyInt }, { FIELD_OFFSET(MIB_IFROW, dwType), copyInt },
{ FIELD_OFFSET(MIB_IFROW, dwMtu), copyInt }, { FIELD_OFFSET(MIB_IFROW, dwMtu), copyInt },
{ FIELD_OFFSET(MIB_IFROW, dwSpeed), copyInt }, { FIELD_OFFSET(MIB_IFROW, dwSpeed), copyInt },
{ FIELD_OFFSET(MIB_IFROW, dwPhysAddrLen), copyLengthPrecededString }, { FIELD_OFFSET(MIB_IFROW, dwPhysAddrLen), copyIfRowPhysAddr },
{ FIELD_OFFSET(MIB_IFROW, dwAdminStatus), copyInt }, { FIELD_OFFSET(MIB_IFROW, dwAdminStatus), copyInt },
{ FIELD_OFFSET(MIB_IFROW, dwOperStatus), copyOperStatus }, { FIELD_OFFSET(MIB_IFROW, dwOperStatus), copyOperStatus },
{ FIELD_OFFSET(MIB_IFROW, dwLastChange), copyInt }, { FIELD_OFFSET(MIB_IFROW, dwLastChange), copyInt },