Deleted Added
full compact
name6.c (233770) name6.c (245225)
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>
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 $");
91__FBSDID("$FreeBSD: head/lib/libc/net/name6.c 245225 2013-01-09 15:22:37Z ume $");
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
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
203#ifdef ENABLE_IP6ADDRCTL
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 *);
204static struct hostent *_hpreorder(struct hostent *);
205static int get_addrselectpolicy(struct policyhead *);
206static void free_addrselectpolicy(struct policyhead *);
207static struct policyqueue *match_addrselectpolicy(struct sockaddr *,
208 struct policyhead *);
209static void set_source(struct hp_order *, struct policyhead *);
210static int matchlen(struct sockaddr *, struct sockaddr *);
211static int comp_dst(const void *, const void *);
212static int gai_addr2scopetype(struct sockaddr *);
213#endif
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;
214
215/*
216 * Functions defined in RFC2553
217 * getipnodebyname, getipnodebyaddr, freehostent
218 */
219
220struct hostent *
221getipnodebyname(const char *name, int af, int flags, int *errp)

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

306 }
307 }
308#endif
309
310 if (hp == NULL)
311 *errp = statp->res_h_errno;
312
313 statp->options = options;
314#ifdef ENABLE_IP6ADDRCTL
312 return _hpreorder(_hpsort(hp, statp));
315 return _hpreorder(_hpsort(hp, statp));
316#else
317 return _hpsort(hp, statp);
318#endif
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
319}
320
321struct hostent *
322getipnodebyaddr(const void *src, size_t len, int af, int *errp)
323{
324 struct hostent *hp;
325 res_state statp;
326 u_long options;

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

633 order[i] = order[j];
634 order[j] = t;
635 }
636 }
637 }
638 return hp;
639}
640
641#ifdef ENABLE_IP6ADDRCTL
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}
642/*
643 * _hpreorder: sort address by default address selection
644 */
645static struct hostent *
646_hpreorder(struct hostent *hp)
647{
648 struct hp_order *aio;
649 int i, n;

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

1111 return(2);
1112 return(14);
1113 break;
1114 default:
1115 errno = EAFNOSUPPORT; /* is this a good error? */
1116 return(-1);
1117 }
1118}
1119#endif