1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#ifndef lint 31static const char rcsid[] = |
32 "$FreeBSD: head/sbin/ifconfig/af_link.c 139494 2004-12-31 19:46:27Z sam $"; |
33#endif /* not lint */ 34 35#include <sys/types.h> 36#include <sys/ioctl.h> 37#include <sys/socket.h> 38#include <net/if.h> |
39#include <net/route.h> /* for RTX_IFA */ |
40 41#include <err.h> 42#include <stdio.h> 43#include <stdlib.h> 44#include <string.h> 45 46#include <net/if_dl.h> 47#include <net/if_types.h> 48#include <net/ethernet.h> 49 50#include "ifconfig.h" 51 52static struct ifreq link_ridreq; 53 54static void 55link_status(int s __unused, const struct rt_addrinfo *info) 56{ |
57 const struct sockaddr_dl *sdl = 58 (const struct sockaddr_dl *) info->rti_info[RTAX_IFA]; |
59 |
60 if (sdl != NULL && sdl->sdl_alen > 0) { |
61 if (sdl->sdl_type == IFT_ETHER && 62 sdl->sdl_alen == ETHER_ADDR_LEN) 63 printf("\tether %s\n", 64 ether_ntoa((const struct ether_addr *)LLADDR(sdl))); 65 else { 66 int n = sdl->sdl_nlen > 0 ? sdl->sdl_nlen + 1 : 0; 67 68 printf("\tlladdr %s\n", link_ntoa(sdl) + n); --- 59 unchanged lines hidden --- |