Hi,

I have extended the UCD-SNMP agent with a MIB module. The vp->magic appears
to be 1 less than what it should be, which causes the value of object above
it to be returned. Following is Code of the variable structure, definition
of the magic numbers from the header file and in the end i'll describe the
unusual behavior.

struct variable7 sPlc_variables[] = {
{ _infoHardwareVersion,     ASN_OCTET_STR,  RONLY,  var_alpsPlc,    2,
{1,1} },
{ _infoFirmwareVersion,     ASN_OCTET_STR,  RONLY,  var_alpsPlc,    2,
{1,2} },
{ _infoBuildDate,   ASN_OCTET_STR,  RONLY,  var_alpsPlc,    2,      {1,3} },
{ _infoFlashParamsNotSaved, ASN_INTEGER,    RONLY,  var_alpsPlc,    2,
{1,4} },
{ _infoFlashChanged,        ASN_INTEGER,    RONLY,  var_alpsPlc,    2,
{1,5} },
{ _nodeType,        ASN_INTEGER,    RWRITE, var_alpsPlc,    3,      {2,1,1}
},
{ _freqBand,        ASN_INTEGER,    RWRITE, var_alpsPlc,    3,      {2,1,2}
},
{ _customFreqBandIdx,       ASN_INTEGER,    RONLY,
var_alpscustomFreqBandTable,    5,      {2,1,3,1,1} },
{ _customFreqBandCenterFreq,        ASN_INTEGER,    RWRITE,
var_alpscustomFreqBandTable,    5,      {2,1,3,1,2} },
{ _customFreqBandBandwidth, ASN_INTEGER,    RWRITE,
var_alpscustomFreqBandTable,    5,      {2,1,3,1,3} },
{ _customFreqBandRowStatus, ASN_INTEGER,    RWRITE,
var_alpscustomFreqBandTable,    5,      {2,1,3,1,4} },
{ _preferredBandTimeout,    ASN_INTEGER,    RWRITE, var_alpsPlc,    3,
{2,1,4} },
{ _powerMask30,     ASN_INTEGER,    RWRITE, var_alpsPlc,    3,      {2,1,5}
},
{ _powerMaskIARU,   ASN_INTEGER,    RWRITE, var_alpsPlc,    3,      {2,1,6}
},
{ _agcTxEnable,     ASN_INTEGER,    RWRITE, var_alpsPlc,    4,
{2,1,7,1} },
{ _agcRxEnable,     ASN_INTEGER,    RWRITE, var_alpsPlc,    4,
{2,1,7,2} },
{ _agcTxGain,       ASN_INTEGER,    RWRITE, var_alpsPlc,    4,
{2,1,7,3} },
{ _agcRxGain,       ASN_INTEGER,    RWRITE, var_alpsPlc,    4,
{2,1,7,4} },
{ _masterSelectionEnable,   ASN_INTEGER,    RWRITE, var_alpsPlc,    4,
{2,1,8,1} },
{ _masterSelectionCriteria, ASN_INTEGER,    RWRITE, var_alpsPlc,    4,
{2,1,8,2} },
{ _masterSelectionNumOfHops,        ASN_INTEGER,    RWRITE, var_alpsPlc,
4,      {2,1,8,3} },
{ _masterSelectionFixed,    ASN_OCTET_STR,  RWRITE, var_alpsPlc,    4,
{2,1,8,4} },
{ _firmwareUpgradeURL,      ASN_OCTET_STR,  RWRITE, var_alpsPlc,    4,
{2,2,1,1} },
{ _configFileDownloadURL,   ASN_OCTET_STR,  RWRITE, var_alpsPlc,    4,
{2,2,1,2} },
{ _configFileUploadURL,     ASN_OCTET_STR,  RWRITE, var_alpsPlc,    4,
{2,2,1,3} },
{ _saveParamsInFlash,       ASN_INTEGER,    RWRITE, var_alpsPlc,    4,
{2,2,2,1} },
{ _restoreFactoryDefaults,  ASN_INTEGER,    RWRITE, var_alpsPlc,    4,
{2,2,2,2} },
{ _upgradeFirmware, ASN_INTEGER,    RWRITE, var_alpsPlc,    4,
{2,2,2,3} },
{ _upgradeCongFile, ASN_INTEGER,    RWRITE, var_alpsPlc,    4,
{2,2,2,4} },
{ _deviceReboot,    ASN_INTEGER,    RWRITE, var_alpsPlc,    4,
{2,2,2,5} },
{ _vlanEnabled,     ASN_INTEGER,    RWRITE, var_alpsPlc,    3,      {2,3,1}
},
{ _vlanType,        ASN_INTEGER,    RWRITE, var_alpsPlc,    3,      {2,3,2}
},
{ _vlanDataID,      ASN_INTEGER,    RWRITE, var_alpsPlc,    3,      {2,3,3}
},
{ _vlanMgmtID,      ASN_INTEGER,    RWRITE, var_alpsPlc,    3,      {2,3,4}
},
{ _vlanDataPriority,        ASN_INTEGER,    RWRITE, var_alpsPlc,    3,
{2,3,5} },
{ _vlanMgmtPriority,        ASN_INTEGER,    RWRITE, var_alpsPlc,    3,
{2,3,6} },
{ _qosEnabled,      ASN_INTEGER,    RWRITE, var_alpsPlc,    3,      {2,4,1}
},
{ _qosClass,        ASN_INTEGER,    RWRITE, var_alpsPlc,    3,      {2,4,2}
},
{ _qosUplinkLimit,  ASN_INTEGER,    RWRITE, var_alpsPlc,    3,      {2,4,3}
},
{ _qosDownlinkLimit,        ASN_INTEGER,    RWRITE, var_alpsPlc,    3,
{2,4,4} },
{ _aclAdminIdx,     ASN_INTEGER,    RONLY,  var_alpsaclAdminTable,  6,
{2,5,1,1,1,1} },
{ _aclAdminHost,    ASN_OCTET_STR,  RWRITE, var_alpsaclAdminTable,  6,
{2,5,1,1,1,2} },
{ _aclAdminRowStatus,       ASN_INTEGER,    RWRITE, var_alpsaclAdminTable,
6,      {2,5,1,1,1,3} }
};

