Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Feb 2002 15:19:22 -0800
From:      Max Khon <fjoe@freebsd.org>
To:        Andrew Gallatin <gallatin@cs.duke.edu>
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/net if.c if_arc.h if_arp.h if_ethersubr.c if_fddisubr.c if_iso88025subr.c if_var.h if_vlan.c src/sys/netinet if_ether.c if_ether.h
Message-ID:  <20020219151922.A31723@hub.freebsd.org>
In-Reply-To: <20020219162648.A52559@grasshopper.cs.duke.edu>; from gallatin@cs.duke.edu on Tue, Feb 19, 2002 at 04:26:48PM -0500
References:  <200202132138.g1DLcuB88159@freefall.freebsd.org> <20020219162648.A52559@grasshopper.cs.duke.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

--EVF5PPMfhYS0aIcm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

hi, there!

On Tue, Feb 19, 2002 at 04:26:48PM -0500, Andrew Gallatin wrote:

> > fjoe        2002/02/13 13:38:56 PST
> <...>
> >   Log:
> >   MFC: ARP support for variable length link level addresses
> 
> <...>
> >   1.18.2.13  +4 -0      src/sys/net/if_var.h
> 
> The addition of a pointer ( u_int8_t *if_broadcastaddr;) into struct
> ifnet breaks binary compatability in the 4-stable series for 3rd party
> network drivers by moving the ac_enaddr[] field down in struct arpcom.

[...]

does the attached patch look ok?
if yes is it ok to commit it to RELENG_4 only?

/fjoe

--EVF5PPMfhYS0aIcm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=ifnet-diffs

Index: net/if.c
===================================================================
RCS file: /home/ncvs/src/sys/net/if.c,v
retrieving revision 1.85.2.13
diff -u -p -r1.85.2.13 if.c
--- net/if.c	13 Feb 2002 21:38:55 -0000	1.85.2.13
+++ net/if.c	19 Feb 2002 22:54:04 -0000
@@ -752,7 +752,6 @@ link_rtrequest(cmd, rt, info)
 		if (ifa->ifa_rtrequest && ifa->ifa_rtrequest != link_rtrequest)
 			ifa->ifa_rtrequest(cmd, rt, info);
 	}
-	ifp->if_broadcastaddr = 0; /* reliably crash if used uninitialized */
 }
 
 /*
Index: net/if_arc.h
===================================================================
RCS file: /home/ncvs/src/sys/net/if_arc.h,v
retrieving revision 1.2.2.1
diff -u -p -r1.2.2.1 if_arc.h
--- net/if_arc.h	13 Feb 2002 21:38:56 -0000	1.2.2.1
+++ net/if_arc.h	19 Feb 2002 22:54:04 -0000
@@ -128,7 +128,6 @@ struct	arccom {
 };
 
 #ifdef _KERNEL
-extern u_int8_t arcbroadcastaddr;
 extern int arc_ipmtu;	/* XXX new ip only, no RFC 1051! */
 
 void	arc_ifattach __P((struct ifnet *, u_int8_t));
Index: net/if_arcsubr.c
===================================================================
RCS file: /home/ncvs/src/sys/net/if_arcsubr.c,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 if_arcsubr.c
--- net/if_arcsubr.c	13 Feb 2002 22:33:42 -0000	1.1.2.1
+++ net/if_arcsubr.c	19 Feb 2002 22:54:06 -0000
@@ -79,8 +79,6 @@ MODULE_VERSION(arcnet, 1);
 
 static struct mbuf *arc_defrag __P((struct ifnet *, struct mbuf *));
 
-u_int8_t  arcbroadcastaddr = 0;
-
 #define senderr(e) { error = (e); goto bad;}
 #define SIN(s) ((struct sockaddr_in *)s)
 
@@ -693,8 +691,6 @@ arc_ifattach(ifp, lla)
 		   ifp->if_name, ifp->if_unit, ifp->if_name, ifp->if_unit);
 	}
 	arc_storelladdr(ifp, lla);
-
-	ifp->if_broadcastaddr = &arcbroadcastaddr;
 
 	bpfattach(ifp, DLT_ARCNET, ARC_HDRLEN);
 }
