]>
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 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1997-1998 Apple Computer, Inc.
24 * All Rights Reserved.
28 * Modified, March 17, 1997 by Tuyen Nguyen for MacOSX.
30 #include <sys/errno.h>
31 #include <sys/types.h>
32 #include <sys/param.h>
33 #include <machine/spl.h>
34 #include <sys/systm.h>
35 #include <sys/kernel.h>
37 #include <sys/filedesc.h>
38 #include <sys/fcntl.h>
40 #include <sys/socket.h>
41 #include <sys/socketvar.h>
45 #include <netat/sysglue.h>
46 #include <netat/appletalk.h>
48 #include <netat/ddp.h>
49 #include <netat/debug.h>
50 #include <netat/at_snmp.h>
51 #include <netat/at_pcb.h>
52 #include <netat/at_var.h>
54 extern snmpStats_t snmpStats
;
56 /****************************************************************/
62 /****************************************************************/
64 void ep_input (mp
, ifID
)
66 register at_ifaddr_t
*ifID
;
68 register at_ddp_t
*ddp
;
70 snmpStats
.ec_echoReq
++;
71 ddp
= (at_ddp_t
*)gbuf_rptr(mp
);
73 /* ep packets that have a source broadcast can cause
74 * possible broadcast storms, prevent that here
76 if ( NET_VALUE(ddp
->src_net
) == 0 || ddp
->src_node
== 255) {
82 * Check if this AEP message is for us or need to be forwarded
85 (ifID
->ifThisNode
.s_net
== NET_VALUE(ddp
->dst_net
))
86 && (ifID
->ifThisNode
.s_node
== ddp
->dst_node
)) {
88 dPrintf(D_M_AEP
, D_L_INFO
, ("aep_input: received for this port from %d:%d\n",
89 NET_VALUE(ddp
->src_net
), ddp
->src_node
));
91 if (ddp
->type
== DDP_ECHO
&&
92 ddp
->data
[0] == EP_REQUEST
) {
93 ddp
->data
[0] = EP_REPLY
;
94 NET_NET(ddp
->dst_net
, ddp
->src_net
);
95 ddp
->dst_node
= ddp
->src_node
;
96 ddp
->dst_socket
= ddp
->src_socket
;
97 /* send the packet out.... */
98 snmpStats
.ec_echoReply
++;
99 (void)ddp_output(&mp
, (at_socket
)EP_SOCKET
, FALSE
);
104 dPrintf(D_M_AEP
, D_L_INFO
,
105 ("aep_input: calling routing needed from %d:%d to %d:%d\n",
106 NET_VALUE(ddp
->src_net
), ddp
->src_node
, NET_VALUE(ddp
->dst_net
),
108 routing_needed(mp
, ifID
, TRUE
);