Deleted Added
sdiff udiff text old ( 233770 ) new ( 245225 )
full compact
1/* $KAME: name6.c,v 1.25 2000/06/26 16:44:40 itojun Exp $ */
2
3/*
4 * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

83 * --Copyright--
84 */
85
86/*
87 * Atsushi Onoe <onoe@sm.sony.co.jp>
88 */
89
90#include <sys/cdefs.h>
91__FBSDID("$FreeBSD: head/lib/libc/net/name6.c 233770 2012-04-02 07:42:17Z delphij $");
92
93#include "namespace.h"
94#include <sys/param.h>
95#include <sys/socket.h>
96#include <sys/time.h>
97#include <sys/queue.h>
98#include <netinet/in.h>
99#ifdef INET6

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

195static struct hostent *_hpcopy(struct hostent *, int *);
196static struct hostent *_hpaddr(int, const char *, void *, int *);
197#ifdef INET6
198static struct hostent *_hpmerge(struct hostent *, struct hostent *, int *);
199static struct hostent *_hpmapv6(struct hostent *, int *);
200#endif
201static struct hostent *_hpsort(struct hostent *, res_state);
202
203static struct hostent *_hpreorder(struct hostent *);
204static int get_addrselectpolicy(struct policyhead *);
205static void free_addrselectpolicy(struct policyhead *);
206static struct policyqueue *match_addrselectpolicy(struct sockaddr *,
207 struct policyhead *);
208static void set_source(struct hp_order *, struct policyhead *);
209static int matchlen(struct sockaddr *, struct sockaddr *);
210static int comp_dst(const void *, const void *);
211static int gai_addr2scopetype(struct sockaddr *);
212
213/*
214 * Functions defined in RFC2553
215 * getipnodebyname, getipnodebyaddr, freehostent
216 */
217
218struct hostent *
219getipnodebyname(const char *name, int af, int flags, int *errp)

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

304 }
305 }
306#endif
307
308 if (hp == NULL)
309 *errp = statp->res_h_errno;
310
311 statp->options = options;
312 return _hpreorder(_hpsort(hp, statp));
313}
314
315struct hostent *
316getipnodebyaddr(const void *src, size_t len, int af, int *errp)
317{
318 struct hostent *hp;
319 res_state statp;
320 u_long options;

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

627 order[i] = order[j];
628 order[j] = t;
629 }
630 }
631 }
632 return hp;
633}
634
635/*
636 * _hpreorder: sort address by default address selection
637 */
638static struct hostent *
639_hpreorder(struct hostent *hp)
640{
641 struct hp_order *aio;
642 int i, n;

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

1104 return(2);
1105 return(14);
1106 break;
1107 default:
1108 errno = EAFNOSUPPORT; /* is this a good error? */
1109 return(-1);
1110 }
1111}