Deleted Added
full compact
name6.c (55877) name6.c (56698)
1/*
2 * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
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

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
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 *
1/*
2 * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
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

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
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 * $FreeBSD: head/lib/libc/net/name6.c 55877 2000-01-13 05:47:11Z shin $
29 * $FreeBSD: head/lib/libc/net/name6.c 56698 2000-01-27 23:07:25Z jasone $
30 */
31/* $Id: name6.c,v 1.9 1999/10/29 03:04:26 itojun Exp $ */
32/*
33 * Atsushi Onoe <onoe@sm.sony.co.jp>
34 */
35
36/*
37 * TODO for thread safe

--- 214 unchanged lines hidden (view full) ---

252 return NULL;
253 /*
254 * TODO:
255 * Note that implementation dependent test for address
256 * configuration should be done everytime called
257 * (or apropriate interval),
258 * because addresses will be dynamically assigned or deleted.
259 */
30 */
31/* $Id: name6.c,v 1.9 1999/10/29 03:04:26 itojun Exp $ */
32/*
33 * Atsushi Onoe <onoe@sm.sony.co.jp>
34 */
35
36/*
37 * TODO for thread safe

--- 214 unchanged lines hidden (view full) ---

252 return NULL;
253 /*
254 * TODO:
255 * Note that implementation dependent test for address
256 * configuration should be done everytime called
257 * (or apropriate interval),
258 * because addresses will be dynamically assigned or deleted.
259 */
260 _libc_close(s);
260 _close(s);
261 }
262
263 for (i = 0; i < MAXHOSTCONF; i++) {
264 if (_hostconf[i].byname
265 && (hp = (*_hostconf[i].byname)(name, af, errp))
266 != NULL)
267 return hp;
268 }

--- 910 unchanged lines hidden (view full) ---

1179 }
1180
1181 if ((s = socket(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) < 0)
1182 return NULL;
1183 (void)setsockopt(s, IPPROTO_ICMPV6, ICMP6_FILTER,
1184 (char *)&filter, sizeof(filter));
1185 cc = sendmsg(s, &msg, 0);
1186 if (cc < 0) {
261 }
262
263 for (i = 0; i < MAXHOSTCONF; i++) {
264 if (_hostconf[i].byname
265 && (hp = (*_hostconf[i].byname)(name, af, errp))
266 != NULL)
267 return hp;
268 }

--- 910 unchanged lines hidden (view full) ---

1179 }
1180
1181 if ((s = socket(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) < 0)
1182 return NULL;
1183 (void)setsockopt(s, IPPROTO_ICMPV6, ICMP6_FILTER,
1184 (char *)&filter, sizeof(filter));
1185 cc = sendmsg(s, &msg, 0);
1186 if (cc < 0) {
1187 _libc_close(s);
1187 _close(s);
1188 return NULL;
1189 }
1190 FD_SET(s, &s_fds);
1191 for (;;) {
1192 fds = s_fds;
1193 if (select(s + 1, &fds, NULL, NULL, &tout) <= 0) {
1188 return NULL;
1189 }
1190 FD_SET(s, &s_fds);
1191 for (;;) {
1192 fds = s_fds;
1193 if (select(s + 1, &fds, NULL, NULL, &tout) <= 0) {
1194 _libc_close(s);
1194 _close(s);
1195 return NULL;
1196 }
1197 len = sizeof(sin6);
1198 cc = recvfrom(s, buf, sizeof(buf), 0,
1199 (struct sockaddr *)&sin6, &len);
1200 if (cc <= 0) {
1195 return NULL;
1196 }
1197 len = sizeof(sin6);
1198 cc = recvfrom(s, buf, sizeof(buf), 0,
1199 (struct sockaddr *)&sin6, &len);
1200 if (cc <= 0) {
1201 _libc_close(s);
1201 _close(s);
1202 return NULL;
1203 }
1204 if (cc < sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr))
1205 continue;
1206 if (!IN6_ARE_ADDR_EQUAL(addr, &sin6.sin6_addr))
1207 continue;
1208 fr = (struct icmp6_fqdn_reply *)(buf + sizeof(struct ip6_hdr));
1209 if (fr->icmp6_fqdn_type == ICMP6_FQDN_REPLY)
1210 break;
1211 }
1202 return NULL;
1203 }
1204 if (cc < sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr))
1205 continue;
1206 if (!IN6_ARE_ADDR_EQUAL(addr, &sin6.sin6_addr))
1207 continue;
1208 fr = (struct icmp6_fqdn_reply *)(buf + sizeof(struct ip6_hdr));
1209 if (fr->icmp6_fqdn_type == ICMP6_FQDN_REPLY)
1210 break;
1211 }
1212 _libc_close(s);
1212 _close(s);
1213 if (fr->icmp6_fqdn_cookie[1] != 0) {
1214 /* rfc1788 type */
1215 name = buf + sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr) + 4;
1216 len = (buf + cc) - name;
1217 } else {
1218 len = fr->icmp6_fqdn_namelen;
1219 name = fr->icmp6_fqdn_name;
1220 }

--- 42 unchanged lines hidden ---
1213 if (fr->icmp6_fqdn_cookie[1] != 0) {
1214 /* rfc1788 type */
1215 name = buf + sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr) + 4;
1216 len = (buf + cc) - name;
1217 } else {
1218 len = fr->icmp6_fqdn_namelen;
1219 name = fr->icmp6_fqdn_name;
1220 }

--- 42 unchanged lines hidden ---