HEADS UP (preliminary): KBI breakage is about to happen

Yar Tikhiy yar at comp.chem.msu.su
Sun May 27 11:51:34 UTC 2007


As discussed earlier on -net, I'd like to commit the following
patch.  It will bring ether_ioctl() into accord with ioctl() WRT
the type of the command argument.  In our ioctl(), command became
an u_long ages ago, but ether_ioctl() has never been fixed.  With
int and u_long being of different widths on 64-bit arch'es, the
discrepancy can get us in trouble sooner or later.

In fact, ioctl command coding is very unlikely to change, so it
will continue to fit in 32 bits.  OTOH, the C compiler should be
uneasy about squeezing u_long into int when ether_ioctl() is called
from an if_ioctl handler, so this patch will be a little step on
the way to a warning-free kernel.

This change will inevitably break the kernel interface to network
modules, so all of them will need rebuilding.

Any objections?

-- 
Yar

Index: ethernet.h
===================================================================
RCS file: /home/ncvs/src/sys/net/ethernet.h,v
retrieving revision 1.31
diff -u -p -r1.31 ethernet.h
--- ethernet.h	13 May 2007 15:52:46 -0000	1.31
+++ ethernet.h	25 May 2007 11:23:01 -0000
@@ -379,7 +379,7 @@ extern	uint32_t ether_crc32_be(const uin
 extern	void ether_demux(struct ifnet *, struct mbuf *);
 extern	void ether_ifattach(struct ifnet *, const u_int8_t *);
 extern	void ether_ifdetach(struct ifnet *);
-extern	int  ether_ioctl(struct ifnet *, int, caddr_t);
+extern	int  ether_ioctl(struct ifnet *, u_long, caddr_t);
 extern	int  ether_output(struct ifnet *,
 		   struct mbuf *, struct sockaddr *, struct rtentry *);
 extern	int  ether_output_frame(struct ifnet *, struct mbuf *);
Index: if_ethersubr.c
===================================================================
RCS file: /home/ncvs/src/sys/net/if_ethersubr.c,v
retrieving revision 1.228
diff -u -p -r1.228 if_ethersubr.c
--- if_ethersubr.c	17 Apr 2007 00:35:11 -0000	1.228
+++ if_ethersubr.c	25 May 2007 11:23:01 -0000
@@ -1018,7 +1018,7 @@ ether_crc32_be(const uint8_t *buf, size_
 }
 
 int
-ether_ioctl(struct ifnet *ifp, int command, caddr_t data)
+ether_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
 {
 	struct ifaddr *ifa = (struct ifaddr *) data;
 	struct ifreq *ifr = (struct ifreq *) data;


More information about the freebsd-current mailing list