1*41484Smckusick /* 2*41484Smckusick * Copyright (c) 1988 University of Utah. 3*41484Smckusick * Copyright (c) 1990 The Regents of the University of California. 4*41484Smckusick * All rights reserved. 5*41484Smckusick * 6*41484Smckusick * This code is derived from software contributed to Berkeley by 7*41484Smckusick * the Systems Programming Group of the University of Utah Computer 8*41484Smckusick * Science Department. 9*41484Smckusick * 10*41484Smckusick * %sccs.include.redist.c% 11*41484Smckusick * 12*41484Smckusick * from: Utah $Hdr: rmp.c 1.3 89/06/07$ 13*41484Smckusick * 14*41484Smckusick * @(#)rmp.c 7.1 (Berkeley) 05/08/90 15*41484Smckusick */ 16*41484Smckusick 17*41484Smckusick #include "param.h" 18*41484Smckusick #include "mbuf.h" 19*41484Smckusick #include "socket.h" 20*41484Smckusick #include "socketvar.h" 21*41484Smckusick 22*41484Smckusick #include "../net/if.h" 23*41484Smckusick #include "../net/route.h" 24*41484Smckusick #include "../net/raw_cb.h" 25*41484Smckusick 26*41484Smckusick #include "../netrmp/rmp.h" 27*41484Smckusick #include "../netrmp/rmp_var.h" 28*41484Smckusick 29*41484Smckusick /* 30*41484Smckusick ** rmp_output: route packet to proper network interface. 31*41484Smckusick */ 32*41484Smckusick 33*41484Smckusick rmp_output(m, so) 34*41484Smckusick struct mbuf *m; 35*41484Smckusick struct socket *so; 36*41484Smckusick { 37*41484Smckusick struct ifnet *ifp; 38*41484Smckusick struct rawcb *rp = sotorawcb(so); 39*41484Smckusick struct rmp_packet *rmp; 40*41484Smckusick 41*41484Smckusick /* 42*41484Smckusick * Convert the mbuf back to an RMP packet so we can get the 43*41484Smckusick * address of the "ifnet struct" specifying the interface it 44*41484Smckusick * should go out on. 45*41484Smckusick */ 46*41484Smckusick rmp = mtod(m, struct rmp_packet *); 47*41484Smckusick ifp = rmp->ifp; 48*41484Smckusick 49*41484Smckusick /* 50*41484Smckusick * Strip off the "ifnet struct ptr" from the packet leaving 51*41484Smckusick * us with a complete IEEE 802.2 packet. 52*41484Smckusick */ 53*41484Smckusick m_adj(m, sizeof(struct ifnet *)); 54*41484Smckusick 55*41484Smckusick /* 56*41484Smckusick * Send the packet. 57*41484Smckusick */ 58*41484Smckusick return ((*ifp->if_output) (ifp, m, &rp->rcb_faddr)); 59*41484Smckusick } 60