diff options
author | julian <julian@FreeBSD.org> | 1996-07-23 01:18:47 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1996-07-23 01:18:47 +0000 |
commit | 7805978130bff3d12577cd0f7ab22e16fcf455ed (patch) | |
tree | 2385f2536a83e74266993dc1005df7f95645ba32 /sys/netatalk/ddp_output.c | |
parent | b38885b4106ac83ac9d14b4d9d6a8567a51abbbe (diff) | |
download | FreeBSD-src-7805978130bff3d12577cd0f7ab22e16fcf455ed.zip FreeBSD-src-7805978130bff3d12577cd0f7ab22e16fcf455ed.tar.gz |
Submitted by: archie@whistle.com
appletalk cleanups
Diffstat (limited to 'sys/netatalk/ddp_output.c')
-rw-r--r-- | sys/netatalk/ddp_output.c | 126 |
1 files changed, 3 insertions, 123 deletions
diff --git a/sys/netatalk/ddp_output.c b/sys/netatalk/ddp_output.c index 54a2c7a..be39935 100644 --- a/sys/netatalk/ddp_output.c +++ b/sys/netatalk/ddp_output.c @@ -23,9 +23,7 @@ #include <sys/types.h> #include <sys/param.h> -#if defined( __FreeBSD__ ) #include <sys/systm.h> -#endif __FreeBSD__ #include <sys/mbuf.h> #include <sys/socket.h> #include <sys/errno.h> @@ -50,44 +48,15 @@ int ddp_cksum = 1; int ddp_output( struct ddpcb *ddp, struct mbuf *m) { -#ifndef BSD4_4 - struct mbuf *m0; - int len; -#endif BSD4_4 - struct ifnet *ifp; - struct at_ifaddr *aa = NULL; struct ddpehdr *deh; - u_short net; -#ifdef BSD4_4 M_PREPEND( m, sizeof( struct ddpehdr ), M_WAIT ); -#else BSD4_4 - for ( len = 0, m0 = m; m; m = m->m_next ) { - len += m->m_len; - } - MGET( m, M_WAIT, MT_HEADER ); - if ( m == 0 ) { - m_freem( m0 ); - return( ENOBUFS ); - } - m->m_next = m0; -#endif BSD4_4 - -#ifndef BSD4_4 -# define align(a) (((a)+3)&0xfc) - m->m_off = MMINOFF + align( SZ_ELAPHDR ); - m->m_len = sizeof( struct ddpehdr ); -#endif BSD4_4 deh = mtod( m, struct ddpehdr *); deh->deh_pad = 0; deh->deh_hops = 0; -#ifdef BSD4_4 deh->deh_len = m->m_pkthdr.len; -#else BSD4_4 - deh->deh_len = len + sizeof( struct ddpehdr ); -#endif BSD4_4 deh->deh_dnet = ddp->ddp_fsat.sat_addr.s_net; deh->deh_dnode = ddp->ddp_fsat.sat_addr.s_node; @@ -145,15 +114,10 @@ ddp_route( struct mbuf *m, struct route *ro) struct mbuf *m0; struct at_ifaddr *aa = NULL; struct ifnet *ifp = NULL; - int mlen; u_short net; if ( ro->ro_rt && ( ifp = ro->ro_rt->rt_ifp )) { -#ifdef BSD4_4 net = satosat( ro->ro_rt->rt_gateway )->sat_addr.s_net; -#else BSD4_4 - net = satosat( &ro->ro_rt->rt_gateway )->sat_addr.s_net; -#endif BSD4_4 for ( aa = at_ifaddr; aa; aa = aa->aa_next ) { if ( aa->aa_ifp == ifp && ntohs( net ) >= ntohs( aa->aa_firstnet ) && @@ -174,35 +138,7 @@ printf( "ddp_route: oops\n" ); * This is bad for transition routing, since phase 1 and phase 2 * packets end up poorly aligned due to the three byte elap header. */ - if ( aa->aa_flags & AFA_PHASE2 ) { -#if defined( __FreeBSD__ ) - /* XXX don't need this because we can change if_ethersubr.c */ -#else - for ( mlen = 0, m0 = m; m0; m0 = m0->m_next ) { - mlen += m0->m_len; - } -#ifndef MIN -#define MIN(x,y) ((x)<(y)?(x):(y)) -#endif - if (( m = m_pullup( m, MIN( MLEN, mlen ))) == 0 ) { - printf("ddp_route: m_pullup of %d (mlen=%d) failed\n", - MIN( MLEN, mlen ), mlen); - return( ENOBUFS ); - } -#endif __FreeBSD__ - } else { -# ifdef notdef -#ifdef BSD4_4 - M_PREPEND( m, SZ_ELAPHDR, M_DONTWAIT ); - if ( m == NULL ) { - return( ENOBUFS ); - } -#else BSD4_4 - m->m_off -= SZ_ELAPHDR; - m->m_len += SZ_ELAPHDR; -#endif BSD4_4 -# endif notdef - + if ( !(aa->aa_flags & AFA_PHASE2) ) { MGET( m0, M_WAIT, MT_HEADER ); if ( m0 == 0 ) { m_freem( m ); @@ -210,12 +146,7 @@ printf( "ddp_route: oops\n" ); return( ENOBUFS ); } m0->m_next = m; - -#ifndef BSD4_4 - m0->m_off = MMINOFF + align( sizeof( struct ether_header )); -#else /* XXX perhaps we ought to align the header? */ -#endif BSD4_4 m0->m_len = SZ_ELAPHDR; m = m0; @@ -228,11 +159,7 @@ printf( "ddp_route: oops\n" ); ntohs( aa->aa_lastnet )) { elh->el_dnode = satosat( &ro->ro_dst )->sat_addr.s_node; } else { -#ifdef BSD4_4 elh->el_dnode = satosat( ro->ro_rt->rt_gateway )->sat_addr.s_node; -#else BSD4_4 - elh->el_dnode = satosat( &ro->ro_rt->rt_gateway )->sat_addr.s_node; -#endif BSD4_4 } } @@ -242,57 +169,10 @@ printf( "ddp_route: oops\n" ); ntohs( aa->aa_lastnet )) { gate = *satosat( &ro->ro_dst ); } else { -#ifdef BSD4_4 gate = *satosat( ro->ro_rt->rt_gateway ); -#else BSD4_4 - gate = *satosat( &ro->ro_rt->rt_gateway ); -#endif BSD4_4 } ro->ro_rt->rt_use++; -#ifdef ultrix - /* - * SAIEW: We can't make changes to net/if_loop.c, so we don't route - * further than this: if it's going to go through the lookback, - * short-circuit to ddp_input(). Who needs queuing? - * - * Note: Passing NULL for the elaphdr is cool, since we'll only ever - * try to send long form ddp throught the loopback. - */ - if ( ifp->if_flags & IFF_LOOPBACK ) { -#ifdef notdef - m->m_off += SZ_ELAPHDR; - m->m_len -= SZ_ELAPHDR; -#endif notdef - ddp_input( m, ifp, (struct elaphdr *)NULL, 2 ); - return( 0 ); - } -#endif ultrix - -#ifdef _IBMR2 - /* - * We can't make changes to the interface routines on RS6ks, and - * they don't provide hooks for if_output, so we just resolve - * our address here, and pass the packet as a raw ethernet packet. - * This doesn't work particularly well, if we aren't *on* ethernet, - * but it's ok for the moment. - */ - if ( ! ( ifp->if_flags & IFF_LOOPBACK )) { - struct ether_header eh; - - if ( !aarpresolve(( struct arpcom *)ifp, m, - &gate, eh.ether_dhost )) { - return( 0 ); - } - eh.ether_type = htons( ETHERTYPE_AT ); - gate.sat_family = AF_UNSPEC; - bcopy( &eh, (*(struct sockaddr *)&gate).sa_data, - sizeof( (*(struct sockaddr *)&gate).sa_data )); - } -#endif _IBMR2 - return((*ifp->if_output)( ifp, m, &gate -#if defined( __FreeBSD__ ) - , NULL /* XXX */ -#endif __FreeBSD__ - )); + return((*ifp->if_output)( ifp, + m, (struct sockaddr *)&gate, NULL)); /* XXX */ } |