ncpaddr.c (98243) | ncpaddr.c (102558) |
---|---|
1/*- 2 * Copyright (c) 2001 Brian Somers <brian@Awfulhak.org> 3 * 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2001 Brian Somers <brian@Awfulhak.org> 3 * 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/usr.sbin/ppp/ncpaddr.c 98243 2002-06-15 08:03:30Z brian $ | 26 * $FreeBSD: head/usr.sbin/ppp/ncpaddr.c 102558 2002-08-29 02:44:58Z brian $ |
27 */ 28 29#include <sys/types.h> 30#include <sys/socket.h> 31#ifdef __OpenBSD__ 32#include <net/if_types.h> 33#include <net/route.h> 34#endif --- 123 unchanged lines hidden (view full) --- 158 159 return masklen; 160} 161 162static void 163adjust_linklocal(struct sockaddr_in6 *sin6) 164{ 165 /* XXX: ?????!?!?!!!!! This is horrible ! */ | 27 */ 28 29#include <sys/types.h> 30#include <sys/socket.h> 31#ifdef __OpenBSD__ 32#include <net/if_types.h> 33#include <net/route.h> 34#endif --- 123 unchanged lines hidden (view full) --- 158 159 return masklen; 160} 161 162static void 163adjust_linklocal(struct sockaddr_in6 *sin6) 164{ 165 /* XXX: ?????!?!?!!!!! This is horrible ! */ |
166#if 0 167 /* 168 * The kernel does not understand sin6_scope_id for routing at this moment. 169 * We should rather keep the embedded ID. 170 * jinmei@kame.net, 20011026 171 */ |
|
166 if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) || 167 IN6_IS_ADDR_MC_LINKLOCAL(&sin6->sin6_addr)) { 168 sin6->sin6_scope_id = 169 ntohs(*(u_short *)&sin6->sin6_addr.s6_addr[2]); 170 *(u_short *)&sin6->sin6_addr.s6_addr[2] = 0; 171 } | 172 if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) || 173 IN6_IS_ADDR_MC_LINKLOCAL(&sin6->sin6_addr)) { 174 sin6->sin6_scope_id = 175 ntohs(*(u_short *)&sin6->sin6_addr.s6_addr[2]); 176 *(u_short *)&sin6->sin6_addr.s6_addr[2] = 0; 177 } |
178#endif |
|
172} 173#endif 174 175void 176ncpaddr_init(struct ncpaddr *addr) 177{ 178 addr->ncpaddr_family = AF_UNSPEC; 179} --- 194 unchanged lines hidden (view full) --- 374 375#ifndef NOINET6 376 case AF_INET6: 377 memset(&sin6, '\0', sizeof(sin6)); 378 sin6.sin6_len = sizeof(sin6); 379 sin6.sin6_family = AF_INET6; 380 sin6.sin6_addr = addr->ncpaddr_ip6addr; 381 adjust_linklocal(&sin6); | 179} 180#endif 181 182void 183ncpaddr_init(struct ncpaddr *addr) 184{ 185 addr->ncpaddr_family = AF_UNSPEC; 186} --- 194 unchanged lines hidden (view full) --- 381 382#ifndef NOINET6 383 case AF_INET6: 384 memset(&sin6, '\0', sizeof(sin6)); 385 sin6.sin6_len = sizeof(sin6); 386 sin6.sin6_family = AF_INET6; 387 sin6.sin6_addr = addr->ncpaddr_ip6addr; 388 adjust_linklocal(&sin6); |
389#ifdef NI_WITHSCOPEID |
|
382 if (getnameinfo((struct sockaddr *)&sin6, sizeof sin6, res, sizeof(res), 383 NULL, 0, NI_WITHSCOPEID | NI_NUMERICHOST) != 0) | 390 if (getnameinfo((struct sockaddr *)&sin6, sizeof sin6, res, sizeof(res), 391 NULL, 0, NI_WITHSCOPEID | NI_NUMERICHOST) != 0) |
392#else 393 if (getnameinfo((struct sockaddr *)&sin6, sizeof sin6, res, sizeof(res), 394 NULL, 0, NI_NUMERICHOST) != 0) 395#endif |
|
384 break; 385 386 return res; 387#endif 388 } 389 390 snprintf(res, sizeof res, "<AF_UNSPEC>"); 391 return res; --- 601 unchanged lines hidden --- | 396 break; 397 398 return res; 399#endif 400 } 401 402 snprintf(res, sizeof res, "<AF_UNSPEC>"); 403 return res; --- 601 unchanged lines hidden --- |