#define _infoHardwareVersion                                1
#define _infoFirmwareVersion                                2
#define _infoBuildDate                                      3
#define _infoFlashParamsNotSaved                            4
#define _infoFlashChanged                                   5
#define _nodeType                                           6
#define _freqBand                                           7
#define _preferredBandTimeout                               12
#define _powerMask30                                        13
#define _powerMaskIARU                                      14
#define _agcTxEnable                                        15
#define _agcRxEnable                                        16
#define _agcTxGain                                          17
#define _agcRxGain                                          18
#define _masterSelectionEnable                              19
#define _masterSelectionCriteria                            20
#define _masterSelectionNumOfHops                           21
#define _masterSelectionFixed                               22
#define _firmwareUpgradeURL                                 23
#define _configFileDownloadURL                              24
#define _configFileUploadURL                                25
#define _saveParamsInFlash                                  26
#define _restoreFactoryDefaults                             27
#define _upgradeFirmware                                    28
#define _upgradeCongFile                                    29
#define _deviceReboot                                       30
#define _vlanEnabled                                        31
#define _vlanType                                           32
#define _vlanDataID                                         33
#define _vlanMgmtID                                         34
#define _vlanDataPriority                                   35
#define _vlanMgmtPriority                                   36
#define _qosEnabled                                         37
#define _qosClass                                           38
#define _qosUplinkLimit                                     39
#define _qosDownlinkLimit                                   40

#define CONF_customFreqBandIdx                                  1
#define CONF_customFreqBandCenterFreq                           2
#define CONF_customFreqBandBandwidth                            3
#define CONF_customFreqBandRowStatus                            4

#define CONF_aclAdminIdx                                       1
#define CONF_aclAdminHost                                      2
#define CONF_aclAdminRowStatus                                 3

The location where this module is registered within the MIB tree is:  oid
sPlc_variables_oid[] = { 1,3,6,1,4,1,188,11,10 };
If I print the value of vp->magic from the method: search_subtree_vars() in
the File: snmp_vars.c, will return 29 for the Object deviceReboot, whose
actual magic number is 30. Its similar with all the objects above the Object
deviceReboot but it returns correct value for the Objects that are below it.
I also printed the vp->magic from within my variable handling routine but
the behavior is the same. Does anyone has an idea why this is happening?
Thank you for your time!

Shuaib
--
MSc in Communication Systems
I&C Faculty
EPFL
Switzerland
Home page: http://shuaibe.googlepages.com/
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to