Deleted Added
full compact
getaddrinfo.c (292539) getaddrinfo.c (298120)
1/* $KAME: getaddrinfo.c,v 1.15 2000/07/09 04:37:24 itojun Exp $ */
2
3/*
4 * Copyright (C) 1995, 1996, 1997, and 1998 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

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

47 * against NULL hostname (3) what is AI_ADDRCONFIG itself. AF not ready?
48 * non-loopback address configured? global address configured?
49 *
50 * OS specific notes for freebsd4:
51 * - FreeBSD supported $GAI. The code does not.
52 */
53
54#include <sys/cdefs.h>
1/* $KAME: getaddrinfo.c,v 1.15 2000/07/09 04:37:24 itojun Exp $ */
2
3/*
4 * Copyright (C) 1995, 1996, 1997, and 1998 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

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

47 * against NULL hostname (3) what is AI_ADDRCONFIG itself. AF not ready?
48 * non-loopback address configured? global address configured?
49 *
50 * OS specific notes for freebsd4:
51 * - FreeBSD supported $GAI. The code does not.
52 */
53
54#include <sys/cdefs.h>
55__FBSDID("$FreeBSD: head/lib/libc/net/getaddrinfo.c 292539 2015-12-21 11:24:14Z ume $");
55__FBSDID("$FreeBSD: head/lib/libc/net/getaddrinfo.c 298120 2016-04-16 17:52:00Z pfg $");
56
57#include "namespace.h"
58#include <sys/types.h>
59#include <sys/param.h>
60#include <sys/socket.h>
61#include <net/if.h>
62#include <netinet/in.h>
63#include <net/if_types.h>

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

393{
394 struct addrinfo sentinel;
395 struct addrinfo *cur;
396 int error = 0;
397 struct addrinfo ai, ai0, *afai;
398 struct addrinfo *pai;
399 const struct afd *afd;
400 const struct explore *ex;
56
57#include "namespace.h"
58#include <sys/types.h>
59#include <sys/param.h>
60#include <sys/socket.h>
61#include <net/if.h>
62#include <netinet/in.h>
63#include <net/if_types.h>

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

393{
394 struct addrinfo sentinel;
395 struct addrinfo *cur;
396 int error = 0;
397 struct addrinfo ai, ai0, *afai;
398 struct addrinfo *pai;
399 const struct afd *afd;
400 const struct explore *ex;
401 struct addrinfo *afailist[sizeof(afdl)/sizeof(afdl[0])];
401 struct addrinfo *afailist[nitems(afdl)];
402 struct addrinfo *afai_unspec;
403 int found;
404 int numeric = 0;
405
406 /* ensure we return NULL on errors */
407 *res = NULL;
408
409 memset(&ai, 0, sizeof(ai));

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

731get_addrselectpolicy(struct policyhead *head)
732{
733#ifdef INET6
734 int mib[] = { CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_ADDRCTLPOLICY };
735 size_t l;
736 char *buf;
737 struct in6_addrpolicy *pol, *ep;
738
402 struct addrinfo *afai_unspec;
403 int found;
404 int numeric = 0;
405
406 /* ensure we return NULL on errors */
407 *res = NULL;
408
409 memset(&ai, 0, sizeof(ai));

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

731get_addrselectpolicy(struct policyhead *head)
732{
733#ifdef INET6
734 int mib[] = { CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_ADDRCTLPOLICY };
735 size_t l;
736 char *buf;
737 struct in6_addrpolicy *pol, *ep;
738
739 if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), NULL, &l, NULL, 0) < 0)
739 if (sysctl(mib, nitems(mib), NULL, &l, NULL, 0) < 0)
740 return (0);
741 if (l == 0)
742 return (0);
743 if ((buf = malloc(l)) == NULL)
744 return (0);
740 return (0);
741 if (l == 0)
742 return (0);
743 if ((buf = malloc(l)) == NULL)
744 return (0);
745 if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), buf, &l, NULL, 0) < 0) {
745 if (sysctl(mib, nitems(mib), buf, &l, NULL, 0) < 0) {
746 free(buf);
747 return (0);
748 }
749
750 ep = (struct in6_addrpolicy *)(buf + l);
751 for (pol = (struct in6_addrpolicy *)buf; pol + 1 <= ep; pol++) {
752 struct policyqueue *new;
753

--- 2264 unchanged lines hidden ---
746 free(buf);
747 return (0);
748 }
749
750 ep = (struct in6_addrpolicy *)(buf + l);
751 for (pol = (struct in6_addrpolicy *)buf; pol + 1 <= ep; pol++) {
752 struct policyqueue *new;
753

--- 2264 unchanged lines hidden ---