Deleted Added
sdiff udiff text old ( 124283 ) new ( 128636 )
full compact
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 124283 2004-01-09 11:25:14Z harti $");
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 rtentry *rt;
130 struct atmllc *atmllc;
131 struct atmllc *llc_hdr = NULL;
132 u_int32_t atm_flags;
133
134#ifdef MAC
135 error = mac_check_ifnet_transmit(ifp, m);
136 if (error)
137 senderr(error);
138#endif
139
140 if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) != (IFF_UP | IFF_RUNNING))
141 senderr(ENETDOWN);
142
143 /*
144 * check route
145 */
146 error = rt_check(&rt, &rt0, dst);
147 if (error)
148 goto bad;
149
150 /*
151 * check for non-native ATM traffic (dst != NULL)
152 */
153 if (dst) {
154 switch (dst->sa_family) {
155
156#if defined(INET) || defined(INET6)
157 case AF_INET:
158 case AF_INET6:
159 if (dst->sa_family == AF_INET6)
160 etype = ETHERTYPE_IPV6;
161 else
162 etype = ETHERTYPE_IP;
163 if (!atmresolve(rt, m, dst, &atmdst)) {
164 m = NULL;
165 /* XXX: atmresolve already free'd it */
166 senderr(EHOSTUNREACH);
167 /* XXX: put ATMARP stuff here */
168 /* XXX: watch who frees m on failure */
169 }
170 break;
171#endif /* INET || INET6 */
172
173 case AF_UNSPEC:
174 /*
175 * XXX: bpfwrite. assuming dst contains 12 bytes
176 * (atm pseudo header (4) + LLC/SNAP (8))
177 */

--- 312 unchanged lines hidden ---