af_inet6.c (146187) | af_inet6.c (147437) |
---|---|
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_inet6.c 146187 2005-05-13 16:31:11Z ume $"; | 32 "$FreeBSD: head/sbin/ifconfig/af_inet6.c 147437 2005-06-16 19:37:09Z ume $"; |
33#endif /* not lint */ 34 35#include <sys/param.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 --- 410 unchanged lines hidden (view full) --- 451 struct in6_ifreq in6_ifr; 452 const struct sockaddr *sa = (const struct sockaddr *) &in6_ifr.ifr_addr; 453 454 memset(&in6_ifr, 0, sizeof(in6_ifr)); 455 strncpy(in6_ifr.ifr_name, name, IFNAMSIZ); 456 457 if (ioctl(s, SIOCGIFPSRCADDR_IN6, (caddr_t)&in6_ifr) < 0) 458 return; | 33#endif /* not lint */ 34 35#include <sys/param.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 --- 410 unchanged lines hidden (view full) --- 451 struct in6_ifreq in6_ifr; 452 const struct sockaddr *sa = (const struct sockaddr *) &in6_ifr.ifr_addr; 453 454 memset(&in6_ifr, 0, sizeof(in6_ifr)); 455 strncpy(in6_ifr.ifr_name, name, IFNAMSIZ); 456 457 if (ioctl(s, SIOCGIFPSRCADDR_IN6, (caddr_t)&in6_ifr) < 0) 458 return; |
459 if (sa->sa_family == AF_INET6) 460 in6_fillscopeid(&in6_ifr.ifr_addr); | 459 if (sa->sa_family != AF_INET6) 460 return; 461 in6_fillscopeid(&in6_ifr.ifr_addr); |
461 if (getnameinfo(sa, sa->sa_len, src, sizeof(src), 0, 0, 462 NI_NUMERICHOST) != 0) 463 src[0] = '\0'; 464 465 if (ioctl(s, SIOCGIFPDSTADDR_IN6, (caddr_t)&in6_ifr) < 0) 466 return; | 462 if (getnameinfo(sa, sa->sa_len, src, sizeof(src), 0, 0, 463 NI_NUMERICHOST) != 0) 464 src[0] = '\0'; 465 466 if (ioctl(s, SIOCGIFPDSTADDR_IN6, (caddr_t)&in6_ifr) < 0) 467 return; |
467 if (sa->sa_family == AF_INET6) 468 in6_fillscopeid(&in6_ifr.ifr_addr); | 468 if (sa->sa_family != AF_INET6) 469 return; 470 in6_fillscopeid(&in6_ifr.ifr_addr); |
469 if (getnameinfo(sa, sa->sa_len, dst, sizeof(dst), 0, 0, 470 NI_NUMERICHOST) != 0) 471 dst[0] = '\0'; 472 473 printf("\ttunnel inet6 %s --> %s\n", src, dst); 474} 475 476static void --- 62 unchanged lines hidden --- | 471 if (getnameinfo(sa, sa->sa_len, dst, sizeof(dst), 0, 0, 472 NI_NUMERICHOST) != 0) 473 dst[0] = '\0'; 474 475 printf("\ttunnel inet6 %s --> %s\n", src, dst); 476} 477 478static void --- 62 unchanged lines hidden --- |