only show a tunnel information of an adequate address family.
Approved by: re (dwhite)
This commit is contained in:
parent
e2ba7862b0
commit
73bbc449db
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=147437
@ -153,11 +153,15 @@ in_status_tunnel(int s)
|
|||||||
|
|
||||||
if (ioctl(s, SIOCGIFPSRCADDR, (caddr_t)&ifr) < 0)
|
if (ioctl(s, SIOCGIFPSRCADDR, (caddr_t)&ifr) < 0)
|
||||||
return;
|
return;
|
||||||
|
if (sa->sa_family != AF_INET)
|
||||||
|
return;
|
||||||
if (getnameinfo(sa, sa->sa_len, src, sizeof(src), 0, 0, NI_NUMERICHOST) != 0)
|
if (getnameinfo(sa, sa->sa_len, src, sizeof(src), 0, 0, NI_NUMERICHOST) != 0)
|
||||||
src[0] = '\0';
|
src[0] = '\0';
|
||||||
|
|
||||||
if (ioctl(s, SIOCGIFPDSTADDR, (caddr_t)&ifr) < 0)
|
if (ioctl(s, SIOCGIFPDSTADDR, (caddr_t)&ifr) < 0)
|
||||||
return;
|
return;
|
||||||
|
if (sa->sa_family != AF_INET)
|
||||||
|
return;
|
||||||
if (getnameinfo(sa, sa->sa_len, dst, sizeof(dst), 0, 0, NI_NUMERICHOST) != 0)
|
if (getnameinfo(sa, sa->sa_len, dst, sizeof(dst), 0, 0, NI_NUMERICHOST) != 0)
|
||||||
dst[0] = '\0';
|
dst[0] = '\0';
|
||||||
|
|
||||||
|
@ -456,16 +456,18 @@ in6_status_tunnel(int s)
|
|||||||
|
|
||||||
if (ioctl(s, SIOCGIFPSRCADDR_IN6, (caddr_t)&in6_ifr) < 0)
|
if (ioctl(s, SIOCGIFPSRCADDR_IN6, (caddr_t)&in6_ifr) < 0)
|
||||||
return;
|
return;
|
||||||
if (sa->sa_family == AF_INET6)
|
if (sa->sa_family != AF_INET6)
|
||||||
in6_fillscopeid(&in6_ifr.ifr_addr);
|
return;
|
||||||
|
in6_fillscopeid(&in6_ifr.ifr_addr);
|
||||||
if (getnameinfo(sa, sa->sa_len, src, sizeof(src), 0, 0,
|
if (getnameinfo(sa, sa->sa_len, src, sizeof(src), 0, 0,
|
||||||
NI_NUMERICHOST) != 0)
|
NI_NUMERICHOST) != 0)
|
||||||
src[0] = '\0';
|
src[0] = '\0';
|
||||||
|
|
||||||
if (ioctl(s, SIOCGIFPDSTADDR_IN6, (caddr_t)&in6_ifr) < 0)
|
if (ioctl(s, SIOCGIFPDSTADDR_IN6, (caddr_t)&in6_ifr) < 0)
|
||||||
return;
|
return;
|
||||||
if (sa->sa_family == AF_INET6)
|
if (sa->sa_family != AF_INET6)
|
||||||
in6_fillscopeid(&in6_ifr.ifr_addr);
|
return;
|
||||||
|
in6_fillscopeid(&in6_ifr.ifr_addr);
|
||||||
if (getnameinfo(sa, sa->sa_len, dst, sizeof(dst), 0, 0,
|
if (getnameinfo(sa, sa->sa_len, dst, sizeof(dst), 0, 0,
|
||||||
NI_NUMERICHOST) != 0)
|
NI_NUMERICHOST) != 0)
|
||||||
dst[0] = '\0';
|
dst[0] = '\0';
|
||||||
|
Loading…
Reference in New Issue
Block a user