Deleted Added
full compact
if_fddisubr.c (105598) if_fddisubr.c (106939)
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 105598 2002-10-21 02:51:56Z brooks $
36 * $FreeBSD: head/sys/net/if_fddisubr.c 106939 2002-11-15 00:00:15Z sam $
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

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

95
96static u_char fddibroadcastaddr[FDDI_ADDR_LEN] =
97 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
98
99static int fddi_resolvemulti(struct ifnet *, struct sockaddr **,
100 struct sockaddr *);
101static int fddi_output(struct ifnet *, struct mbuf *, struct sockaddr *,
102 struct rtentry *);
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

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

95
96static u_char fddibroadcastaddr[FDDI_ADDR_LEN] =
97 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
98
99static int fddi_resolvemulti(struct ifnet *, struct sockaddr **,
100 struct sockaddr *);
101static int fddi_output(struct ifnet *, struct mbuf *, struct sockaddr *,
102 struct rtentry *);
103static void fddi_input(struct ifnet *ifp, struct mbuf *m);
103
104
105#define IFP2AC(IFP) ((struct arpcom *)IFP)
106#define senderr(e) { error = (e); goto bad; }
107
108/*
109 * FDDI output routine.
110 * Encapsulate a packet of type family for the local net.

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

351 return (error);
352}
353
354/*
355 * Process a received FDDI packet;
356 * the packet is in the mbuf chain m without
357 * the fddi header, which is provided separately.
358 */
104
105
106#define IFP2AC(IFP) ((struct arpcom *)IFP)
107#define senderr(e) { error = (e); goto bad; }
108
109/*
110 * FDDI output routine.
111 * Encapsulate a packet of type family for the local net.

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

352 return (error);
353}
354
355/*
356 * Process a received FDDI packet;
357 * the packet is in the mbuf chain m without
358 * the fddi header, which is provided separately.
359 */
359void
360fddi_input(ifp, fh, m)
360static void
361fddi_input(ifp, m)
361 struct ifnet *ifp;
362 struct ifnet *ifp;
362 struct fddi_header *fh;
363 struct mbuf *m;
364{
365 struct ifqueue *inq;
366 struct llc *l;
363 struct mbuf *m;
364{
365 struct ifqueue *inq;
366 struct llc *l;
367 struct fddi_header *fh;
367
368
369 fh = mtod(m, struct fddi_header *);
370
368 /*
371 /*
372 * Update interface statistics.
373 */
374 ifp->if_ibytes += m->m_pkthdr.len;
375 getmicrotime(&ifp->if_lastchange);
376
377 /*
369 * Discard packet if interface is not up.
370 */
371 if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
372 goto dropanyway;
373
374#ifdef MAC
375 mac_create_mbuf_from_ifnet(ifp, m);
376#endif

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

391 if (bcmp((caddr_t)ifp->if_broadcastaddr,
392 (caddr_t)fh->fddi_dhost, FDDI_ADDR_LEN) == 0)
393 m->m_flags |= M_BCAST;
394 else
395 m->m_flags |= M_MCAST;
396 ifp->if_imcasts++;
397 }
398
378 * Discard packet if interface is not up.
379 */
380 if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
381 goto dropanyway;
382
383#ifdef MAC
384 mac_create_mbuf_from_ifnet(ifp, m);
385#endif

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

400 if (bcmp((caddr_t)ifp->if_broadcastaddr,
401 (caddr_t)fh->fddi_dhost, FDDI_ADDR_LEN) == 0)
402 m->m_flags |= M_BCAST;
403 else
404 m->m_flags |= M_MCAST;
405 ifp->if_imcasts++;
406 }
407
399 /*
400 * Update interface statistics.
401 */
402 getmicrotime(&ifp->if_lastchange);
403 ifp->if_ibytes += (m->m_pkthdr.len + FDDI_HDR_LEN);
404
405#ifdef M_LINK0
406 /*
407 * If this has a LLC priority of 0, then mark it so upper
408 * layers have a hint that it really came via a FDDI/Ethernet
409 * bridge.
410 */
411 if ((fh->fddi_fc & FDDIFC_LLC_PRIO7) == FDDIFC_LLC_PRIO0)
412 m->m_flags |= M_LINK0;
413#endif
414
408#ifdef M_LINK0
409 /*
410 * If this has a LLC priority of 0, then mark it so upper
411 * layers have a hint that it really came via a FDDI/Ethernet
412 * bridge.
413 */
414 if ((fh->fddi_fc & FDDIFC_LLC_PRIO7) == FDDIFC_LLC_PRIO0)
415 m->m_flags |= M_LINK0;
416#endif
417
418 /* Strip off FDDI header. */
419 m_adj(m, sizeof(struct fddi_header));
420
415 m = m_pullup(m, sizeof(struct llc));
416 if (m == 0) {
417 ifp->if_ierrors++;
418 goto dropanyway;
419 }
420 l = mtod(m, struct llc *);
421
422 switch (l->llc_dsap) {

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

543 ifp->if_type = IFT_FDDI;
544 ifp->if_addrlen = FDDI_ADDR_LEN;
545 ifp->if_hdrlen = 21;
546
547 if_attach(ifp); /* Must be called before additional assignments */
548
549 ifp->if_mtu = FDDIMTU;
550 ifp->if_output = fddi_output;
421 m = m_pullup(m, sizeof(struct llc));
422 if (m == 0) {
423 ifp->if_ierrors++;
424 goto dropanyway;
425 }
426 l = mtod(m, struct llc *);
427
428 switch (l->llc_dsap) {

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

549 ifp->if_type = IFT_FDDI;
550 ifp->if_addrlen = FDDI_ADDR_LEN;
551 ifp->if_hdrlen = 21;
552
553 if_attach(ifp); /* Must be called before additional assignments */
554
555 ifp->if_mtu = FDDIMTU;
556 ifp->if_output = fddi_output;
557 ifp->if_input = fddi_input;
551 ifp->if_resolvemulti = fddi_resolvemulti;
552 ifp->if_broadcastaddr = fddibroadcastaddr;
553 ifp->if_baudrate = 100000000;
554#ifdef IFF_NOTRAILERS
555 ifp->if_flags |= IFF_NOTRAILERS;
556#endif
557 ifa = ifaddr_byindex(ifp->if_index);
558 if (ifa == NULL) {

--- 205 unchanged lines hidden ---
558 ifp->if_resolvemulti = fddi_resolvemulti;
559 ifp->if_broadcastaddr = fddibroadcastaddr;
560 ifp->if_baudrate = 100000000;
561#ifdef IFF_NOTRAILERS
562 ifp->if_flags |= IFF_NOTRAILERS;
563#endif
564 ifa = ifaddr_byindex(ifp->if_index);
565 if (ifa == NULL) {

--- 205 unchanged lines hidden ---