]>
git.saurik.com Git - apple/xnu.git/blob - bsd/netat/ddp_aep.c
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 * Copyright (c) 1997-1998 Apple Computer, Inc.
30 * All Rights Reserved.
34 * Modified, March 17, 1997 by Tuyen Nguyen for MacOSX.
36 #include <sys/errno.h>
37 #include <sys/types.h>
38 #include <sys/param.h>
39 #include <machine/spl.h>
40 #include <sys/systm.h>
41 #include <sys/kernel.h>
43 #include <sys/filedesc.h>
44 #include <sys/fcntl.h>
46 #include <sys/socket.h>
47 #include <sys/socketvar.h>
51 #include <netat/sysglue.h>
52 #include <netat/appletalk.h>
54 #include <netat/ddp.h>
55 #include <netat/debug.h>
56 #include <netat/at_snmp.h>
57 #include <netat/at_pcb.h>
58 #include <netat/at_var.h>
60 extern snmpStats_t snmpStats
;
62 /****************************************************************/
68 /****************************************************************/
70 void ep_input (mp
, ifID
)
72 register at_ifaddr_t
*ifID
;
74 register at_ddp_t
*ddp
;
76 snmpStats
.ec_echoReq
++;
77 ddp
= (at_ddp_t
*)gbuf_rptr(mp
);
79 /* ep packets that have a source broadcast can cause
80 * possible broadcast storms, prevent that here
82 if ( NET_VALUE(ddp
->src_net
) == 0 || ddp
->src_node
== 255) {
88 * Check if this AEP message is for us or need to be forwarded
91 ((ifID
->ifThisNode
.s_net
== NET_VALUE(ddp
->dst_net
))
92 && (ifID
->ifThisNode
.s_node
== ddp
->dst_node
))) {
94 dPrintf(D_M_AEP
, D_L_INFO
, ("aep_input: received for this port from %d:%d\n",
95 NET_VALUE(ddp
->src_net
), ddp
->src_node
));
97 if (ddp
->type
== DDP_ECHO
&&
98 ddp
->data
[0] == EP_REQUEST
) {
99 ddp
->data
[0] = EP_REPLY
;
100 NET_NET(ddp
->dst_net
, ddp
->src_net
);
101 ddp
->dst_node
= ddp
->src_node
;
102 ddp
->dst_socket
= ddp
->src_socket
;
103 /* send the packet out.... */
104 snmpStats
.ec_echoReply
++;
105 (void)ddp_output(&mp
, (at_socket
)EP_SOCKET
, FALSE
);
110 dPrintf(D_M_AEP
, D_L_INFO
,
111 ("aep_input: calling routing needed from %d:%d to %d:%d\n",
112 NET_VALUE(ddp
->src_net
), ddp
->src_node
, NET_VALUE(ddp
->dst_net
),
114 routing_needed(mp
, ifID
, TRUE
);