2 * $Id: ddp.c,v 1.2.2.1 2002-02-07 23:49:02 srittau Exp $
7 #endif /* HAVE_CONFIG_H */
10 #include <sys/stream.h>
11 #include <sys/cmn_err.h>
12 #include <sys/socket.h>
13 #include <sys/errno.h>
14 #include <sys/tihdr.h>
16 #include <sys/ethernet.h>
25 #include <netatalk/endian.h>
26 #include <netatalk/ddp.h>
27 #include <netatalk/at.h>
33 ddp_rput( struct atif_data *aid, mblk_t *m )
35 struct atif_data *daid;
37 struct sockaddr_at sat;
40 if ( m->b_wptr - m->b_rptr < sizeof( struct ddpehdr )) {
41 cmn_err( CE_NOTE, "ddp_rput short packet\n" );
46 deh = (struct ddpehdr *)m->b_rptr;
48 sat.sat_addr.s_net = deh->deh_dnet;
49 sat.sat_addr.s_node = deh->deh_dnode;
50 sat.sat_port = deh->deh_dport;
52 if (( daid = if_dest( aid, &sat )) != NULL ) {
53 if (( sd = sock_dest( daid, &sat )) != NULL ) {
54 if ( sd->sd_state != TS_IDLE ) {
58 bzero( (caddr_t)&sat, sizeof( struct sockaddr_at ));
59 sat.sat_family = AF_APPLETALK;
60 sat.sat_addr.s_net = deh->deh_snet;
61 sat.sat_addr.s_node = deh->deh_snode;
62 sat.sat_port = deh->deh_sport;
63 adjmsg( m, sizeof( struct ddpehdr ));
64 t_unitdata_ind( WR( sd->sd_q ), m, &sat );
73 return( ENETUNREACH );