Deleted Added
full compact
if_fddisubr.c (185164) if_fddisubr.c (186119)
1/*-
2 * Copyright (c) 1995, 1996
3 * Matt Thomas <matt@3am-software.com>. All rights reserved.
4 * Copyright (c) 1982, 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 19 unchanged lines hidden (view full) ---

28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * from: if_ethersubr.c,v 1.5 1994/12/13 22:31:45 wollman Exp
1/*-
2 * Copyright (c) 1995, 1996
3 * Matt Thomas <matt@3am-software.com>. All rights reserved.
4 * Copyright (c) 1982, 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 19 unchanged lines hidden (view full) ---

28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * from: if_ethersubr.c,v 1.5 1994/12/13 22:31:45 wollman Exp
36 * $FreeBSD: head/sys/net/if_fddisubr.c 185164 2008-11-22 07:35:45Z kmacy $
36 * $FreeBSD: head/sys/net/if_fddisubr.c 186119 2008-12-15 06:10:57Z qingli $
37 */
38
39#include "opt_atalk.h"
40#include "opt_inet.h"
41#include "opt_inet6.h"
42#include "opt_ipx.h"
43#include "opt_mac.h"
44

--- 5 unchanged lines hidden (view full) ---

50#include <sys/module.h>
51#include <sys/socket.h>
52#include <sys/sockio.h>
53
54#include <net/if.h>
55#include <net/if_dl.h>
56#include <net/if_llc.h>
57#include <net/if_types.h>
37 */
38
39#include "opt_atalk.h"
40#include "opt_inet.h"
41#include "opt_inet6.h"
42#include "opt_ipx.h"
43#include "opt_mac.h"
44

--- 5 unchanged lines hidden (view full) ---

50#include <sys/module.h>
51#include <sys/socket.h>
52#include <sys/sockio.h>
53
54#include <net/if.h>
55#include <net/if_dl.h>
56#include <net/if_llc.h>
57#include <net/if_types.h>
58#include <net/if_llatbl.h>
58
59#include <net/ethernet.h>
60#include <net/netisr.h>
61#include <net/route.h>
62#include <net/bpf.h>
63#include <net/fddi.h>
64
65#if defined(INET) || defined(INET6)

--- 49 unchanged lines hidden (view full) ---

115 struct mbuf *m;
116 struct sockaddr *dst;
117 struct rtentry *rt0;
118{
119 u_int16_t type;
120 int loop_copy = 0, error = 0, hdrcmplt = 0;
121 u_char esrc[FDDI_ADDR_LEN], edst[FDDI_ADDR_LEN];
122 struct fddi_header *fh;
59
60#include <net/ethernet.h>
61#include <net/netisr.h>
62#include <net/route.h>
63#include <net/bpf.h>
64#include <net/fddi.h>
65
66#if defined(INET) || defined(INET6)

--- 49 unchanged lines hidden (view full) ---

116 struct mbuf *m;
117 struct sockaddr *dst;
118 struct rtentry *rt0;
119{
120 u_int16_t type;
121 int loop_copy = 0, error = 0, hdrcmplt = 0;
122 u_char esrc[FDDI_ADDR_LEN], edst[FDDI_ADDR_LEN];
123 struct fddi_header *fh;
124 struct llentry *lle;
123
124#ifdef MAC
125 error = mac_ifnet_check_transmit(ifp, m);
126 if (error)
127 senderr(error);
128#endif
129
130 if (ifp->if_flags & IFF_MONITOR)
131 senderr(ENETDOWN);
132 if (!((ifp->if_flags & IFF_UP) &&
133 (ifp->if_drv_flags & IFF_DRV_RUNNING)))
134 senderr(ENETDOWN);
135 getmicrotime(&ifp->if_lastchange);
136
137 switch (dst->sa_family) {
138#ifdef INET
139 case AF_INET: {
125
126#ifdef MAC
127 error = mac_ifnet_check_transmit(ifp, m);
128 if (error)
129 senderr(error);
130#endif
131
132 if (ifp->if_flags & IFF_MONITOR)
133 senderr(ENETDOWN);
134 if (!((ifp->if_flags & IFF_UP) &&
135 (ifp->if_drv_flags & IFF_DRV_RUNNING)))
136 senderr(ENETDOWN);
137 getmicrotime(&ifp->if_lastchange);
138
139 switch (dst->sa_family) {
140#ifdef INET
141 case AF_INET: {
140 error = arpresolve(ifp, rt0, m, dst, edst);
142 error = arpresolve(ifp, rt0, m, dst, edst, &lle);
141 if (error)
142 return (error == EWOULDBLOCK ? 0 : error);
143 type = htons(ETHERTYPE_IP);
144 break;
145 }
146 case AF_ARP:
147 {
148 struct arphdr *ah;

--- 19 unchanged lines hidden (view full) ---

168 else
169 bcopy(ar_tha(ah), edst, FDDI_ADDR_LEN);
170
171 }
172 break;
173#endif /* INET */
174#ifdef INET6
175 case AF_INET6:
143 if (error)
144 return (error == EWOULDBLOCK ? 0 : error);
145 type = htons(ETHERTYPE_IP);
146 break;
147 }
148 case AF_ARP:
149 {
150 struct arphdr *ah;

--- 19 unchanged lines hidden (view full) ---

170 else
171 bcopy(ar_tha(ah), edst, FDDI_ADDR_LEN);
172
173 }
174 break;
175#endif /* INET */
176#ifdef INET6
177 case AF_INET6:
176 error = nd6_storelladdr(ifp, rt0, m, dst, (u_char *)edst);
178 error = nd6_storelladdr(ifp, rt0, m, dst, (u_char *)edst, &lle);
177 if (error)
178 return (error); /* Something bad happened */
179 type = htons(ETHERTYPE_IPV6);
180 break;
181#endif /* INET6 */
182#ifdef IPX
183 case AF_IPX:
184 type = htons(ETHERTYPE_IPX);

--- 606 unchanged lines hidden ---
179 if (error)
180 return (error); /* Something bad happened */
181 type = htons(ETHERTYPE_IPV6);
182 break;
183#endif /* INET6 */
184#ifdef IPX
185 case AF_IPX:
186 type = htons(ETHERTYPE_IPX);

--- 606 unchanged lines hidden ---