1/* $NetBSD: if_atmsubr.c,v 1.10 1997/03/11 23:19:51 chuck Exp $ */ 2 3/* 4 * 5 * Copyright (c) 1996 Charles D. Cranor and Washington University. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 21 unchanged lines hidden (view full) --- 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * 34 * if_atmsubr.c 35 */ 36 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/sys/net/if_atmsubr.c 128636 2004-04-25 09:24:52Z luigi $"); |
39 40#include "opt_inet.h" 41#include "opt_inet6.h" 42#include "opt_mac.h" 43#include "opt_natm.h" 44 45#include <sys/param.h> 46#include <sys/systm.h> --- 74 unchanged lines hidden (view full) --- 121int 122atm_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, 123 struct rtentry *rt0) 124{ 125 u_int16_t etype = 0; /* if using LLC/SNAP */ 126 int error = 0, sz; 127 struct atm_pseudohdr atmdst, *ad; 128 struct mbuf *m = m0; |
129 struct atmllc *atmllc; 130 struct atmllc *llc_hdr = NULL; 131 u_int32_t atm_flags; 132 133#ifdef MAC 134 error = mac_check_ifnet_transmit(ifp, m); 135 if (error) 136 senderr(error); 137#endif 138 139 if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) != (IFF_UP | IFF_RUNNING)) 140 senderr(ENETDOWN); 141 142 /* |
143 * check for non-native ATM traffic (dst != NULL) 144 */ 145 if (dst) { 146 switch (dst->sa_family) { 147 148#if defined(INET) || defined(INET6) 149 case AF_INET: 150 case AF_INET6: |
151 { 152 struct rtentry *rt; 153 /* 154 * check route 155 */ 156 error = rt_check(&rt, &rt0, dst); 157 if (error) 158 goto bad; 159 |
160 if (dst->sa_family == AF_INET6) 161 etype = ETHERTYPE_IPV6; 162 else 163 etype = ETHERTYPE_IP; 164 if (!atmresolve(rt, m, dst, &atmdst)) { 165 m = NULL; 166 /* XXX: atmresolve already free'd it */ 167 senderr(EHOSTUNREACH); 168 /* XXX: put ATMARP stuff here */ 169 /* XXX: watch who frees m on failure */ 170 } |
171 } |
172 break; 173#endif /* INET || INET6 */ 174 175 case AF_UNSPEC: 176 /* 177 * XXX: bpfwrite. assuming dst contains 12 bytes 178 * (atm pseudo header (4) + LLC/SNAP (8)) 179 */ --- 312 unchanged lines hidden --- |