Re: clientAddr ipv6

2018-10-31 Thread Bart Van Assche
On Mon, 2018-10-29 at 09:52 +0530, Pushpa Thimmaiah wrote:
> Hi All,
> I am using option 'clientAddr'  with IPv6 address and noticed that it is not 
> working.
> so I applied patch 
> https://sourceforge.net/p/net-snmp/mailman/message/33064273/ on 5.7.3 but It 
> seems not working.
> Kindly let me know if I am missing any configurations.
> 
> Eg:
> linux machine has ipv6 '2002::2054' and sends trap using 
> 'clientAddr=2002::2056'
> There is no IPv6 '2002::2056' and trap sent out via '2002::2054'.  I have 
> expected it to fail when it doesnot find 2002::2056.
> 
> snmp trap sender:
> /home/# /tmp/snmptrap -Dall -v 3 --clientAddr="2002::2056" -n "" -u testigmv6 
> -l authNoPriv -a MD5 -A mypassword -e 0x80001f880300b0a
> e123548  udp6:[2002::2045]:162 "" .1.3.6.1.4.1.8072.2.3.1 
> .1.3.6.1.4.1.8072.2.1.1 i 444
> /home# 
> 
> Trap Receiver shows: 
> usm: USM processing begun...
> usm: match on user testigmv6
> usm: Verification succeeded.
> usm: USM processing completed.
> 2018-10-29 09:43:59 UDP/IPv6: [2002::2054]:50455 [UDP/IPv6: 
> [2002::2054]:50455]:
> DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (89119) 0:14:51.19
> SNMPv2-MIB::snmpTrapOID.0 = OID: 
> NET-SNMP-EXAMPLES-MIB::netSnmpExampleNotificationNET-SNMP-EXAMPLES-
> MIB::netSnmpExampleInteger = INTEGER: 444

Please retest with the Net-SNMP master branch. That branch includes the patch 
shown below.
$ git branch --contains cc45578c2fa0b94f776* master

