summaryrefslogtreecommitdiffstats
path: root/usr.bin/telnet
diff options
context:
space:
mode:
authorshin <shin@FreeBSD.org>2000-03-03 11:13:12 +0000
committershin <shin@FreeBSD.org>2000-03-03 11:13:12 +0000
commit73d476cc6479c6344b1bd61ca4519254b46d544c (patch)
treed561c1b7b5d50f03f48de22a70eff74d82d43c59 /usr.bin/telnet
parent91b0fd96fd89837d8fb4bcf2d16d5dca2213c1a4 (diff)
downloadFreeBSD-src-73d476cc6479c6344b1bd61ca4519254b46d544c.zip
FreeBSD-src-73d476cc6479c6344b1bd61ca4519254b46d544c.tar.gz
CMSG_XXX macros alignment fixes to follow RFC2292.
Approved by: jkh Submitted by: Partly from tech@openbsd Reviewed by: itojun
Diffstat (limited to 'usr.bin/telnet')
-rw-r--r--usr.bin/telnet/commands.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c
index 0beb906..c0c6b2c 100644
--- a/usr.bin/telnet/commands.c
+++ b/usr.bin/telnet/commands.c
@@ -2879,19 +2879,18 @@ sourceroute(ai, arg, cpp, lenp, protop, optp)
* at least 7 bytes for the option.
*/
if (cpp == NULL || lenp == NULL)
- return((unsigned long)-1);
+ return -1;
if (*cpp != NULL) {
switch (res->ai_family) {
case AF_INET:
if (*lenp < 7)
- return((unsigned long)-1);
+ return -1;
break;
#ifdef INET6
case AF_INET6:
- if (*lenp < (sizeof(struct cmsghdr) +
- sizeof(struct ip6_rthdr) +
- sizeof(struct in6_addr)))
- return((unsigned long)-1);
+ if (*lenp < CMSG_SPACE(sizeof(struct ip6_rthdr) +
+ sizeof(struct in6_addr)))
+ return -1;
break;
#endif
}
@@ -2904,7 +2903,7 @@ sourceroute(ai, arg, cpp, lenp, protop, optp)
lsrp = *cpp;
ep = lsrp + *lenp;
} else {
- *cpp = lsrp = buf;
+ *cpp = lsrp = ALIGN(buf);
ep = lsrp + 1024;
}
@@ -2940,7 +2939,7 @@ sourceroute(ai, arg, cpp, lenp, protop, optp)
#endif
if (*cp != '@')
- return((unsigned long)-1);
+ return -1;
#ifndef sysV88
lsrp++; /* skip over length, we'll fill it in later */
@@ -3016,16 +3015,15 @@ sourceroute(ai, arg, cpp, lenp, protop, optp)
*/
#ifdef INET6
if (res->ai_family == AF_INET6) {
- if (((char *)cmsg +
- sizeof(struct cmsghdr) +
+ if (((char *)CMSG_DATA(cmsg) +
sizeof(struct ip6_rthdr) +
((inet6_rthdr_segments(cmsg) + 1) *
sizeof(struct in6_addr))) > ep)
- return((unsigned long)-1);
+ return -1;
} else
#endif
if (lsrp + 4 > ep)
- return((unsigned long)-1);
+ return -1;
freeaddrinfo(res);
}
#ifdef INET6
@@ -3039,7 +3037,7 @@ sourceroute(ai, arg, cpp, lenp, protop, optp)
if ((*(*cpp+IPOPT_OLEN) = lsrp - *cpp) <= 7) {
*cpp = 0;
*lenp = 0;
- return((unsigned long)-1);
+ return -1;
}
*lsrp++ = IPOPT_NOP; /* 32 bit word align it */
*lenp = lsrp - *cpp;
@@ -3048,7 +3046,7 @@ sourceroute(ai, arg, cpp, lenp, protop, optp)
if (ipopt.io_len <= 5) { /* Is 3 better ? */
*cpp = 0;
*lenp = 0;
- return((unsigned long)-1);
+ return -1;
}
*lenp = sizeof(ipopt);
*cpp = (char *) &ipopt;
OpenPOWER on IntegriCloud