1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
|
/* $OpenBSD: clnp_subr.c,v 1.4 2001/09/20 17:02:32 mpech Exp $ */
/* $NetBSD: clnp_subr.c,v 1.8 1996/04/13 01:34:35 cgd Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)clnp_subr.c 8.1 (Berkeley) 6/10/93
*/
/***********************************************************
Copyright IBM Corporation 1987
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of IBM not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
*/
#ifdef ISO
#include <sys/param.h>
#include <sys/mbuf.h>
#include <sys/domain.h>
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/errno.h>
#include <sys/time.h>
#include <sys/systm.h>
#include <net/if.h>
#include <net/route.h>
#include <net/if_dl.h>
#include <netiso/iso.h>
#include <netiso/iso_var.h>
#include <netiso/iso_pcb.h>
#include <netiso/iso_snpac.h>
#include <netiso/clnp.h>
#include <netiso/clnp_stat.h>
#include <netiso/argo_debug.h>
#include <netiso/esis.h>
/*
* FUNCTION: clnp_data_ck
*
* PURPOSE: Check that the amount of data in the mbuf chain is
* at least as much as the clnp header would have us
* expect. Trim mbufs if longer than expected, drop
* packet if shorter than expected.
*
* RETURNS: success - ptr to mbuf chain
* failure - 0
*
* SIDE EFFECTS:
*
* NOTES:
*/
struct mbuf *
clnp_data_ck(m, length)
register struct mbuf *m;/* ptr to mbuf chain containing hdr & data */
int length; /* length (in bytes) of packet */
{
register int len; /* length of data */
register struct mbuf *mhead; /* ptr to head of chain */
len = -length;
mhead = m;
for (;;) {
len += m->m_len;
if (m->m_next == 0)
break;
m = m->m_next;
}
if (len != 0) {
if (len < 0) {
INCSTAT(cns_toosmall);
clnp_discard(mhead, GEN_INCOMPLETE);
return 0;
}
if (len <= m->m_len)
m->m_len -= len;
else
m_adj(mhead, -len);
}
return mhead;
}
#ifdef notdef
/*
* FUNCTION: clnp_extract_addr
*
* PURPOSE: Extract the source and destination address from the
* supplied buffer. Place them in the supplied address buffers.
* If insufficient data is supplied, then fail.
*
* RETURNS: success - Address of first byte in the packet past
* the address part.
* failure - 0
*
* SIDE EFFECTS:
*
* NOTES:
*/
caddr_t
clnp_extract_addr(bufp, buflen, srcp, destp)
caddr_t bufp; /* ptr to buffer containing addresses */
int buflen; /* length of buffer */
register struct iso_addr *srcp; /* ptr to source address buffer */
register struct iso_addr *destp; /* ptr to destination address
* buffer */
{
int len; /* argument to bcopy */
/*
* check that we have enough data. Plus1 is for length octet
*/
if ((u_char) * bufp + 1 > buflen) {
return ((caddr_t) 0);
}
len = destp->isoa_len = (u_char) * bufp++;
(void) bcopy(bufp, (caddr_t) destp, len);
buflen -= len;
bufp += len;
/*
* check that we have enough data. Plus1 is for length octet
*/
if ((u_char) * bufp + 1 > buflen) {
return ((caddr_t) 0);
}
len = srcp->isoa_len = (u_char) * bufp++;
(void) bcopy(bufp, (caddr_t) srcp, len);
bufp += len;
/*
* Insure that the addresses make sense
*/
if (iso_ck_addr(srcp) && iso_ck_addr(destp))
return bufp;
else
return (caddr_t) 0;
}
#endif /* notdef */
/*
* FUNCTION: clnp_ours
*
* PURPOSE: Decide whether the supplied packet is destined for
* us, or that it should be forwarded on.
*
* RETURNS: packet is for us - 1
* packet is not for us - 0
*
* SIDE EFFECTS:
*
* NOTES:
*/
int
clnp_ours(dst)
register struct iso_addr *dst; /* ptr to destination address */
{
register struct iso_ifaddr *ia; /* scan through interface addresses */
for (ia = iso_ifaddr.tqh_first; ia != 0; ia = ia->ia_list.tqe_next) {
#ifdef ARGO_DEBUG
if (argo_debug[D_ROUTE]) {
printf("clnp_ours: ia_sis %p, dst %p\n",
&ia->ia_addr, dst);
}
#endif
/*
* XXX Warning:
* We are overloading siso_tlen in the if's address, as an nsel length.
*/
if (dst->isoa_len == ia->ia_addr.siso_nlen &&
bcmp((caddr_t) ia->ia_addr.siso_addr.isoa_genaddr,
(caddr_t) dst->isoa_genaddr,
ia->ia_addr.siso_nlen - ia->ia_addr.siso_tlen) == 0)
return 1;
}
return 0;
}
/* Dec bit set if ifp qlen is greater than congest_threshold */
int congest_threshold = 0;
/*
* FUNCTION: clnp_forward
*
* PURPOSE: Forward the datagram passed
* clnpintr guarantees that the header will be
* contigious (a cluster mbuf will be used if necessary).
*
* If oidx is NULL, no options are present.
*
* RETURNS: nothing
*
* SIDE EFFECTS:
*
* NOTES:
*/
void
clnp_forward(m, len, dst, oidx, seg_off, inbound_shp)
struct mbuf *m; /* pkt to forward */
int len; /* length of pkt */
struct iso_addr *dst; /* destination address */
struct clnp_optidx *oidx; /* option index */
int seg_off;/* offset of segmentation part */
struct snpa_hdr *inbound_shp; /* subnetwork header of inbound
* packet */
{
struct clnp_fixed *clnp;/* ptr to fixed part of header */
int error; /* return value of route function */
struct sockaddr *next_hop; /* next hop for dgram */
struct ifnet *ifp; /* ptr to outgoing interface */
struct iso_ifaddr *ia = 0; /* ptr to iso name for ifp */
struct route_iso route; /* filled in by clnp_route */
extern int iso_systype;
clnp = mtod(m, struct clnp_fixed *);
bzero((caddr_t) & route, sizeof(route)); /* MUST be done before
* "bad:" */
/*
* Don't forward multicast or broadcast packets
*/
if ((inbound_shp) && (IS_MULTICAST(inbound_shp->snh_dhost))) {
#ifdef ARGO_DEBUG
if (argo_debug[D_FORWARD]) {
printf("clnp_forward: dropping multicast packet\n");
}
#endif
clnp->cnf_type &= ~CNF_ERR_OK; /* so we don't generate an ER */
clnp_discard(m, 0);
INCSTAT(cns_cantforward);
goto done;
}
#ifdef ARGO_DEBUG
if (argo_debug[D_FORWARD]) {
printf("clnp_forward: %d bytes, to %s, options %p\n", len,
clnp_iso_addrp(dst), oidx);
}
#endif
/*
* Decrement ttl, and if zero drop datagram
* Can't compare ttl as less than zero 'cause its a unsigned
*/
if ((clnp->cnf_ttl == 0) || (--clnp->cnf_ttl == 0)) {
#ifdef ARGO_DEBUG
if (argo_debug[D_FORWARD]) {
printf("clnp_forward: discarding datagram because ttl is zero\n");
}
#endif
INCSTAT(cns_ttlexpired);
clnp_discard(m, TTL_EXPTRANSIT);
goto done;
}
/*
* Route packet; special case for source rt
*/
if CLNPSRCRT_VALID
(oidx) {
/*
* Update src route first
*/
clnp_update_srcrt(m, oidx);
error = clnp_srcroute(m, oidx, &route, &next_hop, &ia, dst);
} else {
error = clnp_route(dst, &route, 0, &next_hop, &ia);
}
if (error || ia == 0) {
#ifdef ARGO_DEBUG
if (argo_debug[D_FORWARD]) {
printf("clnp_forward: can't route packet (errno %d)\n", error);
}
#endif
clnp_discard(m, ADDR_DESTUNREACH);
INCSTAT(cns_cantforward);
goto done;
}
ifp = ia->ia_ifp;
#ifdef ARGO_DEBUG
if (argo_debug[D_FORWARD]) {
printf("clnp_forward: packet routed to %s\n",
clnp_iso_addrp(&satosiso(next_hop)->siso_addr));
}
#endif
INCSTAT(cns_forward);
/*
* If we are an intermediate system and
* we are routing outbound on the same ifp that the packet
* arrived upon, and we know the next hop snpa,
* then generate a redirect request
*/
if ((iso_systype & SNPA_IS) && (inbound_shp) &&
(ifp == inbound_shp->snh_ifp))
esis_rdoutput(inbound_shp, m, oidx, dst, route.ro_rt);
/*
* If options are present, update them
*/
if (oidx) {
struct iso_addr *mysrc = &ia->ia_addr.siso_addr;
if (mysrc == NULL) {
clnp_discard(m, ADDR_DESTUNREACH);
INCSTAT(cns_cantforward);
clnp_stat.cns_forward--;
goto done;
} else {
(void) clnp_dooptions(m, oidx, ifp, mysrc);
}
}
#ifdef DECBIT
if (ifp->if_snd.ifq_len > congest_threshold) {
/*
* Congestion! Set the Dec Bit and thank Dave Oran
*/
#ifdef ARGO_DEBUG
if (argo_debug[D_FORWARD]) {
printf("clnp_forward: congestion experienced\n");
}
#endif
if ((oidx) && (oidx->cni_qos_formatp)) {
caddr_t qosp = CLNP_OFFTOOPT(m, oidx->cni_qos_formatp);
u_char qos = *qosp;
#ifdef ARGO_DEBUG
if (argo_debug[D_FORWARD]) {
printf("clnp_forward: setting congestion bit (qos x%x)\n", qos);
}
#endif
if ((qos & CLNPOVAL_GLOBAL) == CLNPOVAL_GLOBAL) {
qos |= CLNPOVAL_CONGESTED;
INCSTAT(cns_congest_set);
*qosp = qos;
}
}
}
#endif /* DECBIT */
/*
* Dispatch the datagram if it is small enough, otherwise fragment
*/
if (len <= SN_MTU(ifp, route.ro_rt)) {
iso_gen_csum(m, CLNP_CKSUM_OFF, (int) clnp->cnf_hdr_len);
(void) (*ifp->if_output) (ifp, m, next_hop, route.ro_rt);
} else {
(void) clnp_fragment(ifp, m, next_hop, len, seg_off, /* flags */ 0, route.ro_rt);
}
done:
/*
* Free route
*/
if (route.ro_rt != NULL) {
RTFREE(route.ro_rt);
}
}
#ifdef notdef
/*
* FUNCTION: clnp_insert_addr
*
* PURPOSE: Insert the address part into a clnp datagram.
*
* RETURNS: Address of first byte after address part in datagram.
*
* SIDE EFFECTS:
*
* NOTES: Assume that there is enough space for the address part.
*/
caddr_t
clnp_insert_addr(bufp, srcp, dstp)
caddr_t bufp; /* address of where addr part goes */
register struct iso_addr *srcp; /* ptr to src addr */
register struct iso_addr *dstp; /* ptr to dst addr */
{
*bufp++ = dstp->isoa_len;
(void) bcopy((caddr_t) dstp, bufp, dstp->isoa_len);
bufp += dstp->isoa_len;
*bufp++ = srcp->isoa_len;
(void) bcopy((caddr_t) srcp, bufp, srcp->isoa_len);
bufp += srcp->isoa_len;
return bufp;
}
#endif /* notdef */
/*
* FUNCTION: clnp_route
*
* PURPOSE: Route a clnp datagram to the first hop toward its
* destination. In many cases, the first hop will be
* the destination. The address of a route
* is specified. If a routing entry is present in
* that route, and it is still up to the same destination,
* then no further action is necessary. Otherwise, a
* new routing entry will be allocated.
*
* RETURNS: route found - 0
* unix error code
*
* SIDE EFFECTS:
*
* NOTES: It is up to the caller to free the routing entry
* allocated in route.
*/
int
clnp_route(dst, ro, flags, first_hop, ifa)
struct iso_addr *dst; /* ptr to datagram destination */
register struct route_iso *ro; /* existing route structure */
int flags; /* flags for routing */
struct sockaddr **first_hop; /* result: fill in with ptr to
* firsthop */
struct iso_ifaddr **ifa;/* result: fill in with ptr to interface */
{
if (flags & SO_DONTROUTE) {
struct iso_ifaddr *ia;
if (ro->ro_rt) {
RTFREE(ro->ro_rt);
ro->ro_rt = 0;
}
bzero((caddr_t) & ro->ro_dst, sizeof(ro->ro_dst));
bcopy((caddr_t) dst, (caddr_t) & ro->ro_dst.siso_addr,
1 + (unsigned) dst->isoa_len);
ro->ro_dst.siso_family = AF_ISO;
ro->ro_dst.siso_len = sizeof(ro->ro_dst);
ia = iso_localifa(&ro->ro_dst);
if (ia == 0)
return EADDRNOTAVAIL;
if (ifa)
*ifa = ia;
if (first_hop)
*first_hop = sisotosa(&ro->ro_dst);
return 0;
}
/*
* If there is a cached route, check that it is still up and to
* the same destination. If not, free it and try again.
*/
if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 ||
(Bcmp(ro->ro_dst.siso_data, dst->isoa_genaddr, dst->isoa_len)))) {
#ifdef ARGO_DEBUG
if (argo_debug[D_ROUTE]) {
printf("clnp_route: freeing old route: ro->ro_rt %p\n",
ro->ro_rt);
printf("clnp_route: old route refcnt: 0x%x\n",
ro->ro_rt->rt_refcnt);
}
#endif
/* free old route entry */
RTFREE(ro->ro_rt);
ro->ro_rt = (struct rtentry *) 0;
} else {
#ifdef ARGO_DEBUG
if (argo_debug[D_ROUTE]) {
printf("clnp_route: OK route exists\n");
}
#endif
}
if (ro->ro_rt == 0) {
/* set up new route structure */
bzero((caddr_t) & ro->ro_dst, sizeof(ro->ro_dst));
ro->ro_dst.siso_len = sizeof(ro->ro_dst);
ro->ro_dst.siso_family = AF_ISO;
Bcopy(dst, &ro->ro_dst.siso_addr, 1 + dst->isoa_len);
/* allocate new route */
#ifdef ARGO_DEBUG
if (argo_debug[D_ROUTE]) {
printf("clnp_route: allocating new route to %s\n",
clnp_iso_addrp(dst));
}
#endif
rtalloc((struct route *) ro);
}
if (ro->ro_rt == 0)
return (ENETUNREACH); /* rtalloc failed */
ro->ro_rt->rt_use++;
if (ifa)
if ((*ifa = (struct iso_ifaddr *) ro->ro_rt->rt_ifa) == 0)
panic("clnp_route");
if (first_hop) {
if (ro->ro_rt->rt_flags & RTF_GATEWAY)
*first_hop = ro->ro_rt->rt_gateway;
else
*first_hop = sisotosa(&ro->ro_dst);
}
return (0);
}
/*
* FUNCTION: clnp_srcroute
*
* PURPOSE: Source route the datagram. If complete source
* routing is specified but not possible, then
* return an error. If src routing is terminated, then
* try routing on destination.
* Usage of first_hop,
* ifp, and error return is identical to clnp_route.
*
* RETURNS: 0 or unix error code
*
* SIDE EFFECTS:
*
* NOTES: Remember that option index pointers are really
* offsets from the beginning of the mbuf.
*/
int
clnp_srcroute(options, oidx, ro, first_hop, ifa, final_dst)
struct mbuf *options;/* ptr to options */
struct clnp_optidx *oidx; /* index to options */
struct route_iso *ro; /* route structure */
struct sockaddr **first_hop; /* RETURN: fill in with ptr to
* firsthop */
struct iso_ifaddr **ifa;/* RETURN: fill in with ptr to interface */
struct iso_addr *final_dst; /* final destination */
{
struct iso_addr dst; /* first hop specified by src rt */
int error = 0; /* return code */
/*
* Check if we have run out of routes
* If so, then try to route on destination.
*/
if CLNPSRCRT_TERM
(oidx, options) {
dst.isoa_len = final_dst->isoa_len;
bcopy(final_dst->isoa_genaddr, dst.isoa_genaddr, dst.isoa_len);
} else {
/*
* setup dst based on src rt specified
*/
dst.isoa_len = CLNPSRCRT_CLEN(oidx, options);
bcopy(CLNPSRCRT_CADDR(oidx, options), dst.isoa_genaddr, dst.isoa_len);
}
/*
* try to route it
*/
error = clnp_route(&dst, ro, 0, first_hop, ifa);
if (error != 0)
return error;
/*
* If complete src rt, first hop must be equal to dst
*/
if ((CLNPSRCRT_TYPE(oidx, options) == CLNPOVAL_COMPRT) &&
(!iso_addrmatch1(&satosiso(*first_hop)->siso_addr, &dst))) {
#ifdef ARGO_DEBUG
if (argo_debug[D_OPTIONS]) {
printf("clnp_srcroute: complete src route failed\n");
}
#endif
return EHOSTUNREACH; /* RAH? would like ESRCRTFAILED */
}
return error;
}
/*
* FUNCTION: clnp_echoreply
*
* PURPOSE: generate an echo reply packet and transmit
*
* RETURNS: result of clnp_output
*
* SIDE EFFECTS:
*/
int
clnp_echoreply(ec_m, ec_len, ec_src, ec_dst, ec_oidxp)
struct mbuf *ec_m; /* echo request */
int ec_len; /* length of ec */
struct sockaddr_iso *ec_src; /* src of ec */
struct sockaddr_iso *ec_dst; /* destination of ec (i.e., us) */
struct clnp_optidx *ec_oidxp; /* options index to ec packet */
{
struct isopcb isopcb;
int flags = CLNP_NOCACHE | CLNP_ECHOR;
int ret;
/* fill in fake isopcb to pass to output function */
bzero(&isopcb, sizeof(isopcb));
isopcb.isop_laddr = ec_dst;
isopcb.isop_faddr = ec_src;
/*
* forget copying the options for now. If implemented, need only copy
* record route option, but it must be reset to zero length
*/
ret = clnp_output(ec_m, &isopcb, ec_len, flags);
#ifdef ARGO_DEBUG
if (argo_debug[D_OUTPUT]) {
printf("clnp_echoreply: output returns %d\n", ret);
}
#endif
return ret;
}
/*
* FUNCTION: clnp_badmtu
*
* PURPOSE: print notice of route with mtu not initialized.
*
* RETURNS: mtu of ifp.
*
* SIDE EFFECTS: prints notice, slows down system.
*/
int
clnp_badmtu(ifp, rt, line, file)
struct ifnet *ifp; /* outgoing interface */
struct rtentry *rt; /* dst route */
int line; /* where the dirty deed occurred */
char *file; /* where the dirty deed occurred */
{
printf("sending on route %p with no mtu, line %d of file %s\n",
rt, line, file);
#ifdef ARGO_DEBUG
printf("route dst is ");
dump_isoaddr((struct sockaddr_iso *) rt_key(rt));
#endif
return ifp->if_mtu;
}
/*
* FUNCTION: clnp_ypocb - backwards bcopy
*
* PURPOSE: bcopy starting at end of src rather than beginning.
*
* RETURNS: none
*
* SIDE EFFECTS:
*
* NOTES: No attempt has been made to make this efficient
*/
void
clnp_ypocb(from, to, len)
caddr_t from; /* src buffer */
caddr_t to; /* dst buffer */
u_int len; /* number of bytes */
{
while (len--)
*(to + len) = *(from + len);
}
#endif /* ISO */
|