$ git show cc45578c2fa0b94f776commit 
cc45578c2fa0b94f7762057ee3b8a0b795c497ffAuthor: Bill Fenner 
Date:   Sun May 6 13:05:55 2018 +
snmpd: BUG: 2864: use clientaddr properlyThe code parsed out the 
address from the clientaddr spec,then used the return value wrong and only 
respected itif it existed but didn't
parse properly.
diff --git a/snmplib/transports/snmpUDPIPv4BaseDomain.c 
b/snmplib/transports/snmpUDPIPv4BaseDomain.cindex 37d8e33b47c7..433eb809bb91 
100644--- a/snmplib/transports/snmpUDPIPv4BaseDomain.c+++
b/snmplib/transports/snmpUDPIPv4BaseDomain.c@@ -367,7 +367,7 @@ 
netsnmp_udpipv4base_transport(const struct sockaddr_in *addr, int local)
 rc = netsnmp_sockaddr_in2(_addr,
client_socket, NULL); if (client_address != client_socket)  
   free(client_address);-if(!rc) {+if(rc) { 
if (!uses_port || !have_port) /*
if port isn't from string, */ client_addr.sin_port = 0; /* 
... clear it */ return 
netsnmp_udpipv4base_transport_with_source(addr, local,
Thanks,
Bart.___
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


Re: clientAddr ipv6

2018-10-31 Thread Bart Van Assche

On 10/29/18 9:34 PM, Pushpa Thimmaiah wrote:

Thank you.  I  will verify. Does the patch works for IPv6 too?


Oops, I had overlooked that your example uses an IPv6 client address.
Can you verify whether the following (untested) patch helps (checked
in yesterday on the v5.8 and master branches):

commit 9b637efe809c490fdcaf30d1af20b4cbaef76e3e
Author: Bart Van Assche 
Date:   Sat Oct 27 20:34:21 2018 -0700

libsnmp/transports: Fix netsnmp_udp6_transport()

Only create a transport object if parsing the client address succeeded
instead of creating a transport object when parsing the client address
failed.

Fixes: 5d8372341594 ("shared transport + udp shared domain")

diff --git a/snmplib/transports/snmpUDPIPv6Domain.c 
b/snmplib/transports/snmpUDPIPv6Domain.c
index 4d9f65eb9d19..7a3b1db15c67 100644
--- a/snmplib/transports/snmpUDPIPv6Domain.c
+++ b/snmplib/transports/snmpUDPIPv6Domain.c
@@ -460,14 +460,16 @@ netsnmp_udp6_transport(const struct sockaddr_in6 *addr, 
int local)
 {
 if (!local) {
 const char *client_socket;
+
 client_socket = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
   NETSNMP_DS_LIB_CLIENT_ADDR);
 if (client_socket) {
 struct sockaddr_in6 client_addr;
-if(!netsnmp_sockaddr_in6_2(_addr, client_socket, NULL)) {
-return netsnmp_udp6_transport_with_source(addr, local,
-  _addr);
-}
+
+if (!netsnmp_sockaddr_in6_2(_addr, client_socket, NULL))
+return NULL;
+return netsnmp_udp6_transport_with_source(addr, local,
+  _addr);
 }
 }
 return netsnmp_udp6_transport_with_source(addr, local, NULL);


___
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


Re: clientAddr ipv6

2018-10-30 Thread Pushpa Thimmaiah
Thank you Bart. I will  check.

Regards,
Pushpa.T

On Tue, Oct 30, 2018 at 10:34 AM Bart Van Assche  wrote:

> On 10/29/18 9:34 PM, Pushpa Thimmaiah wrote:
> > Thank you.  I  will verify. Does the patch works for IPv6 too?
>
> Oops, I had overlooked that your example uses an IPv6 client address.
> Can you verify whether the following (untested) patch helps (checked
> in yesterday on the v5.8 and master branches):
>
> commit 9b637efe809c490fdcaf30d1af20b4cbaef76e3e
> Author: Bart Van Assche 
> Date:   Sat Oct 27 20:34:21 2018 -0700
>
>  libsnmp/transports: Fix netsnmp_udp6_transport()
>
>  Only create a transport object if parsing the client address succeeded
>  instead of creating a transport object when parsing the client address
>  failed.
>
>  Fixes: 5d8372341594 ("shared transport + udp shared domain")
>
> diff --git a/snmplib/transports/snmpUDPIPv6Domain.c
> b/snmplib/transports/snmpUDPIPv6Domain.c
> index 4d9f65eb9d19..7a3b1db15c67 100644
> --- a/snmplib/transports/snmpUDPIPv6Domain.c
> +++ b/snmplib/transports/snmpUDPIPv6Domain.c
> @@ -460,14 +460,16 @@ netsnmp_udp6_transport(const struct sockaddr_in6
> *addr, int local)
>   {
>   if (!local) {
>   const char *client_socket;
> +
>   client_socket = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
>
> NETSNMP_DS_LIB_CLIENT_ADDR);
>   if (client_socket) {
>   struct sockaddr_in6 client_addr;
> -if(!netsnmp_sockaddr_in6_2(_addr, client_socket,
> NULL)) {
> -return netsnmp_udp6_transport_with_source(addr, local,
> -  _addr);
> -}
> +
> +if (!netsnmp_sockaddr_in6_2(_addr, client_socket,
> NULL))
> +return NULL;
> +return netsnmp_udp6_transport_with_source(addr, local,
> +  _addr);
>   }
>   }
>   return netsnmp_udp6_transport_with_source(addr, local, NULL);
>
___
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


Re: clientAddr ipv6

2018-10-29 Thread Pushpa Thimmaiah
Hi Bart,

Thank you.  I  will verify. Does the patch works for IPv6 too?

Regards,
Pushpa. T



On Tue, Oct 30, 2018 at 4:27 AM Bart Van Assche  wrote:

> On Mon, 2018-10-29 at 09:52 +0530, Pushpa Thimmaiah wrote:
>
> Hi All,
> I am using option 'clientAddr'  with IPv6 address and noticed that it is
> not working.
> so I applied patch
> https://sourceforge.net/p/net-snmp/mailman/message/33064273/ on 5.7.3 but
> It seems not working.
> Kindly let me know if I am missing any configurations.
>
> Eg:
> linux machine has ipv6 '2002::2054' and sends trap using
> 'clientAddr=2002::2056'
> There is no IPv6 '2002::2056' and trap sent out via '2002::2054'.  I have
> expected it to fail when it doesnot find 2002::2056.
>
> *snmp trap sender:*
> /home/# /tmp/snmptrap -Dall -v 3 *--clientAddr="2002::2056"* -n "" -u
> testigmv6 -l authNoPriv -a MD5 -A mypassword -e 0x80001f880300b0a
> e123548  udp6:[2002::2045]:162 "" .1.3.6.1.4.1.8072.2.3.1
> .1.3.6.1.4.1.8072.2.1.1 i 444
> /home#
>
> *Trap Receiver shows:*
> usm: USM processing begun...
> usm: match on user testigmv6
> usm: Verification succeeded.
> usm: USM processing completed.
> 2018-10-29 09:43:59 UDP/IPv6: [2002::2054]:50455 [UDP/IPv6: [*2002::2054*
> ]:50455]:
> DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (89119) 0:14:51.19
> SNMPv2-MIB::snmpTrapOID.0 = OID:
> NET-SNMP-EXAMPLES-MIB::netSnmpExampleNotification
> NET-SNMP-EXAMPLES-MIB::netSnmpExampleInteger = INTEGER: 444
>
>
> Please retest with the Net-SNMP master branch. That branch includes the
> patch shown below.
>
> $ git branch --contains cc45578c2fa0b94f776
>
> * master
>
> $ git show cc45578c2fa0b94f776
>
> commit cc45578c2fa0b94f7762057ee3b8a0b795c497ff
>
> Author: Bill Fenner 
>
> Date:   Sun May 6 13:05:55 2018 +
>
>
> snmpd: BUG: 2864: use clientaddr properly
>
> The code parsed out the address from the clientaddr spec,
>
> then used the return value wrong and only respected it
>
> if it existed but didn't parse properly.
>
>
> diff --git a/snmplib/transports/snmpUDPIPv4BaseDomain.c 
> b/snmplib/transports/snmpUDPIPv4BaseDomain.c
>
> index 37d8e33b47c7..433eb809bb91 100644
>
> --- a/snmplib/transports/snmpUDPIPv4BaseDomain.c
>
> +++ b/snmplib/transports/snmpUDPIPv4BaseDomain.c
>
> @@ -367,7 +367,7 @@ netsnmp_udpipv4base_transport(const struct sockaddr_in 
> *addr, int local)
>
>  rc = netsnmp_sockaddr_in2(_addr, client_socket, NULL);
>
>  if (client_address != client_socket)
>
>  free(client_address);
>
> -if(!rc) {
>
> +if(rc) {
>
>  if (!uses_port || !have_port) /* if port isn't from string, 
> */
>
>  client_addr.sin_port = 0; /* ... clear it */
>
>  return netsnmp_udpipv4base_transport_with_source(addr, local,
>
>
> Thanks,
>
> Bart.
>
>
___
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