diff options
author | itojun <> | 2006-12-08 21:32:59 +0000 |
---|---|---|
committer | itojun <> | 2006-12-08 21:32:59 +0000 |
commit | 5cdcbef9e2b8e7df629a9a6a32f24581308e0c27 (patch) | |
tree | 917455cf98fb2a1b640a3b0b2ca18ab2fb16445c /src | |
parent | 3ebd7e0bf4e6dd96670aeba0f6fd9187b801f884 (diff) | |
download | openbsd-5cdcbef9e2b8e7df629a9a6a32f24581308e0c27.tar.gz openbsd-5cdcbef9e2b8e7df629a9a6a32f24581308e0c27.tar.bz2 openbsd-5cdcbef9e2b8e7df629a9a6a32f24581308e0c27.zip |
return is not a function. (cosmetic)
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libc/net/ip6opt.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/lib/libc/net/ip6opt.c b/src/lib/libc/net/ip6opt.c index 565c0ed369..d3d68a54bf 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.2 2005/03/25 13:24:12 otto Exp $ */ | 1 | /* $OpenBSD: ip6opt.c,v 1.3 2006/12/08 21:32:59 itojun 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. |
@@ -55,7 +55,7 @@ int | |||
55 | inet6_option_space(int nbytes) | 55 | inet6_option_space(int nbytes) |
56 | { | 56 | { |
57 | nbytes += 2; /* we need space for nxt-hdr and length fields */ | 57 | nbytes += 2; /* we need space for nxt-hdr and length fields */ |
58 | return(CMSG_SPACE((nbytes + 7) & ~7)); | 58 | return (CMSG_SPACE((nbytes + 7) & ~7)); |
59 | } | 59 | } |
60 | 60 | ||
61 | /* | 61 | /* |
@@ -70,14 +70,14 @@ inet6_option_init(void *bp, struct cmsghdr **cmsgp, int type) | |||
70 | 70 | ||
71 | /* argument validation */ | 71 | /* argument validation */ |
72 | if (type != IPV6_HOPOPTS && type != IPV6_DSTOPTS) | 72 | if (type != IPV6_HOPOPTS && type != IPV6_DSTOPTS) |
73 | return(-1); | 73 | return (-1); |
74 | 74 | ||
75 | ch->cmsg_level = IPPROTO_IPV6; | 75 | ch->cmsg_level = IPPROTO_IPV6; |
76 | ch->cmsg_type = type; | 76 | ch->cmsg_type = type; |
77 | ch->cmsg_len = CMSG_LEN(0); | 77 | ch->cmsg_len = CMSG_LEN(0); |
78 | 78 | ||
79 | *cmsgp = ch; | 79 | *cmsgp = ch; |
80 | return(0); | 80 | return (0); |
81 | } | 81 | } |
82 | 82 | ||
83 | /* | 83 | /* |
@@ -100,11 +100,11 @@ inet6_option_append(struct cmsghdr *cmsg, const u_int8_t *typep, int multx, | |||
100 | 100 | ||
101 | /* argument validation */ | 101 | /* argument validation */ |
102 | if (multx != 1 && multx != 2 && multx != 4 && multx != 8) | 102 | if (multx != 1 && multx != 2 && multx != 4 && multx != 8) |
103 | return(-1); | 103 | return (-1); |
104 | if (plusy < 0 || plusy > 7) | 104 | if (plusy < 0 || plusy > 7) |
105 | return(-1); | 105 | return (-1); |
106 | if (typep[0] > 255) | 106 | if (typep[0] > 255) |
107 | return(-1); | 107 | return (-1); |
108 | 108 | ||
109 | /* | 109 | /* |
110 | * If this is the first option, allocate space for the | 110 | * If this is the first option, allocate space for the |
@@ -146,7 +146,7 @@ inet6_option_append(struct cmsghdr *cmsg, const u_int8_t *typep, int multx, | |||
146 | /* update the length field of the ip6 option header */ | 146 | /* update the length field of the ip6 option header */ |
147 | eh->ip6e_len = ((bp - (u_char *)eh) >> 3) - 1; | 147 | eh->ip6e_len = ((bp - (u_char *)eh) >> 3) - 1; |
148 | 148 | ||
149 | return(0); | 149 | return (0); |
150 | } | 150 | } |
151 | 151 | ||
152 | /* | 152 | /* |
@@ -172,9 +172,9 @@ inet6_option_alloc(struct cmsghdr *cmsg, int datalen, int multx, int plusy) | |||
172 | 172 | ||
173 | /* argument validation */ | 173 | /* argument validation */ |
174 | if (multx != 1 && multx != 2 && multx != 4 && multx != 8) | 174 | if (multx != 1 && multx != 2 && multx != 4 && multx != 8) |
175 | return(NULL); | 175 | return (NULL); |
176 | if (plusy < 0 || plusy > 7) | 176 | if (plusy < 0 || plusy > 7) |
177 | return(NULL); | 177 | return (NULL); |
178 | 178 | ||
179 | /* | 179 | /* |
180 | * If this is the first option, allocate space for the | 180 | * If this is the first option, allocate space for the |
@@ -212,7 +212,7 @@ inet6_option_alloc(struct cmsghdr *cmsg, int datalen, int multx, int plusy) | |||
212 | /* update the length field of the ip6 option header */ | 212 | /* update the length field of the ip6 option header */ |
213 | eh->ip6e_len = ((bp - (u_char *)eh) >> 3) - 1; | 213 | eh->ip6e_len = ((bp - (u_char *)eh) >> 3) - 1; |
214 | 214 | ||
215 | return(retval); | 215 | return (retval); |
216 | } | 216 | } |
217 | 217 | ||
218 | /* | 218 | /* |
@@ -235,15 +235,15 @@ inet6_option_next(const struct cmsghdr *cmsg, u_int8_t **tptrp) | |||
235 | if (cmsg->cmsg_level != IPPROTO_IPV6 || | 235 | if (cmsg->cmsg_level != IPPROTO_IPV6 || |
236 | (cmsg->cmsg_type != IPV6_HOPOPTS && | 236 | (cmsg->cmsg_type != IPV6_HOPOPTS && |
237 | cmsg->cmsg_type != IPV6_DSTOPTS)) | 237 | cmsg->cmsg_type != IPV6_DSTOPTS)) |
238 | return(-1); | 238 | return (-1); |
239 | 239 | ||
240 | /* message length validation */ | 240 | /* message length validation */ |
241 | if (cmsg->cmsg_len < CMSG_SPACE(sizeof(struct ip6_ext))) | 241 | if (cmsg->cmsg_len < CMSG_SPACE(sizeof(struct ip6_ext))) |
242 | return(-1); | 242 | return (-1); |
243 | ip6e = (struct ip6_ext *)CMSG_DATA(cmsg); | 243 | ip6e = (struct ip6_ext *)CMSG_DATA(cmsg); |
244 | hdrlen = (ip6e->ip6e_len + 1) << 3; | 244 | hdrlen = (ip6e->ip6e_len + 1) << 3; |
245 | if (cmsg->cmsg_len < CMSG_SPACE(hdrlen)) | 245 | if (cmsg->cmsg_len < CMSG_SPACE(hdrlen)) |
246 | return(-1); | 246 | return (-1); |
247 | 247 | ||
248 | /* | 248 | /* |
249 | * If the caller does not specify the starting point, | 249 | * If the caller does not specify the starting point, |
@@ -255,22 +255,22 @@ inet6_option_next(const struct cmsghdr *cmsg, u_int8_t **tptrp) | |||
255 | *tptrp = (u_int8_t *)(ip6e + 1); | 255 | *tptrp = (u_int8_t *)(ip6e + 1); |
256 | else { | 256 | else { |
257 | if ((optlen = ip6optlen(*tptrp, lim)) == 0) | 257 | if ((optlen = ip6optlen(*tptrp, lim)) == 0) |
258 | return(-1); | 258 | return (-1); |
259 | 259 | ||
260 | *tptrp = *tptrp + optlen; | 260 | *tptrp = *tptrp + optlen; |
261 | } | 261 | } |
262 | if (*tptrp >= lim) { /* there is no option */ | 262 | if (*tptrp >= lim) { /* there is no option */ |
263 | *tptrp = NULL; | 263 | *tptrp = NULL; |
264 | return(-1); | 264 | return (-1); |
265 | } | 265 | } |
266 | /* | 266 | /* |
267 | * Finally, checks if the next option is safely stored in the | 267 | * Finally, checks if the next option is safely stored in the |
268 | * cmsg data. | 268 | * cmsg data. |
269 | */ | 269 | */ |
270 | if (ip6optlen(*tptrp, lim) == 0) | 270 | if (ip6optlen(*tptrp, lim) == 0) |
271 | return(-1); | 271 | return (-1); |
272 | else | 272 | else |
273 | return(0); | 273 | return (0); |
274 | } | 274 | } |
275 | 275 | ||
276 | /* | 276 | /* |
@@ -291,15 +291,15 @@ inet6_option_find(const struct cmsghdr *cmsg, u_int8_t **tptrp, int type) | |||
291 | if (cmsg->cmsg_level != IPPROTO_IPV6 || | 291 | if (cmsg->cmsg_level != IPPROTO_IPV6 || |
292 | (cmsg->cmsg_type != IPV6_HOPOPTS && | 292 | (cmsg->cmsg_type != IPV6_HOPOPTS && |
293 | cmsg->cmsg_type != IPV6_DSTOPTS)) | 293 | cmsg->cmsg_type != IPV6_DSTOPTS)) |
294 | return(-1); | 294 | return (-1); |
295 | 295 | ||
296 | /* message length validation */ | 296 | /* message length validation */ |
297 | if (cmsg->cmsg_len < CMSG_SPACE(sizeof(struct ip6_ext))) | 297 | if (cmsg->cmsg_len < CMSG_SPACE(sizeof(struct ip6_ext))) |
298 | return(-1); | 298 | return (-1); |
299 | ip6e = (struct ip6_ext *)CMSG_DATA(cmsg); | 299 | ip6e = (struct ip6_ext *)CMSG_DATA(cmsg); |
300 | hdrlen = (ip6e->ip6e_len + 1) << 3; | 300 | hdrlen = (ip6e->ip6e_len + 1) << 3; |
301 | if (cmsg->cmsg_len < CMSG_SPACE(hdrlen)) | 301 | if (cmsg->cmsg_len < CMSG_SPACE(hdrlen)) |
302 | return(-1); | 302 | return (-1); |
303 | 303 | ||
304 | /* | 304 | /* |
305 | * If the caller does not specify the starting point, | 305 | * If the caller does not specify the starting point, |
@@ -311,22 +311,22 @@ inet6_option_find(const struct cmsghdr *cmsg, u_int8_t **tptrp, int type) | |||
311 | *tptrp = (u_int8_t *)(ip6e + 1); | 311 | *tptrp = (u_int8_t *)(ip6e + 1); |
312 | else { | 312 | else { |
313 | if ((optlen = ip6optlen(*tptrp, lim)) == 0) | 313 | if ((optlen = ip6optlen(*tptrp, lim)) == 0) |
314 | return(-1); | 314 | return (-1); |
315 | 315 | ||
316 | *tptrp = *tptrp + optlen; | 316 | *tptrp = *tptrp + optlen; |
317 | } | 317 | } |
318 | for (optp = *tptrp; optp < lim; optp += optlen) { | 318 | for (optp = *tptrp; optp < lim; optp += optlen) { |
319 | if (*optp == type) { | 319 | if (*optp == type) { |
320 | *tptrp = optp; | 320 | *tptrp = optp; |
321 | return(0); | 321 | return (0); |
322 | } | 322 | } |
323 | if ((optlen = ip6optlen(optp, lim)) == 0) | 323 | if ((optlen = ip6optlen(optp, lim)) == 0) |
324 | return(-1); | 324 | return (-1); |
325 | } | 325 | } |
326 | 326 | ||
327 | /* search failed */ | 327 | /* search failed */ |
328 | *tptrp = NULL; | 328 | *tptrp = NULL; |
329 | return(-1); | 329 | return (-1); |
330 | } | 330 | } |
331 | 331 | ||
332 | /* | 332 | /* |
@@ -344,13 +344,13 @@ ip6optlen(u_int8_t *opt, u_int8_t *lim) | |||
344 | else { | 344 | else { |
345 | /* is there enough space to store type and len? */ | 345 | /* is there enough space to store type and len? */ |
346 | if (opt + 2 > lim) | 346 | if (opt + 2 > lim) |
347 | return(0); | 347 | return (0); |
348 | optlen = *(opt + 1) + 2; | 348 | optlen = *(opt + 1) + 2; |
349 | } | 349 | } |
350 | if (opt + optlen <= lim) | 350 | if (opt + optlen <= lim) |
351 | return(optlen); | 351 | return (optlen); |
352 | 352 | ||
353 | return(0); | 353 | return (0); |
354 | } | 354 | } |
355 | 355 | ||
356 | static void | 356 | static void |