NI_WITHSCOPEID cleanup. Neither RFC 2553 nor RFC 3493 defines
NI_WITHSCOPEID, and our getaddrinfo(3) does nothing special for it, now.
This commit is contained in:
parent
8dcb56dc78
commit
4f10131848
@ -366,11 +366,9 @@ char *string;
|
||||
return NO;
|
||||
memcpy(&addr, res->ai_addr, sizeof(addr));
|
||||
freeaddrinfo(res);
|
||||
#ifdef NI_WITHSCOPEID
|
||||
if (pat.sin6_scope_id != 0 &&
|
||||
addr.sin6_scope_id != pat.sin6_scope_id)
|
||||
return NO;
|
||||
#endif
|
||||
return (!memcmp(&pat.sin6_addr, &addr.sin6_addr,
|
||||
sizeof(struct in6_addr)));
|
||||
return (ret);
|
||||
@ -472,10 +470,8 @@ char *string;
|
||||
if ((mask_len = atoi(mask_tok)) < 0 || mask_len > 128)
|
||||
return NO;
|
||||
|
||||
#ifdef NI_WITHSCOPEID
|
||||
if (net.sin6_scope_id != 0 && addr.sin6_scope_id != net.sin6_scope_id)
|
||||
return NO;
|
||||
#endif
|
||||
while (mask_len > 0) {
|
||||
if (mask_len < 32) {
|
||||
mask = htonl(~(0xffffffff >> mask_len));
|
||||
|
@ -32,11 +32,7 @@ static char sccsid[] = "@(#) socket.c 1.15 97/03/21 19:27:24";
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef INET6
|
||||
#ifndef NI_WITHSCOPEID
|
||||
#define NI_WITHSCOPEID 0
|
||||
#endif
|
||||
#else
|
||||
#ifndef INET6
|
||||
extern char *inet_ntoa();
|
||||
#endif
|
||||
|
||||
@ -159,7 +155,7 @@ struct host_info *host;
|
||||
: sizeof(struct sockaddr_in6);
|
||||
#endif
|
||||
getnameinfo(sin, salen, host->addr, sizeof(host->addr),
|
||||
NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID);
|
||||
NULL, 0, NI_NUMERICHOST);
|
||||
#else
|
||||
struct sockaddr_in *sin = host->sin;
|
||||
|
||||
@ -211,7 +207,7 @@ struct host_info *host;
|
||||
}
|
||||
if (ap)
|
||||
err = getnameinfo(sin, salen, hname, sizeof(hname),
|
||||
NULL, 0, NI_WITHSCOPEID | NI_NAMEREQD);
|
||||
NULL, 0, NI_NAMEREQD);
|
||||
}
|
||||
if (!err) {
|
||||
|
||||
@ -316,7 +312,7 @@ struct host_info *host;
|
||||
*/
|
||||
|
||||
getnameinfo(sin, salen, hname, sizeof(hname),
|
||||
NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID);
|
||||
NULL, 0, NI_NUMERICHOST);
|
||||
tcpd_warn("host name/address mismatch: %s != %.*s",
|
||||
hname, STRING_LENGTH,
|
||||
(res0->ai_canonname == NULL) ? "" : res0->ai_canonname);
|
||||
|
@ -63,11 +63,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <arpa/nameser.h>
|
||||
#include "un-namespace.h"
|
||||
|
||||
/* wrapper for KAME-special getnameinfo() */
|
||||
#ifndef NI_WITHSCOPEID
|
||||
#define NI_WITHSCOPEID 0
|
||||
#endif
|
||||
|
||||
extern int innetgr( const char *, const char *, const char *, const char * );
|
||||
|
||||
#define max(a, b) ((a > b) ? a : b)
|
||||
@ -197,10 +192,8 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
|
||||
if (nres > 1) {
|
||||
int oerrno = errno;
|
||||
|
||||
getnameinfo(ai->ai_addr, ai->ai_addrlen,
|
||||
paddr, sizeof(paddr),
|
||||
NULL, 0,
|
||||
NI_NUMERICHOST|NI_WITHSCOPEID);
|
||||
getnameinfo(ai->ai_addr, ai->ai_addrlen, paddr,
|
||||
sizeof(paddr), NULL, 0, NI_NUMERICHOST);
|
||||
(void)fprintf(stderr, "connect to address %s: ",
|
||||
paddr);
|
||||
errno = oerrno;
|
||||
@ -218,10 +211,8 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
|
||||
refused = 0;
|
||||
}
|
||||
if (nres > 1) {
|
||||
getnameinfo(ai->ai_addr, ai->ai_addrlen,
|
||||
paddr, sizeof(paddr),
|
||||
NULL, 0,
|
||||
NI_NUMERICHOST|NI_WITHSCOPEID);
|
||||
getnameinfo(ai->ai_addr, ai->ai_addrlen, paddr,
|
||||
sizeof(paddr), NULL, 0, NI_NUMERICHOST);
|
||||
fprintf(stderr, "Trying %s...\n", paddr);
|
||||
}
|
||||
}
|
||||
@ -717,9 +708,6 @@ __ivaliduser_sa(hostf, raddr, salen, luser, ruser)
|
||||
|
||||
/*
|
||||
* Returns "true" if match, 0 if no match.
|
||||
*
|
||||
* NI_WITHSCOPEID is useful for comparing sin6_scope_id portion
|
||||
* if af == AF_INET6.
|
||||
*/
|
||||
static int
|
||||
__icheckhost(raddr, salen, lhost)
|
||||
@ -748,7 +736,7 @@ __icheckhost(raddr, salen, lhost)
|
||||
|
||||
h1[0] = '\0';
|
||||
if (getnameinfo(raddr, salen, h1, sizeof(h1), NULL, 0,
|
||||
NI_NUMERICHOST | NI_WITHSCOPEID) != 0)
|
||||
NI_NUMERICHOST) != 0)
|
||||
return (0);
|
||||
|
||||
/* Resolve laddr into sockaddr */
|
||||
@ -763,7 +751,7 @@ __icheckhost(raddr, salen, lhost)
|
||||
for (r = res; r ; r = r->ai_next) {
|
||||
h2[0] = '\0';
|
||||
if (getnameinfo(r->ai_addr, r->ai_addrlen, h2, sizeof(h2),
|
||||
NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID) != 0)
|
||||
NULL, 0, NI_NUMERICHOST) != 0)
|
||||
continue;
|
||||
if (strcmp(h1, h2) == 0) {
|
||||
freeaddrinfo(res);
|
||||
|
@ -141,8 +141,7 @@ static void Perror(FILE *, char *, int);
|
||||
char pbuf[NI_MAXSERV];
|
||||
|
||||
if (getnameinfo(address, address->sa_len, abuf, sizeof(abuf),
|
||||
pbuf, sizeof(pbuf),
|
||||
NI_NUMERICHOST|NI_NUMERICSERV|NI_WITHSCOPEID) != 0) {
|
||||
pbuf, sizeof(pbuf), NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
|
||||
strncpy(abuf, "?", sizeof(abuf));
|
||||
strncpy(pbuf, "?", sizeof(pbuf));
|
||||
}
|
||||
@ -444,7 +443,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
|
||||
Dprint((_res.options & RES_DEBUG) &&
|
||||
getnameinfo(nsap, salen, abuf, sizeof(abuf),
|
||||
NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID) == 0,
|
||||
NULL, 0, NI_NUMERICHOST) == 0,
|
||||
(stdout, ";; Querying server (# %d) address = %s\n",
|
||||
ns + 1, abuf));
|
||||
|
||||
|
@ -54,11 +54,6 @@ static char sccsid[] = "@(#)logwtmp.c 8.1 (Berkeley) 6/4/93";
|
||||
#include <unistd.h>
|
||||
#include <utmp.h>
|
||||
|
||||
/* wrapper for KAME-special getnameinfo() */
|
||||
#ifndef NI_WITHSCOPEID
|
||||
#define NI_WITHSCOPEID 0
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
logwtmp(const char *line, const char *name, const char *host)
|
||||
@ -86,7 +81,7 @@ logwtmp(const char *line, const char *name, const char *host)
|
||||
else {
|
||||
error = getnameinfo(res->ai_addr, res->ai_addrlen,
|
||||
fullhost, strlen(fullhost), NULL, 0,
|
||||
NI_NUMERICHOST|NI_WITHSCOPEID);
|
||||
NI_NUMERICHOST);
|
||||
if (error != 0) {
|
||||
fprintf(stderr, "%d", error);
|
||||
host = "invalid hostname";
|
||||
|
@ -39,11 +39,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "libutil.h"
|
||||
|
||||
/* wrapper for KAME-special getnameinfo() */
|
||||
#ifndef NI_WITHSCOPEID
|
||||
#define NI_WITHSCOPEID 0
|
||||
#endif
|
||||
|
||||
struct sockinet {
|
||||
u_char si_len;
|
||||
u_char si_family;
|
||||
@ -119,7 +114,7 @@ realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, int addrlen)
|
||||
#endif
|
||||
|
||||
error = getnameinfo(addr, addrlen, buf, sizeof(buf), NULL, 0,
|
||||
NI_WITHSCOPEID | NI_NAMEREQD);
|
||||
NI_NAMEREQD);
|
||||
if (error == 0) {
|
||||
struct addrinfo hints, *res, *ores;
|
||||
struct sockaddr *sa;
|
||||
@ -181,7 +176,7 @@ realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, int addrlen)
|
||||
} else {
|
||||
numeric:
|
||||
if (getnameinfo(addr, addrlen, buf, sizeof(buf), NULL, 0,
|
||||
NI_NUMERICHOST|NI_WITHSCOPEID) == 0)
|
||||
NI_NUMERICHOST) == 0)
|
||||
strncpy(host, buf, hsize);
|
||||
}
|
||||
|
||||
|
@ -94,11 +94,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#define ARGSTR "Daln"
|
||||
|
||||
/* wrapper for KAME-special getnameinfo() */
|
||||
#ifndef NI_WITHSCOPEID
|
||||
#define NI_WITHSCOPEID 0
|
||||
#endif
|
||||
|
||||
char *env[2];
|
||||
#define NMAX 30
|
||||
char lusername[NMAX+1], rusername[NMAX+1];
|
||||
@ -233,7 +228,7 @@ doit(int f, union sockunion *fromp)
|
||||
getnameinfo((struct sockaddr *)fromp,
|
||||
fromp->su_len,
|
||||
nameinfo, sizeof(nameinfo), NULL, 0,
|
||||
NI_NUMERICHOST|NI_WITHSCOPEID);
|
||||
NI_NUMERICHOST);
|
||||
/* error check ? */
|
||||
syslog(LOG_NOTICE, "Connection from %s on illegal port",
|
||||
nameinfo);
|
||||
|
@ -266,7 +266,7 @@ main(int argc, char *argv[])
|
||||
unmappedaddr((struct sockaddr_in6 *)&ss);
|
||||
getnameinfo((struct sockaddr *)&ss, ss.ss_len,
|
||||
hbuf, sizeof(hbuf), NULL, 0,
|
||||
NI_NUMERICHOST | NI_WITHSCOPEID);
|
||||
NI_NUMERICHOST);
|
||||
asprintf(&tempchroot, "%s/%s", chroot_dir, hbuf);
|
||||
if (ipchroot == 2)
|
||||
statret = stat(tempchroot, &sb);
|
||||
@ -487,8 +487,7 @@ option_fail:
|
||||
char hbuf[NI_MAXHOST];
|
||||
|
||||
getnameinfo((struct sockaddr *)&from, from.ss_len,
|
||||
hbuf, sizeof(hbuf), NULL, 0,
|
||||
NI_WITHSCOPEID);
|
||||
hbuf, sizeof(hbuf), NULL, 0, 0);
|
||||
syslog(LOG_INFO, "%s: %s request for %s: %s", hbuf,
|
||||
tp->th_opcode == WRQ ? "write" : "read",
|
||||
filename, errtomsg(ecode));
|
||||
|
@ -86,11 +86,6 @@ static const char rcsid[] =
|
||||
|
||||
#include "pathnames.h"
|
||||
|
||||
/* wrapper for KAME-special getnameinfo() */
|
||||
#ifndef NI_WITHSCOPEID
|
||||
#define NI_WITHSCOPEID 0
|
||||
#endif
|
||||
|
||||
void badlogin(char *);
|
||||
void checknologin(void);
|
||||
void dolastlog(int);
|
||||
@ -234,8 +229,7 @@ main(argc, argv)
|
||||
res->ai_addrlen,
|
||||
hostbuf,
|
||||
sizeof(hostbuf), NULL, 0,
|
||||
NI_NUMERICHOST|
|
||||
NI_WITHSCOPEID);
|
||||
NI_NUMERICHOST);
|
||||
optarg = strdup(hostbuf);
|
||||
if (optarg == NULL) {
|
||||
syslog(LOG_NOTICE,
|
||||
@ -480,7 +474,7 @@ main(argc, argv)
|
||||
|
||||
getnameinfo(res->ai_addr, res->ai_addrlen,
|
||||
hostbuf, sizeof(hostbuf), NULL, 0,
|
||||
NI_NUMERICHOST|NI_WITHSCOPEID);
|
||||
NI_NUMERICHOST);
|
||||
if ((optarg = strdup(hostbuf)) == NULL) {
|
||||
syslog(LOG_NOTICE, "strdup(): %m");
|
||||
sleepexit(1);
|
||||
|
@ -57,11 +57,6 @@ static const char rcsid[] =
|
||||
|
||||
#include "ifconfig.h"
|
||||
|
||||
/* wrapper for KAME-special getnameinfo() */
|
||||
#ifndef NI_WITHSCOPEID
|
||||
#define NI_WITHSCOPEID 0
|
||||
#endif
|
||||
|
||||
static struct in6_ifreq in6_ridreq;
|
||||
static struct in6_aliasreq in6_addreq =
|
||||
{ { 0 },
|
||||
@ -236,8 +231,7 @@ in6_status(int s __unused, const struct rt_addrinfo * info)
|
||||
scopeid = sin->sin6_scope_id;
|
||||
|
||||
error = getnameinfo((struct sockaddr *)sin, sin->sin6_len, addr_buf,
|
||||
sizeof(addr_buf), NULL, 0,
|
||||
NI_NUMERICHOST|NI_WITHSCOPEID);
|
||||
sizeof(addr_buf), NULL, 0, NI_NUMERICHOST);
|
||||
if (error != 0)
|
||||
inet_ntop(AF_INET6, &sin->sin6_addr, addr_buf,
|
||||
sizeof(addr_buf));
|
||||
@ -267,7 +261,7 @@ in6_status(int s __unused, const struct rt_addrinfo * info)
|
||||
error = getnameinfo((struct sockaddr *)sin,
|
||||
sin->sin6_len, addr_buf,
|
||||
sizeof(addr_buf), NULL, 0,
|
||||
NI_NUMERICHOST|NI_WITHSCOPEID);
|
||||
NI_NUMERICHOST);
|
||||
if (error != 0)
|
||||
inet_ntop(AF_INET6, &sin->sin6_addr, addr_buf,
|
||||
sizeof(addr_buf));
|
||||
@ -454,11 +448,6 @@ in6_status_tunnel(int s)
|
||||
{
|
||||
char src[NI_MAXHOST];
|
||||
char dst[NI_MAXHOST];
|
||||
#ifdef NI_WITHSCOPEID
|
||||
const int niflag = NI_NUMERICHOST | NI_WITHSCOPEID;
|
||||
#else
|
||||
const int niflag = NI_NUMERICHOST;
|
||||
#endif
|
||||
struct in6_ifreq in6_ifr;
|
||||
const struct sockaddr *sa = (const struct sockaddr *) &in6_ifr.ifr_addr;
|
||||
|
||||
@ -469,14 +458,16 @@ in6_status_tunnel(int s)
|
||||
return;
|
||||
if (sa->sa_family == AF_INET6)
|
||||
in6_fillscopeid(&in6_ifr.ifr_addr);
|
||||
if (getnameinfo(sa, sa->sa_len, src, sizeof(src), 0, 0, niflag) != 0)
|
||||
if (getnameinfo(sa, sa->sa_len, src, sizeof(src), 0, 0,
|
||||
NI_NUMERICHOST) != 0)
|
||||
src[0] = '\0';
|
||||
|
||||
if (ioctl(s, SIOCGIFPDSTADDR_IN6, (caddr_t)&in6_ifr) < 0)
|
||||
return;
|
||||
if (sa->sa_family == AF_INET6)
|
||||
in6_fillscopeid(&in6_ifr.ifr_addr);
|
||||
if (getnameinfo(sa, sa->sa_len, dst, sizeof(dst), 0, 0, niflag) != 0)
|
||||
if (getnameinfo(sa, sa->sa_len, dst, sizeof(dst), 0, 0,
|
||||
NI_NUMERICHOST) != 0)
|
||||
dst[0] = '\0';
|
||||
|
||||
printf("\ttunnel inet6 %s --> %s\n", src, dst);
|
||||
|
@ -352,9 +352,6 @@ routename(sa)
|
||||
{
|
||||
struct sockaddr_in6 sin6; /* use static var for safety */
|
||||
int niflags = 0;
|
||||
#ifdef NI_WITHSCOPEID
|
||||
niflags = NI_WITHSCOPEID;
|
||||
#endif
|
||||
|
||||
memset(&sin6, 0, sizeof(sin6));
|
||||
memcpy(&sin6, sa, sa->sa_len);
|
||||
@ -480,9 +477,6 @@ netname(sa)
|
||||
{
|
||||
struct sockaddr_in6 sin6; /* use static var for safety */
|
||||
int niflags = 0;
|
||||
#ifdef NI_WITHSCOPEID
|
||||
niflags = NI_WITHSCOPEID;
|
||||
#endif
|
||||
|
||||
memset(&sin6, 0, sizeof(sin6));
|
||||
memcpy(&sin6, sa, sa->sa_len);
|
||||
|
@ -903,7 +903,7 @@ netname6(struct sockaddr_in6 *sa6, struct in6_addr *mask)
|
||||
static char line[MAXHOSTNAMELEN];
|
||||
u_char *p = (u_char *)mask;
|
||||
u_char *lim;
|
||||
int masklen, illegal = 0, flag = NI_WITHSCOPEID;
|
||||
int masklen, illegal = 0, flag = 0;
|
||||
|
||||
if (mask) {
|
||||
for (masklen = 0, lim = p + 16; p < lim; p++) {
|
||||
@ -963,7 +963,7 @@ char *
|
||||
routename6(struct sockaddr_in6 *sa6)
|
||||
{
|
||||
static char line[MAXHOSTNAMELEN];
|
||||
int flag = NI_WITHSCOPEID;
|
||||
int flag = 0;
|
||||
/* use local variable for safety */
|
||||
struct sockaddr_in6 sa6_local = {AF_INET6, sizeof(sa6_local),};
|
||||
|
||||
|
@ -150,11 +150,6 @@ __FBSDID("$FreeBSD$");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* wrapper for KAME-special getnameinfo() */
|
||||
#ifndef NI_WITHSCOPEID
|
||||
#define NI_WITHSCOPEID 0
|
||||
#endif
|
||||
|
||||
#ifndef LIBWRAP_ALLOW_FACILITY
|
||||
# define LIBWRAP_ALLOW_FACILITY LOG_AUTH
|
||||
#endif
|
||||
@ -663,17 +658,13 @@ main(int argc, char **argv)
|
||||
getnameinfo((struct sockaddr *)&peermax,
|
||||
peer.sa_len,
|
||||
pname, sizeof(pname),
|
||||
NULL, 0,
|
||||
NI_NUMERICHOST|
|
||||
NI_WITHSCOPEID);
|
||||
NULL, 0, NI_NUMERICHOST);
|
||||
}
|
||||
} else {
|
||||
getnameinfo((struct sockaddr *)&peermax,
|
||||
peer.sa_len,
|
||||
pname, sizeof(pname),
|
||||
NULL, 0,
|
||||
NI_NUMERICHOST|
|
||||
NI_WITHSCOPEID);
|
||||
NULL, 0, NI_NUMERICHOST);
|
||||
}
|
||||
syslog(LOG_INFO,"%s from %s", sep->se_service, pname);
|
||||
}
|
||||
@ -2117,7 +2108,7 @@ inetd_setproctitle(const char *a, int s)
|
||||
size = sizeof(ss);
|
||||
if (getpeername(s, (struct sockaddr *)&ss, &size) == 0) {
|
||||
getnameinfo((struct sockaddr *)&ss, size, pbuf, sizeof(pbuf),
|
||||
NULL, 0, NI_NUMERICHOST|NI_WITHSCOPEID);
|
||||
NULL, 0, NI_NUMERICHOST);
|
||||
(void) sprintf(buf, "%s [%s]", a, pbuf);
|
||||
} else
|
||||
(void) sprintf(buf, "%s", a);
|
||||
@ -2152,7 +2143,7 @@ check_loop(const struct sockaddr *sa, const struct servtab *sep)
|
||||
}
|
||||
isloop:
|
||||
getnameinfo(sa, sa->sa_len, pname, sizeof(pname), NULL, 0,
|
||||
NI_NUMERICHOST|NI_WITHSCOPEID);
|
||||
NI_NUMERICHOST);
|
||||
syslog(LOG_WARNING, "%s/%s:%s/%s loop request REFUSED from %s",
|
||||
sep->se_service, sep->se_proto,
|
||||
se2->se_service, se2->se_proto,
|
||||
@ -2346,7 +2337,7 @@ cpmip(const struct servtab *sep, int ctrl)
|
||||
getnameinfo((struct sockaddr *)&rss,
|
||||
((struct sockaddr *)&rss)->sa_len,
|
||||
pname, sizeof(pname), NULL, 0,
|
||||
NI_NUMERICHOST|NI_WITHSCOPEID);
|
||||
NI_NUMERICHOST);
|
||||
r = -1;
|
||||
syslog(LOG_ERR,
|
||||
"%s from %s exceeded counts/min (limit %d/min)",
|
||||
@ -2396,13 +2387,13 @@ search_conn(struct servtab *sep, int ctrl)
|
||||
}
|
||||
|
||||
if (getnameinfo((struct sockaddr *)&ss, sslen, pname, sizeof(pname),
|
||||
NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID) != 0)
|
||||
NULL, 0, NI_NUMERICHOST) != 0)
|
||||
return NULL;
|
||||
|
||||
LIST_FOREACH(conn, &sep->se_conn[hv], co_link) {
|
||||
if (getnameinfo((struct sockaddr *)&conn->co_addr,
|
||||
conn->co_addr.ss_len, pname2, sizeof(pname2), NULL, 0,
|
||||
NI_NUMERICHOST | NI_WITHSCOPEID) == 0 &&
|
||||
NI_NUMERICHOST) == 0 &&
|
||||
strcmp(pname, pname2) == 0)
|
||||
break;
|
||||
}
|
||||
@ -2439,7 +2430,7 @@ room_conn(struct servtab *sep, struct conninfo *conn)
|
||||
if (conn->co_numchild >= sep->se_maxperip) {
|
||||
getnameinfo((struct sockaddr *)&conn->co_addr,
|
||||
conn->co_addr.ss_len, pname, sizeof(pname), NULL, 0,
|
||||
NI_NUMERICHOST | NI_WITHSCOPEID);
|
||||
NI_NUMERICHOST);
|
||||
syslog(LOG_ERR, "%s from %s exceeded counts (limit %d)",
|
||||
sep->se_service, pname, sep->se_maxperip);
|
||||
return 0;
|
||||
|
@ -227,11 +227,6 @@ int got_sighup = 0;
|
||||
|
||||
int opt_flags;
|
||||
static int have_v6 = 1;
|
||||
#ifdef NI_WITHSCOPEID
|
||||
static const int ninumeric = NI_NUMERICHOST | NI_WITHSCOPEID;
|
||||
#else
|
||||
static const int ninumeric = NI_NUMERICHOST;
|
||||
#endif
|
||||
|
||||
int mountdlockfd;
|
||||
/* Bits for opt_flags above */
|
||||
@ -1692,7 +1687,7 @@ get_host(cp, grp, tgrp)
|
||||
while (ai != NULL) {
|
||||
if (ai->ai_canonname == NULL) {
|
||||
if (getnameinfo(ai->ai_addr, ai->ai_addrlen, host,
|
||||
sizeof host, NULL, 0, ninumeric) != 0)
|
||||
sizeof host, NULL, 0, NI_NUMERICHOST) != 0)
|
||||
strlcpy(host, "?", sizeof(host));
|
||||
ai->ai_canonname = strdup(host);
|
||||
ai->ai_flags |= AI_CANONNAME;
|
||||
@ -2009,7 +2004,7 @@ get_net(cp, net, maskflg)
|
||||
if (np) {
|
||||
name = np->n_name;
|
||||
} else if (getnameinfo(sa, sa->sa_len, netname, sizeof netname,
|
||||
NULL, 0, ninumeric) == 0) {
|
||||
NULL, 0, NI_NUMERICHOST) == 0) {
|
||||
name = netname;
|
||||
} else {
|
||||
goto fail;
|
||||
|
@ -388,13 +388,8 @@ ncpaddr_ntowa(const struct ncpaddr *addr)
|
||||
#if 0
|
||||
adjust_linklocal(&sin6);
|
||||
#endif
|
||||
#ifdef NI_WITHSCOPEID
|
||||
if (getnameinfo((struct sockaddr *)&sin6, sizeof sin6, res, sizeof(res),
|
||||
NULL, 0, NI_WITHSCOPEID | NI_NUMERICHOST) != 0)
|
||||
#else
|
||||
if (getnameinfo((struct sockaddr *)&sin6, sizeof sin6, res, sizeof(res),
|
||||
NULL, 0, NI_NUMERICHOST) != 0)
|
||||
#endif
|
||||
break;
|
||||
|
||||
return res;
|
||||
|
@ -56,11 +56,6 @@
|
||||
|
||||
#include "route6d.h"
|
||||
|
||||
/* wrapper for KAME-special getnameinfo() */
|
||||
#ifndef NI_WITHSCOPEID
|
||||
#define NI_WITHSCOPEID 0
|
||||
#endif
|
||||
|
||||
int s;
|
||||
struct sockaddr_in6 sin6;
|
||||
struct rip6 *ripbuf;
|
||||
@ -192,7 +187,7 @@ sa_n2a(sa)
|
||||
static char buf[NI_MAXHOST];
|
||||
|
||||
if (getnameinfo(sa, sa->sa_len, buf, sizeof(buf),
|
||||
NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID) != 0) {
|
||||
NULL, 0, NI_NUMERICHOST) != 0) {
|
||||
snprintf(buf, sizeof(buf), "%s", "(invalid)");
|
||||
}
|
||||
return buf;
|
||||
|
@ -113,12 +113,6 @@ __FBSDID("$FreeBSD$");
|
||||
#define SYSLOG_NAMES
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#ifdef NI_WITHSCOPEID
|
||||
static const int withscopeid = NI_WITHSCOPEID;
|
||||
#else
|
||||
static const int withscopeid;
|
||||
#endif
|
||||
|
||||
const char *ConfFile = _PATH_LOGCONF;
|
||||
const char *PidFile = _PATH_LOGPID;
|
||||
const char ctty[] = _PATH_CONSOLE;
|
||||
@ -1386,8 +1380,7 @@ cvthname(struct sockaddr *f)
|
||||
|
||||
error = getnameinfo((struct sockaddr *)f,
|
||||
((struct sockaddr *)f)->sa_len,
|
||||
ip, sizeof ip, NULL, 0,
|
||||
NI_NUMERICHOST | withscopeid);
|
||||
ip, sizeof ip, NULL, 0, NI_NUMERICHOST);
|
||||
dprintf("cvthname(%s)\n", ip);
|
||||
|
||||
if (error) {
|
||||
@ -1402,8 +1395,7 @@ cvthname(struct sockaddr *f)
|
||||
sigprocmask(SIG_BLOCK, &nmask, &omask);
|
||||
error = getnameinfo((struct sockaddr *)f,
|
||||
((struct sockaddr *)f)->sa_len,
|
||||
hname, sizeof hname, NULL, 0,
|
||||
NI_NAMEREQD | withscopeid);
|
||||
hname, sizeof hname, NULL, 0, NI_NAMEREQD);
|
||||
sigprocmask(SIG_SETMASK, &omask, NULL);
|
||||
if (error) {
|
||||
dprintf("Host name for your address (%s) unknown\n", ip);
|
||||
@ -2236,13 +2228,11 @@ allowaddr(char *s)
|
||||
printf("numeric, ");
|
||||
getnameinfo((struct sockaddr *)&ap.a_addr,
|
||||
((struct sockaddr *)&ap.a_addr)->sa_len,
|
||||
ip, sizeof ip, NULL, 0,
|
||||
NI_NUMERICHOST | withscopeid);
|
||||
ip, sizeof ip, NULL, 0, NI_NUMERICHOST);
|
||||
printf("addr = %s, ", ip);
|
||||
getnameinfo((struct sockaddr *)&ap.a_mask,
|
||||
((struct sockaddr *)&ap.a_mask)->sa_len,
|
||||
ip, sizeof ip, NULL, 0,
|
||||
NI_NUMERICHOST | withscopeid);
|
||||
ip, sizeof ip, NULL, 0, NI_NUMERICHOST);
|
||||
printf("mask = %s; ", ip);
|
||||
} else {
|
||||
printf("domainname = %s; ", ap.a_name);
|
||||
@ -2291,7 +2281,7 @@ validate(struct sockaddr *sa, const char *hname)
|
||||
strlcat(name, LocalDomain, sizeof name);
|
||||
}
|
||||
if (getnameinfo(sa, sa->sa_len, ip, sizeof ip, port, sizeof port,
|
||||
NI_NUMERICHOST | withscopeid | NI_NUMERICSERV) != 0)
|
||||
NI_NUMERICHOST | NI_NUMERICSERV) != 0)
|
||||
return (0); /* for safety, should not occur */
|
||||
dprintf("validate: dgram from IP %s, port %s, name %s;\n",
|
||||
ip, port, name);
|
||||
@ -2324,13 +2314,11 @@ validate(struct sockaddr *sa, const char *hname)
|
||||
sin6 = (struct sockaddr_in6 *)sa;
|
||||
a6p = (struct sockaddr_in6 *)&ap->a_addr;
|
||||
m6p = (struct sockaddr_in6 *)&ap->a_mask;
|
||||
#ifdef NI_WITHSCOPEID
|
||||
if (a6p->sin6_scope_id != 0 &&
|
||||
sin6->sin6_scope_id != a6p->sin6_scope_id) {
|
||||
dprintf("rejected in rule %d due to scope mismatch.\n", i);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
reject = 0;
|
||||
for (j = 0; j < 16; j += 4) {
|
||||
if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[j] & *(u_int32_t *)&m6p->sin6_addr.s6_addr[j])
|
||||
|
Loading…
x
Reference in New Issue
Block a user