Lines Matching refs:cmsg

26 add_pad (struct cmsghdr *cmsg, int len)  in add_pad()  argument
28 unsigned char *p = CMSG_DATA (cmsg) + cmsg->cmsg_len - CMSG_LEN (0); in add_pad()
44 cmsg->cmsg_len += len; in add_pad()
75 static uint8_t *option_alloc (struct cmsghdr *cmsg, int datalen, int multx,
140 inet6_option_append (struct cmsghdr *cmsg, const uint8_t *typep, int multx, in inet6_option_append() argument
151 uint8_t *ptr = option_alloc (cmsg, len, multx, plusy); in inet6_option_append()
173 option_alloc (struct cmsghdr *cmsg, int datalen, int multx, int plusy) in option_alloc() argument
181 int dsize = cmsg->cmsg_len - CMSG_LEN (0); in option_alloc()
186 cmsg->cmsg_len += sizeof (struct ip6_ext); in option_alloc()
191 add_pad (cmsg, ((multx - (dsize & (multx - 1))) & (multx - 1)) + plusy); in option_alloc()
194 uint8_t *result = CMSG_DATA (cmsg) + cmsg->cmsg_len - CMSG_LEN (0); in option_alloc()
195 cmsg->cmsg_len += datalen; in option_alloc()
199 dsize = cmsg->cmsg_len - CMSG_LEN (0); in option_alloc()
200 add_pad (cmsg, (8 - (dsize & (8 - 1))) & (8 - 1)); in option_alloc()
203 assert (((cmsg->cmsg_len - CMSG_LEN (0)) % 8) == 0); in option_alloc()
204 int len8b = (cmsg->cmsg_len - CMSG_LEN (0)) / 8 - 1; in option_alloc()
209 struct ip6_ext *ie = (void *) CMSG_DATA (cmsg); in option_alloc()
217 inet6_option_alloc (struct cmsghdr *cmsg, int datalen, int multx, int plusy) in inet6_option_alloc() argument
219 return option_alloc (cmsg, datalen, multx, plusy); in inet6_option_alloc()
235 inet6_option_next (const struct cmsghdr *cmsg, uint8_t **tptrp) in inet6_option_next() argument
238 if (cmsg->cmsg_level != IPPROTO_IPV6 in inet6_option_next()
239 || (cmsg->cmsg_type != IPV6_HOPOPTS && cmsg->cmsg_type != IPV6_DSTOPTS)) in inet6_option_next()
244 const struct ip6_ext *ip6e = (const struct ip6_ext *) CMSG_DATA (cmsg); in inet6_option_next()
247 if (cmsg->cmsg_len < CMSG_LEN (sizeof (struct ip6_ext)) in inet6_option_next()
249 || cmsg->cmsg_len < CMSG_LEN ((ip6e->ip6e_len + 1) * 8)) in inet6_option_next()
254 const uint8_t *endp = CMSG_DATA (cmsg) + (ip6e->ip6e_len + 1) * 8; in inet6_option_next()
291 inet6_option_find (const struct cmsghdr *cmsg, uint8_t **tptrp, int type) in inet6_option_find() argument
294 if (cmsg->cmsg_level != IPPROTO_IPV6 in inet6_option_find()
295 || (cmsg->cmsg_type != IPV6_HOPOPTS && cmsg->cmsg_type != IPV6_DSTOPTS)) in inet6_option_find()
300 const struct ip6_ext *ip6e = (const struct ip6_ext *) CMSG_DATA (cmsg); in inet6_option_find()
303 if (cmsg->cmsg_len < CMSG_LEN (sizeof (struct ip6_ext)) in inet6_option_find()
305 || cmsg->cmsg_len < CMSG_LEN ((ip6e->ip6e_len + 1) * 8)) in inet6_option_find()
310 const uint8_t *endp = CMSG_DATA (cmsg) + (ip6e->ip6e_len + 1) * 8; in inet6_option_find()