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 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 |
203#ifdef ENABLE_IP6ADDRCTL |
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 |
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 |
315 return _hpreorder(_hpsort(hp, statp)); |
316#else 317 return _hpsort(hp, statp); 318#endif |
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 |
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 |