spppcomp.c revision d624471bb6b5999909f7fb3a8fe4cdef10004294
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * spppcomp.c - STREAMS module for kernel-level compression and CCP support.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz * Use is subject to license terms.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * Permission to use, copy, modify, and distribute this software and its
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * documentation is hereby granted, provided that the above copyright
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * notice appears in all copies.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * SUN MAKES NO REPRESENTATION OR WARRANTIES ABOUT THE SUITABILITY OF
92f381329ebf1c2209df9608670666b32b291e05artem * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * Copyright (c) 1994 The Australian National University.
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz * All rights reserved.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * Permission to use, copy, modify, and distribute this software and its
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * documentation is hereby granted, provided that the above copyright
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz * notice appears in all copies. This software is provided without any
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz * warranty, express or implied. The Australian National University
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * makes no representations about the suitability of this software for
#include "s_common.h"
#ifdef DEBUG
#define SPC_DEBUG
#include "spppcomp.h"
#ifdef INTERNAL_BUILD
const char spppcomp_module_description[] =
#ifdef DEBUG
#define PPPCOMP_MI_MINPSZ (0)
#define ALG_DEBUG 0
#if DO_BSD_COMPRESS
#if DO_DEFLATE
#if DO_BSD_COMPRESS
#if DO_DEFLATE
static const char *kstats_names[] = {
#ifdef SPCDEBUG_KSTATS_NAMES
return (EINVAL);
qprocson(q);
qprocsoff(q);
CP_FLAGSSTR));
int flag;
case M_DATA:
servicing_interrupt())) {
#ifdef SPC_DEBUG
#ifdef SPC_DEBUG
case M_IOCTL:
case M_CTL:
if (flag != 0)
case M_FLUSH:
static mblk_t *
int len;
#ifdef SPC_DEBUG
goto msg_oerror;
IPPROTO_TCP) {
int type;
sizeof (uint32_t)];
void *srcp;
int thislen;
while (tocopy > 0) {
#ifdef SPC_DEBUG
goto msg_oerror;
switch (type) {
case TYPE_UNCOMPRESSED_TCP:
if (srcp ==
case TYPE_COMPRESSED_TCP:
goto msg_oerror;
if (srcp !=
copied = 0;
goto msg_oerror;
if (copied > 0) {
if (len < 0) {
return (NULL);
#ifdef SPC_DEBUG
goto msg_oerror;
return (mp);
return (NULL);
int flags;
int mask;
int rc;
int len;
int cmd;
int nxslots;
int nrslots;
int val;
void *xtemp;
len = 0;
case PPPIO_CFLAGS:
rc = 0;
case PPPIO_VJINIT:
rc = 0;
case PPPIO_XCOMP:
case PPPIO_RCOMP:
len = 0;
rc = 0;
opt_len);
CP_FLAGSSTR));
CP_FLAGSSTR));
if (rc != 0) {
rc = 0;
case PPPIO_DEBUG:
rc = 0;
case PPPIO_LASTMOD:
rc = 0;
rc = 0;
if (rc != 0)
return (rc);
int flag;
case PPPIO_CFLAGS:
case PPPIO_VJINIT:
case PPPIO_XCOMP:
case PPPIO_RCOMP:
case PPPIO_DEBUG:
case PPPIO_LASTMOD:
case PPPIO_COMPLEV:
} else if (flag == 0) {
case PPPIO_GETCSTAT:
const char **cpp;
case PPPCTL_MTU:
case PPPCTL_MRU:
case PPPCTL_UNIT:
sizeof (kstat_named_t), 0);
knt++;
knt++;
case M_DATA:
if (inter) {
#ifdef SPC_DEBUG
if (inter) {
#ifdef SPC_DEBUG
case M_IOCACK:
case M_CTL:
case M_FLUSH:
static mblk_t *
int len;
int hlen;
goto bad;
goto bad;
hlen = 0;
if (np == 0) {
goto bad;
#ifdef SPC_DEBUG
if (mp == 0) {
goto bad;
int rv;
switch (rv) {
case DECOMP_OK:
case DECOMP_ERROR:
case DECOMP_FATALERROR:
return (NULL);
if (rv < 0) {
goto bad;
#ifdef SPC_DEBUG
goto bad;
int vjlen;
int errcnt;
goto bad;
goto bad;
goto bad;
return (mp);
bad:
if (mp != 0) {
return (NULL);
int len;
int clen;
case CCP_CONFREQ:
case CCP_TERMREQ:
case CCP_TERMACK:
case CCP_CONFACK:
int rc;
if (!rcvd) {
case CCP_RESETACK:
if (!rcvd) {
return (EACCES);
#ifdef SPC_DEBUG