npf_alg_icmp.c revision 1.6.4.2 1 1.6.4.2 rmind /* $NetBSD: npf_alg_icmp.c,v 1.6.4.2 2011/03/05 20:55:54 rmind Exp $ */
2 1.6.4.2 rmind
3 1.6.4.2 rmind /*-
4 1.6.4.2 rmind * Copyright (c) 2010 The NetBSD Foundation, Inc.
5 1.6.4.2 rmind * All rights reserved.
6 1.6.4.2 rmind *
7 1.6.4.2 rmind * This material is based upon work partially supported by The
8 1.6.4.2 rmind * NetBSD Foundation under a contract with Mindaugas Rasiukevicius.
9 1.6.4.2 rmind *
10 1.6.4.2 rmind * Redistribution and use in source and binary forms, with or without
11 1.6.4.2 rmind * modification, are permitted provided that the following conditions
12 1.6.4.2 rmind * are met:
13 1.6.4.2 rmind * 1. Redistributions of source code must retain the above copyright
14 1.6.4.2 rmind * notice, this list of conditions and the following disclaimer.
15 1.6.4.2 rmind * 2. Redistributions in binary form must reproduce the above copyright
16 1.6.4.2 rmind * notice, this list of conditions and the following disclaimer in the
17 1.6.4.2 rmind * documentation and/or other materials provided with the distribution.
18 1.6.4.2 rmind *
19 1.6.4.2 rmind * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.6.4.2 rmind * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.6.4.2 rmind * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.6.4.2 rmind * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.6.4.2 rmind * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.6.4.2 rmind * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.6.4.2 rmind * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.6.4.2 rmind * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.6.4.2 rmind * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.6.4.2 rmind * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.6.4.2 rmind * POSSIBILITY OF SUCH DAMAGE.
30 1.6.4.2 rmind */
31 1.6.4.2 rmind
32 1.6.4.2 rmind /*
33 1.6.4.2 rmind * NPF ALG for ICMP and traceroute translations.
34 1.6.4.2 rmind */
35 1.6.4.2 rmind
36 1.6.4.2 rmind #include <sys/cdefs.h>
37 1.6.4.2 rmind __KERNEL_RCSID(0, "$NetBSD: npf_alg_icmp.c,v 1.6.4.2 2011/03/05 20:55:54 rmind Exp $");
38 1.6.4.2 rmind
39 1.6.4.2 rmind #include <sys/param.h>
40 1.6.4.2 rmind #include <sys/kernel.h>
41 1.6.4.2 rmind #include <sys/module.h>
42 1.6.4.2 rmind #include <sys/pool.h>
43 1.6.4.2 rmind
44 1.6.4.2 rmind #include <netinet/in_systm.h>
45 1.6.4.2 rmind #include <netinet/in.h>
46 1.6.4.2 rmind #include <netinet/ip.h>
47 1.6.4.2 rmind #include <netinet/tcp.h>
48 1.6.4.2 rmind #include <netinet/udp.h>
49 1.6.4.2 rmind #include <netinet/ip_icmp.h>
50 1.6.4.2 rmind #include <net/pfil.h>
51 1.6.4.2 rmind
52 1.6.4.2 rmind #include "npf_impl.h"
53 1.6.4.2 rmind
54 1.6.4.2 rmind MODULE(MODULE_CLASS_MISC, npf_alg_icmp, "npf");
55 1.6.4.2 rmind
56 1.6.4.2 rmind /*
57 1.6.4.2 rmind * Traceroute criteria.
58 1.6.4.2 rmind *
59 1.6.4.2 rmind * IANA assigned base port: 33434. However, common practice is to increase
60 1.6.4.2 rmind * the port, thus monitor [33434-33484] range. Additional filter is TTL < 50.
61 1.6.4.2 rmind */
62 1.6.4.2 rmind
63 1.6.4.2 rmind #define TR_BASE_PORT 33434
64 1.6.4.2 rmind #define TR_PORT_RANGE 33484
65 1.6.4.2 rmind #define TR_MAX_TTL 50
66 1.6.4.2 rmind
67 1.6.4.2 rmind static npf_alg_t * alg_icmp __read_mostly;
68 1.6.4.2 rmind
69 1.6.4.2 rmind static bool npfa_icmp_match(npf_cache_t *, nbuf_t *, void *);
70 1.6.4.2 rmind static bool npfa_icmp_natin(npf_cache_t *, nbuf_t *, void *);
71 1.6.4.2 rmind static bool npfa_icmp_session(npf_cache_t *, nbuf_t *, void *);
72 1.6.4.2 rmind
73 1.6.4.2 rmind /*
74 1.6.4.2 rmind * npf_alg_icmp_{init,fini,modcmd}: ICMP ALG initialization, destruction
75 1.6.4.2 rmind * and module interface.
76 1.6.4.2 rmind */
77 1.6.4.2 rmind
78 1.6.4.2 rmind static int
79 1.6.4.2 rmind npf_alg_icmp_init(void)
80 1.6.4.2 rmind {
81 1.6.4.2 rmind
82 1.6.4.2 rmind alg_icmp = npf_alg_register(npfa_icmp_match, NULL,
83 1.6.4.2 rmind npfa_icmp_natin, npfa_icmp_session);
84 1.6.4.2 rmind KASSERT(alg_icmp != NULL);
85 1.6.4.2 rmind return 0;
86 1.6.4.2 rmind }
87 1.6.4.2 rmind
88 1.6.4.2 rmind static int
89 1.6.4.2 rmind npf_alg_icmp_fini(void)
90 1.6.4.2 rmind {
91 1.6.4.2 rmind
92 1.6.4.2 rmind KASSERT(alg_icmp != NULL);
93 1.6.4.2 rmind return npf_alg_unregister(alg_icmp);
94 1.6.4.2 rmind }
95 1.6.4.2 rmind
96 1.6.4.2 rmind static int
97 1.6.4.2 rmind npf_alg_icmp_modcmd(modcmd_t cmd, void *arg)
98 1.6.4.2 rmind {
99 1.6.4.2 rmind
100 1.6.4.2 rmind switch (cmd) {
101 1.6.4.2 rmind case MODULE_CMD_INIT:
102 1.6.4.2 rmind return npf_alg_icmp_init();
103 1.6.4.2 rmind case MODULE_CMD_FINI:
104 1.6.4.2 rmind return npf_alg_icmp_fini();
105 1.6.4.2 rmind default:
106 1.6.4.2 rmind return ENOTTY;
107 1.6.4.2 rmind }
108 1.6.4.2 rmind return 0;
109 1.6.4.2 rmind }
110 1.6.4.2 rmind
111 1.6.4.2 rmind /*
112 1.6.4.2 rmind * npfa_icmp_match: ALG matching inspector - determines ALG case and
113 1.6.4.2 rmind * associates ALG with NAT entry.
114 1.6.4.2 rmind */
115 1.6.4.2 rmind static bool
116 1.6.4.2 rmind npfa_icmp_match(npf_cache_t *npc, nbuf_t *nbuf, void *ntptr)
117 1.6.4.2 rmind {
118 1.6.4.2 rmind const int proto = npf_cache_ipproto(npc);
119 1.6.4.2 rmind struct ip *ip = &npc->npc_ip.v4;
120 1.6.4.2 rmind in_port_t dport;
121 1.6.4.2 rmind
122 1.6.4.2 rmind KASSERT(npf_iscached(npc, NPC_IP46 | NPC_LAYER4));
123 1.6.4.2 rmind
124 1.6.4.2 rmind /* Check for low TTL. */
125 1.6.4.2 rmind if (ip->ip_ttl > TR_MAX_TTL) {
126 1.6.4.2 rmind return false;
127 1.6.4.2 rmind }
128 1.6.4.2 rmind
129 1.6.4.2 rmind if (proto == IPPROTO_TCP) {
130 1.6.4.2 rmind struct tcphdr *th = &npc->npc_l4.tcp;
131 1.6.4.2 rmind dport = ntohs(th->th_dport);
132 1.6.4.2 rmind } else if (proto == IPPROTO_UDP) {
133 1.6.4.2 rmind struct udphdr *uh = &npc->npc_l4.udp;
134 1.6.4.2 rmind dport = ntohs(uh->uh_dport);
135 1.6.4.2 rmind } else {
136 1.6.4.2 rmind return false;
137 1.6.4.2 rmind }
138 1.6.4.2 rmind
139 1.6.4.2 rmind /* Handle TCP/UDP traceroute - check for port range. */
140 1.6.4.2 rmind if (dport < TR_BASE_PORT || dport > TR_PORT_RANGE) {
141 1.6.4.2 rmind return false;
142 1.6.4.2 rmind }
143 1.6.4.2 rmind
144 1.6.4.2 rmind /* Associate ALG with translation entry. */
145 1.6.4.2 rmind npf_nat_t *nt = ntptr;
146 1.6.4.2 rmind npf_nat_setalg(nt, alg_icmp, 0);
147 1.6.4.2 rmind return true;
148 1.6.4.2 rmind }
149 1.6.4.2 rmind
150 1.6.4.2 rmind /*
151 1.6.4.2 rmind * npf_icmp_uniqid: retrieve unique identifiers - either ICMP query ID
152 1.6.4.2 rmind * or TCP/UDP ports of the original packet, which is embedded.
153 1.6.4.2 rmind */
154 1.6.4.2 rmind static bool
155 1.6.4.2 rmind npf_icmp_uniqid(const int type, npf_cache_t *npc, nbuf_t *nbuf, void *n_ptr)
156 1.6.4.2 rmind {
157 1.6.4.2 rmind struct icmp *ic;
158 1.6.4.2 rmind u_int offby;
159 1.6.4.2 rmind
160 1.6.4.2 rmind /* Per RFC 792. */
161 1.6.4.2 rmind switch (type) {
162 1.6.4.2 rmind case ICMP_UNREACH:
163 1.6.4.2 rmind case ICMP_SOURCEQUENCH:
164 1.6.4.2 rmind case ICMP_REDIRECT:
165 1.6.4.2 rmind case ICMP_TIMXCEED:
166 1.6.4.2 rmind case ICMP_PARAMPROB:
167 1.6.4.2 rmind /* Should contain original IP header. */
168 1.6.4.2 rmind offby = offsetof(struct icmp, icmp_ip);
169 1.6.4.2 rmind if ((n_ptr = nbuf_advance(&nbuf, n_ptr, offby)) == NULL) {
170 1.6.4.2 rmind return false;
171 1.6.4.2 rmind }
172 1.6.4.2 rmind /* Fetch into the cache. */
173 1.6.4.2 rmind if (!npf_fetch_ip(npc, nbuf, n_ptr)) {
174 1.6.4.2 rmind return false;
175 1.6.4.2 rmind }
176 1.6.4.2 rmind switch (npf_cache_ipproto(npc)) {
177 1.6.4.2 rmind case IPPROTO_TCP:
178 1.6.4.2 rmind return npf_fetch_tcp(npc, nbuf, n_ptr);
179 1.6.4.2 rmind case IPPROTO_UDP:
180 1.6.4.2 rmind return npf_fetch_udp(npc, nbuf, n_ptr);
181 1.6.4.2 rmind default:
182 1.6.4.2 rmind return false;
183 1.6.4.2 rmind }
184 1.6.4.2 rmind return true;
185 1.6.4.2 rmind
186 1.6.4.2 rmind case ICMP_ECHOREPLY:
187 1.6.4.2 rmind case ICMP_ECHO:
188 1.6.4.2 rmind case ICMP_TSTAMP:
189 1.6.4.2 rmind case ICMP_TSTAMPREPLY:
190 1.6.4.2 rmind case ICMP_IREQ:
191 1.6.4.2 rmind case ICMP_IREQREPLY:
192 1.6.4.2 rmind /* Should contain ICMP query ID. */
193 1.6.4.2 rmind ic = &npc->npc_l4.icmp;
194 1.6.4.2 rmind offby = offsetof(struct icmp, icmp_id);
195 1.6.4.2 rmind if (nbuf_advfetch(&nbuf, &n_ptr, offby,
196 1.6.4.2 rmind sizeof(uint16_t), &ic->icmp_id)) {
197 1.6.4.2 rmind return false;
198 1.6.4.2 rmind }
199 1.6.4.2 rmind npc->npc_info |= NPC_ICMP_ID;
200 1.6.4.2 rmind return true;
201 1.6.4.2 rmind default:
202 1.6.4.2 rmind break;
203 1.6.4.2 rmind }
204 1.6.4.2 rmind /* No unique IDs. */
205 1.6.4.2 rmind return false;
206 1.6.4.2 rmind }
207 1.6.4.2 rmind
208 1.6.4.2 rmind static void
209 1.6.4.2 rmind npfa_srcdst_invert(npf_cache_t *npc)
210 1.6.4.2 rmind {
211 1.6.4.2 rmind const int proto = npf_cache_ipproto(npc);
212 1.6.4.2 rmind npf_addr_t *tmp_ip;
213 1.6.4.2 rmind
214 1.6.4.2 rmind if (proto == IPPROTO_TCP) {
215 1.6.4.2 rmind struct tcphdr *th = &npc->npc_l4.tcp;
216 1.6.4.2 rmind in_port_t tmp_sport = th->th_sport;
217 1.6.4.2 rmind th->th_sport = th->th_dport;
218 1.6.4.2 rmind th->th_dport = tmp_sport;
219 1.6.4.2 rmind
220 1.6.4.2 rmind } else if (proto == IPPROTO_UDP) {
221 1.6.4.2 rmind struct udphdr *uh = &npc->npc_l4.udp;
222 1.6.4.2 rmind in_port_t tmp_sport = uh->uh_sport;
223 1.6.4.2 rmind uh->uh_sport = uh->uh_dport;
224 1.6.4.2 rmind uh->uh_dport = tmp_sport;
225 1.6.4.2 rmind }
226 1.6.4.2 rmind tmp_ip = npc->npc_srcip;
227 1.6.4.2 rmind npc->npc_srcip = npc->npc_dstip;
228 1.6.4.2 rmind npc->npc_dstip = tmp_ip;
229 1.6.4.2 rmind }
230 1.6.4.2 rmind
231 1.6.4.2 rmind /*
232 1.6.4.2 rmind * npfa_icmp_session: ALG session inspector, returns unique identifiers.
233 1.6.4.2 rmind */
234 1.6.4.2 rmind static bool
235 1.6.4.2 rmind npfa_icmp_session(npf_cache_t *npc, nbuf_t *nbuf, void *keyptr)
236 1.6.4.2 rmind {
237 1.6.4.2 rmind npf_cache_t *key = keyptr;
238 1.6.4.2 rmind KASSERT(key->npc_info == 0);
239 1.6.4.2 rmind
240 1.6.4.2 rmind /* IP + ICMP? Get unique identifiers from ICMP packet. */
241 1.6.4.2 rmind if (!npf_iscached(npc, NPC_IP4)) {
242 1.6.4.2 rmind return false;
243 1.6.4.2 rmind }
244 1.6.4.2 rmind if (npf_cache_ipproto(npc) != IPPROTO_ICMP) {
245 1.6.4.2 rmind return false;
246 1.6.4.2 rmind }
247 1.6.4.2 rmind KASSERT(npf_iscached(npc, NPC_ICMP));
248 1.6.4.2 rmind
249 1.6.4.2 rmind /* Advance to ICMP header. */
250 1.6.4.2 rmind struct ip *ip = &npc->npc_ip.v4;
251 1.6.4.2 rmind void *n_ptr = nbuf_dataptr(nbuf);
252 1.6.4.2 rmind
253 1.6.4.2 rmind if ((n_ptr = nbuf_advance(&nbuf, n_ptr, ip->ip_hl << 2)) == NULL) {
254 1.6.4.2 rmind return false;
255 1.6.4.2 rmind }
256 1.6.4.2 rmind
257 1.6.4.2 rmind /* Fetch relevant data into the separate ("key") cache. */
258 1.6.4.2 rmind struct icmp *ic = &npc->npc_l4.icmp;
259 1.6.4.2 rmind if (!npf_icmp_uniqid(ic->icmp_type, key, nbuf, n_ptr)) {
260 1.6.4.2 rmind return false;
261 1.6.4.2 rmind }
262 1.6.4.2 rmind
263 1.6.4.2 rmind if (npf_iscached(key, NPC_ICMP_ID)) {
264 1.6.4.2 rmind struct icmp *keyic = &key->npc_l4.icmp;
265 1.6.4.2 rmind
266 1.6.4.2 rmind /* Copy ICMP ID to the cache and flag it. */
267 1.6.4.2 rmind npc->npc_info |= NPC_ICMP_ID;
268 1.6.4.2 rmind ic->icmp_id = keyic->icmp_id;
269 1.6.4.2 rmind
270 1.6.4.2 rmind /* Note: return False, since key is the original cache. */
271 1.6.4.2 rmind return false;
272 1.6.4.2 rmind }
273 1.6.4.2 rmind
274 1.6.4.2 rmind /*
275 1.6.4.2 rmind * Embedded IP packet is the original of "forwards" stream.
276 1.6.4.2 rmind * We should imitate the "backwards" stream for inspection.
277 1.6.4.2 rmind */
278 1.6.4.2 rmind KASSERT(npf_iscached(key, NPC_IP46));
279 1.6.4.2 rmind KASSERT(npf_iscached(key, NPC_LAYER4));
280 1.6.4.2 rmind npfa_srcdst_invert(key);
281 1.6.4.2 rmind key->npc_ipsz = npc->npc_ipsz;
282 1.6.4.2 rmind
283 1.6.4.2 rmind return true;
284 1.6.4.2 rmind }
285 1.6.4.2 rmind
286 1.6.4.2 rmind /*
287 1.6.4.2 rmind * npfa_icmp_natin: ALG inbound translation inspector, rewrite IP address
288 1.6.4.2 rmind * in the IP header, which is embedded in ICMP packet.
289 1.6.4.2 rmind */
290 1.6.4.2 rmind static bool
291 1.6.4.2 rmind npfa_icmp_natin(npf_cache_t *npc, nbuf_t *nbuf, void *ntptr)
292 1.6.4.2 rmind {
293 1.6.4.2 rmind npf_cache_t enpc = { .npc_info = 0 };
294 1.6.4.2 rmind
295 1.6.4.2 rmind /* XXX: Duplicated work (done at session inspection). */
296 1.6.4.2 rmind if (!npfa_icmp_session(npc, nbuf, &enpc)) {
297 1.6.4.2 rmind return false;
298 1.6.4.2 rmind }
299 1.6.4.2 rmind /* XXX: Restore inversion (inefficient). */
300 1.6.4.2 rmind KASSERT(npf_iscached(&enpc, NPC_IP46 | NPC_LAYER4));
301 1.6.4.2 rmind npfa_srcdst_invert(&enpc);
302 1.6.4.2 rmind
303 1.6.4.2 rmind /*
304 1.6.4.2 rmind * Save ICMP and embedded IP with TCP/UDP header checksums, retrieve
305 1.6.4.2 rmind * the original address and port, and calculate ICMP checksum for
306 1.6.4.2 rmind * embedded packet changes, while data is not rewritten in the cache.
307 1.6.4.2 rmind */
308 1.6.4.2 rmind const int proto = npf_cache_ipproto(&enpc);
309 1.6.4.2 rmind const struct ip * const ip = &npc->npc_ip.v4, *eip = &enpc.npc_ip.v4;
310 1.6.4.2 rmind const struct icmp * const ic = &npc->npc_l4.icmp;
311 1.6.4.2 rmind uint16_t cksum = ic->icmp_cksum, ecksum = eip->ip_sum, l4cksum;
312 1.6.4.2 rmind npf_nat_t *nt = ntptr;
313 1.6.4.2 rmind npf_addr_t *addr;
314 1.6.4.2 rmind in_port_t port;
315 1.6.4.2 rmind
316 1.6.4.2 rmind npf_nat_getorig(nt, &addr, &port);
317 1.6.4.2 rmind
318 1.6.4.2 rmind if (proto == IPPROTO_TCP) {
319 1.6.4.2 rmind struct tcphdr *th = &enpc.npc_l4.tcp;
320 1.6.4.2 rmind cksum = npf_fixup16_cksum(cksum, th->th_sport, port);
321 1.6.4.2 rmind l4cksum = th->th_sum;
322 1.6.4.2 rmind } else {
323 1.6.4.2 rmind struct udphdr *uh = &enpc.npc_l4.udp;
324 1.6.4.2 rmind cksum = npf_fixup16_cksum(cksum, uh->uh_sport, port);
325 1.6.4.2 rmind l4cksum = uh->uh_sum;
326 1.6.4.2 rmind }
327 1.6.4.2 rmind cksum = npf_addr_cksum(cksum, enpc.npc_ipsz, enpc.npc_srcip, addr);
328 1.6.4.2 rmind
329 1.6.4.2 rmind /*
330 1.6.4.2 rmind * Save the original pointers to the main IP header and then advance
331 1.6.4.2 rmind * to the embedded IP header after ICMP header.
332 1.6.4.2 rmind */
333 1.6.4.2 rmind void *n_ptr = nbuf_dataptr(nbuf), *cnbuf = nbuf, *cnptr = n_ptr;
334 1.6.4.2 rmind u_int offby = (ip->ip_hl << 2) + offsetof(struct icmp, icmp_ip);
335 1.6.4.2 rmind
336 1.6.4.2 rmind if ((n_ptr = nbuf_advance(&nbuf, n_ptr, offby)) == NULL) {
337 1.6.4.2 rmind return false;
338 1.6.4.2 rmind }
339 1.6.4.2 rmind
340 1.6.4.2 rmind /*
341 1.6.4.2 rmind * Rewrite source IP address and port of the embedded IP header,
342 1.6.4.2 rmind * which represents original packet - therefore passing PFIL_OUT.
343 1.6.4.2 rmind * Note: checksums are first, since it uses values from the cache.
344 1.6.4.2 rmind */
345 1.6.4.2 rmind if (!npf_rwrcksum(&enpc, nbuf, n_ptr, PFIL_OUT, addr, port)) {
346 1.6.4.2 rmind return false;
347 1.6.4.2 rmind }
348 1.6.4.2 rmind if (!npf_rwrip(&enpc, nbuf, n_ptr, PFIL_OUT, addr)) {
349 1.6.4.2 rmind return false;
350 1.6.4.2 rmind }
351 1.6.4.2 rmind if (!npf_rwrport(&enpc, nbuf, n_ptr, PFIL_OUT, port)) {
352 1.6.4.2 rmind return false;
353 1.6.4.2 rmind }
354 1.6.4.2 rmind
355 1.6.4.2 rmind /*
356 1.6.4.2 rmind * Finish calculation of the ICMP checksum. Update for embedded IP
357 1.6.4.2 rmind * and TCP/UDP checksum changes. Finally, rewrite ICMP checksum.
358 1.6.4.2 rmind */
359 1.6.4.2 rmind if (proto == IPPROTO_TCP) {
360 1.6.4.2 rmind struct tcphdr *th = &enpc.npc_l4.tcp;
361 1.6.4.2 rmind cksum = npf_fixup16_cksum(cksum, l4cksum, th->th_sum);
362 1.6.4.2 rmind } else if (l4cksum) {
363 1.6.4.2 rmind struct udphdr *uh = &enpc.npc_l4.udp;
364 1.6.4.2 rmind cksum = npf_fixup16_cksum(cksum, l4cksum, uh->uh_sum);
365 1.6.4.2 rmind }
366 1.6.4.2 rmind cksum = npf_fixup16_cksum(cksum, ecksum, eip->ip_sum);
367 1.6.4.2 rmind
368 1.6.4.2 rmind offby = (ip->ip_hl << 2) + offsetof(struct icmp, icmp_cksum);
369 1.6.4.2 rmind if (nbuf_advstore(&cnbuf, &cnptr, offby, sizeof(uint16_t), &cksum)) {
370 1.6.4.2 rmind return false;
371 1.6.4.2 rmind }
372 1.6.4.2 rmind return true;
373 1.6.4.2 rmind }
374