diff options
author | 2016-04-06 01:39:17 +0000 | |
---|---|---|
committer | 2016-04-06 01:39:17 +0000 | |
commit | 8fb0ac714dc3d6578bd40725d3c37d229916463d (patch) | |
tree | 0e74eb029e16226dc241a368940e3265a47cc106 | |
parent | correct the order of arguments to m_get in m_dup_pkt (diff) | |
download | wireguard-openbsd-8fb0ac714dc3d6578bd40725d3c37d229916463d.tar.xz wireguard-openbsd-8fb0ac714dc3d6578bd40725d3c37d229916463d.zip |
move getting the vnetid out next to getting the ifparent
its now separate to getting the tunnel address.
ok mpi@
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 4bf2e435486..905bf1a486e 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.317 2016/03/02 19:45:10 deraadt Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.318 2016/04/06 01:39:17 dlg Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -181,6 +181,7 @@ void settunnelinst(const char *, int); void settunnelttl(const char *, int); void setvnetid(const char *, int); void delvnetid(const char *, int); +void getvnetid(void); void setifparent(const char *, int); void delifparent(const char *, int); void getifparent(void); @@ -2850,8 +2851,6 @@ phys_status(int force) if (dstport) printf(":%u", ntohs(dstport)); - if (ioctl(s, SIOCGVNETID, (caddr_t)&ifr) == 0) - printf(" vnetid %d", ifr.ifr_vnetid); if (ioctl(s, SIOCGLIFPHYTTL, (caddr_t)&ifr) == 0 && ifr.ifr_ttl > 0) printf(" ttl %d", ifr.ifr_ttl); #ifndef SMALL @@ -2943,6 +2942,7 @@ status(int link, struct sockaddr_dl *sdl, int ls) printf("\tpatch: %s\n", ifname); #endif vlan_status(); + getvnetid(); getifparent(); #ifndef SMALL carp_status(); @@ -3399,6 +3399,25 @@ delvnetid(const char *ignored, int alsoignored) } void +getvnetid(void) +{ + if (strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)) >= + sizeof(ifr.ifr_name)) + errx(1, "vnetid: name is too long"); + + if (ioctl(s, SIOCGVNETID, &ifr) == -1) { + if (errno != EADDRNOTAVAIL) + return; + + printf("\tvnetid: none\n"); + + return; + } + + printf("\tvnetid: %u\n", ifr.ifr_vnetid); +} + +void setifparent(const char *id, int param) { struct if_parent ifp; |