Attached is my fix for IPv6 address. I think it is clear and simple way. - getting 
addr directly from inet_ntop() call without manipulating it in 
netsnmp_tcp6(udp6)_frmaddr(). Do you see any problem with it? This is based on v5.0.9.


Thanks,

Fong

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 11, 2004 11:32 PM
To: Fong Tsui
Cc: [EMAIL PROTECTED]
Subject: Re: RE: Get data using Tcp6


> From: "Fong Tsui" <[EMAIL PROTECTED]>
> 
> I have checked patch [ 942155 ] IPv6 addr_string fix,
> patch [ 550830 ] Fixes for libwrap.
>  Both fixes seem manipulating data after netsnmp_tcp6(udp6)_fmtaddr() 
> forms the address.  Why we need to reformat the ipv6 address(add 
> [..]:port) at the first place ?

Hi, Fong.
Perhaps there is a misunderstanding expressed in the code.

Have you tried adding "-D ALL" to the command options ?
Did you see where the host name was being interpreted ?


>  
> My local fixes for this tcpwrap issue are getting addr directly from 
> inet_ntop() call without manipulating it in 
> netsnmp_tcp6(udp6)_frmaddr().  It works for tcpwrap. Will my change 
> cause tcp6  "Unknow host"  or it is just a separated issue?


Did you attach a 'diff -u old new' patch that expresses your local fixes ?

>  
>  
> Thanks,
>  
> Fong
> 

--


>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> 
>I believe there are patches and a bug report in the net-snmp repository
>that might provide ideas that can be applied to your situation. 
>
>In other words, there may be a need to parse the '[' and the ']'
>more intelligently ? 
>
>patch [ 942155 ] IPv6 addr_string fix
>patch [ 550830 ] Fixes for libwrap 
>  bug [ 555417 ] bad tcpwrapper-related typecast 
> 
>To get clear on where the change might be made,
> "printf()" can be your friend, if used judiciously. 
>
>Best Regards,
>-Mike Slifcak 
> 
> 
> 
>>-----Original Message-----
>> From: "Fong Tsui" <[EMAIL PROTECTED]> 
>> 
>> Hi, Greeting,
>> 
>> 
>> Is the followiing command correct? I am on Linux with v5.0.9.
>> 
>> snmpwalk -c public tcp6:[fe80::2e0:81ff:fe25:8097]:161  ucdavis
>> 
>> I lanuch snmpd on udp6:161,tcp6:161 and netstat shows it is lisening 
>> on tcp. >> However, I seem have a problem to run above command. It 
>> gives me "snmpwalk: >> Unknown host (Invalid argument)". What will be 
>> the correct argument?
> 
>> 
>> snmpwalk -c public udp6:[fe80::2e0:81ff:fe25:8097]:161  ucdavis --ok
>> snmpwalk -c public tcp:192.168.102.235  ucdavis  --ok 
>> 
>> Have I missed anything?
>> 
>> 
>> Thanks,
>> 
>> Fong
>> 


--- snmpTCPIPv6Domain.c.old     2004-08-12 14:13:59.000000000 -0700
+++ snmpTCPIPv6Domain.c 2004-08-11 15:19:44.000000000 -0700
@@ -67,12 +67,10 @@
         return strdup("TCP/IPv6: unknown");
     } else {
         char addr[INET6_ADDRSTRLEN];
-        char tmp[INET6_ADDRSTRLEN + 8];
 
-        sprintf(tmp, "[%s]:%hd",
-                inet_ntop(AF_INET6, (void *) &(to->sin6_addr), addr,
-                          INET6_ADDRSTRLEN), ntohs(to->sin6_port));
-        return strdup(tmp);
+        inet_ntop(AF_INET6, (void *) &(to->sin6_addr), addr,
+              INET6_ADDRSTRLEN);
+        return strdup(addr);
     }
 }

--- snmpUDPIPv6Domain.c.old     2004-08-12 14:14:19.000000000 -0700
+++ snmpUDPIPv6Domain.c 2004-08-11 15:19:48.000000000 -0700
@@ -67,12 +67,10 @@
         return strdup("UDP/IPv6: unknown");
     } else {
         char addr[INET6_ADDRSTRLEN];
-        char tmp[INET6_ADDRSTRLEN + 8];
 
-        sprintf(tmp, "[%s]:%hd",
-                inet_ntop(AF_INET6, (void *) &(to->sin6_addr), addr,
-                          INET6_ADDRSTRLEN), ntohs(to->sin6_port));
-        return strdup(tmp);
+        inet_ntop(AF_INET6, (void *) &(to->sin6_addr), addr,
+                  INET6_ADDRSTRLEN);
+        return strdup(addr);
     }
 }

Reply via email to