Re: Problem using IP_RECVDSTADDR on HPUX.
Den 19-11-2013 11:03, Jean-Paul VILLETTE skrev: The tarballs don't seem to be online. Problems ? Sorry 'bout that :-( A filesystem had filled up, but they should be back now /Niels -- Niels Baggesen - @home - Århus - Denmark - n...@users.sourceforge.net The purpose of computing is insight, not numbers --- R W Hamming -- Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311iu=/4140/ostg.clktrk ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
Re: Show SNMPv3 users
I second this request. I am trying to configure V3 users and its a real pain. Perhaps this type of function would be nice. On Thu, Nov 21, 2013 at 1:32 AM, sarath azad saraths...@yahoo.co.in wrote: Hello, Could you please tell, in a program, what is the best method to show all the SNMPv3 users configured? Is it a good, to write a function to read the snmpd.conf file to show all the configured SNMPv3 users? Or is there any other API to get the list of SNMPv3 users configured? Thanks and regards S Sarath -- Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311iu=/4140/ostg.clktrk ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders -- Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311iu=/4140/ostg.clktrk ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
Re: net-snmp fails to create entries with a zero in the OID in SnmpTargetParamsEntry
On 10/16/13 10:31, zhuyj wrote: If this patch is used in net-snmp-5.7.2, the following should be used, too. If not, snmp-trap could not work well. Hello Zhu, Please make yourself familiar with git and start from the V5-7-patches or master branch when preparing patches. The patch that was attached to your e-mail doesn't apply on the V5-7-branch: $ git checkout V5-7-patches Switched to branch 'V5-7-patches' Your branch is behind 'origin/V5-7-patches' by 2 commits, and can be fast-forwarded. (use git pull to update your local branch) $ git rebase origin/V5-7-patches First, rewinding head to replay your work on top of it... Fast-forwarded V5-7-patches to origin/V5-7-patches. $ git apply -p1 ~/net-snmp-5.7.2-fix-param-length.patch error: patch failed: agent/mibgroup/notification/snmpNotifyTable.c:338 error: agent/mibgroup/notification/snmpNotifyTable.c: patch does not apply Bart. -- Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311iu=/4140/ostg.clktrk ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
Re: net-snmp fails to create entries with a zero in the OID in SnmpTargetParamsEntry
On 11/18/2013 07:08 PM, Bart Van Assche wrote: On 11/18/13 11:48, zhuyj wrote: On 09/10/2013 01:41 PM, Bart Van Assche wrote: On 09/10/13 04:04, zhuyj wrote: Please help me to merge this patch into trunk. Thanks a lot. Hello Zhu, The code in snmpd_parse_config_targetAddr() and store_snmpTargetAddrEntry() assumes that targetAddTable_struct.params is an ASCII string that does *not* contain an ASCII '\0' nor any ASCII control characters nor any whitespace. I'm afraid that your patch would break the code for saving and restoring the target address. If I fixed these problems with snmpd_parse_config_targetAddr() and store_snmpTargetAddrEntry(). Would you like to merge these patches into the trunk? Sorry but I can't promise anything if I haven't seen the patch first. Bart. Hi, Bart I made a patch based on net-snmp-5.7.2. Maybe it can fix the problem that you mentioned. Would you like to comment on this patch? This patch and the above 3 patches can support snmpTarget mib well. Now the patch is in the attachment. Please check it. If you have any advice , please let me know. I will follow your advice to make this series patches better. In the end, please merge this series patches to trunk to support zero OID in snmpTarget mib. Thanks a lot. Zhu Yanjun diff -urpN ./5.7.2/net-snmp-5.7.2/agent/mibgroup/target/snmpTargetAddrEntry.c ./net-snmp-5.7.2/agent/mibgroup/target/snmpTargetAddrEntry.c --- ./5.7.2/net-snmp-5.7.2/agent/mibgroup/target/snmpTargetAddrEntry.c +++ ./net-snmp-5.7.2/agent/mibgroup/target/snmpTargetAddrEntry.c @@ -612,17 +612,33 @@ snmpTargetAddr_addRowStatus(struct targe void snmpd_parse_config_targetAddr(const char *token, char *char_ptr) { -char *cptr = char_ptr, buff[1024]; +char *cptr = char_ptr, buff[1024], tmp[1024], temp[1024]; struct targetAddrTable_struct *newEntry; int i, j, buff_len; +size_t bufl; newEntry = snmpTargetAddrTable_create(); +cptr = skip_white_const(cptr); +if (cptr == NULL) { +DEBUGMSGTL((snmpTargetAddrEntry, +ERROR snmpTargetAddrEntry: no name in config string\n)); +snmpTargetAddrTable_dispose(newEntry); +return; +} -cptr = copy_nword(cptr, buff, sizeof(buff)); -if (snmpTargetAddr_addName(newEntry, buff) == 0) { +bufl = 0; +cptr = read_config_read_octet_string_const(cptr, + (u_char**)newEntry-nameData, + bufl); +if (bufl 1 || bufl 32) { +DEBUGMSGTL((snmpTargetAddrEntry, +ERROR snmpTargetAddrEntry: name out of range in config +string\n)); snmpTargetAddrTable_dispose(newEntry); return; } +newEntry-nameLen = bufl; + cptr = copy_nword(cptr, buff, sizeof(buff)); if (snmpTargetAddr_addTDomain(newEntry, buff) == 0) { snmpTargetAddrTable_dispose(newEntry); @@ -653,11 +669,18 @@ snmpd_parse_config_targetAddr(const char snmpTargetAddrTable_dispose(newEntry); return; } -cptr = copy_nword(cptr, buff, sizeof(buff)); -if (snmpTargetAddr_addParams(newEntry, buff) == 0) { +cptr = +read_config_read_octet_string_const(cptr, + (u_char **) newEntry-params, + bufl); +if (bufl 1 || bufl 32) { +DEBUGMSGTL((snmpTargetAddrEntry, +ERROR snmpTargetAddrEntry: params out of range in config string\n)); snmpTargetAddrTable_dispose(newEntry); return; } +newEntry-paramsLen = bufl; + cptr = copy_nword(cptr, buff, sizeof(buff)); if (snmpTargetAddr_addStorageType(newEntry, buff) == 0) { snmpTargetAddrTable_dispose(newEntry); @@ -668,8 +691,8 @@ snmpd_parse_config_targetAddr(const char snmpTargetAddrTable_dispose(newEntry); return; } -//snprintf(buff, sizeof(buff), snmp_parse_config_targetAddr, read: %s\n, -//newEntry-nameData); +snprintf(buff, sizeof(buff), snmp_parse_config_targetAddr, read: %s\n, +newEntry-nameData); memset(buff, 0, sizeof(buff)); snprintf(buff, sizeof(buff), snmp_parse_config_targetAddr, read: ); buff_len = strlen(buff); @@ -681,18 +704,19 @@ snmpd_parse_config_targetAddr(const char buff[ sizeof(buff)-1 ] = 0; for (i = 0; i newEntry-tDomainLen; i++) { -//snprintf(buff[strlen(buff)], sizeof(buff)-strlen(buff)-1, -// .%d, (int) newEntry-tDomain[i]); -char tmp[1024]={0}; -snprintf(tmp, sizeof(tmp), .%d, (int) newEntry-tDomain[i]); -strncpy(buff[buff_len], tmp, strlen(tmp)); -buff_len += strlen(tmp); +snprintf(buff[strlen(buff)], sizeof(buff)-strlen(buff)-1, + .%d, (int) newEntry-tDomain[i]); buff[ sizeof(buff)-1 ] = 0; } + +memset(tmp, 0, sizeof(tmp)); +
Re: Show SNMPv3 users
Hi Giuseppe, Thanks for the reply. For getting the user details from a remote system, we may do SNMPWALK on this OID. But if on the same device where snmp agent is running (where we are doing the SNMPv3 configuration), if we want to get the user details, do we need to do snmpwalk on localhost for this OID or is there any other method also. Currently I am doing the SNMPv3 configuration using snmpd.conf file and so thinking to implement the show user details functions by reading the snmpd.conf file. But is it the correct method which will work in all cases, or is there any other better methods. thanks and regards S Sarath On Thursday, November 21, 2013 3:08 PM, giuseppe de vito giusepp...@gmail.com wrote: Hello, SNMPv3 users are stored in the usmUserTable (OID=.1.3.6.1.6.3.15.1.2.2). This table has the following entries usmUserTable +usmUserEntry(1) +-usmUserEngineID(1) +-usmUserName (2) +-usmUserSecurityName (3) +- . (see http://www.net-snmp.org/wiki/index.php/TUT:SNMPv3_Options for details You are looking for the usmUserSecurityName and, for a complete list of such items, you can walk the usmUserTable over the same field; for example you can execute snmpwalk .1.3.6.1.6.3.15.1.2.2.1.3 to obtain all configured users in the usmUserTable. I hope this will help. 2013/11/21 sarath azad saraths...@yahoo.co.in Hello, Could you please tell, in a program, what is the best method to show all the SNMPv3 users configured? Is it a good, to write a function to read the snmpd.conf file to show all the configured SNMPv3 users? Or is there any other API to get the list of SNMPv3 users configured? Thanks and regards S Sarath -- Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311iu=/4140/ostg.clktrk ___ Net-snmp-users mailing list net-snmp-us...@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users -- Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311iu=/4140/ostg.clktrk___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
Re: net-snmp fails to create entries with a zero in the OID in SnmpTargetParamsEntry
On 11/21/2013 10:41 PM, zhuyj wrote: On 11/18/2013 07:08 PM, Bart Van Assche wrote: On 11/18/13 11:48, zhuyj wrote: On 09/10/2013 01:41 PM, Bart Van Assche wrote: On 09/10/13 04:04, zhuyj wrote: Please help me to merge this patch into trunk. Thanks a lot. Hello Zhu, The code in snmpd_parse_config_targetAddr() and store_snmpTargetAddrEntry() assumes that targetAddTable_struct.params is an ASCII string that does *not* contain an ASCII '\0' nor any ASCII control characters nor any whitespace. I'm afraid that your patch would break the code for saving and restoring the target address. If I fixed these problems with snmpd_parse_config_targetAddr() and store_snmpTargetAddrEntry(). Would you like to merge these patches into the trunk? Sorry but I can't promise anything if I haven't seen the patch first. Bart. Hi, Bart I made a patch based on net-snmp-5.7.2. Maybe it can fix the problem that you mentioned. Would you like to comment on this patch? This patch and the above 3 patches can support snmpTarget mib well. Now the patch is in the attachment. Please check it. If you have any advice , please let me know. I will follow your advice to make this series patches better. In the end, please merge this series patches to trunk to support zero OID in snmpTarget mib. Thanks a lot. Zhu Yanjun Hi, Bart There is something wrong in the last patch. Now I made a new patch. Please comment on this patch. Thanks a lot. Zhu Yanjun diff -urpN ./5.7.2/net-snmp-5.7.2/agent/mibgroup/target/snmpTargetAddrEntry.c ./net-snmp-5.7.2/agent/mibgroup/target/snmpTargetAddrEntry.c --- ./5.7.2/net-snmp-5.7.2/agent/mibgroup/target/snmpTargetAddrEntry.c 2013-11-21 18:47:43.031554976 +0800 +++ ./net-snmp-5.7.2/agent/mibgroup/target/snmpTargetAddrEntry.c 2013-11-21 22:52:56.540101065 +0800 @@ -612,17 +612,33 @@ snmpTargetAddr_addRowStatus(struct targe void snmpd_parse_config_targetAddr(const char *token, char *char_ptr) { -char *cptr = char_ptr, buff[1024]; +char *cptr = char_ptr, buff[1024], tmp[1024], temp[1024]; struct targetAddrTable_struct *newEntry; int i, j, buff_len; +size_t bufl; newEntry = snmpTargetAddrTable_create(); +cptr = skip_white_const(cptr); +if (cptr == NULL) { +DEBUGMSGTL((snmpTargetAddrEntry, +ERROR snmpTargetAddrEntry: no name in config string\n)); +snmpTargetAddrTable_dispose(newEntry); +return; +} -cptr = copy_nword(cptr, buff, sizeof(buff)); -if (snmpTargetAddr_addName(newEntry, buff) == 0) { +bufl = 0; +cptr = read_config_read_octet_string_const(cptr, + (u_char**)newEntry-nameData, + bufl); +if (bufl 1 || bufl 32) { +DEBUGMSGTL((snmpTargetAddrEntry, +ERROR snmpTargetAddrEntry: name out of range in config +string\n)); snmpTargetAddrTable_dispose(newEntry); return; } +newEntry-nameLen = bufl; + cptr = copy_nword(cptr, buff, sizeof(buff)); if (snmpTargetAddr_addTDomain(newEntry, buff) == 0) { snmpTargetAddrTable_dispose(newEntry); @@ -653,11 +669,18 @@ snmpd_parse_config_targetAddr(const char snmpTargetAddrTable_dispose(newEntry); return; } -cptr = copy_nword(cptr, buff, sizeof(buff)); -if (snmpTargetAddr_addParams(newEntry, buff) == 0) { +cptr = +read_config_read_octet_string_const(cptr, + (u_char **) newEntry-params, + bufl); +if (bufl 1 || bufl 32) { +DEBUGMSGTL((snmpTargetAddrEntry, +ERROR snmpTargetAddrEntry: params out of range in config string\n)); snmpTargetAddrTable_dispose(newEntry); return; } +newEntry-paramsLen = bufl; + cptr = copy_nword(cptr, buff, sizeof(buff)); if (snmpTargetAddr_addStorageType(newEntry, buff) == 0) { snmpTargetAddrTable_dispose(newEntry); @@ -668,31 +691,24 @@ snmpd_parse_config_targetAddr(const char snmpTargetAddrTable_dispose(newEntry); return; } -//snprintf(buff, sizeof(buff), snmp_parse_config_targetAddr, read: %s\n, -//newEntry-nameData); -memset(buff, 0, sizeof(buff)); -snprintf(buff, sizeof(buff), snmp_parse_config_targetAddr, read: ); -buff_len = strlen(buff); -for (j=0; jnewEntry-nameLen; j++){ -buff[buff_len+j] = newEntry-nameData[j]; -} -buff_len += newEntry-nameLen; -buff[buff_len++] = '\n'; - +memset(tmp, 0, sizeof(tmp)); +read_config_save_octet_string(tmp, newEntry-nameData, newEntry-nameLen); +snprintf(buff, sizeof(buff), snmp_parse_config_targetAddr, read: %s\n, tmp); buff[ sizeof(buff)-1 ] = 0; for (i = 0; i newEntry-tDomainLen; i++) { -//snprintf(buff[strlen(buff)], sizeof(buff)-strlen(buff)-1, -//
Re: net-snmp fails to create entries with a zero in the OID in SnmpTargetParamsEntry
On 11/22/2013 02:45 AM, Bart Van Assche wrote: On 10/16/13 10:31, zhuyj wrote: If this patch is used in net-snmp-5.7.2, the following should be used, too. If not, snmp-trap could not work well. Hello Zhu, Please make yourself familiar with git and start from the V5-7-patches or master branch when preparing patches. The patch that was attached to your e-mail doesn't apply on the V5-7-branch: $ git checkout V5-7-patches Switched to branch 'V5-7-patches' Your branch is behind 'origin/V5-7-patches' by 2 commits, and can be fast-forwarded. (use git pull to update your local branch) $ git rebase origin/V5-7-patches First, rewinding head to replay your work on top of it... Fast-forwarded V5-7-patches to origin/V5-7-patches. $ git apply -p1 ~/net-snmp-5.7.2-fix-param-length.patch error: patch failed: agent/mibgroup/notification/snmpNotifyTable.c:338 error: agent/mibgroup/notification/snmpNotifyTable.c: patch does not apply Bart. Hi, Bart Sorry. I prepared these patches based on net-snmp-5.7.2 release. I will prepare these patches based on V5-7-branch. Best Regards! Zhu Yanjun -- Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311iu=/4140/ostg.clktrk ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
Re: net-snmp fails to create entries with a zero in the OID in SnmpTargetParamsEntry
On 11/22/2013 10:54 AM, zhuyj wrote: On 11/22/2013 02:45 AM, Bart Van Assche wrote: On 10/16/13 10:31, zhuyj wrote: If this patch is used in net-snmp-5.7.2, the following should be used, too. If not, snmp-trap could not work well. Hello Zhu, Please make yourself familiar with git and start from the V5-7-patches or master branch when preparing patches. The patch that was attached to your e-mail doesn't apply on the V5-7-branch: $ git checkout V5-7-patches Switched to branch 'V5-7-patches' Your branch is behind 'origin/V5-7-patches' by 2 commits, and can be fast-forwarded. (use git pull to update your local branch) $ git rebase origin/V5-7-patches First, rewinding head to replay your work on top of it... Fast-forwarded V5-7-patches to origin/V5-7-patches. $ git apply -p1 ~/net-snmp-5.7.2-fix-param-length.patch error: patch failed: agent/mibgroup/notification/snmpNotifyTable.c:338 error: agent/mibgroup/notification/snmpNotifyTable.c: patch does not apply Bart. Hi, Bart Sorry. I prepared these patches based on net-snmp-5.7.2 release. I will prepare these patches based on V5-7-branch. Best Regards! Zhu Yanjun Hi, Bart I prepared 3 patches based on V5-7-branch. I made tests following these steps. It can apply well. 1.git clone git://git.code.sf.net/p/net-snmp/code 2.git checkout V5-7-patches 3.git pull 4.patch -p1 V5-7-patches-snmpTargetParam_support_zero_OID.patch patch -p1 V5-7-patches-fix-param-length.patch patch -p1 V5-7-patches-conf-support.patch 5../configure --enable-developer --disable-embeded-perl 6.sudo make sudo make install The three patches are in the attachment. Please make tests. If any problem, please let me know. Best Regards! Zhu Yanjun diff --git a/agent/mibgroup/target/snmpTargetAddrEntry.c b/agent/mibgroup/target/snmpTargetAddrEntry.c index f2cb2ab..b3b2340 100644 --- a/agent/mibgroup/target/snmpTargetAddrEntry.c +++ b/agent/mibgroup/target/snmpTargetAddrEntry.c @@ -483,32 +483,6 @@ snmpTargetAddr_addTagList(struct targetAddrTable_struct *entry, char *cptr) return (1); } /* snmpTargetAddr_addTagList */ - -int -snmpTargetAddr_addParams(struct targetAddrTable_struct *entry, char *cptr) -{ -size_t len; -if (cptr == NULL) { -DEBUGMSGTL((snmpTargetAddrEntry, -ERROR snmpTargetAddrEntry: no params in config string\n)); -return (0); -} else { -len = strlen(cptr); -/* - * spec check for string 1-32 - */ -if (len 1 || len 32) { -DEBUGMSGTL((snmpTargetAddrEntry, -ERROR snmpTargetAddrEntry: params out of range in config string\n)); -return (0); -} -entry-params = strdup(cptr); -entry-paramsLen = len; -} -return (1); -} /* snmpTargetAddr_addParams */ - - int snmpTargetAddr_addStorageType(struct targetAddrTable_struct *entry, char *cptr) @@ -583,7 +557,7 @@ void snmpd_parse_config_targetAddr(const char *token, char *char_ptr) { const char *cptr = char_ptr; -charbuff[1024], *bptr; +charbuff[1024], *bptr, tmp[1024], temp[1024]; struct targetAddrTable_struct *newEntry; int i; size_t bufl; @@ -641,11 +615,17 @@ snmpd_parse_config_targetAddr(const char *token, char *char_ptr) snmpTargetAddrTable_dispose(newEntry); return; } -cptr = copy_nword_const(cptr, buff, sizeof(buff)); -if (snmpTargetAddr_addParams(newEntry, buff) == 0) { -snmpTargetAddrTable_dispose(newEntry); -return; -} +cptr = +read_config_read_octet_string_const(cptr, + (u_char **) newEntry-params, + bufl); +if (bufl 1 || bufl 32) { +DEBUGMSGTL((snmpTargetAddrEntry, +ERROR snmpTargetAddrEntry: params out of range in config string\n)); + snmpTargetAddrTable_dispose(newEntry); + return; + } +newEntry-paramsLen = bufl; cptr = copy_nword_const(cptr, buff, sizeof(buff)); if (snmpTargetAddr_addStorageType(newEntry, buff) == 0) { snmpTargetAddrTable_dispose(newEntry); @@ -665,11 +645,15 @@ snmpd_parse_config_targetAddr(const char *token, char *char_ptr) bptr += snprintf(bptr, buff + sizeof(buff) - bptr, .%d, (int) newEntry-tDomain[i]); } +memset(tmp, 0, sizeof(tmp)); +memset(temp, 0, sizeof(temp)); +read_config_save_octet_string(tmp, newEntry-tAddress, newEntry-tAddressLen); +read_config_save_octet_string(temp, newEntry-params, newEntry-paramsLen); bptr += snprintf(bptr, buff + sizeof(buff) - bptr, %s %d %d %s %s %d %d\n, - newEntry-tAddress, newEntry-timeout, + tmp, newEntry-timeout, newEntry-retryCount,