]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - drivers/net/slhc.c
[PATCH] Convert to kzalloc
[mirror_ubuntu-hirsute-kernel.git] / drivers / net / slhc.c
CommitLineData
1da177e4
LT
1/*
2 * Routines to compress and uncompress tcp packets (for transmission
3 * over low speed serial lines).
4 *
5 * Copyright (c) 1989 Regents of the University of California.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the University of California, Berkeley. The name of the
14 * University may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
20 * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:
21 * - Initial distribution.
22 *
23 *
24 * modified for KA9Q Internet Software Package by
25 * Katie Stevens (dkstevens@ucdavis.edu)
26 * University of California, Davis
27 * Computing Services
28 * - 01-31-90 initial adaptation (from 1.19)
29 * PPP.05 02-15-90 [ks]
30 * PPP.08 05-02-90 [ks] use PPP protocol field to signal compression
31 * PPP.15 09-90 [ks] improve mbuf handling
32 * PPP.16 11-02 [karn] substantially rewritten to use NOS facilities
33 *
34 * - Feb 1991 Bill_Simpson@um.cc.umich.edu
35 * variable number of conversation slots
36 * allow zero or one slots
37 * separate routines
38 * status display
39 * - Jul 1994 Dmitry Gorodchanin
40 * Fixes for memory leaks.
41 * - Oct 1994 Dmitry Gorodchanin
42 * Modularization.
43 * - Jan 1995 Bjorn Ekwall
44 * Use ip_fast_csum from ip.h
45 * - July 1995 Christos A. Polyzols
46 * Spotted bug in tcp option checking
47 *
48 *
49 * This module is a difficult issue. It's clearly inet code but it's also clearly
50 * driver code belonging close to PPP and SLIP
51 */
52
1da177e4
LT
53#include <linux/module.h>
54#include <linux/types.h>
55#include <linux/string.h>
56#include <linux/errno.h>
57#include <linux/kernel.h>
58#include <net/slhc_vj.h>
59
60#ifdef CONFIG_INET
61/* Entire module is for IP only */
62#include <linux/mm.h>
63#include <linux/socket.h>
64#include <linux/sockios.h>
65#include <linux/termios.h>
66#include <linux/in.h>
67#include <linux/fcntl.h>
68#include <linux/inet.h>
69#include <linux/netdevice.h>
70#include <net/ip.h>
71#include <net/protocol.h>
72#include <net/icmp.h>
73#include <net/tcp.h>
74#include <linux/skbuff.h>
75#include <net/sock.h>
76#include <linux/timer.h>
77#include <asm/system.h>
78#include <asm/uaccess.h>
79#include <net/checksum.h>
80#include <asm/unaligned.h>
81
82static unsigned char *encode(unsigned char *cp, unsigned short n);
83static long decode(unsigned char **cpp);
84static unsigned char * put16(unsigned char *cp, unsigned short x);
85static unsigned short pull16(unsigned char **cpp);
86
87/* Initialize compression data structure
88 * slots must be in range 0 to 255 (zero meaning no compression)
89 */
90struct slcompress *
91slhc_init(int rslots, int tslots)
92{
93 register short i;
94 register struct cstate *ts;
95 struct slcompress *comp;
96
15880352 97 comp = (struct slcompress *)kzalloc(sizeof(struct slcompress),
1da177e4
LT
98 GFP_KERNEL);
99 if (! comp)
100 goto out_fail;
1da177e4
LT
101
102 if ( rslots > 0 && rslots < 256 ) {
103 size_t rsize = rslots * sizeof(struct cstate);
15880352 104 comp->rstate = (struct cstate *) kzalloc(rsize, GFP_KERNEL);
1da177e4
LT
105 if (! comp->rstate)
106 goto out_free;
1da177e4
LT
107 comp->rslot_limit = rslots - 1;
108 }
109
110 if ( tslots > 0 && tslots < 256 ) {
111 size_t tsize = tslots * sizeof(struct cstate);
15880352 112 comp->tstate = (struct cstate *) kzalloc(tsize, GFP_KERNEL);
1da177e4
LT
113 if (! comp->tstate)
114 goto out_free2;
1da177e4
LT
115 comp->tslot_limit = tslots - 1;
116 }
117
118 comp->xmit_oldest = 0;
119 comp->xmit_current = 255;
120 comp->recv_current = 255;
121 /*
122 * don't accept any packets with implicit index until we get
123 * one with an explicit index. Otherwise the uncompress code
124 * will try to use connection 255, which is almost certainly
125 * out of range
126 */
127 comp->flags |= SLF_TOSS;
128
129 if ( tslots > 0 ) {
130 ts = comp->tstate;
131 for(i = comp->tslot_limit; i > 0; --i){
132 ts[i].cs_this = i;
133 ts[i].next = &(ts[i - 1]);
134 }
135 ts[0].next = &(ts[comp->tslot_limit]);
136 ts[0].cs_this = 0;
137 }
138 return comp;
139
140out_free2:
141 kfree((unsigned char *)comp->rstate);
142out_free:
143 kfree((unsigned char *)comp);
144out_fail:
145 return NULL;
146}
147
148
149/* Free a compression data structure */
150void
151slhc_free(struct slcompress *comp)
152{
153 if ( comp == NULLSLCOMPR )
154 return;
155
156 if ( comp->tstate != NULLSLSTATE )
157 kfree( comp->tstate );
158
159 if ( comp->rstate != NULLSLSTATE )
160 kfree( comp->rstate );
161
162 kfree( comp );
163}
164
165
166/* Put a short in host order into a char array in network order */
167static inline unsigned char *
168put16(unsigned char *cp, unsigned short x)
169{
170 *cp++ = x >> 8;
171 *cp++ = x;
172
173 return cp;
174}
175
176
177/* Encode a number */
178unsigned char *
179encode(unsigned char *cp, unsigned short n)
180{
181 if(n >= 256 || n == 0){
182 *cp++ = 0;
183 cp = put16(cp,n);
184 } else {
185 *cp++ = n;
186 }
187 return cp;
188}
189
190/* Pull a 16-bit integer in host order from buffer in network byte order */
191static unsigned short
192pull16(unsigned char **cpp)
193{
194 short rval;
195
196 rval = *(*cpp)++;
197 rval <<= 8;
198 rval |= *(*cpp)++;
199 return rval;
200}
201
202/* Decode a number */
203long
204decode(unsigned char **cpp)
205{
206 register int x;
207
208 x = *(*cpp)++;
209 if(x == 0){
210 return pull16(cpp) & 0xffff; /* pull16 returns -1 on error */
211 } else {
212 return x & 0xff; /* -1 if PULLCHAR returned error */
213 }
214}
215
216/*
217 * icp and isize are the original packet.
218 * ocp is a place to put a copy if necessary.
219 * cpp is initially a pointer to icp. If the copy is used,
220 * change it to ocp.
221 */
222
223int
224slhc_compress(struct slcompress *comp, unsigned char *icp, int isize,
225 unsigned char *ocp, unsigned char **cpp, int compress_cid)
226{
227 register struct cstate *ocs = &(comp->tstate[comp->xmit_oldest]);
228 register struct cstate *lcs = ocs;
229 register struct cstate *cs = lcs->next;
230 register unsigned long deltaS, deltaA;
231 register short changes = 0;
232 int hlen;
233 unsigned char new_seq[16];
234 register unsigned char *cp = new_seq;
235 struct iphdr *ip;
236 struct tcphdr *th, *oth;
237
238
239 /*
240 * Don't play with runt packets.
241 */
242
243 if(isize<sizeof(struct iphdr))
244 return isize;
245
246 ip = (struct iphdr *) icp;
247
248 /* Bail if this packet isn't TCP, or is an IP fragment */
249 if (ip->protocol != IPPROTO_TCP || (ntohs(ip->frag_off) & 0x3fff)) {
250 /* Send as regular IP */
251 if(ip->protocol != IPPROTO_TCP)
252 comp->sls_o_nontcp++;
253 else
254 comp->sls_o_tcp++;
255 return isize;
256 }
257 /* Extract TCP header */
258
259 th = (struct tcphdr *)(((unsigned char *)ip) + ip->ihl*4);
260 hlen = ip->ihl*4 + th->doff*4;
261
262 /* Bail if the TCP packet isn't `compressible' (i.e., ACK isn't set or
263 * some other control bit is set). Also uncompressible if
264 * it's a runt.
265 */
266 if(hlen > isize || th->syn || th->fin || th->rst ||
267 ! (th->ack)){
268 /* TCP connection stuff; send as regular IP */
269 comp->sls_o_tcp++;
270 return isize;
271 }
272 /*
273 * Packet is compressible -- we're going to send either a
274 * COMPRESSED_TCP or UNCOMPRESSED_TCP packet. Either way,
275 * we need to locate (or create) the connection state.
276 *
277 * States are kept in a circularly linked list with
278 * xmit_oldest pointing to the end of the list. The
279 * list is kept in lru order by moving a state to the
280 * head of the list whenever it is referenced. Since
281 * the list is short and, empirically, the connection
282 * we want is almost always near the front, we locate
283 * states via linear search. If we don't find a state
284 * for the datagram, the oldest state is (re-)used.
285 */
286 for ( ; ; ) {
287 if( ip->saddr == cs->cs_ip.saddr
288 && ip->daddr == cs->cs_ip.daddr
289 && th->source == cs->cs_tcp.source
290 && th->dest == cs->cs_tcp.dest)
291 goto found;
292
293 /* if current equal oldest, at end of list */
294 if ( cs == ocs )
295 break;
296 lcs = cs;
297 cs = cs->next;
298 comp->sls_o_searches++;
299 };
300 /*
301 * Didn't find it -- re-use oldest cstate. Send an
302 * uncompressed packet that tells the other side what
303 * connection number we're using for this conversation.
304 *
305 * Note that since the state list is circular, the oldest
306 * state points to the newest and we only need to set
307 * xmit_oldest to update the lru linkage.
308 */
309 comp->sls_o_misses++;
310 comp->xmit_oldest = lcs->cs_this;
311 goto uncompressed;
312
313found:
314 /*
315 * Found it -- move to the front on the connection list.
316 */
317 if(lcs == ocs) {
318 /* found at most recently used */
319 } else if (cs == ocs) {
320 /* found at least recently used */
321 comp->xmit_oldest = lcs->cs_this;
322 } else {
323 /* more than 2 elements */
324 lcs->next = cs->next;
325 cs->next = ocs->next;
326 ocs->next = cs;
327 }
328
329 /*
330 * Make sure that only what we expect to change changed.
331 * Check the following:
332 * IP protocol version, header length & type of service.
333 * The "Don't fragment" bit.
334 * The time-to-live field.
335 * The TCP header length.
336 * IP options, if any.
337 * TCP options, if any.
338 * If any of these things are different between the previous &
339 * current datagram, we send the current datagram `uncompressed'.
340 */
341 oth = &cs->cs_tcp;
342
343 if(ip->version != cs->cs_ip.version || ip->ihl != cs->cs_ip.ihl
344 || ip->tos != cs->cs_ip.tos
345 || (ip->frag_off & htons(0x4000)) != (cs->cs_ip.frag_off & htons(0x4000))
346 || ip->ttl != cs->cs_ip.ttl
347 || th->doff != cs->cs_tcp.doff
348 || (ip->ihl > 5 && memcmp(ip+1,cs->cs_ipopt,((ip->ihl)-5)*4) != 0)
349 || (th->doff > 5 && memcmp(th+1,cs->cs_tcpopt,((th->doff)-5)*4) != 0)){
350 goto uncompressed;
351 }
352
353 /*
354 * Figure out which of the changing fields changed. The
355 * receiver expects changes in the order: urgent, window,
356 * ack, seq (the order minimizes the number of temporaries
357 * needed in this section of code).
358 */
359 if(th->urg){
360 deltaS = ntohs(th->urg_ptr);
361 cp = encode(cp,deltaS);
362 changes |= NEW_U;
363 } else if(th->urg_ptr != oth->urg_ptr){
364 /* argh! URG not set but urp changed -- a sensible
365 * implementation should never do this but RFC793
366 * doesn't prohibit the change so we have to deal
367 * with it. */
368 goto uncompressed;
369 }
370 if((deltaS = ntohs(th->window) - ntohs(oth->window)) != 0){
371 cp = encode(cp,deltaS);
372 changes |= NEW_W;
373 }
374 if((deltaA = ntohl(th->ack_seq) - ntohl(oth->ack_seq)) != 0L){
375 if(deltaA > 0x0000ffff)
376 goto uncompressed;
377 cp = encode(cp,deltaA);
378 changes |= NEW_A;
379 }
380 if((deltaS = ntohl(th->seq) - ntohl(oth->seq)) != 0L){
381 if(deltaS > 0x0000ffff)
382 goto uncompressed;
383 cp = encode(cp,deltaS);
384 changes |= NEW_S;
385 }
386
387 switch(changes){
388 case 0: /* Nothing changed. If this packet contains data and the
389 * last one didn't, this is probably a data packet following
390 * an ack (normal on an interactive connection) and we send
391 * it compressed. Otherwise it's probably a retransmit,
392 * retransmitted ack or window probe. Send it uncompressed
393 * in case the other side missed the compressed version.
394 */
395 if(ip->tot_len != cs->cs_ip.tot_len &&
396 ntohs(cs->cs_ip.tot_len) == hlen)
397 break;
398 goto uncompressed;
399 break;
400 case SPECIAL_I:
401 case SPECIAL_D:
402 /* actual changes match one of our special case encodings --
403 * send packet uncompressed.
404 */
405 goto uncompressed;
406 case NEW_S|NEW_A:
407 if(deltaS == deltaA &&
408 deltaS == ntohs(cs->cs_ip.tot_len) - hlen){
409 /* special case for echoed terminal traffic */
410 changes = SPECIAL_I;
411 cp = new_seq;
412 }
413 break;
414 case NEW_S:
415 if(deltaS == ntohs(cs->cs_ip.tot_len) - hlen){
416 /* special case for data xfer */
417 changes = SPECIAL_D;
418 cp = new_seq;
419 }
420 break;
421 }
422 deltaS = ntohs(ip->id) - ntohs(cs->cs_ip.id);
423 if(deltaS != 1){
424 cp = encode(cp,deltaS);
425 changes |= NEW_I;
426 }
427 if(th->psh)
428 changes |= TCP_PUSH_BIT;
429 /* Grab the cksum before we overwrite it below. Then update our
430 * state with this packet's header.
431 */
432 deltaA = ntohs(th->check);
433 memcpy(&cs->cs_ip,ip,20);
434 memcpy(&cs->cs_tcp,th,20);
435 /* We want to use the original packet as our compressed packet.
436 * (cp - new_seq) is the number of bytes we need for compressed
437 * sequence numbers. In addition we need one byte for the change
438 * mask, one for the connection id and two for the tcp checksum.
439 * So, (cp - new_seq) + 4 bytes of header are needed.
440 */
441 deltaS = cp - new_seq;
442 if(compress_cid == 0 || comp->xmit_current != cs->cs_this){
443 cp = ocp;
444 *cpp = ocp;
445 *cp++ = changes | NEW_C;
446 *cp++ = cs->cs_this;
447 comp->xmit_current = cs->cs_this;
448 } else {
449 cp = ocp;
450 *cpp = ocp;
451 *cp++ = changes;
452 }
453 cp = put16(cp,(short)deltaA); /* Write TCP checksum */
454/* deltaS is now the size of the change section of the compressed header */
455 memcpy(cp,new_seq,deltaS); /* Write list of deltas */
456 memcpy(cp+deltaS,icp+hlen,isize-hlen);
457 comp->sls_o_compressed++;
458 ocp[0] |= SL_TYPE_COMPRESSED_TCP;
459 return isize - hlen + deltaS + (cp - ocp);
460
461 /* Update connection state cs & send uncompressed packet (i.e.,
462 * a regular ip/tcp packet but with the 'conversation id' we hope
463 * to use on future compressed packets in the protocol field).
464 */
465uncompressed:
466 memcpy(&cs->cs_ip,ip,20);
467 memcpy(&cs->cs_tcp,th,20);
468 if (ip->ihl > 5)
469 memcpy(cs->cs_ipopt, ip+1, ((ip->ihl) - 5) * 4);
470 if (th->doff > 5)
471 memcpy(cs->cs_tcpopt, th+1, ((th->doff) - 5) * 4);
472 comp->xmit_current = cs->cs_this;
473 comp->sls_o_uncompressed++;
474 memcpy(ocp, icp, isize);
475 *cpp = ocp;
476 ocp[9] = cs->cs_this;
477 ocp[0] |= SL_TYPE_UNCOMPRESSED_TCP;
478 return isize;
479}
480
481
482int
483slhc_uncompress(struct slcompress *comp, unsigned char *icp, int isize)
484{
485 register int changes;
486 long x;
487 register struct tcphdr *thp;
488 register struct iphdr *ip;
489 register struct cstate *cs;
490 int len, hdrlen;
491 unsigned char *cp = icp;
492
493 /* We've got a compressed packet; read the change byte */
494 comp->sls_i_compressed++;
495 if(isize < 3){
496 comp->sls_i_error++;
497 return 0;
498 }
499 changes = *cp++;
500 if(changes & NEW_C){
501 /* Make sure the state index is in range, then grab the state.
502 * If we have a good state index, clear the 'discard' flag.
503 */
504 x = *cp++; /* Read conn index */
505 if(x < 0 || x > comp->rslot_limit)
506 goto bad;
507
508 comp->flags &=~ SLF_TOSS;
509 comp->recv_current = x;
510 } else {
511 /* this packet has an implicit state index. If we've
512 * had a line error since the last time we got an
513 * explicit state index, we have to toss the packet. */
514 if(comp->flags & SLF_TOSS){
515 comp->sls_i_tossed++;
516 return 0;
517 }
518 }
519 cs = &comp->rstate[comp->recv_current];
520 thp = &cs->cs_tcp;
521 ip = &cs->cs_ip;
522
523 if((x = pull16(&cp)) == -1) { /* Read the TCP checksum */
524 goto bad;
525 }
526 thp->check = htons(x);
527
528 thp->psh = (changes & TCP_PUSH_BIT) ? 1 : 0;
529/*
530 * we can use the same number for the length of the saved header and
531 * the current one, because the packet wouldn't have been sent
532 * as compressed unless the options were the same as the previous one
533 */
534
535 hdrlen = ip->ihl * 4 + thp->doff * 4;
536
537 switch(changes & SPECIALS_MASK){
538 case SPECIAL_I: /* Echoed terminal traffic */
539 {
540 register short i;
541 i = ntohs(ip->tot_len) - hdrlen;
542 thp->ack_seq = htonl( ntohl(thp->ack_seq) + i);
543 thp->seq = htonl( ntohl(thp->seq) + i);
544 }
545 break;
546
547 case SPECIAL_D: /* Unidirectional data */
548 thp->seq = htonl( ntohl(thp->seq) +
549 ntohs(ip->tot_len) - hdrlen);
550 break;
551
552 default:
553 if(changes & NEW_U){
554 thp->urg = 1;
555 if((x = decode(&cp)) == -1) {
556 goto bad;
557 }
558 thp->urg_ptr = htons(x);
559 } else
560 thp->urg = 0;
561 if(changes & NEW_W){
562 if((x = decode(&cp)) == -1) {
563 goto bad;
564 }
565 thp->window = htons( ntohs(thp->window) + x);
566 }
567 if(changes & NEW_A){
568 if((x = decode(&cp)) == -1) {
569 goto bad;
570 }
571 thp->ack_seq = htonl( ntohl(thp->ack_seq) + x);
572 }
573 if(changes & NEW_S){
574 if((x = decode(&cp)) == -1) {
575 goto bad;
576 }
577 thp->seq = htonl( ntohl(thp->seq) + x);
578 }
579 break;
580 }
581 if(changes & NEW_I){
582 if((x = decode(&cp)) == -1) {
583 goto bad;
584 }
585 ip->id = htons (ntohs (ip->id) + x);
586 } else
587 ip->id = htons (ntohs (ip->id) + 1);
588
589 /*
590 * At this point, cp points to the first byte of data in the
591 * packet. Put the reconstructed TCP and IP headers back on the
592 * packet. Recalculate IP checksum (but not TCP checksum).
593 */
594
595 len = isize - (cp - icp);
596 if (len < 0)
597 goto bad;
598 len += hdrlen;
599 ip->tot_len = htons(len);
600 ip->check = 0;
601
602 memmove(icp + hdrlen, cp, len - hdrlen);
603
604 cp = icp;
605 memcpy(cp, ip, 20);
606 cp += 20;
607
608 if (ip->ihl > 5) {
609 memcpy(cp, cs->cs_ipopt, (ip->ihl - 5) * 4);
610 cp += (ip->ihl - 5) * 4;
611 }
612
613 put_unaligned(ip_fast_csum(icp, ip->ihl),
614 &((struct iphdr *)icp)->check);
615
616 memcpy(cp, thp, 20);
617 cp += 20;
618
619 if (thp->doff > 5) {
620 memcpy(cp, cs->cs_tcpopt, ((thp->doff) - 5) * 4);
621 cp += ((thp->doff) - 5) * 4;
622 }
623
624 return len;
625bad:
626 comp->sls_i_error++;
627 return slhc_toss( comp );
628}
629
630
631int
632slhc_remember(struct slcompress *comp, unsigned char *icp, int isize)
633{
634 register struct cstate *cs;
635 unsigned ihl;
636
637 unsigned char index;
638
639 if(isize < 20) {
640 /* The packet is shorter than a legal IP header */
641 comp->sls_i_runt++;
642 return slhc_toss( comp );
643 }
644 /* Peek at the IP header's IHL field to find its length */
645 ihl = icp[0] & 0xf;
646 if(ihl < 20 / 4){
647 /* The IP header length field is too small */
648 comp->sls_i_runt++;
649 return slhc_toss( comp );
650 }
651 index = icp[9];
652 icp[9] = IPPROTO_TCP;
653
654 if (ip_fast_csum(icp, ihl)) {
655 /* Bad IP header checksum; discard */
656 comp->sls_i_badcheck++;
657 return slhc_toss( comp );
658 }
659 if(index > comp->rslot_limit) {
660 comp->sls_i_error++;
661 return slhc_toss(comp);
662 }
663
664 /* Update local state */
665 cs = &comp->rstate[comp->recv_current = index];
666 comp->flags &=~ SLF_TOSS;
667 memcpy(&cs->cs_ip,icp,20);
668 memcpy(&cs->cs_tcp,icp + ihl*4,20);
669 if (ihl > 5)
670 memcpy(cs->cs_ipopt, icp + sizeof(struct iphdr), (ihl - 5) * 4);
671 if (cs->cs_tcp.doff > 5)
672 memcpy(cs->cs_tcpopt, icp + ihl*4 + sizeof(struct tcphdr), (cs->cs_tcp.doff - 5) * 4);
673 cs->cs_hsize = ihl*2 + cs->cs_tcp.doff*2;
674 /* Put headers back on packet
675 * Neither header checksum is recalculated
676 */
677 comp->sls_i_uncompressed++;
678 return isize;
679}
680
681int
682slhc_toss(struct slcompress *comp)
683{
684 if ( comp == NULLSLCOMPR )
685 return 0;
686
687 comp->flags |= SLF_TOSS;
688 return 0;
689}
690
691
692/* VJ header compression */
693EXPORT_SYMBOL(slhc_init);
694EXPORT_SYMBOL(slhc_free);
695EXPORT_SYMBOL(slhc_remember);
696EXPORT_SYMBOL(slhc_compress);
697EXPORT_SYMBOL(slhc_uncompress);
698EXPORT_SYMBOL(slhc_toss);
699
700#ifdef MODULE
701
702int init_module(void)
703{
704 printk(KERN_INFO "CSLIP: code copyright 1989 Regents of the University of California\n");
705 return 0;
706}
707
708void cleanup_module(void)
709{
710 return;
711}
712
713#endif /* MODULE */
714#else /* CONFIG_INET */
715
716
717int
718slhc_toss(struct slcompress *comp)
719{
720 printk(KERN_DEBUG "Called IP function on non IP-system: slhc_toss");
721 return -EINVAL;
722}
723int
724slhc_uncompress(struct slcompress *comp, unsigned char *icp, int isize)
725{
726 printk(KERN_DEBUG "Called IP function on non IP-system: slhc_uncompress");
727 return -EINVAL;
728}
729int
730slhc_compress(struct slcompress *comp, unsigned char *icp, int isize,
731 unsigned char *ocp, unsigned char **cpp, int compress_cid)
732{
733 printk(KERN_DEBUG "Called IP function on non IP-system: slhc_compress");
734 return -EINVAL;
735}
736
737int
738slhc_remember(struct slcompress *comp, unsigned char *icp, int isize)
739{
740 printk(KERN_DEBUG "Called IP function on non IP-system: slhc_remember");
741 return -EINVAL;
742}
743
744void
745slhc_free(struct slcompress *comp)
746{
747 printk(KERN_DEBUG "Called IP function on non IP-system: slhc_free");
748 return;
749}
750struct slcompress *
751slhc_init(int rslots, int tslots)
752{
753 printk(KERN_DEBUG "Called IP function on non IP-system: slhc_init");
754 return NULL;
755}
756EXPORT_SYMBOL(slhc_init);
757EXPORT_SYMBOL(slhc_free);
758EXPORT_SYMBOL(slhc_remember);
759EXPORT_SYMBOL(slhc_compress);
760EXPORT_SYMBOL(slhc_uncompress);
761EXPORT_SYMBOL(slhc_toss);
762
763#endif /* CONFIG_INET */
764MODULE_LICENSE("Dual BSD/GPL");