2002-10-06 11:35:21 +02:00
|
|
|
--- snmplib/snmpTCPIPv6Domain.c.orig Fri Aug 9 22:57:43 2002
|
|
|
|
+++ snmplib/snmpTCPIPv6Domain.c Sun Oct 6 01:07:12 2002
|
2002-07-25 13:03:01 +02:00
|
|
|
@@ -62,13 +62,21 @@
|
|
|
|
if (to == NULL) {
|
|
|
|
return strdup("TCP/IPv6: unknown");
|
|
|
|
} else {
|
2002-10-06 11:35:21 +02:00
|
|
|
- char addr[INET6_ADDRSTRLEN];
|
|
|
|
- char tmp[INET6_ADDRSTRLEN + 8];
|
|
|
|
+ char tmp[NI_MAXHOST];
|
2002-07-25 13:03:01 +02:00
|
|
|
|
|
|
|
- sprintf(tmp, "[%s]:%hd",
|
|
|
|
- inet_ntop(AF_INET6, (void *) &(to->sin6_addr), addr,
|
|
|
|
- INET6_ADDRSTRLEN), ntohs(to->sin6_port));
|
|
|
|
- return strdup(tmp);
|
|
|
|
+/*
|
|
|
|
+ * NI_WITHSCOPEID will be obsoleted. But some implementations require
|
|
|
|
+ * this flag to retrieve scoped name.
|
|
|
|
+ * (2002-07-25: kuriyama@FreeBSD.org)
|
|
|
|
+ */
|
|
|
|
+#ifndef NI_WITHSCOPEID
|
|
|
|
+#define NI_WITHSCOPEID 0
|
|
|
|
+#endif
|
|
|
|
+ if (getnameinfo(to, sizeof(struct sockaddr_in6), tmp, sizeof(tmp),
|
|
|
|
+ NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID)) {
|
|
|
|
+ return strdup("UDP/IPv6: unknown");
|
|
|
|
+ }
|
|
|
|
+ return strdup(tmp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|