Index: net/if_arp.h
===================================================================
RCS file: /home/ncvs/src/sys/net/if_arp.h,v
retrieving revision 1.14.2.2
diff -u -p -r1.14.2.2 if_arp.h
--- net/if_arp.h	13 Feb 2002 21:38:56 -0000	1.14.2.2
+++ net/if_arp.h	19 Feb 2002 22:54:07 -0000
@@ -116,6 +116,7 @@ struct	arpcom {
 };
 
 extern u_char	etherbroadcastaddr[6];
+extern u_char	arcbroadcastaddr;
 #endif
 
 #endif /* !_NET_IF_ARP_H_ */
Index: net/if_ethersubr.c
===================================================================
RCS file: /home/ncvs/src/sys/net/if_ethersubr.c,v
retrieving revision 1.70.2.24
diff -u -p -r1.70.2.24 if_ethersubr.c
--- net/if_ethersubr.c	13 Feb 2002 21:38:56 -0000	1.70.2.24
+++ net/if_ethersubr.c	19 Feb 2002 22:54:13 -0000
@@ -699,7 +699,6 @@ ether_ifattach(ifp, bpf)
 	ifp->if_resolvemulti = ether_resolvemulti;
 	if (ifp->if_baudrate == 0)
 	    ifp->if_baudrate = 10000000;
-	ifp->if_broadcastaddr = etherbroadcastaddr;
 	ifa = ifnet_addrs[ifp->if_index - 1];
 	KASSERT(ifa != NULL, ("%s: no lladdr!\n", __FUNCTION__));
 	sdl = (struct sockaddr_dl *)ifa->ifa_addr;
Index: net/if_fddisubr.c
===================================================================
RCS file: /home/ncvs/src/sys/net/if_fddisubr.c,v
retrieving revision 1.41.2.7
diff -u -p -r1.41.2.7 if_fddisubr.c
--- net/if_fddisubr.c	13 Feb 2002 21:38:56 -0000	1.41.2.7
+++ net/if_fddisubr.c	19 Feb 2002 22:54:17 -0000
@@ -547,7 +547,6 @@ fddi_ifattach(ifp)
 #ifdef IFF_NOTRAILERS
 	ifp->if_flags |= IFF_NOTRAILERS;
 #endif
-	ifp->if_broadcastaddr = fddibroadcastaddr;
 #if defined(__FreeBSD__)
 	ifa = ifnet_addrs[ifp->if_index - 1];
 	sdl = (struct sockaddr_dl *)ifa->ifa_addr;
Index: net/if_iso88025subr.c
===================================================================
RCS file: /home/ncvs/src/sys/net/if_iso88025subr.c,v
retrieving revision 1.7.2.5
diff -u -p -r1.7.2.5 if_iso88025subr.c
--- net/if_iso88025subr.c	13 Feb 2002 21:38:56 -0000	1.7.2.5
+++ net/if_iso88025subr.c	19 Feb 2002 22:54:19 -0000
@@ -95,7 +95,6 @@ iso88025_ifattach(struct ifnet *ifp)
         ifp->if_baudrate = TR_16MBPS; /* 16Mbit should be a safe default */
     if (ifp->if_mtu == 0)
         ifp->if_mtu = ISO88025_DEFAULT_MTU;
