Lines Matching +full:function +full:- +full:off

3 /*-
4 * SPDX-License-Identifier: BSD-3-Clause
59 * This function returns the number of bytes required to hold an option
70 nbytes += 2; /* we need space for nxt-hdr and length fields */ in inet6_option_space()
75 * This function is called once per ancillary data object that will
76 * contain either Hop-by-Hop or Destination options. It returns 0 on
77 * success or -1 on an error.
86 return(-1); in inet6_option_init()
88 ch->cmsg_level = IPPROTO_IPV6; in inet6_option_init()
89 ch->cmsg_type = type; in inet6_option_init()
90 ch->cmsg_len = CMSG_LEN(0); in inet6_option_init()
97 * This function appends a Hop-by-Hop option or a Destination option
99 * inet6_option_init(). This function returns 0 if it succeeds or -1 on
110 int padlen, optlen, off; in inet6_option_append() local
111 u_char *bp = (u_char *)cmsg + cmsg->cmsg_len; in inet6_option_append()
116 return(-1); in inet6_option_append()
118 return(-1); in inet6_option_append()
127 cmsg->cmsg_len += 2; in inet6_option_append()
131 off = bp - (u_char *)eh; in inet6_option_append()
132 padlen = roundup2(off % multx, multx) - (off % multx); in inet6_option_append()
137 cmsg->cmsg_len += padlen; in inet6_option_append()
147 cmsg->cmsg_len += optlen; in inet6_option_append()
150 off = bp - (u_char *)eh; in inet6_option_append()
151 padlen = ((off + 7) & ~7) - off; in inet6_option_append()
154 cmsg->cmsg_len += padlen; in inet6_option_append()
157 eh->ip6e_len = ((bp - (u_char *)eh) >> 3) - 1; in inet6_option_append()
163 * This function appends a Hop-by-Hop option or a Destination option
165 * inet6_option_init(). This function returns a pointer to the 8-bit
168 * The difference between this function and inet6_option_append() is
170 * the ancillary data object while the current function returns a
178 int padlen, off; in inet6_option_alloc() local
179 u_int8_t *bp = (u_char *)cmsg + cmsg->cmsg_len; in inet6_option_alloc()
196 cmsg->cmsg_len += 2; in inet6_option_alloc()
200 off = bp - (u_char *)eh; in inet6_option_alloc()
201 padlen = roundup2(off % multx, multx) - (off % multx); in inet6_option_alloc()
206 cmsg->cmsg_len += padlen; in inet6_option_alloc()
212 cmsg->cmsg_len += datalen; in inet6_option_alloc()
215 off = bp - (u_char *)eh; in inet6_option_alloc()
216 padlen = ((off + 7) & ~7) - off; in inet6_option_alloc()
219 cmsg->cmsg_len += padlen; in inet6_option_alloc()
222 eh->ip6e_len = ((bp - (u_char *)eh) >> 3) - 1; in inet6_option_alloc()
228 * This function processes the next Hop-by-Hop option or Destination
230 * processed, the return value of the function is 0 and *tptrp points to
231 * the 8-bit option type field (which is followed by the 8-bit option
233 * to be processed, the return value is -1 and *tptrp is NULL. If an
234 * error occurs, the return value is -1 and *tptrp is not NULL.
244 if (cmsg->cmsg_level != IPPROTO_IPV6 || in inet6_option_next()
245 (!is_ipv6_hopopts(cmsg->cmsg_type) && in inet6_option_next()
246 !is_ipv6_dstopts(cmsg->cmsg_type))) in inet6_option_next()
247 return(-1); in inet6_option_next()
250 if (cmsg->cmsg_len < CMSG_SPACE(sizeof(struct ip6_ext))) in inet6_option_next()
251 return(-1); in inet6_option_next()
253 hdrlen = (ip6e->ip6e_len + 1) << 3; in inet6_option_next()
254 if (cmsg->cmsg_len < CMSG_SPACE(hdrlen)) in inet6_option_next()
255 return(-1); in inet6_option_next()
267 return(-1); in inet6_option_next()
273 return(-1); in inet6_option_next()
280 return(-1); in inet6_option_next()
286 * This function is similar to the inet6_option_next() function,
287 * except this function lets the caller specify the option type to be
300 if (cmsg->cmsg_level != IPPROTO_IPV6 || in inet6_option_find()
301 (!is_ipv6_hopopts(cmsg->cmsg_type) && in inet6_option_find()
302 !is_ipv6_dstopts(cmsg->cmsg_type))) in inet6_option_find()
303 return(-1); in inet6_option_find()
306 if (cmsg->cmsg_len < CMSG_SPACE(sizeof(struct ip6_ext))) in inet6_option_find()
307 return(-1); in inet6_option_find()
309 hdrlen = (ip6e->ip6e_len + 1) << 3; in inet6_option_find()
310 if (cmsg->cmsg_len < CMSG_SPACE(hdrlen)) in inet6_option_find()
311 return(-1); in inet6_option_find()
323 return(-1); in inet6_option_find()
333 return(-1); in inet6_option_find()
338 return(-1); in inet6_option_find()
376 p[1] = len - 2; in inet6_insert_padopt()
377 memset(&p[2], 0, len - 2); in inet6_insert_padopt()
394 return(-1); in inet6_opt_init()
395 ext->ip6e_len = (extlen >> 3) - 1; in inet6_opt_init()
412 return(-1); in inet6_opt_append()
419 return(-1); in inet6_opt_append()
426 return(-1); in inet6_opt_append()
428 return(-1); in inet6_opt_append()
433 padlen = align - (currentlen % align); in inet6_opt_append()
439 return(-1); in inet6_opt_append()
452 *optp++ = padlen - 2; in inet6_opt_append()
453 memset(optp, 0, padlen - 2); in inet6_opt_append()
454 optp += (padlen - 2); in inet6_opt_append()
469 int updatelen = offset > 0 ? (1 + ((offset - 1) | 7)) : 0; in inet6_opt_finish()
473 int padlen = updatelen - offset; in inet6_opt_finish()
476 return(-1); in inet6_opt_finish()
483 *padp++ = (padlen - 2); in inet6_opt_finish()
484 memset(padp, 0, padlen - 2); in inet6_opt_finish()
508 return(-1); in inet6_opt_next()
512 * If this is the first time this function called for this options in inet6_opt_next()
537 *lenp = optlen - 2; in inet6_opt_next()
539 return(optp + optlen - (u_int8_t *)extbuf); in inet6_opt_next()
545 return(-1); in inet6_opt_next()
557 return(-1); in inet6_opt_find()
561 * If this is the first time this function called for this options in inet6_opt_find()
577 *lenp = optlen - 2; in inet6_opt_find()
579 return(optp + optlen - (u_int8_t *)extbuf); in inet6_opt_find()
587 return(-1); in inet6_opt_find()