summaryrefslogtreecommitdiff
path: root/usr.bin/kdump
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2020-12-21 07:47:38 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2020-12-21 07:47:38 +0000
commit9fdb4bab47a3caae694237bfd511b91e0f69f8ec (patch)
tree82689edcfab46dbfa49877d72cd07c04f0753d2f /usr.bin/kdump
parentb62b672e213054a5533d8760a424b4062c16e321 (diff)
Show scope id when set; ok florian@
Diffstat (limited to 'usr.bin/kdump')
-rw-r--r--usr.bin/kdump/ktrstruct.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/kdump/ktrstruct.c b/usr.bin/kdump/ktrstruct.c
index 217ba42ae06..45f7ce21b2b 100644
--- a/usr.bin/kdump/ktrstruct.c
+++ b/usr.bin/kdump/ktrstruct.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ktrstruct.c,v 1.28 2018/11/17 20:46:12 claudio Exp $ */
+/* $OpenBSD: ktrstruct.c,v 1.29 2020/12/21 07:47:37 otto Exp $ */
/*-
* Copyright (c) 1988, 1993
@@ -90,7 +90,7 @@ ktrsockaddr(struct sockaddr *sa)
switch(sa->sa_family) {
case AF_INET: {
struct sockaddr_in *sa_in;
- char addr[64];
+ char addr[INET_ADDRSTRLEN];
sa_in = (struct sockaddr_in *)sa;
check_sockaddr_len(in);
@@ -100,12 +100,15 @@ ktrsockaddr(struct sockaddr *sa)
}
case AF_INET6: {
struct sockaddr_in6 *sa_in6;
- char addr[64];
+ char addr[INET6_ADDRSTRLEN], scope[12] = { 0 };
sa_in6 = (struct sockaddr_in6 *)sa;
check_sockaddr_len(in6);
inet_ntop(AF_INET6, &sa_in6->sin6_addr, addr, sizeof addr);
- printf("[%s]:%u", addr, htons(sa_in6->sin6_port));
+ if (sa_in6->sin6_scope_id)
+ snprintf(scope, sizeof(scope), "%%%u",
+ sa_in6->sin6_scope_id);
+ printf("[%s%s]:%u", addr, scope, htons(sa_in6->sin6_port));
break;
}
case AF_UNIX: {