1b06ebda0SMatthew Dillon /*-
2b06ebda0SMatthew Dillon * Copyright (c) 2006 Alexander Motin <mav@alkar.net>
3b06ebda0SMatthew Dillon * All rights reserved.
4b06ebda0SMatthew Dillon *
5b06ebda0SMatthew Dillon * Redistribution and use in source and binary forms, with or without
6b06ebda0SMatthew Dillon * modification, are permitted provided that the following conditions
7b06ebda0SMatthew Dillon * are met:
8b06ebda0SMatthew Dillon * 1. Redistributions of source code must retain the above copyright
9b06ebda0SMatthew Dillon * notice unmodified, this list of conditions, and the following
10b06ebda0SMatthew Dillon * disclaimer.
11b06ebda0SMatthew Dillon * 2. Redistributions in binary form must reproduce the above copyright
12b06ebda0SMatthew Dillon * notice, this list of conditions and the following disclaimer in the
13b06ebda0SMatthew Dillon * documentation and/or other materials provided with the distribution.
14b06ebda0SMatthew Dillon *
15b06ebda0SMatthew Dillon * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16b06ebda0SMatthew Dillon * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17b06ebda0SMatthew Dillon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18b06ebda0SMatthew Dillon * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19b06ebda0SMatthew Dillon * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20b06ebda0SMatthew Dillon * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21b06ebda0SMatthew Dillon * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22b06ebda0SMatthew Dillon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23b06ebda0SMatthew Dillon * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24b06ebda0SMatthew Dillon * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25b06ebda0SMatthew Dillon * SUCH DAMAGE.
26b06ebda0SMatthew Dillon *
27b06ebda0SMatthew Dillon * $FreeBSD: src/sys/netgraph/ng_pred1.c,v 1.3 2008/01/27 02:04:12 mav Exp $
28b06ebda0SMatthew Dillon */
29b06ebda0SMatthew Dillon
30b06ebda0SMatthew Dillon /*
31b06ebda0SMatthew Dillon * Predictor-1 PPP compression netgraph node type.
32b06ebda0SMatthew Dillon */
33b06ebda0SMatthew Dillon
34b06ebda0SMatthew Dillon #include <sys/param.h>
35b06ebda0SMatthew Dillon #include <sys/systm.h>
36b06ebda0SMatthew Dillon #include <sys/kernel.h>
37b06ebda0SMatthew Dillon #include <sys/mbuf.h>
38b06ebda0SMatthew Dillon #include <sys/malloc.h>
39b06ebda0SMatthew Dillon #include <sys/errno.h>
40b06ebda0SMatthew Dillon #include <sys/syslog.h>
41b06ebda0SMatthew Dillon
425a975a3dSMatthew Dillon #include "ng_message.h"
435a975a3dSMatthew Dillon #include "netgraph.h"
445a975a3dSMatthew Dillon #include "ng_parse.h"
455a975a3dSMatthew Dillon #include "ng_pred1.h"
46b06ebda0SMatthew Dillon
47b06ebda0SMatthew Dillon #include "opt_netgraph.h"
48b06ebda0SMatthew Dillon
49b06ebda0SMatthew Dillon MALLOC_DEFINE(M_NETGRAPH_PRED1, "netgraph_pred1", "netgraph pred1 node ");
50b06ebda0SMatthew Dillon
51b06ebda0SMatthew Dillon /* PRED1 header length */
52b06ebda0SMatthew Dillon #define PRED1_HDRLEN 2
53b06ebda0SMatthew Dillon
54b06ebda0SMatthew Dillon #define PRED1_TABLE_SIZE 0x10000
55b06ebda0SMatthew Dillon #define PRED1_BUF_SIZE 4096
56b06ebda0SMatthew Dillon #define PPP_INITFCS 0xffff /* Initial FCS value */
57b06ebda0SMatthew Dillon #define PPP_GOODFCS 0xf0b8 /* Good final FCS value */
58b06ebda0SMatthew Dillon
59b06ebda0SMatthew Dillon /*
60b06ebda0SMatthew Dillon * The following hash code is the heart of the algorithm:
61b06ebda0SMatthew Dillon * it builds a sliding hash sum of the previous 3-and-a-bit
62b06ebda0SMatthew Dillon * characters which will be used to index the guess table.
63b06ebda0SMatthew Dillon * A better hash function would result in additional compression,
64b06ebda0SMatthew Dillon * at the expense of time.
65b06ebda0SMatthew Dillon */
66b06ebda0SMatthew Dillon
67b06ebda0SMatthew Dillon #define HASH(x) priv->Hash = (priv->Hash << 4) ^ (x)
68b06ebda0SMatthew Dillon
69b06ebda0SMatthew Dillon /* Node private data */
70b06ebda0SMatthew Dillon struct ng_pred1_private {
71b06ebda0SMatthew Dillon struct ng_pred1_config cfg; /* configuration */
72b06ebda0SMatthew Dillon u_char GuessTable[PRED1_TABLE_SIZE]; /* dictionary */
73b06ebda0SMatthew Dillon u_char inbuf[PRED1_BUF_SIZE]; /* input buffer */
74b06ebda0SMatthew Dillon u_char outbuf[PRED1_BUF_SIZE]; /* output buffer */
75b06ebda0SMatthew Dillon struct ng_pred1_stats stats; /* statistics */
76b06ebda0SMatthew Dillon uint16_t Hash;
77b06ebda0SMatthew Dillon ng_ID_t ctrlnode; /* path to controlling node */
78b06ebda0SMatthew Dillon uint16_t seqnum; /* sequence number */
79b06ebda0SMatthew Dillon u_char compress; /* compress/decompress flag */
80b06ebda0SMatthew Dillon };
81b06ebda0SMatthew Dillon typedef struct ng_pred1_private *priv_p;
82b06ebda0SMatthew Dillon
83b06ebda0SMatthew Dillon /* Netgraph node methods */
84b06ebda0SMatthew Dillon static ng_constructor_t ng_pred1_constructor;
85b06ebda0SMatthew Dillon static ng_rcvmsg_t ng_pred1_rcvmsg;
86b06ebda0SMatthew Dillon static ng_shutdown_t ng_pred1_shutdown;
87b06ebda0SMatthew Dillon static ng_newhook_t ng_pred1_newhook;
88b06ebda0SMatthew Dillon static ng_rcvdata_t ng_pred1_rcvdata;
89b06ebda0SMatthew Dillon static ng_disconnect_t ng_pred1_disconnect;
90b06ebda0SMatthew Dillon
91b06ebda0SMatthew Dillon /* Helper functions */
92b06ebda0SMatthew Dillon static int ng_pred1_compress(node_p node, struct mbuf *m,
93b06ebda0SMatthew Dillon struct mbuf **resultp);
94b06ebda0SMatthew Dillon static int ng_pred1_decompress(node_p node, struct mbuf *m,
95b06ebda0SMatthew Dillon struct mbuf **resultp);
96b06ebda0SMatthew Dillon static void Pred1Init(node_p node);
97b06ebda0SMatthew Dillon static int Pred1Compress(node_p node, u_char *source, u_char *dest,
98b06ebda0SMatthew Dillon int len);
99b06ebda0SMatthew Dillon static int Pred1Decompress(node_p node, u_char *source, u_char *dest,
100b06ebda0SMatthew Dillon int slen, int dlen);
101b06ebda0SMatthew Dillon static void Pred1SyncTable(node_p node, u_char *source, int len);
102b06ebda0SMatthew Dillon static uint16_t Crc16(uint16_t fcs, u_char *cp, int len);
103b06ebda0SMatthew Dillon
104b06ebda0SMatthew Dillon static const uint16_t Crc16Table[];
105b06ebda0SMatthew Dillon
106b06ebda0SMatthew Dillon /* Parse type for struct ng_pred1_config. */
107b06ebda0SMatthew Dillon static const struct ng_parse_struct_field ng_pred1_config_type_fields[]
108b06ebda0SMatthew Dillon = NG_PRED1_CONFIG_INFO;
109b06ebda0SMatthew Dillon static const struct ng_parse_type ng_pred1_config_type = {
110b06ebda0SMatthew Dillon &ng_parse_struct_type,
111b06ebda0SMatthew Dillon ng_pred1_config_type_fields
112b06ebda0SMatthew Dillon };
113b06ebda0SMatthew Dillon
114b06ebda0SMatthew Dillon /* Parse type for struct ng_pred1_stat. */
115b06ebda0SMatthew Dillon static const struct ng_parse_struct_field ng_pred1_stats_type_fields[]
116b06ebda0SMatthew Dillon = NG_PRED1_STATS_INFO;
117b06ebda0SMatthew Dillon static const struct ng_parse_type ng_pred1_stat_type = {
118b06ebda0SMatthew Dillon &ng_parse_struct_type,
119b06ebda0SMatthew Dillon ng_pred1_stats_type_fields
120b06ebda0SMatthew Dillon };
121b06ebda0SMatthew Dillon
122b06ebda0SMatthew Dillon /* List of commands and how to convert arguments to/from ASCII. */
123b06ebda0SMatthew Dillon static const struct ng_cmdlist ng_pred1_cmds[] = {
124b06ebda0SMatthew Dillon {
125b06ebda0SMatthew Dillon NGM_PRED1_COOKIE,
126b06ebda0SMatthew Dillon NGM_PRED1_CONFIG,
127b06ebda0SMatthew Dillon "config",
128b06ebda0SMatthew Dillon &ng_pred1_config_type,
129b06ebda0SMatthew Dillon NULL
130b06ebda0SMatthew Dillon },
131b06ebda0SMatthew Dillon {
132b06ebda0SMatthew Dillon NGM_PRED1_COOKIE,
133b06ebda0SMatthew Dillon NGM_PRED1_RESETREQ,
134b06ebda0SMatthew Dillon "resetreq",
135b06ebda0SMatthew Dillon NULL,
136b06ebda0SMatthew Dillon NULL
137b06ebda0SMatthew Dillon },
138b06ebda0SMatthew Dillon {
139b06ebda0SMatthew Dillon NGM_PRED1_COOKIE,
140b06ebda0SMatthew Dillon NGM_PRED1_GET_STATS,
141b06ebda0SMatthew Dillon "getstats",
142b06ebda0SMatthew Dillon NULL,
143b06ebda0SMatthew Dillon &ng_pred1_stat_type
144b06ebda0SMatthew Dillon },
145b06ebda0SMatthew Dillon {
146b06ebda0SMatthew Dillon NGM_PRED1_COOKIE,
147b06ebda0SMatthew Dillon NGM_PRED1_CLR_STATS,
148b06ebda0SMatthew Dillon "clrstats",
149b06ebda0SMatthew Dillon NULL,
150b06ebda0SMatthew Dillon NULL
151b06ebda0SMatthew Dillon },
152b06ebda0SMatthew Dillon {
153b06ebda0SMatthew Dillon NGM_PRED1_COOKIE,
154b06ebda0SMatthew Dillon NGM_PRED1_GETCLR_STATS,
155b06ebda0SMatthew Dillon "getclrstats",
156b06ebda0SMatthew Dillon NULL,
157b06ebda0SMatthew Dillon &ng_pred1_stat_type
158b06ebda0SMatthew Dillon },
159b06ebda0SMatthew Dillon { 0 }
160b06ebda0SMatthew Dillon };
161b06ebda0SMatthew Dillon
162b06ebda0SMatthew Dillon /* Node type descriptor */
163b06ebda0SMatthew Dillon static struct ng_type ng_pred1_typestruct = {
164b06ebda0SMatthew Dillon .version = NG_ABI_VERSION,
165b06ebda0SMatthew Dillon .name = NG_PRED1_NODE_TYPE,
166b06ebda0SMatthew Dillon .constructor = ng_pred1_constructor,
167b06ebda0SMatthew Dillon .rcvmsg = ng_pred1_rcvmsg,
168b06ebda0SMatthew Dillon .shutdown = ng_pred1_shutdown,
169b06ebda0SMatthew Dillon .newhook = ng_pred1_newhook,
170b06ebda0SMatthew Dillon .rcvdata = ng_pred1_rcvdata,
171b06ebda0SMatthew Dillon .disconnect = ng_pred1_disconnect,
172b06ebda0SMatthew Dillon .cmdlist = ng_pred1_cmds,
173b06ebda0SMatthew Dillon };
174b06ebda0SMatthew Dillon NETGRAPH_INIT(pred1, &ng_pred1_typestruct);
175b06ebda0SMatthew Dillon
176b06ebda0SMatthew Dillon #define ERROUT(x) do { error = (x); goto done; } while (0)
177b06ebda0SMatthew Dillon
178b06ebda0SMatthew Dillon /************************************************************************
179b06ebda0SMatthew Dillon NETGRAPH NODE STUFF
180b06ebda0SMatthew Dillon ************************************************************************/
181b06ebda0SMatthew Dillon
182b06ebda0SMatthew Dillon /*
183b06ebda0SMatthew Dillon * Node type constructor
184b06ebda0SMatthew Dillon */
185b06ebda0SMatthew Dillon static int
ng_pred1_constructor(node_p node)186b06ebda0SMatthew Dillon ng_pred1_constructor(node_p node)
187b06ebda0SMatthew Dillon {
188b06ebda0SMatthew Dillon priv_p priv;
189b06ebda0SMatthew Dillon
190b06ebda0SMatthew Dillon /* Allocate private structure. */
1915a975a3dSMatthew Dillon priv = kmalloc(sizeof(*priv), M_NETGRAPH_PRED1, M_WAITOK | M_ZERO);
192b06ebda0SMatthew Dillon
193b06ebda0SMatthew Dillon NG_NODE_SET_PRIVATE(node, priv);
194b06ebda0SMatthew Dillon
195b06ebda0SMatthew Dillon /* This node is not thread safe. */
196b06ebda0SMatthew Dillon NG_NODE_FORCE_WRITER(node);
197b06ebda0SMatthew Dillon
198b06ebda0SMatthew Dillon /* Done */
199b06ebda0SMatthew Dillon return (0);
200b06ebda0SMatthew Dillon }
201b06ebda0SMatthew Dillon
202b06ebda0SMatthew Dillon /*
203b06ebda0SMatthew Dillon * Give our OK for a hook to be added.
204b06ebda0SMatthew Dillon */
205b06ebda0SMatthew Dillon static int
ng_pred1_newhook(node_p node,hook_p hook,const char * name)206b06ebda0SMatthew Dillon ng_pred1_newhook(node_p node, hook_p hook, const char *name)
207b06ebda0SMatthew Dillon {
208b06ebda0SMatthew Dillon const priv_p priv = NG_NODE_PRIVATE(node);
209b06ebda0SMatthew Dillon
210b06ebda0SMatthew Dillon if (NG_NODE_NUMHOOKS(node) > 0)
211b06ebda0SMatthew Dillon return (EINVAL);
212b06ebda0SMatthew Dillon
213b06ebda0SMatthew Dillon if (strcmp(name, NG_PRED1_HOOK_COMP) == 0)
214b06ebda0SMatthew Dillon priv->compress = 1;
215b06ebda0SMatthew Dillon else if (strcmp(name, NG_PRED1_HOOK_DECOMP) == 0)
216b06ebda0SMatthew Dillon priv->compress = 0;
217b06ebda0SMatthew Dillon else
218b06ebda0SMatthew Dillon return (EINVAL);
219b06ebda0SMatthew Dillon
220b06ebda0SMatthew Dillon return (0);
221b06ebda0SMatthew Dillon }
222b06ebda0SMatthew Dillon
223b06ebda0SMatthew Dillon /*
224b06ebda0SMatthew Dillon * Receive a control message.
225b06ebda0SMatthew Dillon */
226b06ebda0SMatthew Dillon static int
ng_pred1_rcvmsg(node_p node,item_p item,hook_p lasthook)227b06ebda0SMatthew Dillon ng_pred1_rcvmsg(node_p node, item_p item, hook_p lasthook)
228b06ebda0SMatthew Dillon {
229b06ebda0SMatthew Dillon const priv_p priv = NG_NODE_PRIVATE(node);
230b06ebda0SMatthew Dillon struct ng_mesg *resp = NULL;
231b06ebda0SMatthew Dillon int error = 0;
232b06ebda0SMatthew Dillon struct ng_mesg *msg;
233b06ebda0SMatthew Dillon
234b06ebda0SMatthew Dillon NGI_GET_MSG(item, msg);
235b06ebda0SMatthew Dillon
236b06ebda0SMatthew Dillon if (msg->header.typecookie != NGM_PRED1_COOKIE)
237b06ebda0SMatthew Dillon ERROUT(EINVAL);
238b06ebda0SMatthew Dillon
239b06ebda0SMatthew Dillon switch (msg->header.cmd) {
240b06ebda0SMatthew Dillon case NGM_PRED1_CONFIG:
241b06ebda0SMatthew Dillon {
242b06ebda0SMatthew Dillon struct ng_pred1_config *const cfg =
243b06ebda0SMatthew Dillon (struct ng_pred1_config *)msg->data;
244b06ebda0SMatthew Dillon
245b06ebda0SMatthew Dillon /* Check configuration. */
246b06ebda0SMatthew Dillon if (msg->header.arglen != sizeof(*cfg))
247b06ebda0SMatthew Dillon ERROUT(EINVAL);
248b06ebda0SMatthew Dillon
249b06ebda0SMatthew Dillon /* Configuration is OK, reset to it. */
250b06ebda0SMatthew Dillon priv->cfg = *cfg;
251b06ebda0SMatthew Dillon
252b06ebda0SMatthew Dillon /* Save return address so we can send reset-req's. */
253b06ebda0SMatthew Dillon priv->ctrlnode = NGI_RETADDR(item);
254b06ebda0SMatthew Dillon
255b06ebda0SMatthew Dillon /* Clear our state. */
256b06ebda0SMatthew Dillon Pred1Init(node);
257b06ebda0SMatthew Dillon
258b06ebda0SMatthew Dillon break;
259b06ebda0SMatthew Dillon }
260b06ebda0SMatthew Dillon case NGM_PRED1_RESETREQ:
261b06ebda0SMatthew Dillon Pred1Init(node);
262b06ebda0SMatthew Dillon break;
263b06ebda0SMatthew Dillon
264b06ebda0SMatthew Dillon case NGM_PRED1_GET_STATS:
265b06ebda0SMatthew Dillon case NGM_PRED1_CLR_STATS:
266b06ebda0SMatthew Dillon case NGM_PRED1_GETCLR_STATS:
267b06ebda0SMatthew Dillon {
268b06ebda0SMatthew Dillon /* Create response. */
269b06ebda0SMatthew Dillon if (msg->header.cmd != NGM_PRED1_CLR_STATS) {
270b06ebda0SMatthew Dillon NG_MKRESPONSE(resp, msg,
2715a975a3dSMatthew Dillon sizeof(struct ng_pred1_stats), M_WAITOK | M_NULLOK);
272b06ebda0SMatthew Dillon if (resp == NULL)
273b06ebda0SMatthew Dillon ERROUT(ENOMEM);
274b06ebda0SMatthew Dillon bcopy(&priv->stats, resp->data,
275b06ebda0SMatthew Dillon sizeof(struct ng_pred1_stats));
276b06ebda0SMatthew Dillon }
277b06ebda0SMatthew Dillon
278b06ebda0SMatthew Dillon if (msg->header.cmd != NGM_PRED1_GET_STATS)
279b06ebda0SMatthew Dillon bzero(&priv->stats, sizeof(struct ng_pred1_stats));
280b06ebda0SMatthew Dillon break;
281b06ebda0SMatthew Dillon }
282b06ebda0SMatthew Dillon
283b06ebda0SMatthew Dillon default:
284b06ebda0SMatthew Dillon error = EINVAL;
285b06ebda0SMatthew Dillon break;
286b06ebda0SMatthew Dillon }
287b06ebda0SMatthew Dillon done:
288b06ebda0SMatthew Dillon NG_RESPOND_MSG(error, node, item, resp);
289b06ebda0SMatthew Dillon NG_FREE_MSG(msg);
290b06ebda0SMatthew Dillon return (error);
291b06ebda0SMatthew Dillon }
292b06ebda0SMatthew Dillon
293b06ebda0SMatthew Dillon /*
294b06ebda0SMatthew Dillon * Receive incoming data on our hook.
295b06ebda0SMatthew Dillon */
296b06ebda0SMatthew Dillon static int
ng_pred1_rcvdata(hook_p hook,item_p item)297b06ebda0SMatthew Dillon ng_pred1_rcvdata(hook_p hook, item_p item)
298b06ebda0SMatthew Dillon {
299b06ebda0SMatthew Dillon const node_p node = NG_HOOK_NODE(hook);
300b06ebda0SMatthew Dillon const priv_p priv = NG_NODE_PRIVATE(node);
301b06ebda0SMatthew Dillon struct mbuf *m, *out;
302b06ebda0SMatthew Dillon int error;
303b06ebda0SMatthew Dillon
304b06ebda0SMatthew Dillon if (!priv->cfg.enable) {
305b06ebda0SMatthew Dillon NG_FREE_ITEM(item);
306b06ebda0SMatthew Dillon return (ENXIO);
307b06ebda0SMatthew Dillon }
308b06ebda0SMatthew Dillon
309b06ebda0SMatthew Dillon NGI_GET_M(item, m);
310b06ebda0SMatthew Dillon /* Compress. */
311b06ebda0SMatthew Dillon if (priv->compress) {
312b06ebda0SMatthew Dillon if ((error = ng_pred1_compress(node, m, &out)) != 0) {
313b06ebda0SMatthew Dillon NG_FREE_ITEM(item);
314b06ebda0SMatthew Dillon log(LOG_NOTICE, "%s: error: %d\n", __func__, error);
315b06ebda0SMatthew Dillon return (error);
316b06ebda0SMatthew Dillon }
317b06ebda0SMatthew Dillon
318b06ebda0SMatthew Dillon } else { /* Decompress. */
319b06ebda0SMatthew Dillon if ((error = ng_pred1_decompress(node, m, &out)) != 0) {
320b06ebda0SMatthew Dillon NG_FREE_ITEM(item);
321b06ebda0SMatthew Dillon log(LOG_NOTICE, "%s: error: %d\n", __func__, error);
322b06ebda0SMatthew Dillon if (priv->ctrlnode != 0) {
323b06ebda0SMatthew Dillon struct ng_mesg *msg;
324b06ebda0SMatthew Dillon
325b06ebda0SMatthew Dillon /* Need to send a reset-request. */
326b06ebda0SMatthew Dillon NG_MKMESSAGE(msg, NGM_PRED1_COOKIE,
3275a975a3dSMatthew Dillon NGM_PRED1_RESETREQ, 0, M_WAITOK | M_NULLOK);
328b06ebda0SMatthew Dillon if (msg == NULL)
329b06ebda0SMatthew Dillon return (error);
330b06ebda0SMatthew Dillon NG_SEND_MSG_ID(error, node, msg,
331b06ebda0SMatthew Dillon priv->ctrlnode, 0);
332b06ebda0SMatthew Dillon }
333b06ebda0SMatthew Dillon return (error);
334b06ebda0SMatthew Dillon }
335b06ebda0SMatthew Dillon }
336b06ebda0SMatthew Dillon
337b06ebda0SMatthew Dillon NG_FWD_NEW_DATA(error, item, hook, out);
338b06ebda0SMatthew Dillon return (error);
339b06ebda0SMatthew Dillon }
340b06ebda0SMatthew Dillon
341b06ebda0SMatthew Dillon /*
342b06ebda0SMatthew Dillon * Destroy node.
343b06ebda0SMatthew Dillon */
344b06ebda0SMatthew Dillon static int
ng_pred1_shutdown(node_p node)345b06ebda0SMatthew Dillon ng_pred1_shutdown(node_p node)
346b06ebda0SMatthew Dillon {
347b06ebda0SMatthew Dillon const priv_p priv = NG_NODE_PRIVATE(node);
348b06ebda0SMatthew Dillon
3495a975a3dSMatthew Dillon kfree(priv, M_NETGRAPH_PRED1);
350b06ebda0SMatthew Dillon NG_NODE_SET_PRIVATE(node, NULL);
351b06ebda0SMatthew Dillon NG_NODE_UNREF(node); /* Let the node escape. */
352b06ebda0SMatthew Dillon return (0);
353b06ebda0SMatthew Dillon }
354b06ebda0SMatthew Dillon
355b06ebda0SMatthew Dillon /*
356b06ebda0SMatthew Dillon * Hook disconnection
357b06ebda0SMatthew Dillon */
358b06ebda0SMatthew Dillon static int
ng_pred1_disconnect(hook_p hook)359b06ebda0SMatthew Dillon ng_pred1_disconnect(hook_p hook)
360b06ebda0SMatthew Dillon {
361b06ebda0SMatthew Dillon const node_p node = NG_HOOK_NODE(hook);
362b06ebda0SMatthew Dillon
363b06ebda0SMatthew Dillon Pred1Init(node);
364b06ebda0SMatthew Dillon
365b06ebda0SMatthew Dillon /* Go away if no longer connected. */
366b06ebda0SMatthew Dillon if ((NG_NODE_NUMHOOKS(node) == 0) && NG_NODE_IS_VALID(node))
367b06ebda0SMatthew Dillon ng_rmnode_self(node);
368b06ebda0SMatthew Dillon return (0);
369b06ebda0SMatthew Dillon }
370b06ebda0SMatthew Dillon
371b06ebda0SMatthew Dillon /************************************************************************
372b06ebda0SMatthew Dillon HELPER STUFF
373b06ebda0SMatthew Dillon ************************************************************************/
374b06ebda0SMatthew Dillon
375b06ebda0SMatthew Dillon /*
376b06ebda0SMatthew Dillon * Compress/encrypt a packet and put the result in a new mbuf at *resultp.
377b06ebda0SMatthew Dillon * The original mbuf is not free'd.
378b06ebda0SMatthew Dillon */
379b06ebda0SMatthew Dillon static int
ng_pred1_compress(node_p node,struct mbuf * m,struct mbuf ** resultp)380b06ebda0SMatthew Dillon ng_pred1_compress(node_p node, struct mbuf *m, struct mbuf **resultp)
381b06ebda0SMatthew Dillon {
382b06ebda0SMatthew Dillon const priv_p priv = NG_NODE_PRIVATE(node);
383b06ebda0SMatthew Dillon int outlen, inlen;
384b06ebda0SMatthew Dillon u_char *out;
385b06ebda0SMatthew Dillon uint16_t fcs, lenn;
386b06ebda0SMatthew Dillon int len;
387b06ebda0SMatthew Dillon
388b06ebda0SMatthew Dillon /* Initialize. */
389b06ebda0SMatthew Dillon *resultp = NULL;
390b06ebda0SMatthew Dillon
391b06ebda0SMatthew Dillon inlen = m->m_pkthdr.len;
392b06ebda0SMatthew Dillon
393b06ebda0SMatthew Dillon priv->stats.FramesPlain++;
394b06ebda0SMatthew Dillon priv->stats.InOctets += inlen;
395b06ebda0SMatthew Dillon
396b06ebda0SMatthew Dillon /* Reserve space for expansion. */
397b06ebda0SMatthew Dillon if (inlen > (PRED1_BUF_SIZE*8/9 + 1 + 4)) {
398b06ebda0SMatthew Dillon priv->stats.Errors++;
399b06ebda0SMatthew Dillon NG_FREE_M(m);
400b06ebda0SMatthew Dillon return (ENOMEM);
401b06ebda0SMatthew Dillon }
402b06ebda0SMatthew Dillon
403b06ebda0SMatthew Dillon /* Work with contiguous regions of memory. */
404*05d02a38SAaron LI m_copydata(m, 0, inlen, priv->inbuf + 2);
405b06ebda0SMatthew Dillon
406b06ebda0SMatthew Dillon NG_FREE_M(m);
407b06ebda0SMatthew Dillon
408b06ebda0SMatthew Dillon lenn = htons(inlen & 0x7FFF);
409b06ebda0SMatthew Dillon
410b06ebda0SMatthew Dillon /* Compute FCS. */
411b06ebda0SMatthew Dillon fcs = Crc16(PPP_INITFCS, (u_char *)&lenn, 2);
412b06ebda0SMatthew Dillon fcs = Crc16(fcs, priv->inbuf + 2, inlen);
413b06ebda0SMatthew Dillon fcs = ~fcs;
414b06ebda0SMatthew Dillon
415b06ebda0SMatthew Dillon /* Compress data. */
416b06ebda0SMatthew Dillon len = Pred1Compress(node, priv->inbuf + 2, priv->outbuf + 2, inlen);
417b06ebda0SMatthew Dillon
418b06ebda0SMatthew Dillon /* What happened? */
419b06ebda0SMatthew Dillon if (len < inlen) {
420b06ebda0SMatthew Dillon out = priv->outbuf;
421b06ebda0SMatthew Dillon outlen = 2 + len;
422b06ebda0SMatthew Dillon *(uint16_t *)out = lenn;
423b06ebda0SMatthew Dillon *out |= 0x80;
424b06ebda0SMatthew Dillon priv->stats.FramesComp++;
425b06ebda0SMatthew Dillon } else {
426b06ebda0SMatthew Dillon out = priv->inbuf;
427b06ebda0SMatthew Dillon outlen = 2 + inlen;
428b06ebda0SMatthew Dillon *(uint16_t *)out = lenn;
429b06ebda0SMatthew Dillon priv->stats.FramesUncomp++;
430b06ebda0SMatthew Dillon }
431b06ebda0SMatthew Dillon
432b06ebda0SMatthew Dillon /* Add FCS. */
433b06ebda0SMatthew Dillon (out + outlen)[0] = fcs & 0xFF;
434b06ebda0SMatthew Dillon (out + outlen)[1] = fcs >> 8;
435b06ebda0SMatthew Dillon
436b06ebda0SMatthew Dillon /* Calculate resulting size. */
437b06ebda0SMatthew Dillon outlen += 2;
438b06ebda0SMatthew Dillon
439b06ebda0SMatthew Dillon /* Return packet in an mbuf. */
440*05d02a38SAaron LI *resultp = m_devget(out, outlen, 0, NULL);
441b06ebda0SMatthew Dillon if (*resultp == NULL) {
442b06ebda0SMatthew Dillon priv->stats.Errors++;
443b06ebda0SMatthew Dillon return (ENOMEM);
4440fdb7d01SSascha Wildner }
445b06ebda0SMatthew Dillon
446b06ebda0SMatthew Dillon priv->stats.OutOctets += outlen;
447b06ebda0SMatthew Dillon
448b06ebda0SMatthew Dillon return (0);
449b06ebda0SMatthew Dillon }
450b06ebda0SMatthew Dillon
451b06ebda0SMatthew Dillon /*
452b06ebda0SMatthew Dillon * Decompress/decrypt packet and put the result in a new mbuf at *resultp.
453b06ebda0SMatthew Dillon * The original mbuf is not free'd.
454b06ebda0SMatthew Dillon */
455b06ebda0SMatthew Dillon static int
ng_pred1_decompress(node_p node,struct mbuf * m,struct mbuf ** resultp)456b06ebda0SMatthew Dillon ng_pred1_decompress(node_p node, struct mbuf *m, struct mbuf **resultp)
457b06ebda0SMatthew Dillon {
458b06ebda0SMatthew Dillon const priv_p priv = NG_NODE_PRIVATE(node);
459b06ebda0SMatthew Dillon int inlen;
460b06ebda0SMatthew Dillon uint16_t len, len1, cf, lenn;
461b06ebda0SMatthew Dillon uint16_t fcs;
462b06ebda0SMatthew Dillon
463b06ebda0SMatthew Dillon /* Initialize. */
464b06ebda0SMatthew Dillon *resultp = NULL;
465b06ebda0SMatthew Dillon
466b06ebda0SMatthew Dillon inlen = m->m_pkthdr.len;
467b06ebda0SMatthew Dillon
468b06ebda0SMatthew Dillon if (inlen > PRED1_BUF_SIZE) {
469b06ebda0SMatthew Dillon priv->stats.Errors++;
470b06ebda0SMatthew Dillon NG_FREE_M(m);
471b06ebda0SMatthew Dillon return (ENOMEM);
472b06ebda0SMatthew Dillon }
473b06ebda0SMatthew Dillon
474b06ebda0SMatthew Dillon /* Work with contiguous regions of memory. */
475*05d02a38SAaron LI m_copydata(m, 0, inlen, priv->inbuf);
476b06ebda0SMatthew Dillon
477b06ebda0SMatthew Dillon priv->stats.InOctets += inlen;
478b06ebda0SMatthew Dillon
479b06ebda0SMatthew Dillon /* Get initial length value. */
480b06ebda0SMatthew Dillon len = priv->inbuf[0] << 8;
481b06ebda0SMatthew Dillon len += priv->inbuf[1];
482b06ebda0SMatthew Dillon
483b06ebda0SMatthew Dillon cf = (len & 0x8000);
484b06ebda0SMatthew Dillon len &= 0x7fff;
485b06ebda0SMatthew Dillon
486b06ebda0SMatthew Dillon /* Is data compressed or not really? */
487b06ebda0SMatthew Dillon if (cf) {
488b06ebda0SMatthew Dillon NG_FREE_M(m);
489b06ebda0SMatthew Dillon
490b06ebda0SMatthew Dillon priv->stats.FramesComp++;
491b06ebda0SMatthew Dillon len1 = Pred1Decompress(node, priv->inbuf + 2, priv->outbuf,
492b06ebda0SMatthew Dillon inlen - 4, PRED1_BUF_SIZE);
493b06ebda0SMatthew Dillon if (len != len1) {
494b06ebda0SMatthew Dillon /* Error is detected. Send reset request */
495b06ebda0SMatthew Dillon priv->stats.Errors++;
496b06ebda0SMatthew Dillon log(LOG_NOTICE, "ng_pred1: Comp length error (%d) "
497b06ebda0SMatthew Dillon "--> len (%d)\n", len, len1);
498b06ebda0SMatthew Dillon return (EIO);
499b06ebda0SMatthew Dillon }
500b06ebda0SMatthew Dillon
501b06ebda0SMatthew Dillon /*
502b06ebda0SMatthew Dillon * CRC check on receive is defined in RFC. It is surely required
503b06ebda0SMatthew Dillon * for compressed frames to signal dictionary corruption,
504b06ebda0SMatthew Dillon * but it is actually useless for uncompressed frames because
505b06ebda0SMatthew Dillon * the same check has already done by HDLC and/or other layer.
506b06ebda0SMatthew Dillon */
507b06ebda0SMatthew Dillon lenn = htons(len);
508b06ebda0SMatthew Dillon fcs = Crc16(PPP_INITFCS, (u_char *)&lenn, 2);
509b06ebda0SMatthew Dillon fcs = Crc16(fcs, priv->outbuf, len);
510b06ebda0SMatthew Dillon fcs = Crc16(fcs, priv->inbuf + inlen - 2, 2);
511b06ebda0SMatthew Dillon
512b06ebda0SMatthew Dillon if (fcs != PPP_GOODFCS) {
513b06ebda0SMatthew Dillon priv->stats.Errors++;
514b06ebda0SMatthew Dillon log(LOG_NOTICE, "ng_pred1: Pred1: Bad CRC-16\n");
515b06ebda0SMatthew Dillon return (EIO);
516b06ebda0SMatthew Dillon }
517b06ebda0SMatthew Dillon
518b06ebda0SMatthew Dillon /* Return packet in an mbuf. */
519*05d02a38SAaron LI *resultp = m_devget(priv->outbuf, len, 0, NULL);
520b06ebda0SMatthew Dillon if (*resultp == NULL) {
521b06ebda0SMatthew Dillon priv->stats.Errors++;
522b06ebda0SMatthew Dillon return (ENOMEM);
5230fdb7d01SSascha Wildner }
524b06ebda0SMatthew Dillon
525b06ebda0SMatthew Dillon } else {
526b06ebda0SMatthew Dillon priv->stats.FramesUncomp++;
527b06ebda0SMatthew Dillon if (len != (inlen - 4)) {
528b06ebda0SMatthew Dillon /* Wrong length. Send reset request */
529b06ebda0SMatthew Dillon priv->stats.Errors++;
530b06ebda0SMatthew Dillon log(LOG_NOTICE, "ng_pred1: Uncomp length error (%d) "
531b06ebda0SMatthew Dillon "--> len (%d)\n", len, inlen - 4);
532b06ebda0SMatthew Dillon NG_FREE_M(m);
533b06ebda0SMatthew Dillon return (EIO);
534b06ebda0SMatthew Dillon }
535b06ebda0SMatthew Dillon Pred1SyncTable(node, priv->inbuf + 2, len);
536b06ebda0SMatthew Dillon m_adj(m, 2); /* Strip length. */
537b06ebda0SMatthew Dillon m_adj(m, -2); /* Strip fcs. */
538b06ebda0SMatthew Dillon *resultp = m;
539b06ebda0SMatthew Dillon }
540b06ebda0SMatthew Dillon
541b06ebda0SMatthew Dillon priv->stats.FramesPlain++;
542b06ebda0SMatthew Dillon priv->stats.OutOctets += len;
543b06ebda0SMatthew Dillon
544b06ebda0SMatthew Dillon return (0);
545b06ebda0SMatthew Dillon }
546b06ebda0SMatthew Dillon
547b06ebda0SMatthew Dillon /*
548b06ebda0SMatthew Dillon * Pred1Init()
549b06ebda0SMatthew Dillon */
550b06ebda0SMatthew Dillon
551b06ebda0SMatthew Dillon static void
Pred1Init(node_p node)552b06ebda0SMatthew Dillon Pred1Init(node_p node)
553b06ebda0SMatthew Dillon {
554b06ebda0SMatthew Dillon const priv_p priv = NG_NODE_PRIVATE(node);
555b06ebda0SMatthew Dillon
556b06ebda0SMatthew Dillon priv->Hash = 0;
557b06ebda0SMatthew Dillon memset(priv->GuessTable, 0, PRED1_TABLE_SIZE);
558b06ebda0SMatthew Dillon }
559b06ebda0SMatthew Dillon
560b06ebda0SMatthew Dillon /*
561b06ebda0SMatthew Dillon * Pred1Compress()
562b06ebda0SMatthew Dillon */
563b06ebda0SMatthew Dillon
564b06ebda0SMatthew Dillon static int
Pred1Compress(node_p node,u_char * source,u_char * dest,int len)565b06ebda0SMatthew Dillon Pred1Compress(node_p node, u_char *source, u_char *dest, int len)
566b06ebda0SMatthew Dillon {
567b06ebda0SMatthew Dillon const priv_p priv = NG_NODE_PRIVATE(node);
568b06ebda0SMatthew Dillon int i;
569b06ebda0SMatthew Dillon u_char flags;
570b06ebda0SMatthew Dillon u_char *flagdest, *orgdest;
571b06ebda0SMatthew Dillon
572b06ebda0SMatthew Dillon orgdest = dest;
573b06ebda0SMatthew Dillon while (len) {
574b06ebda0SMatthew Dillon flagdest = dest++;
575b06ebda0SMatthew Dillon flags = 0; /* All guesses are wrong initially. */
576b06ebda0SMatthew Dillon for (i = 0; i < 8 && len; i++) {
577b06ebda0SMatthew Dillon if (priv->GuessTable[priv->Hash] == *source)
578b06ebda0SMatthew Dillon /* Guess was right - don't output. */
579b06ebda0SMatthew Dillon flags |= (1 << i);
580b06ebda0SMatthew Dillon else {
581b06ebda0SMatthew Dillon /* Guess wrong, output char. */
582b06ebda0SMatthew Dillon priv->GuessTable[priv->Hash] = *source;
583b06ebda0SMatthew Dillon *dest++ = *source;
584b06ebda0SMatthew Dillon }
585b06ebda0SMatthew Dillon HASH(*source++);
586b06ebda0SMatthew Dillon len--;
587b06ebda0SMatthew Dillon }
588b06ebda0SMatthew Dillon *flagdest = flags;
589b06ebda0SMatthew Dillon }
590b06ebda0SMatthew Dillon return (dest - orgdest);
591b06ebda0SMatthew Dillon }
592b06ebda0SMatthew Dillon
593b06ebda0SMatthew Dillon /*
594b06ebda0SMatthew Dillon * Pred1Decompress()
595b06ebda0SMatthew Dillon *
596b06ebda0SMatthew Dillon * Returns decompressed size, or -1 if we ran out of space.
597b06ebda0SMatthew Dillon */
598b06ebda0SMatthew Dillon
599b06ebda0SMatthew Dillon static int
Pred1Decompress(node_p node,u_char * source,u_char * dest,int slen,int dlen)600b06ebda0SMatthew Dillon Pred1Decompress(node_p node, u_char *source, u_char *dest, int slen, int dlen)
601b06ebda0SMatthew Dillon {
602b06ebda0SMatthew Dillon const priv_p priv = NG_NODE_PRIVATE(node);
603b06ebda0SMatthew Dillon int i;
604b06ebda0SMatthew Dillon u_char flags, *orgdest;
605b06ebda0SMatthew Dillon
606b06ebda0SMatthew Dillon orgdest = dest;
607b06ebda0SMatthew Dillon while (slen) {
608b06ebda0SMatthew Dillon flags = *source++;
609b06ebda0SMatthew Dillon slen--;
610b06ebda0SMatthew Dillon for (i = 0; i < 8; i++, flags >>= 1) {
611b06ebda0SMatthew Dillon if (dlen <= 0)
612b06ebda0SMatthew Dillon return(-1);
613b06ebda0SMatthew Dillon if (flags & 0x01)
614b06ebda0SMatthew Dillon /* Guess correct */
615b06ebda0SMatthew Dillon *dest = priv->GuessTable[priv->Hash];
616b06ebda0SMatthew Dillon else {
617b06ebda0SMatthew Dillon if (!slen)
618b06ebda0SMatthew Dillon /* We seem to be really done -- cabo. */
619b06ebda0SMatthew Dillon break;
620b06ebda0SMatthew Dillon
621b06ebda0SMatthew Dillon /* Guess wrong. */
622b06ebda0SMatthew Dillon priv->GuessTable[priv->Hash] = *source;
623b06ebda0SMatthew Dillon /* Read from source. */
624b06ebda0SMatthew Dillon *dest = *source++;
625b06ebda0SMatthew Dillon slen--;
626b06ebda0SMatthew Dillon }
627b06ebda0SMatthew Dillon HASH(*dest++);
628b06ebda0SMatthew Dillon dlen--;
629b06ebda0SMatthew Dillon }
630b06ebda0SMatthew Dillon }
631b06ebda0SMatthew Dillon return (dest - orgdest);
632b06ebda0SMatthew Dillon }
633b06ebda0SMatthew Dillon
634b06ebda0SMatthew Dillon /*
635b06ebda0SMatthew Dillon * Pred1SyncTable()
636b06ebda0SMatthew Dillon */
637b06ebda0SMatthew Dillon
638b06ebda0SMatthew Dillon static void
Pred1SyncTable(node_p node,u_char * source,int len)639b06ebda0SMatthew Dillon Pred1SyncTable(node_p node, u_char *source, int len)
640b06ebda0SMatthew Dillon {
641b06ebda0SMatthew Dillon const priv_p priv = NG_NODE_PRIVATE(node);
642b06ebda0SMatthew Dillon
643b06ebda0SMatthew Dillon while (len--) {
644b06ebda0SMatthew Dillon priv->GuessTable[priv->Hash] = *source;
645b06ebda0SMatthew Dillon HASH(*source++);
646b06ebda0SMatthew Dillon }
647b06ebda0SMatthew Dillon }
648b06ebda0SMatthew Dillon
649b06ebda0SMatthew Dillon /*
650b06ebda0SMatthew Dillon * Crc16()
651b06ebda0SMatthew Dillon *
652b06ebda0SMatthew Dillon * Compute the 16 bit frame check value, per RFC 1171 Appendix B,
653b06ebda0SMatthew Dillon * on an array of bytes.
654b06ebda0SMatthew Dillon */
655b06ebda0SMatthew Dillon
656b06ebda0SMatthew Dillon static uint16_t
Crc16(uint16_t crc,u_char * cp,int len)657b06ebda0SMatthew Dillon Crc16(uint16_t crc, u_char *cp, int len)
658b06ebda0SMatthew Dillon {
659b06ebda0SMatthew Dillon while (len--)
660b06ebda0SMatthew Dillon crc = (crc >> 8) ^ Crc16Table[(crc ^ *cp++) & 0xff];
661b06ebda0SMatthew Dillon return (crc);
662b06ebda0SMatthew Dillon }
663b06ebda0SMatthew Dillon
664b06ebda0SMatthew Dillon static const uint16_t Crc16Table[256] = {
665b06ebda0SMatthew Dillon /* 00 */ 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
666b06ebda0SMatthew Dillon /* 08 */ 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
667b06ebda0SMatthew Dillon /* 10 */ 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
668b06ebda0SMatthew Dillon /* 18 */ 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876,
669b06ebda0SMatthew Dillon /* 20 */ 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd,
670b06ebda0SMatthew Dillon /* 28 */ 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5,
671b06ebda0SMatthew Dillon /* 30 */ 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c,
672b06ebda0SMatthew Dillon /* 38 */ 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974,
673b06ebda0SMatthew Dillon /* 40 */ 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb,
674b06ebda0SMatthew Dillon /* 48 */ 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3,
675b06ebda0SMatthew Dillon /* 50 */ 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a,
676b06ebda0SMatthew Dillon /* 58 */ 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72,
677b06ebda0SMatthew Dillon /* 60 */ 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9,
678b06ebda0SMatthew Dillon /* 68 */ 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1,
679b06ebda0SMatthew Dillon /* 70 */ 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738,
680b06ebda0SMatthew Dillon /* 78 */ 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70,
681b06ebda0SMatthew Dillon /* 80 */ 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7,
682b06ebda0SMatthew Dillon /* 88 */ 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff,
683b06ebda0SMatthew Dillon /* 90 */ 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036,
684b06ebda0SMatthew Dillon /* 98 */ 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e,
685b06ebda0SMatthew Dillon /* a0 */ 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5,
686b06ebda0SMatthew Dillon /* a8 */ 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd,
687b06ebda0SMatthew Dillon /* b0 */ 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134,
688b06ebda0SMatthew Dillon /* b8 */ 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
689b06ebda0SMatthew Dillon /* c0 */ 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
690b06ebda0SMatthew Dillon /* c8 */ 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
691b06ebda0SMatthew Dillon /* d0 */ 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232,
692b06ebda0SMatthew Dillon /* d8 */ 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
693b06ebda0SMatthew Dillon /* e0 */ 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
694b06ebda0SMatthew Dillon /* e8 */ 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
695b06ebda0SMatthew Dillon /* f0 */ 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
696b06ebda0SMatthew Dillon /* f8 */ 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
697b06ebda0SMatthew Dillon };
698b06ebda0SMatthew Dillon
699