diff options
author | ume <ume@FreeBSD.org> | 2003-10-24 18:26:30 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2003-10-24 18:26:30 +0000 |
commit | 881c4fa39150df7d0de2dae7ae808f6a73cb199a (patch) | |
tree | 6ce05cb7459c9a9be90d670c12bfddbbbcb6946d /contrib/telnet | |
parent | 0b2009d038122fd790a91ca95c5d9044ff2715c0 (diff) | |
download | FreeBSD-src-881c4fa39150df7d0de2dae7ae808f6a73cb199a.zip FreeBSD-src-881c4fa39150df7d0de2dae7ae808f6a73cb199a.tar.gz |
Switch Advanced Sockets API for IPv6 from RFC2292 to RFC3542
(aka RFC2292bis). Though I believe this commit doesn't break
backward compatibility againt existing binaries, it breaks
backward compatibility of API.
Now, the applications which use Advanced Sockets API such as
telnet, ping6, mld6query and traceroute6 use RFC3542 API.
Obtained from: KAME
Diffstat (limited to 'contrib/telnet')
-rw-r--r-- | contrib/telnet/telnet/commands.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/contrib/telnet/telnet/commands.c b/contrib/telnet/telnet/commands.c index 2635a20..906a875 100644 --- a/contrib/telnet/telnet/commands.c +++ b/contrib/telnet/telnet/commands.c @@ -2846,7 +2846,7 @@ sourceroute(struct addrinfo *ai, char *arg, char **cpp, int *lenp, int *protop, struct sockaddr_in *_sin; #ifdef INET6 struct sockaddr_in6 *sin6; - struct cmsghdr *cmsg; + struct ip6_rthdr *rth; #endif struct addrinfo hints, *res; int error; @@ -2889,11 +2889,13 @@ sourceroute(struct addrinfo *ai, char *arg, char **cpp, int *lenp, int *protop, #ifdef INET6 if (ai->ai_family == AF_INET6) { - cmsg = inet6_rthdr_init(*cpp, IPV6_RTHDR_TYPE_0); + if ((rth = inet6_rth_init((void *)*cpp, sizeof(buf), + IPV6_RTHDR_TYPE_0, 0)) == NULL) + return -1; if (*cp != '@') return -1; *protop = IPPROTO_IPV6; - *optp = IPV6_PKTOPTIONS; + *optp = IPV6_RTHDR; } else #endif { @@ -2965,8 +2967,8 @@ sourceroute(struct addrinfo *ai, char *arg, char **cpp, int *lenp, int *protop, #ifdef INET6 if (res->ai_family == AF_INET6) { sin6 = (struct sockaddr_in6 *)res->ai_addr; - inet6_rthdr_add(cmsg, &sin6->sin6_addr, - IPV6_RTHDR_LOOSE); + if (inet6_rth_add((void *)rth, &sin6->sin6_addr) == -1) + return(0); } else #endif { @@ -2981,23 +2983,14 @@ sourceroute(struct addrinfo *ai, char *arg, char **cpp, int *lenp, int *protop, /* * Check to make sure there is space for next address */ -#ifdef INET6 - if (res->ai_family == AF_INET6) { - if (((char *)CMSG_DATA(cmsg) + - sizeof(struct ip6_rthdr) + - ((inet6_rthdr_segments(cmsg) + 1) * - sizeof(struct in6_addr))) > ep) - return -1; - } else -#endif if (lsrp + 4 > ep) return -1; freeaddrinfo(res); } #ifdef INET6 if (res->ai_family == AF_INET6) { - inet6_rthdr_lasthop(cmsg, IPV6_RTHDR_LOOSE); - *lenp = cmsg->cmsg_len; + rth->ip6r_len = rth->ip6r_segleft * 2; + *lenp = (rth->ip6r_len + 1) << 3; } else #endif { |