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