summaryrefslogtreecommitdiffstats
path: root/sbin/ifconfig/af_link.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2004-12-31 19:46:27 +0000
committersam <sam@FreeBSD.org>2004-12-31 19:46:27 +0000
commit65cf57f523204a7d6cd5d3c0982549ff4e7a3c01 (patch)
tree8074773f4ec0bc591d617a3e62e72b59e4fadd5d /sbin/ifconfig/af_link.c
parent53f032a130f0a58cb1612d7aa7df15b94e0fc5d8 (diff)
downloadFreeBSD-src-65cf57f523204a7d6cd5d3c0982549ff4e7a3c01.zip
FreeBSD-src-65cf57f523204a7d6cd5d3c0982549ff4e7a3c01.tar.gz
Fix special status reporting. Prior to the reorg there was
special-purpose code to display status for an interface for state that was not address-oriented. This status reporting was merged in to the address-oriented status reporting but did not work for link address reporting (as discovered with fwip interfaces). Correct this mis-merge and eliminate the bogus kludge that was used for link-level address reporting. o add an af_other_status method for an address family for reporting status of things like media, vlan, etc. o call the af_other_status methods after reporting address status for an interface o special-case link address status; when reporting all status for an interface invoke it specially prior to reporting af_other_status methods (since it requires the sockaddr_dl that is passed in to status separately from the rtmsg address state) o correct the calling convention for link address status; don't cast types, construct the proper parameter This fixes ifconfig on fwip interfaces.
Diffstat (limited to 'sbin/ifconfig/af_link.c')
-rw-r--r--sbin/ifconfig/af_link.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sbin/ifconfig/af_link.c b/sbin/ifconfig/af_link.c
index 9daef02..57a1e27 100644
--- a/sbin/ifconfig/af_link.c
+++ b/sbin/ifconfig/af_link.c
@@ -36,6 +36,7 @@ static const char rcsid[] =
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <net/if.h>
+#include <net/route.h> /* for RTX_IFA */
#include <err.h>
#include <stdio.h>
@@ -53,9 +54,10 @@ static struct ifreq link_ridreq;
static void
link_status(int s __unused, const struct rt_addrinfo *info)
{
- const struct sockaddr_dl *sdl = (const struct sockaddr_dl *)info;
+ const struct sockaddr_dl *sdl =
+ (const struct sockaddr_dl *) info->rti_info[RTAX_IFA];
- if (sdl->sdl_alen > 0) {
+ if (sdl != NULL && sdl->sdl_alen > 0) {
if (sdl->sdl_type == IFT_ETHER &&
sdl->sdl_alen == ETHER_ADDR_LEN)
printf("\tether %s\n",
OpenPOWER on IntegriCloud