-    ifp->if_broadcastaddr = etherbroadcastaddr;
 
         ifa = ifnet_addrs[ifp->if_index - 1];
         if (ifa == 0) {
Index: net/if_var.h
===================================================================
RCS file: /home/ncvs/src/sys/net/if_var.h,v
retrieving revision 1.18.2.13
diff -u -p -r1.18.2.13 if_var.h
--- net/if_var.h	13 Feb 2002 21:38:56 -0000	1.18.2.13
+++ net/if_var.h	19 Feb 2002 22:54:23 -0000
@@ -174,7 +174,6 @@ struct ifnet {
 	struct	ifqueue if_snd;		/* output queue */
 	struct	ifqueue *if_poll_slowq;	/* input queue for slow devices */
 	struct	ifprefixhead if_prefixhead; /* list of prefixes per if */
-	u_int8_t *if_broadcastaddr;	/* linklevel broadcast bytestring */
 };
 typedef void if_init_f_t __P((void *));
 
Index: netinet/if_ether.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/if_ether.c,v
retrieving revision 1.64.2.16
diff -u -p -r1.64.2.16 if_ether.c
--- netinet/if_ether.c	13 Feb 2002 21:38:56 -0000	1.64.2.16
+++ netinet/if_ether.c	19 Feb 2002 22:54:31 -0000
@@ -127,6 +127,12 @@ static struct llinfo_arp
 static void	in_arpinput __P((struct mbuf *));
 #endif
 
+u_char arcbroadcastaddr = 0;
+
+#define IF_BCASTADDR(ifp)					\
+	((ifp)->if_type == IFT_ARCNET ?				\
+		&arcbroadcastaddr : etherbroadcastaddr)
+
 /*
  * Timeout routine.  Age arp_tab entries periodically.
  */
@@ -241,7 +247,7 @@ arp_rtrequest(req, rt, info)
 			rt->rt_expire = 0;
 		}
 		if (in_broadcast(SIN(rt_key(rt))->sin_addr, rt->rt_ifp)) {
-			memcpy(LLADDR(SDL(gate)), rt->rt_ifp->if_broadcastaddr,
+			memcpy(LLADDR(SDL(gate)), IF_BCASTADDR(rt->rt_ifp),
 			       rt->rt_ifp->if_addrlen);
 			SDL(gate)->sdl_alen = rt->rt_ifp->if_addrlen;
 			rt->rt_expire = 0;
@@ -315,7 +321,7 @@ arprequest(ifp, sip, tip, enaddr)
 		MH_ALIGN(m, m->m_len);
 
 		arh = (struct arc_header *)sa.sa_data;
-		arh->arc_dhost = *ifp->if_broadcastaddr;
+		arh->arc_dhost = arcbroadcastaddr;
 		arh->arc_type = ARCTYPE_ARP;
 
 		ah = mtod(m, struct arphdr *);
@@ -330,7 +336,7 @@ arprequest(ifp, sip, tip, enaddr)
 		MH_ALIGN(m, m->m_len);
 
 		(void)memcpy(mtod(m, caddr_t), llcx, sizeof(llcx));
-		(void)memcpy(sa.sa_data, ifp->if_broadcastaddr, 6);
+		(void)memcpy(sa.sa_data, etherbroadcastaddr, 6);
 		(void)memcpy(sa.sa_data + 6, enaddr, 6);
 		sa.sa_data[6] |= TR_RII;
 		sa.sa_data[12] = TR_AC;
@@ -354,7 +360,7 @@ arprequest(ifp, sip, tip, enaddr)
 		eh = (struct ether_header *)sa.sa_data;
 		/* if_output will not swap */
 		eh->ether_type = htons(ETHERTYPE_ARP);
-		(void)memcpy(eh->ether_dhost, ifp->if_broadcastaddr,
+		(void)memcpy(eh->ether_dhost, etherbroadcastaddr,
 		    sizeof(eh->ether_dhost));
 
 		ah = mtod(m, struct arphdr *);
@@ -398,7 +404,7 @@ arpresolve(ifp, rt, m, dst, desten, rt0)
 	struct sockaddr_dl *sdl;
 
 	if (m->m_flags & M_BCAST) {	/* broadcast */
-		(void)memcpy(desten, ifp->if_broadcastaddr, ifp->if_addrlen);
+		(void)memcpy(desten, IF_BCASTADDR(ifp), ifp->if_addrlen);
 		return (1);
 	}
 	if (m->m_flags & M_MCAST && ifp->if_type != IFT_ARCNET) {/* multicast */
@@ -614,7 +620,7 @@ match:
 		m_freem(m);	/* it's from me, ignore it. */
 		return;
 	}
-	if (!bcmp(ar_sha(ah), ifp->if_broadcastaddr, ifp->if_addrlen)) {
+	if (!bcmp(ar_sha(ah), IF_BCASTADDR(ifp), ifp->if_addrlen)) {
 		log(LOG_ERR,
 		    "arp: link address is broadcast for IP address %s!\n",
 		    inet_ntoa(isaddr));

--EVF5PPMfhYS0aIcm--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020219151922.A31723>