af_link.c (154401) | af_link.c (166956) |
---|---|
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[] = | 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 154401 2006-01-15 19:17:13Z ru $"; | 32 "$FreeBSD: head/sbin/ifconfig/af_link.c 166956 2007-02-24 23:55:46Z 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> | 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> | 39 40#include <err.h> 41#include <stdio.h> 42#include <stdlib.h> 43#include <string.h> |
44#include <ifaddrs.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 | 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) | 55link_status(int s __unused, const struct ifaddrs *ifa) |
56{ | 56{ |
57 const struct sockaddr_dl *sdl = 58 (const struct sockaddr_dl *) info->rti_info[RTAX_IFA]; | 57 /* XXX no const 'cuz LLADDR is defined wrong */ 58 struct sockaddr_dl *sdl = (struct sockaddr_dl *) ifa->ifa_addr; |
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", | 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))); | 64 ether_ntoa((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); 69 } 70 } 71} 72 --- 55 unchanged lines hidden --- | 65 else { 66 int n = sdl->sdl_nlen > 0 ? sdl->sdl_nlen + 1 : 0; 67 68 printf("\tlladdr %s\n", link_ntoa(sdl) + n); 69 } 70 } 71} 72 --- 55 unchanged lines hidden --- |