if_fddisubr.c (51646) | if_fddisubr.c (52248) |
---|---|
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 51646 1999-09-25 12:06:01Z phk $ | 36 * $FreeBSD: head/sys/net/if_fddisubr.c 52248 1999-10-15 05:07:00Z msmith $ |
37 */ 38 39#include "opt_atalk.h" 40#include "opt_inet.h" 41#include "opt_ipx.h" 42 43#include <sys/param.h> 44#include <sys/systm.h> --- 86 unchanged lines hidden (view full) --- 131int 132fddi_output(ifp, m0, dst, rt0) 133 register struct ifnet *ifp; 134 struct mbuf *m0; 135 struct sockaddr *dst; 136 struct rtentry *rt0; 137{ 138 u_int16_t type; | 37 */ 38 39#include "opt_atalk.h" 40#include "opt_inet.h" 41#include "opt_ipx.h" 42 43#include <sys/param.h> 44#include <sys/systm.h> --- 86 unchanged lines hidden (view full) --- 131int 132fddi_output(ifp, m0, dst, rt0) 133 register struct ifnet *ifp; 134 struct mbuf *m0; 135 struct sockaddr *dst; 136 struct rtentry *rt0; 137{ 138 u_int16_t type; |
139 int s, loop_copy = 0, error = 0; 140 u_char edst[6]; | 139 int s, loop_copy = 0, error = 0, hdrcmplt = 0; 140 u_char esrc[6], edst[6]; |
141 register struct mbuf *m = m0; 142 register struct rtentry *rt; 143 register struct fddi_header *fh; 144 struct arpcom *ac = (struct arpcom *)ifp; 145 146 if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) 147 senderr(ENETDOWN); 148 getmicrotime(&ifp->if_lastchange); --- 141 unchanged lines hidden (view full) --- 290 type & 0xff, l->llc_dsap & 0xff, l->llc_ssap &0xff, 291 l->llc_control & 0xff); 292 293 } 294#endif /* LLC_DEBUG */ 295 } break; 296#endif /* LLC */ 297 | 141 register struct mbuf *m = m0; 142 register struct rtentry *rt; 143 register struct fddi_header *fh; 144 struct arpcom *ac = (struct arpcom *)ifp; 145 146 if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) 147 senderr(ENETDOWN); 148 getmicrotime(&ifp->if_lastchange); --- 141 unchanged lines hidden (view full) --- 290 type & 0xff, l->llc_dsap & 0xff, l->llc_ssap &0xff, 291 l->llc_control & 0xff); 292 293 } 294#endif /* LLC_DEBUG */ 295 } break; 296#endif /* LLC */ 297 |
298 case pseudo_AF_HDRCMPLT: 299 { 300 struct ether_header *eh; 301 hdrcmplt = 1; 302 eh = (struct ether_header *)dst->sa_data; 303 (void)memcpy((caddr_t)esrc, (caddr_t)eh->ether_shost, sizeof (esrc)); 304 /* FALLTHROUGH */ 305 } 306 |
|
298 case AF_UNSPEC: 299 { 300 struct ether_header *eh; 301 loop_copy = -1; 302 eh = (struct ether_header *)dst->sa_data; 303 (void)memcpy((caddr_t)edst, (caddr_t)eh->ether_dhost, sizeof (edst)); 304 if (*edst & 1) 305 m->m_flags |= (M_BCAST|M_MCAST); --- 59 unchanged lines hidden (view full) --- 365 */ 366 M_PREPEND(m, sizeof (struct fddi_header), M_DONTWAIT); 367 if (m == 0) 368 senderr(ENOBUFS); 369 fh = mtod(m, struct fddi_header *); 370 fh->fddi_fc = FDDIFC_LLC_ASYNC|FDDIFC_LLC_PRIO4; 371 (void)memcpy((caddr_t)fh->fddi_dhost, (caddr_t)edst, sizeof (edst)); 372 queue_it: | 307 case AF_UNSPEC: 308 { 309 struct ether_header *eh; 310 loop_copy = -1; 311 eh = (struct ether_header *)dst->sa_data; 312 (void)memcpy((caddr_t)edst, (caddr_t)eh->ether_dhost, sizeof (edst)); 313 if (*edst & 1) 314 m->m_flags |= (M_BCAST|M_MCAST); --- 59 unchanged lines hidden (view full) --- 374 */ 375 M_PREPEND(m, sizeof (struct fddi_header), M_DONTWAIT); 376 if (m == 0) 377 senderr(ENOBUFS); 378 fh = mtod(m, struct fddi_header *); 379 fh->fddi_fc = FDDIFC_LLC_ASYNC|FDDIFC_LLC_PRIO4; 380 (void)memcpy((caddr_t)fh->fddi_dhost, (caddr_t)edst, sizeof (edst)); 381 queue_it: |
373 (void)memcpy((caddr_t)fh->fddi_shost, (caddr_t)ac->ac_enaddr, 374 sizeof(fh->fddi_shost)); 375 | 382 if (hdrcmplt) 383 (void)memcpy((caddr_t)fh->fddi_shost, (caddr_t)esrc, 384 sizeof(fh->fddi_shost)); 385 else 386 (void)memcpy((caddr_t)fh->fddi_shost, (caddr_t)ac->ac_enaddr, 387 sizeof(fh->fddi_shost)); |
376 /* 377 * If a simplex interface, and the packet is being sent to our 378 * Ethernet address or a broadcast address, loopback a copy. 379 * XXX To make a simplex device behave exactly like a duplex 380 * device, we should copy in the case of sending to our own 381 * ethernet address (thus letting the original actually appear 382 * on the wire). However, we don't do that here for security 383 * reasons and compatibility with the original behavior. --- 316 unchanged lines hidden --- | 388 /* 389 * If a simplex interface, and the packet is being sent to our 390 * Ethernet address or a broadcast address, loopback a copy. 391 * XXX To make a simplex device behave exactly like a duplex 392 * device, we should copy in the case of sending to our own 393 * ethernet address (thus letting the original actually appear 394 * on the wire). However, we don't do that here for security 395 * reasons and compatibility with the original behavior. --- 316 unchanged lines hidden --- |