summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/ip6opt.c
diff options
context:
space:
mode:
authorotto <>2005-03-25 13:24:12 +0000
committerotto <>2005-03-25 13:24:12 +0000
commit2f490723a2e673b2457f65c4b06cacb7d700a3e8 (patch)
treec9dcd3a58da3f7404d9e626fe10abdd67c384fba /src/lib/libc/net/ip6opt.c
parent9a03506f8308b6023a12f108a2072feb958607a6 (diff)
downloadopenbsd-2f490723a2e673b2457f65c4b06cacb7d700a3e8.tar.gz
openbsd-2f490723a2e673b2457f65c4b06cacb7d700a3e8.tar.bz2
openbsd-2f490723a2e673b2457f65c4b06cacb7d700a3e8.zip
ansify. ok deraadt@ moritz@
Diffstat (limited to 'src/lib/libc/net/ip6opt.c')
-rw-r--r--src/lib/libc/net/ip6opt.c41
1 files changed, 12 insertions, 29 deletions
diff --git a/src/lib/libc/net/ip6opt.c b/src/lib/libc/net/ip6opt.c
index cbd49f0c22..565c0ed369 100644
--- a/src/lib/libc/net/ip6opt.c
+++ b/src/lib/libc/net/ip6opt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ip6opt.c,v 1.1 1999/12/11 08:09:11 itojun Exp $ */ 1/* $OpenBSD: ip6opt.c,v 1.2 2005/03/25 13:24:12 otto Exp $ */
2 2
3/* 3/*
4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -52,8 +52,7 @@ static void inet6_insert_padopt(u_char *p, int len);
52 * byte, the length byte, and the option data. 52 * byte, the length byte, and the option data.
53 */ 53 */
54int 54int
55inet6_option_space(nbytes) 55inet6_option_space(int nbytes)
56 int nbytes;
57{ 56{
58 nbytes += 2; /* we need space for nxt-hdr and length fields */ 57 nbytes += 2; /* we need space for nxt-hdr and length fields */
59 return(CMSG_SPACE((nbytes + 7) & ~7)); 58 return(CMSG_SPACE((nbytes + 7) & ~7));
@@ -65,12 +64,9 @@ inet6_option_space(nbytes)
65 * success or -1 on an error. 64 * success or -1 on an error.
66 */ 65 */
67int 66int
68inet6_option_init(bp, cmsgp, type) 67inet6_option_init(void *bp, struct cmsghdr **cmsgp, int type)
69 void *bp;
70 struct cmsghdr **cmsgp;
71 int type;
72{ 68{
73 register struct cmsghdr *ch = (struct cmsghdr *)bp; 69 struct cmsghdr *ch = (struct cmsghdr *)bp;
74 70
75 /* argument validation */ 71 /* argument validation */
76 if (type != IPV6_HOPOPTS && type != IPV6_DSTOPTS) 72 if (type != IPV6_HOPOPTS && type != IPV6_DSTOPTS)
@@ -95,14 +91,11 @@ inet6_option_init(bp, cmsgp, type)
95 * earlier. It must have a value between 0 and 7, inclusive. 91 * earlier. It must have a value between 0 and 7, inclusive.
96 */ 92 */
97int 93int
98inet6_option_append(cmsg, typep, multx, plusy) 94inet6_option_append(struct cmsghdr *cmsg, const u_int8_t *typep, int multx,
99 struct cmsghdr *cmsg; 95 int plusy)
100 const u_int8_t *typep;
101 int multx;
102 int plusy;
103{ 96{
104 int padlen, optlen, off; 97 int padlen, optlen, off;
105 register u_char *bp = (u_char *)cmsg + cmsg->cmsg_len; 98 u_char *bp = (u_char *)cmsg + cmsg->cmsg_len;
106 struct ip6_ext *eh = (struct ip6_ext *)CMSG_DATA(cmsg); 99 struct ip6_ext *eh = (struct ip6_ext *)CMSG_DATA(cmsg);
107 100
108 /* argument validation */ 101 /* argument validation */
@@ -170,14 +163,10 @@ inet6_option_append(cmsg, typep, multx, plusy)
170 * 163 *
171 */ 164 */
172u_int8_t * 165u_int8_t *
173inet6_option_alloc(cmsg, datalen, multx, plusy) 166inet6_option_alloc(struct cmsghdr *cmsg, int datalen, int multx, int plusy)
174 struct cmsghdr *cmsg;
175 int datalen;
176 int multx;
177 int plusy;
178{ 167{
179 int padlen, off; 168 int padlen, off;
180 register u_int8_t *bp = (u_char *)cmsg + cmsg->cmsg_len; 169 u_int8_t *bp = (u_char *)cmsg + cmsg->cmsg_len;
181 u_int8_t *retval; 170 u_int8_t *retval;
182 struct ip6_ext *eh = (struct ip6_ext *)CMSG_DATA(cmsg); 171 struct ip6_ext *eh = (struct ip6_ext *)CMSG_DATA(cmsg);
183 172
@@ -237,9 +226,7 @@ inet6_option_alloc(cmsg, datalen, multx, plusy)
237 * (RFC 2292, 6.3.5) 226 * (RFC 2292, 6.3.5)
238 */ 227 */
239int 228int
240inet6_option_next(cmsg, tptrp) 229inet6_option_next(const struct cmsghdr *cmsg, u_int8_t **tptrp)
241 const struct cmsghdr *cmsg;
242 u_int8_t **tptrp;
243{ 230{
244 struct ip6_ext *ip6e; 231 struct ip6_ext *ip6e;
245 int hdrlen, optlen; 232 int hdrlen, optlen;
@@ -295,10 +282,7 @@ inet6_option_next(cmsg, tptrp)
295 * it's a typo. The variable should be type of u_int8_t **. 282 * it's a typo. The variable should be type of u_int8_t **.
296 */ 283 */
297int 284int
298inet6_option_find(cmsg, tptrp, type) 285inet6_option_find(const struct cmsghdr *cmsg, u_int8_t **tptrp, int type)
299 const struct cmsghdr *cmsg;
300 u_int8_t **tptrp;
301 int type;
302{ 286{
303 struct ip6_ext *ip6e; 287 struct ip6_ext *ip6e;
304 int hdrlen, optlen; 288 int hdrlen, optlen;
@@ -351,8 +335,7 @@ inet6_option_find(cmsg, tptrp, type)
351 * calculated length and the limitation of the buffer. 335 * calculated length and the limitation of the buffer.
352 */ 336 */
353static int 337static int
354ip6optlen(opt, lim) 338ip6optlen(u_int8_t *opt, u_int8_t *lim)
355 u_int8_t *opt, *lim;
356{ 339{
357 int optlen; 340 int optlen;
358 341