af_nd6.c (235285) | af_nd6.c (244538) |
---|---|
1/* 2 * Copyright (c) 2009 Hiroki Sato. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 11 unchanged lines hidden (view full) --- 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 */ 25 26#ifndef lint 27static const char rcsid[] = | 1/* 2 * Copyright (c) 2009 Hiroki Sato. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 11 unchanged lines hidden (view full) --- 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 */ 25 26#ifndef lint 27static const char rcsid[] = |
28 "$FreeBSD: head/sbin/ifconfig/af_nd6.c 235285 2012-05-11 20:01:45Z hrs $"; | 28 "$FreeBSD: head/sbin/ifconfig/af_nd6.c 244538 2012-12-21 15:54:13Z kevlo $"; |
29#endif /* not lint */ 30 31#include <sys/param.h> 32#include <sys/ioctl.h> 33#include <sys/socket.h> 34#include <sys/sysctl.h> 35#include <net/if.h> 36#include <net/route.h> --- 106 unchanged lines hidden (view full) --- 143 struct in6_ndireq nd; 144 int s6; 145 int error; 146 int isdefif; 147 148 memset(&nd, 0, sizeof(nd)); 149 strncpy(nd.ifname, ifr.ifr_name, sizeof(nd.ifname)); 150 if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { | 29#endif /* not lint */ 30 31#include <sys/param.h> 32#include <sys/ioctl.h> 33#include <sys/socket.h> 34#include <sys/sysctl.h> 35#include <net/if.h> 36#include <net/route.h> --- 106 unchanged lines hidden (view full) --- 143 struct in6_ndireq nd; 144 int s6; 145 int error; 146 int isdefif; 147 148 memset(&nd, 0, sizeof(nd)); 149 strncpy(nd.ifname, ifr.ifr_name, sizeof(nd.ifname)); 150 if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { |
151 if (errno != EPROTONOSUPPORT) | 151 if (errno != EAFNOSUPPORT) |
152 warn("socket(AF_INET6, SOCK_DGRAM)"); 153 return; 154 } 155 error = ioctl(s6, SIOCGIFINFO_IN6, &nd); 156 if (error) { 157 if (errno != EPFNOSUPPORT) 158 warn("ioctl(SIOCGIFINFO_IN6)"); 159 close(s6); 160 return; 161 } 162 isdefif = isnd6defif(s6); 163 close(s6); 164 if (nd.ndi.flags == 0 && !isdefif) 165 return; 166 printb("\tnd6 options", 167 (unsigned int)(nd.ndi.flags | (isdefif << 15)), ND6BITS); 168 putchar('\n'); 169} | 152 warn("socket(AF_INET6, SOCK_DGRAM)"); 153 return; 154 } 155 error = ioctl(s6, SIOCGIFINFO_IN6, &nd); 156 if (error) { 157 if (errno != EPFNOSUPPORT) 158 warn("ioctl(SIOCGIFINFO_IN6)"); 159 close(s6); 160 return; 161 } 162 isdefif = isnd6defif(s6); 163 close(s6); 164 if (nd.ndi.flags == 0 && !isdefif) 165 return; 166 printb("\tnd6 options", 167 (unsigned int)(nd.ndi.flags | (isdefif << 15)), ND6BITS); 168 putchar('\n'); 169} |