Deleted Added
sdiff udiff text old ( 109771 ) new ( 110106 )
full compact
1/* $NetBSD: if_arcsubr.c,v 1.36 2001/06/14 05:44:23 itojun Exp $ */
2/* $FreeBSD: head/sys/net/if_arcsubr.c 109771 2003-01-24 01:32:20Z fjoe $ */
3
4/*
5 * Copyright (c) 1994, 1995 Ignatios Souvatzis
6 * Copyright (c) 1982, 1989, 1993
7 * The Regents of the University of California. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions

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

84#define ARCNET_ALLOW_BROKEN_ARP
85
86static struct mbuf *arc_defrag(struct ifnet *, struct mbuf *);
87static int arc_resolvemulti(struct ifnet *, struct sockaddr **,
88 struct sockaddr *);
89
90u_int8_t arcbroadcastaddr = 0;
91
92#define senderr(e) { error = (e); goto bad;}
93#define SIN(s) ((struct sockaddr_in *)s)
94#define SIPX(s) ((struct sockaddr_ipx *)s)
95
96/*
97 * ARCnet output routine.
98 * Encapsulate a packet of type family for the local net.
99 * Assumes that ifp is actually pointer to arccom structure.

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

106 struct rtentry *rt0;
107{
108 struct rtentry *rt;
109 struct arccom *ac;
110 struct arc_header *ah;
111 int error;
112 u_int8_t atype, adst;
113 int loop_copy = 0;
114
115 if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
116 return(ENETDOWN); /* m, m1 aren't initialized yet */
117
118 error = 0;
119 ac = (struct arccom *)ifp;
120
121 if ((rt = rt0)) {

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

203 }
204 break;
205
206 default:
207 if_printf(ifp, "can't handle af%d\n", dst->sa_family);
208 senderr(EAFNOSUPPORT);
209 }
210
211 M_PREPEND(m, ARC_HDRLEN, M_NOWAIT);
212 if (m == 0)
213 senderr(ENOBUFS);
214 ah = mtod(m, struct arc_header *);
215 ah->arc_type = atype;
216 ah->arc_dhost = adst;
217 ah->arc_shost = *IF_LLADDR(ifp);
218
219 if ((ifp->if_flags & IFF_SIMPLEX) && (loop_copy != -1)) {
220 if ((m->m_flags & M_BCAST) || (loop_copy > 0)) {
221 struct mbuf *n = m_copy(m, 0, (int)M_COPYALL);
222
223 (void) if_simloop(ifp, n, dst->sa_family, ARC_HDRLEN);
224 } else if (ah->arc_dhost == ah->arc_shost) {
225 (void) if_simloop(ifp, m, dst->sa_family, ARC_HDRLEN);

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

277 tfrags = (m->m_pkthdr.len + ARC_MAX_DATA - 1) / ARC_MAX_DATA;
278 ac->fsflag = 2 * tfrags - 3;
279 ac->sflag = 0;
280 ac->rsflag = ac->fsflag;
281 ac->arc_dhost = ah->arc_dhost;
282 ac->arc_shost = ah->arc_shost;
283 ac->arc_type = ah->arc_type;
284
285 m_adj(m, ARC_HDRLEN);
286 ac->curr_frag = m;
287 }
288
289 /* split out next fragment and return it */
290 if (ac->sflag < ac->fsflag) {
291 /* we CAN'T have short packets here */
292 ac->curr_frag = m_split(m, ARC_MAX_DATA, M_NOWAIT);
293 if (ac->curr_frag == 0) {

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

530 m = arc_defrag(ifp, m);
531 if (m == NULL)
532 return;
533
534 BPF_MTAP(ifp, m);
535
536 ah = mtod(m, struct arc_header *);
537 /* does this belong to us? */
538 if ((ifp->if_flags & IFF_PROMISC) != 0
539 && ah->arc_dhost != arcbroadcastaddr
540 && ah->arc_dhost != *IF_LLADDR(ifp)) {
541 m_freem(m);
542 return;
543 }
544
545 ifp->if_ibytes += m->m_pkthdr.len;
546
547 if (ah->arc_dhost == arcbroadcastaddr) {
548 m->m_flags |= M_BCAST|M_MCAST;

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

621/*
622 * Register (new) link level address.
623 */
624void
625arc_storelladdr(ifp, lla)
626 struct ifnet *ifp;
627 u_int8_t lla;
628{
629 *IF_LLADDR(ifp) = lla;
630}
631
632/*
633 * Perform common duties while attaching to interface list
634 */
635void
636arc_ifattach(ifp, lla)
637 struct ifnet *ifp;

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

708 /*
709 * XXX This code is probably wrong
710 */
711 case AF_IPX:
712 {
713 struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
714
715 if (ipx_nullhost(*ina))
716 ina->x_host.c_host[5] = *IF_LLADDR(ifp);
717 else
718 arc_storelladdr(ifp, ina->x_host.c_host[5]);
719
720 /*
721 * Set new address
722 */
723 ifp->if_init(ifp->if_softc);
724 break;

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

730 }
731 break;
732
733 case SIOCGIFADDR:
734 {
735 struct sockaddr *sa;
736
737 sa = (struct sockaddr *) &ifr->ifr_data;
738 bcopy(IF_LLADDR(ifp),
739 (caddr_t) sa->sa_data, ARC_ADDR_LEN);
740 }
741 break;
742
743 case SIOCADDMULTI:
744 case SIOCDELMULTI:
745 if (ifr == NULL)
746 error = EAFNOSUPPORT;
747 else {

--- 103 unchanged lines hidden ---