Yes, this code is in my container_load procedure and I do understand that I need to define those fields myself. Now, the same problem occurs in the ocStbHostAVInterfaceTable container_load procedure since it mirrors the ifTable implementation in the tutorial.
Now, I attached the "data_access.c" module which has the container_load procedure in it for you to see. I included a description of the problem for you to read at the location in which in occurs. Search for the text "PROBLEM" in the code and you will find it. It is very easy to find. Now, keep in mind I am simply trying to learn SNMP, so the code you are about to see is simply a hardcoded values used to populate this MIB table. My goal is to finally be able to perform a "snmpwalk" through this table and smiply see my hardcoded values. Anyway, let me know what you think..... it is not that hard to figure out at all. Robert Story <[EMAIL PROTECTED]> wrote: On Thu, 17 May 2007 08:26:18 -0700 (PDT) Need wrote: NH> In order to learn how to use NetSNMP I was reading through the MFD ifTable tutorial. Part of the code generated for the "ifTable" table (when using the "mib2c" command with the MFD configuration file) is the following: NH> NH> if ((rowreq_ctx->data.ifDescr == NULL) || NH> (rowreq_ctx->data.ifDescr_len < (ifDescr_len * sizeof(ifDescr[0])))) { NH> snmp_log(LOG_ERR, "not enough space for value\n"); NH> return MFD_ERROR; NH> } NH> rowreq_ctx->data.ifDescr_len = ifDescr_len * sizeof(ifDescr[0]); NH> memcpy(rowreq_ctx->data.ifDescr, ifDescr, ifDescr_len * sizeof(ifDescr[0])); Unfortunately, because of the multitude of options available with the mfd config, simply presenting this code snippet doesn't help. I either need the source files, or the mfd configuration files ('default' directory). Without those, I'm going to guess that this code is in your 'container_load' function. NH> When runnnig this code I get the "not enough space for value" error being produced. The reason why it fails is due to the length check which is being performed (shown below): NH> NH> (rowreq_ctx->data.ifDescr_len < (ifDescr_len * sizeof(ifDescr[0]))) NH> NH> It seems to me that this will always fail since the "rowreq_ctx->data.ifDescr_len" variable does not get populated until "after" the "If" check is performed (see code snipet above). NH> NH> Question: NH> What am I missing? How can this check (which is generated for me automatically using mib2c) actually ever work? Remember, this code is a template, not a finished product. Note that the initial code generated for container_load doesn't even define the variables used in this snipped (ifDescr, ifDescr_len). Anyways, in other places where this code is used, it is prefixed with rowreq_ctx->data.ifDescr_len = sizeof(rowreq_ctx->data.ifDescr); --------------------------------- Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out.
ocStbHostAVInterfaceTable_data_access.c
Description: 1367737609-ocStbHostAVInterfaceTable_data_access.c
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
_______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders