stop use of NI_WITHSCOPEID. it was deprecated.

Obtained from:	KAME
This commit is contained in:
Hajimu UMEMOTO 2003-10-21 20:11:47 +00:00
parent 9a4f9608ad
commit d24cb2490d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=121316
8 changed files with 13 additions and 46 deletions

View file

@ -195,7 +195,9 @@ struct addrinfo {
#define NI_NAMEREQD 0x00000004
#define NI_NUMERICSERV 0x00000008
#define NI_DGRAM 0x00000010
#if 1 /* obsolete */
#define NI_WITHSCOPEID 0x00000020
#endif
/*
* Scope delimit character

View file

@ -178,16 +178,11 @@ These
flags are defined in
.In netdb.h .
.\"
.Sh EXTENSION
.Ss Extension for scoped IPv6 address
The implementation allows experimental numeric IPv6 address notation with
scope identifier.
IPv6 link-local address will appear as string like
.Dq Li fe80::1%ne0 ,
if
.Dv NI_WITHSCOPEID
bit is enabled in
.Fa flags
argument.
IPv6 link-local address will appear as a string like
.Dq Li fe80::1%ne0 .
Refer to
.Xr getaddrinfo 3
for the notation.

View file

@ -293,11 +293,7 @@ set_address(buf, len, sa)
size_t len;
struct sockaddr *sa;
{
#ifdef NI_WITHSCOPEID
const int niflags = NI_NUMERICHOST | NI_WITHSCOPEID;
#else
const int niflags = NI_NUMERICHOST;
#endif
if (len < 1)
return NULL;

View file

@ -497,11 +497,7 @@ str_ipaddr(sa)
struct sockaddr *sa;
{
static char buf[NI_MAXHOST];
#ifdef NI_WITHSCOPEID
const int niflag = NI_NUMERICHOST | NI_WITHSCOPEID;
#else
const int niflag = NI_NUMERICHOST;
#endif
if (sa == NULL)
return "";

View file

@ -2477,13 +2477,8 @@ pr_addr(addr, addrlen)
int addrlen;
{
static char buf[NI_MAXHOST];
int flag;
int flag = 0;
#ifdef NI_WITHSCOPEID
flag = NI_WITHSCOPEID;
#else
flag = 0;
#endif
if ((options & F_HOSTNAME) == 0)
flag |= NI_NUMERICHOST;

View file

@ -55,11 +55,7 @@ static void config_show __P((void));
#endif
struct config *config_list = NULL;
#ifdef NI_WITHSCOPEID
const int niflags = NI_NUMERICHOST | NI_WITHSCOPEID;
#else
const int niflags = NI_NUMERICHOST;
#endif
static int
prefix_set(s, prefix, slash)

View file

@ -87,11 +87,7 @@ const char *inet6_n2a(p)
static char buf[NI_MAXHOST];
struct sockaddr_in6 sin6;
u_int32_t scopeid;
#ifdef NI_WITHSCOPEID
const int niflags = NI_NUMERICHOST | NI_WITHSCOPEID;
#else
const int niflags = NI_NUMERICHOST;
#endif
memset(&sin6, 0, sizeof(sin6));
sin6.sin6_family = AF_INET6;

View file

@ -368,12 +368,6 @@ int waittime = 5; /* time to wait for response (in seconds) */
int nflag; /* print addresses numerically */
int lflag; /* print both numerical address & hostname */
#ifdef KAME_SCOPEID
const int niflag = NI_WITHSCOPEID;
#else
const int niflag = 0;
#endif
int
main(argc, argv)
int argc;
@ -793,8 +787,7 @@ main(argc, argv)
exit(1);
}
if (getnameinfo((struct sockaddr *)&Src, Src.sin6_len,
src0, sizeof(src0), NULL, 0,
NI_NUMERICHOST | niflag)) {
src0, sizeof(src0), NULL, 0, NI_NUMERICHOST)) {
Fprintf(stderr, "getnameinfo failed for source\n");
exit(1);
}
@ -828,7 +821,7 @@ main(argc, argv)
* Message to users
*/
if (getnameinfo((struct sockaddr *)&Dst, Dst.sin6_len, hbuf,
sizeof(hbuf), NULL, 0, NI_NUMERICHOST | niflag))
sizeof(hbuf), NULL, 0, NI_NUMERICHOST))
strlcpy(hbuf, "(invalid)", sizeof(hbuf));
Fprintf(stderr, "traceroute6");
Fprintf(stderr, " to %s (%s)", hostname, hbuf);
@ -1114,8 +1107,7 @@ packet_ok(mhdr, cc, seq)
if (cc < hlen + sizeof(struct icmp6_hdr)) {
if (verbose) {
if (getnameinfo((struct sockaddr *)from, from->sin6_len,
hbuf, sizeof(hbuf), NULL, 0,
NI_NUMERICHOST | niflag) != 0)
hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0)
strlcpy(hbuf, "invalid", sizeof(hbuf));
Printf("packet too short (%d bytes) from %s\n", cc,
hbuf);
@ -1128,8 +1120,7 @@ packet_ok(mhdr, cc, seq)
if (cc < sizeof(struct icmp6_hdr)) {
if (verbose) {
if (getnameinfo((struct sockaddr *)from, from->sin6_len,
hbuf, sizeof(hbuf), NULL, 0,
NI_NUMERICHOST | niflag) != 0)
hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0)
strlcpy(hbuf, "invalid", sizeof(hbuf));
Printf("data too short (%d bytes) from %s\n", cc, hbuf);
}
@ -1187,7 +1178,7 @@ packet_ok(mhdr, cc, seq)
char sbuf[NI_MAXHOST+1], dbuf[INET6_ADDRSTRLEN];
if (getnameinfo((struct sockaddr *)from, from->sin6_len,
sbuf, sizeof(sbuf), NULL, 0, NI_NUMERICHOST | niflag) != 0)
sbuf, sizeof(sbuf), NULL, 0, NI_NUMERICHOST) != 0)
strlcpy(sbuf, "invalid", sizeof(hbuf));
Printf("\n%d bytes from %s to %s", cc, sbuf,
rcvpktinfo ? inet_ntop(AF_INET6, &rcvpktinfo->ipi6_addr,
@ -1266,7 +1257,7 @@ print(mhdr, cc)
char hbuf[NI_MAXHOST];
if (getnameinfo((struct sockaddr *)from, from->sin6_len,
hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST | niflag) != 0)
hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0)
strlcpy(hbuf, "invalid", sizeof(hbuf));
if (nflag)
Printf(" %s", hbuf);
@ -1342,7 +1333,7 @@ inetname(sa)
return cp;
if (getnameinfo(sa, sa->sa_len, line, sizeof(line), NULL, 0,
NI_NUMERICHOST | niflag) != 0)
NI_NUMERICHOST) != 0)
strlcpy(line, "invalid", sizeof(line));
return line;
}