Hi, Robert,

After I re-read your email, I think there are some confusion.
The '[' ']' we were discussing refers that in fuction netsnmp_tcp6(udp6)_frmaddr(), 
not command line. Attached is my fix for netsnmp_tcp6(udp6)_frmaddr().


The command line argument is different problem. That's tcp6 doesn't work but udp6 
works fine.
snmpwalk -c public udp6:[fe80::2e0:81ff:fe25:8097]:161  ucdavis  --- works
snmpwalk -c public udp6:[fe80::2e0:81ff:fe25:8097]:161  ucdavis  --- Unknown host 
(Invalid argument)

And I launched snmpd on udp6:161,tcp6:161

Thanks,

Fong


-----Original Message-----
From: Robert Story (Coders) [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 16, 2004 12:23 PM
To: Fong Tsui
Cc: [EMAIL PROTECTED]; Michael J. Slifcak
Subject: Re: Get data using Tcp6


On Wed, 11 Aug 2004 19:08:25 -0700 Fong wrote:
FT> snmpwalk -c public tcp6:[fe80::2e0:81ff:fe25:8097]:161  ucdavis

On Thu, 12 Aug 2004 19:15:15 -0700 Fong wrote:
FT> I don't know why we need [' ']' there.

I believe it is to allow for easier parsing. The delimiter is ':', and that works 
great for host name and IPv4 addresses. However, for IPv6 addresses, it gets messy, so 
the [] around IPv6 addresses makes parsing easier. They should be removed in the code 
before being passed to system calls like hosts_ctl.

FT> Yes, I DO have some concern that the reason this  [' ']' is added at 
FT> the first place. Are they used somewhere else?

No, I'm pretty sure once the command line has been parsed, the should be able to be 
discarded


-- 
Robert Story; NET-SNMP Junkie <http://www.net-snmp.org/> 
<irc://irc.freenode.net/#net-snmp>
Archive: <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-coders>

You are lost in a twisty maze of little standards, all different. 
--- 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