]>
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_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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 * Copyright (c) 1997-1998 Apple Computer, Inc.
25 * All Rights Reserved.
29 * Modified, March 17, 1997 by Tuyen Nguyen for MacOSX.
31 #include <sys/errno.h>
32 #include <sys/types.h>
33 #include <sys/param.h>
34 #include <machine/spl.h>
35 #include <sys/systm.h>
36 #include <sys/kernel.h>
38 #include <sys/filedesc.h>
39 #include <sys/fcntl.h>
41 #include <sys/socket.h>
42 #include <sys/socketvar.h>
46 #include <netat/sysglue.h>
47 #include <netat/appletalk.h>
49 #include <netat/ddp.h>
50 #include <netat/debug.h>
51 #include <netat/at_snmp.h>
52 #include <netat/at_pcb.h>
53 #include <netat/at_var.h>
55 extern snmpStats_t snmpStats
;
57 /****************************************************************/
63 /****************************************************************/
65 void ep_input (mp
, ifID
)
67 register at_ifaddr_t
*ifID
;
69 register at_ddp_t
*ddp
;
71 snmpStats
.ec_echoReq
++;
72 ddp
= (at_ddp_t
*)gbuf_rptr(mp
);
74 /* ep packets that have a source broadcast can cause
75 * possible broadcast storms, prevent that here
77 if ( NET_VALUE(ddp
->src_net
) == 0 || ddp
->src_node
== 255) {
83 * Check if this AEP message is for us or need to be forwarded
86 (ifID
->ifThisNode
.s_net
== NET_VALUE(ddp
->dst_net
))
87 && (ifID
->ifThisNode
.s_node
== ddp
->dst_node
)) {
89 dPrintf(D_M_AEP
, D_L_INFO
, ("aep_input: received for this port from %d:%d\n",
90 NET_VALUE(ddp
->src_net
), ddp
->src_node
));
92 if (ddp
->type
== DDP_ECHO
&&
93 ddp
->data
[0] == EP_REQUEST
) {
94 ddp
->data
[0] = EP_REPLY
;
95 NET_NET(ddp
->dst_net
, ddp
->src_net
);
96 ddp
->dst_node
= ddp
->src_node
;
97 ddp
->dst_socket
= ddp
->src_socket
;
98 /* send the packet out.... */
99 snmpStats
.ec_echoReply
++;
100 (void)ddp_output(&mp
, (at_socket
)EP_SOCKET
, FALSE
);
105 dPrintf(D_M_AEP
, D_L_INFO
,
106 ("aep_input: calling routing needed from %d:%d to %d:%d\n",
107 NET_VALUE(ddp
->src_net
), ddp
->src_node
, NET_VALUE(ddp
->dst_net
),
109 routing_needed(mp
, ifID
, TRUE
);