diff options
author | chrisz <> | 2014-06-13 15:41:06 +0000 |
---|---|---|
committer | chrisz <> | 2014-06-13 15:41:06 +0000 |
commit | f1685739a04d6123f73b6afbf1765acb4cc03d22 (patch) | |
tree | d96eff38fb0597605f0b4813f0cbf2b1bacaa212 | |
parent | 378abe0ca2a1224356342d63a962108de549162f (diff) | |
download | openbsd-f1685739a04d6123f73b6afbf1765acb4cc03d22.tar.gz openbsd-f1685739a04d6123f73b6afbf1765acb4cc03d22.tar.bz2 openbsd-f1685739a04d6123f73b6afbf1765acb4cc03d22.zip |
Remove deprecated RFC2292 ancillary data convenience functions.
They are obsoleted by the RFC3542 api.
ok mpi@
-rw-r--r-- | src/lib/libc/net/ip6opt.c | 309 | ||||
-rw-r--r-- | src/lib/libc/net/rthdr.c | 181 |
2 files changed, 2 insertions, 488 deletions
diff --git a/src/lib/libc/net/ip6opt.c b/src/lib/libc/net/ip6opt.c index 7b4fdc4c4e..d98e300cb6 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.6 2014/02/17 21:05:39 stsp Exp $ */ | 1 | /* $OpenBSD: ip6opt.c,v 1.7 2014/06/13 15:41:06 chrisz Exp $ */ |
2 | /* $KAME: ip6opt.c,v 1.18 2005/06/15 07:11:35 keiichi Exp $ */ | 2 | /* $KAME: ip6opt.c,v 1.18 2005/06/15 07:11:35 keiichi Exp $ */ |
3 | 3 | ||
4 | /* | 4 | /* |
@@ -41,296 +41,6 @@ | |||
41 | #include <stdio.h> | 41 | #include <stdio.h> |
42 | 42 | ||
43 | static int ip6optlen(u_int8_t *opt, u_int8_t *lim); | 43 | static int ip6optlen(u_int8_t *opt, u_int8_t *lim); |
44 | static void inet6_insert_padopt(u_char *p, int len); | ||
45 | |||
46 | /* | ||
47 | * This function returns the number of bytes required to hold an option | ||
48 | * when it is stored as ancillary data, including the cmsghdr structure | ||
49 | * at the beginning, and any padding at the end (to make its size a | ||
50 | * multiple of 8 bytes). The argument is the size of the structure | ||
51 | * defining the option, which must include any pad bytes at the | ||
52 | * beginning (the value y in the alignment term "xn + y"), the type | ||
53 | * byte, the length byte, and the option data. | ||
54 | */ | ||
55 | int | ||
56 | inet6_option_space(int nbytes) | ||
57 | { | ||
58 | nbytes += 2; /* we need space for nxt-hdr and length fields */ | ||
59 | return (CMSG_SPACE((nbytes + 7) & ~7)); | ||
60 | } | ||
61 | |||
62 | /* | ||
63 | * This function is called once per ancillary data object that will | ||
64 | * contain either Hop-by-Hop or Destination options. It returns 0 on | ||
65 | * success or -1 on an error. | ||
66 | */ | ||
67 | int | ||
68 | inet6_option_init(void *bp, struct cmsghdr **cmsgp, int type) | ||
69 | { | ||
70 | struct cmsghdr *ch = (struct cmsghdr *)bp; | ||
71 | |||
72 | /* argument validation */ | ||
73 | if (type != IPV6_HOPOPTS && type != IPV6_DSTOPTS) | ||
74 | return (-1); | ||
75 | |||
76 | ch->cmsg_level = IPPROTO_IPV6; | ||
77 | ch->cmsg_type = type; | ||
78 | ch->cmsg_len = CMSG_LEN(0); | ||
79 | |||
80 | *cmsgp = ch; | ||
81 | return (0); | ||
82 | } | ||
83 | |||
84 | /* | ||
85 | * This function appends a Hop-by-Hop option or a Destination option | ||
86 | * into an ancillary data object that has been initialized by | ||
87 | * inet6_option_init(). This function returns 0 if it succeeds or -1 on | ||
88 | * an error. | ||
89 | * multx is the value x in the alignment term "xn + y" described | ||
90 | * earlier. It must have a value of 1, 2, 4, or 8. | ||
91 | * plusy is the value y in the alignment term "xn + y" described | ||
92 | * earlier. It must have a value between 0 and 7, inclusive. | ||
93 | */ | ||
94 | int | ||
95 | inet6_option_append(struct cmsghdr *cmsg, const u_int8_t *typep, int multx, | ||
96 | int plusy) | ||
97 | { | ||
98 | int padlen, optlen, off; | ||
99 | u_char *bp = (u_char *)cmsg + cmsg->cmsg_len; | ||
100 | struct ip6_ext *eh = (struct ip6_ext *)CMSG_DATA(cmsg); | ||
101 | |||
102 | /* argument validation */ | ||
103 | if (multx != 1 && multx != 2 && multx != 4 && multx != 8) | ||
104 | return (-1); | ||
105 | if (plusy < 0 || plusy > 7) | ||
106 | return (-1); | ||
107 | #if 0 | ||
108 | if (typep[0] > 255) | ||
109 | return (-1); | ||
110 | #endif | ||
111 | |||
112 | /* | ||
113 | * If this is the first option, allocate space for the | ||
114 | * first 2 bytes(for next header and length fields) of | ||
115 | * the option header. | ||
116 | */ | ||
117 | if (bp == (u_char *)eh) { | ||
118 | bp += 2; | ||
119 | cmsg->cmsg_len += 2; | ||
120 | } | ||
121 | |||
122 | /* calculate pad length before the option. */ | ||
123 | off = bp - (u_char *)eh; | ||
124 | padlen = (((off % multx) + (multx - 1)) & ~(multx - 1)) - | ||
125 | (off % multx); | ||
126 | padlen += plusy; | ||
127 | padlen %= multx; /* keep the pad as short as possible */ | ||
128 | /* insert padding */ | ||
129 | inet6_insert_padopt(bp, padlen); | ||
130 | cmsg->cmsg_len += padlen; | ||
131 | bp += padlen; | ||
132 | |||
133 | /* copy the option */ | ||
134 | if (typep[0] == IP6OPT_PAD1) | ||
135 | optlen = 1; | ||
136 | else | ||
137 | optlen = typep[1] + 2; | ||
138 | memcpy(bp, typep, optlen); | ||
139 | bp += optlen; | ||
140 | cmsg->cmsg_len += optlen; | ||
141 | |||
142 | /* calculate pad length after the option and insert the padding */ | ||
143 | off = bp - (u_char *)eh; | ||
144 | padlen = ((off + 7) & ~7) - off; | ||
145 | inet6_insert_padopt(bp, padlen); | ||
146 | bp += padlen; | ||
147 | cmsg->cmsg_len += padlen; | ||
148 | |||
149 | /* update the length field of the ip6 option header */ | ||
150 | eh->ip6e_len = ((bp - (u_char *)eh) >> 3) - 1; | ||
151 | |||
152 | return (0); | ||
153 | } | ||
154 | |||
155 | /* | ||
156 | * This function appends a Hop-by-Hop option or a Destination option | ||
157 | * into an ancillary data object that has been initialized by | ||
158 | * inet6_option_init(). This function returns a pointer to the 8-bit | ||
159 | * option type field that starts the option on success, or NULL on an | ||
160 | * error. | ||
161 | * The difference between this function and inet6_option_append() is | ||
162 | * that the latter copies the contents of a previously built option into | ||
163 | * the ancillary data object while the current function returns a | ||
164 | * pointer to the space in the data object where the option's TLV must | ||
165 | * then be built by the caller. | ||
166 | * | ||
167 | */ | ||
168 | u_int8_t * | ||
169 | inet6_option_alloc(struct cmsghdr *cmsg, int datalen, int multx, int plusy) | ||
170 | { | ||
171 | int padlen, off; | ||
172 | u_int8_t *bp = (u_char *)cmsg + cmsg->cmsg_len; | ||
173 | u_int8_t *retval; | ||
174 | struct ip6_ext *eh = (struct ip6_ext *)CMSG_DATA(cmsg); | ||
175 | |||
176 | /* argument validation */ | ||
177 | if (multx != 1 && multx != 2 && multx != 4 && multx != 8) | ||
178 | return (NULL); | ||
179 | if (plusy < 0 || plusy > 7) | ||
180 | return (NULL); | ||
181 | |||
182 | /* | ||
183 | * If this is the first option, allocate space for the | ||
184 | * first 2 bytes(for next header and length fields) of | ||
185 | * the option header. | ||
186 | */ | ||
187 | if (bp == (u_char *)eh) { | ||
188 | bp += 2; | ||
189 | cmsg->cmsg_len += 2; | ||
190 | } | ||
191 | |||
192 | /* calculate pad length before the option. */ | ||
193 | off = bp - (u_char *)eh; | ||
194 | padlen = (((off % multx) + (multx - 1)) & ~(multx - 1)) - | ||
195 | (off % multx); | ||
196 | padlen += plusy; | ||
197 | padlen %= multx; /* keep the pad as short as possible */ | ||
198 | /* insert padding */ | ||
199 | inet6_insert_padopt(bp, padlen); | ||
200 | cmsg->cmsg_len += padlen; | ||
201 | bp += padlen; | ||
202 | |||
203 | /* keep space to store specified length of data */ | ||
204 | retval = bp; | ||
205 | bp += datalen; | ||
206 | cmsg->cmsg_len += datalen; | ||
207 | |||
208 | /* calculate pad length after the option and insert the padding */ | ||
209 | off = bp - (u_char *)eh; | ||
210 | padlen = ((off + 7) & ~7) - off; | ||
211 | inet6_insert_padopt(bp, padlen); | ||
212 | bp += padlen; | ||
213 | cmsg->cmsg_len += padlen; | ||
214 | |||
215 | /* update the length field of the ip6 option header */ | ||
216 | eh->ip6e_len = ((bp - (u_char *)eh) >> 3) - 1; | ||
217 | |||
218 | return (retval); | ||
219 | } | ||
220 | |||
221 | /* | ||
222 | * This function processes the next Hop-by-Hop option or Destination | ||
223 | * option in an ancillary data object. If another option remains to be | ||
224 | * processed, the return value of the function is 0 and *tptrp points to | ||
225 | * the 8-bit option type field (which is followed by the 8-bit option | ||
226 | * data length, followed by the option data). If no more options remain | ||
227 | * to be processed, the return value is -1 and *tptrp is NULL. If an | ||
228 | * error occurs, the return value is -1 and *tptrp is not NULL. | ||
229 | * (RFC 2292, 6.3.5) | ||
230 | */ | ||
231 | int | ||
232 | inet6_option_next(const struct cmsghdr *cmsg, u_int8_t **tptrp) | ||
233 | { | ||
234 | struct ip6_ext *ip6e; | ||
235 | int hdrlen, optlen; | ||
236 | u_int8_t *lim; | ||
237 | |||
238 | if (cmsg->cmsg_level != IPPROTO_IPV6 || | ||
239 | (cmsg->cmsg_type != IPV6_HOPOPTS && | ||
240 | cmsg->cmsg_type != IPV6_DSTOPTS)) | ||
241 | return (-1); | ||
242 | |||
243 | /* message length validation */ | ||
244 | if (cmsg->cmsg_len < CMSG_SPACE(sizeof(struct ip6_ext))) | ||
245 | return (-1); | ||
246 | ip6e = (struct ip6_ext *)CMSG_DATA(cmsg); | ||
247 | hdrlen = (ip6e->ip6e_len + 1) << 3; | ||
248 | if (cmsg->cmsg_len < CMSG_SPACE(hdrlen)) | ||
249 | return (-1); | ||
250 | |||
251 | /* | ||
252 | * If the caller does not specify the starting point, | ||
253 | * simply return the 1st option. | ||
254 | * Otherwise, search the option list for the next option. | ||
255 | */ | ||
256 | lim = (u_int8_t *)ip6e + hdrlen; | ||
257 | if (*tptrp == NULL) | ||
258 | *tptrp = (u_int8_t *)(ip6e + 1); | ||
259 | else { | ||
260 | if ((optlen = ip6optlen(*tptrp, lim)) == 0) | ||
261 | return (-1); | ||
262 | |||
263 | *tptrp = *tptrp + optlen; | ||
264 | } | ||
265 | if (*tptrp >= lim) { /* there is no option */ | ||
266 | *tptrp = NULL; | ||
267 | return (-1); | ||
268 | } | ||
269 | /* | ||
270 | * Finally, checks if the next option is safely stored in the | ||
271 | * cmsg data. | ||
272 | */ | ||
273 | if (ip6optlen(*tptrp, lim) == 0) | ||
274 | return (-1); | ||
275 | else | ||
276 | return (0); | ||
277 | } | ||
278 | |||
279 | /* | ||
280 | * This function is similar to the inet6_option_next() function, | ||
281 | * except this function lets the caller specify the option type to be | ||
282 | * searched for, instead of always returning the next option in the | ||
283 | * ancillary data object. | ||
284 | * Note: RFC 2292 says the type of tptrp is u_int8_t *, but we think | ||
285 | * it's a typo. The variable should be type of u_int8_t **. | ||
286 | */ | ||
287 | int | ||
288 | inet6_option_find(const struct cmsghdr *cmsg, u_int8_t **tptrp, int type) | ||
289 | { | ||
290 | struct ip6_ext *ip6e; | ||
291 | int hdrlen, optlen; | ||
292 | u_int8_t *optp, *lim; | ||
293 | |||
294 | if (cmsg->cmsg_level != IPPROTO_IPV6 || | ||
295 | (cmsg->cmsg_type != IPV6_HOPOPTS && | ||
296 | cmsg->cmsg_type != IPV6_DSTOPTS)) | ||
297 | return (-1); | ||
298 | |||
299 | /* message length validation */ | ||
300 | if (cmsg->cmsg_len < CMSG_SPACE(sizeof(struct ip6_ext))) | ||
301 | return (-1); | ||
302 | ip6e = (struct ip6_ext *)CMSG_DATA(cmsg); | ||
303 | hdrlen = (ip6e->ip6e_len + 1) << 3; | ||
304 | if (cmsg->cmsg_len < CMSG_SPACE(hdrlen)) | ||
305 | return (-1); | ||
306 | |||
307 | /* | ||
308 | * If the caller does not specify the starting point, | ||
309 | * search from the beginning of the option list. | ||
310 | * Otherwise, search from *the next option* of the specified point. | ||
311 | */ | ||
312 | lim = (u_int8_t *)ip6e + hdrlen; | ||
313 | if (*tptrp == NULL) | ||
314 | *tptrp = (u_int8_t *)(ip6e + 1); | ||
315 | else { | ||
316 | if ((optlen = ip6optlen(*tptrp, lim)) == 0) | ||
317 | return (-1); | ||
318 | |||
319 | *tptrp = *tptrp + optlen; | ||
320 | } | ||
321 | for (optp = *tptrp; optp < lim; optp += optlen) { | ||
322 | if (*optp == type) { | ||
323 | *tptrp = optp; | ||
324 | return (0); | ||
325 | } | ||
326 | if ((optlen = ip6optlen(optp, lim)) == 0) | ||
327 | return (-1); | ||
328 | } | ||
329 | |||
330 | /* search failed */ | ||
331 | *tptrp = NULL; | ||
332 | return (-1); | ||
333 | } | ||
334 | 44 | ||
335 | /* | 45 | /* |
336 | * Calculate the length of a given IPv6 option. Also checks | 46 | * Calculate the length of a given IPv6 option. Also checks |
@@ -356,23 +66,6 @@ ip6optlen(u_int8_t *opt, u_int8_t *lim) | |||
356 | return (0); | 66 | return (0); |
357 | } | 67 | } |
358 | 68 | ||
359 | static void | ||
360 | inet6_insert_padopt(u_char *p, int len) | ||
361 | { | ||
362 | switch(len) { | ||
363 | case 0: | ||
364 | return; | ||
365 | case 1: | ||
366 | p[0] = IP6OPT_PAD1; | ||
367 | return; | ||
368 | default: | ||
369 | p[0] = IP6OPT_PADN; | ||
370 | p[1] = len - 2; | ||
371 | memset(&p[2], 0, len - 2); | ||
372 | return; | ||
373 | } | ||
374 | } | ||
375 | |||
376 | /* | 69 | /* |
377 | * The following functions are defined in RFC3542, which is a successor | 70 | * The following functions are defined in RFC3542, which is a successor |
378 | * of RFC2292. | 71 | * of RFC2292. |
diff --git a/src/lib/libc/net/rthdr.c b/src/lib/libc/net/rthdr.c index d10334e027..9e917f1009 100644 --- a/src/lib/libc/net/rthdr.c +++ b/src/lib/libc/net/rthdr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rthdr.c,v 1.8 2006/12/09 01:12:28 itojun Exp $ */ | 1 | /* $OpenBSD: rthdr.c,v 1.9 2014/06/13 15:41:06 chrisz Exp $ */ |
2 | /* $KAME: rthdr.c,v 1.22 2006/02/09 08:18:58 keiichi Exp $ */ | 2 | /* $KAME: rthdr.c,v 1.22 2006/02/09 08:18:58 keiichi Exp $ */ |
3 | 3 | ||
4 | /* | 4 | /* |
@@ -41,185 +41,6 @@ | |||
41 | #include <stdio.h> | 41 | #include <stdio.h> |
42 | 42 | ||
43 | /* | 43 | /* |
44 | * RFC2292 API | ||
45 | */ | ||
46 | |||
47 | size_t | ||
48 | inet6_rthdr_space(int type, int seg) | ||
49 | { | ||
50 | switch (type) { | ||
51 | case IPV6_RTHDR_TYPE_0: | ||
52 | if (seg < 1 || seg > 23) | ||
53 | return (0); | ||
54 | return (CMSG_SPACE(sizeof(struct in6_addr) * seg + | ||
55 | sizeof(struct ip6_rthdr0))); | ||
56 | default: | ||
57 | return (0); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | struct cmsghdr * | ||
62 | inet6_rthdr_init(void *bp, int type) | ||
63 | { | ||
64 | struct cmsghdr *ch = (struct cmsghdr *)bp; | ||
65 | struct ip6_rthdr *rthdr; | ||
66 | |||
67 | rthdr = (struct ip6_rthdr *)CMSG_DATA(ch); | ||
68 | |||
69 | ch->cmsg_level = IPPROTO_IPV6; | ||
70 | ch->cmsg_type = IPV6_RTHDR; | ||
71 | |||
72 | switch (type) { | ||
73 | case IPV6_RTHDR_TYPE_0: | ||
74 | ch->cmsg_len = CMSG_LEN(sizeof(struct ip6_rthdr0)); | ||
75 | bzero(rthdr, sizeof(struct ip6_rthdr0)); | ||
76 | rthdr->ip6r_type = IPV6_RTHDR_TYPE_0; | ||
77 | return (ch); | ||
78 | default: | ||
79 | return (NULL); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | int | ||
84 | inet6_rthdr_add(struct cmsghdr *cmsg, const struct in6_addr *addr, u_int flags) | ||
85 | { | ||
86 | struct ip6_rthdr *rthdr; | ||
87 | |||
88 | rthdr = (struct ip6_rthdr *)CMSG_DATA(cmsg); | ||
89 | |||
90 | switch (rthdr->ip6r_type) { | ||
91 | case IPV6_RTHDR_TYPE_0: | ||
92 | { | ||
93 | struct ip6_rthdr0 *rt0 = (struct ip6_rthdr0 *)rthdr; | ||
94 | if (flags != IPV6_RTHDR_LOOSE) | ||
95 | return (-1); | ||
96 | if (rt0->ip6r0_segleft == 23) | ||
97 | return (-1); | ||
98 | rt0->ip6r0_segleft++; | ||
99 | bcopy(addr, (caddr_t)rt0 + ((rt0->ip6r0_len + 1) << 3), | ||
100 | sizeof(struct in6_addr)); | ||
101 | rt0->ip6r0_len += sizeof(struct in6_addr) >> 3; | ||
102 | cmsg->cmsg_len = CMSG_LEN((rt0->ip6r0_len + 1) << 3); | ||
103 | break; | ||
104 | } | ||
105 | default: | ||
106 | return (-1); | ||
107 | } | ||
108 | |||
109 | return (0); | ||
110 | } | ||
111 | |||
112 | int | ||
113 | inet6_rthdr_lasthop(struct cmsghdr *cmsg, unsigned int flags) | ||
114 | { | ||
115 | struct ip6_rthdr *rthdr; | ||
116 | |||
117 | rthdr = (struct ip6_rthdr *)CMSG_DATA(cmsg); | ||
118 | |||
119 | switch (rthdr->ip6r_type) { | ||
120 | case IPV6_RTHDR_TYPE_0: | ||
121 | { | ||
122 | struct ip6_rthdr0 *rt0 = (struct ip6_rthdr0 *)rthdr; | ||
123 | if (flags != IPV6_RTHDR_LOOSE) | ||
124 | return (-1); | ||
125 | if (rt0->ip6r0_segleft > 23) | ||
126 | return (-1); | ||
127 | break; | ||
128 | } | ||
129 | default: | ||
130 | return (-1); | ||
131 | } | ||
132 | |||
133 | return (0); | ||
134 | } | ||
135 | |||
136 | #if 0 | ||
137 | int | ||
138 | inet6_rthdr_reverse(in, out) | ||
139 | const struct cmsghdr *in; | ||
140 | struct cmsghdr *out; | ||
141 | { | ||
142 | |||
143 | return (-1); | ||
144 | } | ||
145 | #endif | ||
146 | |||
147 | int | ||
148 | inet6_rthdr_segments(const struct cmsghdr *cmsg) | ||
149 | { | ||
150 | struct ip6_rthdr *rthdr; | ||
151 | |||
152 | rthdr = (struct ip6_rthdr *)CMSG_DATA(cmsg); | ||
153 | |||
154 | switch (rthdr->ip6r_type) { | ||
155 | case IPV6_RTHDR_TYPE_0: | ||
156 | { | ||
157 | struct ip6_rthdr0 *rt0 = (struct ip6_rthdr0 *)rthdr; | ||
158 | |||
159 | if (rt0->ip6r0_len % 2 || 46 < rt0->ip6r0_len) | ||
160 | return (-1); | ||
161 | |||
162 | return (rt0->ip6r0_len * 8) / sizeof(struct in6_addr); | ||
163 | } | ||
164 | |||
165 | default: | ||
166 | return (-1); | ||
167 | } | ||
168 | } | ||
169 | |||
170 | struct in6_addr * | ||
171 | inet6_rthdr_getaddr(struct cmsghdr *cmsg, int index) | ||
172 | { | ||
173 | struct ip6_rthdr *rthdr; | ||
174 | |||
175 | rthdr = (struct ip6_rthdr *)CMSG_DATA(cmsg); | ||
176 | |||
177 | switch (rthdr->ip6r_type) { | ||
178 | case IPV6_RTHDR_TYPE_0: | ||
179 | { | ||
180 | struct ip6_rthdr0 *rt0 = (struct ip6_rthdr0 *)rthdr; | ||
181 | int naddr; | ||
182 | |||
183 | if (rt0->ip6r0_len % 2 || 46 < rt0->ip6r0_len) | ||
184 | return NULL; | ||
185 | naddr = (rt0->ip6r0_len * 8) / sizeof(struct in6_addr); | ||
186 | if (index <= 0 || naddr < index) | ||
187 | return NULL; | ||
188 | return ((struct in6_addr *)(rt0 + 1)) + index; | ||
189 | } | ||
190 | |||
191 | default: | ||
192 | return NULL; | ||
193 | } | ||
194 | } | ||
195 | |||
196 | int | ||
197 | inet6_rthdr_getflags(const struct cmsghdr *cmsg, int index) | ||
198 | { | ||
199 | struct ip6_rthdr *rthdr; | ||
200 | |||
201 | rthdr = (struct ip6_rthdr *)CMSG_DATA(cmsg); | ||
202 | |||
203 | switch (rthdr->ip6r_type) { | ||
204 | case IPV6_RTHDR_TYPE_0: | ||
205 | { | ||
206 | struct ip6_rthdr0 *rt0 = (struct ip6_rthdr0 *)rthdr; | ||
207 | int naddr; | ||
208 | |||
209 | if (rt0->ip6r0_len % 2 || 46 < rt0->ip6r0_len) | ||
210 | return (-1); | ||
211 | naddr = (rt0->ip6r0_len * 8) / sizeof(struct in6_addr); | ||
212 | if (index < 0 || naddr < index) | ||
213 | return (-1); | ||
214 | return IPV6_RTHDR_LOOSE; | ||
215 | } | ||
216 | |||
217 | default: | ||
218 | return (-1); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | /* | ||
223 | * RFC3542 (2292bis) API | 44 | * RFC3542 (2292bis) API |
224 | */ | 45 | */ |
225 | 46 | ||