route.c (6d4b97158fa99be390dba1c61c1d1f547852aef6) | route.c (324930d7f89eb3be05650cecb0d6ce2f7dc18f11) |
---|---|
1/* 2 * Copyright (c) 1983, 1989, 1991, 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 --- 361 unchanged lines hidden (view full) --- 370 371 memset(&sin6, 0, sizeof(sin6)); 372 memcpy(&sin6, sa, sa->sa_len); 373 sin6.sin6_len = sizeof(struct sockaddr_in6); 374 sin6.sin6_family = AF_INET6; 375#ifdef __KAME__ 376 if (sa->sa_len == sizeof(struct sockaddr_in6) && 377 (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) || | 1/* 2 * Copyright (c) 1983, 1989, 1991, 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 --- 361 unchanged lines hidden (view full) --- 370 371 memset(&sin6, 0, sizeof(sin6)); 372 memcpy(&sin6, sa, sa->sa_len); 373 sin6.sin6_len = sizeof(struct sockaddr_in6); 374 sin6.sin6_family = AF_INET6; 375#ifdef __KAME__ 376 if (sa->sa_len == sizeof(struct sockaddr_in6) && 377 (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) || |
378 IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr)) && | 378 IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr) || 379 IN6_IS_ADDR_MC_NODELOCAL(&sin6.sin6_addr)) && |
379 sin6.sin6_scope_id == 0) { 380 sin6.sin6_scope_id = 381 ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]); 382 sin6.sin6_addr.s6_addr[2] = 0; 383 sin6.sin6_addr.s6_addr[3] = 0; 384 } 385#endif 386 if (nflag) --- 108 unchanged lines hidden (view full) --- 495 496 memset(&sin6, 0, sizeof(sin6)); 497 memcpy(&sin6, sa, sa->sa_len); 498 sin6.sin6_len = sizeof(struct sockaddr_in6); 499 sin6.sin6_family = AF_INET6; 500#ifdef __KAME__ 501 if (sa->sa_len == sizeof(struct sockaddr_in6) && 502 (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) || | 380 sin6.sin6_scope_id == 0) { 381 sin6.sin6_scope_id = 382 ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]); 383 sin6.sin6_addr.s6_addr[2] = 0; 384 sin6.sin6_addr.s6_addr[3] = 0; 385 } 386#endif 387 if (nflag) --- 108 unchanged lines hidden (view full) --- 496 497 memset(&sin6, 0, sizeof(sin6)); 498 memcpy(&sin6, sa, sa->sa_len); 499 sin6.sin6_len = sizeof(struct sockaddr_in6); 500 sin6.sin6_family = AF_INET6; 501#ifdef __KAME__ 502 if (sa->sa_len == sizeof(struct sockaddr_in6) && 503 (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) || |
503 IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr)) && | 504 IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr) || 505 IN6_IS_ADDR_MC_NODELOCAL(&sin6.sin6_addr)) && |
504 sin6.sin6_scope_id == 0) { 505 sin6.sin6_scope_id = 506 ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]); 507 sin6.sin6_addr.s6_addr[2] = 0; 508 sin6.sin6_addr.s6_addr[3] = 0; 509 } 510#endif 511 if (nflag) --- 485 unchanged lines hidden (view full) --- 997 res->ai_addrlen != sizeof(su->sin6)) { 998 (void) fprintf(stderr, "%s: %s\n", str, 999 gai_strerror(ecode)); 1000 exit(1); 1001 } 1002 memcpy(&su->sin6, res->ai_addr, sizeof(su->sin6)); 1003#ifdef __KAME__ 1004 if ((IN6_IS_ADDR_LINKLOCAL(&su->sin6.sin6_addr) || | 506 sin6.sin6_scope_id == 0) { 507 sin6.sin6_scope_id = 508 ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]); 509 sin6.sin6_addr.s6_addr[2] = 0; 510 sin6.sin6_addr.s6_addr[3] = 0; 511 } 512#endif 513 if (nflag) --- 485 unchanged lines hidden (view full) --- 999 res->ai_addrlen != sizeof(su->sin6)) { 1000 (void) fprintf(stderr, "%s: %s\n", str, 1001 gai_strerror(ecode)); 1002 exit(1); 1003 } 1004 memcpy(&su->sin6, res->ai_addr, sizeof(su->sin6)); 1005#ifdef __KAME__ 1006 if ((IN6_IS_ADDR_LINKLOCAL(&su->sin6.sin6_addr) || |
1005 IN6_IS_ADDR_MC_LINKLOCAL(&su->sin6.sin6_addr)) && | 1007 IN6_IS_ADDR_MC_LINKLOCAL(&su->sin6.sin6_addr) || 1008 IN6_IS_ADDR_MC_NODELOCAL(&su->sin6.sin6_addr)) && |
1006 su->sin6.sin6_scope_id) { 1007 *(u_int16_t *)&su->sin6.sin6_addr.s6_addr[2] = 1008 htons(su->sin6.sin6_scope_id); 1009 su->sin6.sin6_scope_id = 0; 1010 } 1011#endif 1012 freeaddrinfo(res); 1013 if (q != NULL) --- 679 unchanged lines hidden --- | 1009 su->sin6.sin6_scope_id) { 1010 *(u_int16_t *)&su->sin6.sin6_addr.s6_addr[2] = 1011 htons(su->sin6.sin6_scope_id); 1012 su->sin6.sin6_scope_id = 0; 1013 } 1014#endif 1015 freeaddrinfo(res); 1016 if (q != NULL) --- 679 unchanged lines hidden --- |