Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Nov 2004 07:51:15 +0200
From:      John Hay <jhay@icomtek.csir.co.za>
To:        Sam Leffler <sam@errno.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: net80211+atheros changes (updated)
Message-ID:  <20041111055115.GA58987@zibbi.icomtek.csir.co.za>
In-Reply-To: <41704795.6070603@errno.com>
References:  <416DF63E.6000401@errno.com> <20041015132512.GA95147@zibbi.icomtek.csir.co.za> <416FE900.7030809@errno.com> <20041015152337.GA98631@zibbi.icomtek.csir.co.za> <416FEDFB.1060908@errno.com> <20041015172105.GA2560@zibbi.icomtek.csir.co.za> <41704795.6070603@errno.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> Let's try this again:
> 
> http://people.freebsd.org/~sam/net80211+ath-20041015.tgz
> 
> This applys cleanly to -current as of last night, builds, and boots. 
> Beware of applying this over old patches as patch -N doesn't always seem 
> to do the right thing with the new files.  I tested against a clean cvs co.
> 

For those interested, here is a patch so that one can use Sam's patches
on 5.3 too.

John
-- 
John Hay -- John.Hay@icomtek.csir.co.za / jhay@FreeBSD.org


Index: sys/net/ethernet.h
===================================================================
RCS file: /home/ncvs/src/sys/net/ethernet.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- sys/net/ethernet.h	2 Jun 2004 21:34:14 -0000	1.23
+++ sys/net/ethernet.h	5 Oct 2004 19:28:52 -0000	1.24
@@ -1,7 +1,7 @@
 /*
  * Fundamental constants relating to ethernet.
  *
- * $FreeBSD: src/sys/net/ethernet.h,v 1.23 2004/06/02 21:34:14 naddy Exp $
+ * $FreeBSD: src/sys/net/ethernet.h,v 1.24 2004/10/05 19:28:52 sam Exp $
  *
  */
 
@@ -319,6 +319,7 @@
 #define	ETHERTYPE_PPPOEDISC	0x8863	/* PPP Over Ethernet Discovery Stage */
 #define	ETHERTYPE_PPPOE		0x8864	/* PPP Over Ethernet Session Stage */
 #define	ETHERTYPE_LANPROBE	0x8888	/* HP LanProbe test? */
+#define	ETHERTYPE_PAE		0x888e	/* EAPOL PAE/802.1x */
 #define	ETHERTYPE_LOOPBACK	0x9000	/* Loopback: used to test interfaces */
 #define	ETHERTYPE_LBACK		ETHERTYPE_LOOPBACK	/* DEC MOP loopback */
 #define	ETHERTYPE_XNSSM		0x9001	/* 3Com (Formerly Bridge Communications), XNS Systems Management */
Index: sys/net/route.h
===================================================================
RCS file: /home/ncvs/src/sys/net/route.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- sys/net/route.h	28 Jul 2004 06:51:33 -0000	1.61
+++ sys/net/route.h	5 Oct 2004 19:48:33 -0000	1.62
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)route.h	8.4 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/net/route.h,v 1.61 2004/07/28 06:51:33 kan Exp $
+ * $FreeBSD: src/sys/net/route.h,v 1.62 2004/10/05 19:48:33 sam Exp $
  */
 
 #ifndef _NET_ROUTE_H_
@@ -219,6 +219,7 @@
 #define	RTM_NEWMADDR	0xf	/* mcast group membership being added to if */
 #define	RTM_DELMADDR	0x10	/* mcast group membership being deleted */
 #define	RTM_IFANNOUNCE	0x11	/* iface arrival/departure */
+#define	RTM_IEEE80211	0x12	/* IEEE80211 wireless event */
 
 /*
  * Bitmask values for rtm_inits and rmx_locks.
@@ -319,6 +320,7 @@
 struct ifmultiaddr;
 
 int	 rt_getifa(struct rt_addrinfo *);
+void	 rt_ieee80211msg(struct ifnet *, int, void *, size_t);
 void	 rt_ifannouncemsg(struct ifnet *, int);
 void	 rt_ifmsg(struct ifnet *);
 void	 rt_missmsg(int, struct rt_addrinfo *, int, int);
Index: sys/net/rtsock.c
===================================================================
RCS file: /home/ncvs/src/sys/net/rtsock.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -r1.117 -r1.118
--- sys/net/rtsock.c	27 Aug 2004 18:33:07 -0000	1.117
+++ sys/net/rtsock.c	5 Oct 2004 19:48:33 -0000	1.118
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)rtsock.c	8.7 (Berkeley) 10/12/95
- * $FreeBSD: src/sys/net/rtsock.c,v 1.117 2004/08/27 18:33:07 andre Exp $
+ * $FreeBSD: src/sys/net/rtsock.c,v 1.118 2004/10/05 19:48:33 sam Exp $
  */
 
 #include <sys/param.h>
@@ -675,6 +675,7 @@
 		break;
 
 	case RTM_IFANNOUNCE:
+	case RTM_IEEE80211:
 		len = sizeof(struct if_announcemsghdr);
 		break;
 
@@ -932,6 +933,67 @@
 	rt_dispatch(m, ifma->ifma_addr);
 }
 
+static struct mbuf *
+rt_makeifannouncemsg(struct ifnet *ifp, int type, int what,
+	struct rt_addrinfo *info)
+{
+	struct if_announcemsghdr *ifan;
+	struct mbuf *m;
+
+	if (route_cb.any_count == 0)
+		return NULL;
+	bzero((caddr_t)info, sizeof(*info));
+	m = rt_msg1(type, info);
+	if (m != NULL) {
+		ifan = mtod(m, struct if_announcemsghdr *);
+		ifan->ifan_index = ifp->if_index;
+		strlcpy(ifan->ifan_name, ifp->if_xname,
+			sizeof(ifan->ifan_name));
+		ifan->ifan_what = what;
+	}
+	return m;
+}
+
+/*
+ * This is called to generate routing socket messages indicating
+ * IEEE80211 wireless events.
+ * XXX we piggyback on the RTM_IFANNOUNCE msg format in a clumsy way.
+ */
+void
+rt_ieee80211msg(struct ifnet *ifp, int what, void *data, size_t data_len)
+{
+	struct mbuf *m;
+	struct rt_addrinfo info;
+
+	m = rt_makeifannouncemsg(ifp, RTM_IEEE80211, what, &info);
+	if (m != NULL) {
+		/*
+		 * Append the ieee80211 data.  Try to stick it in the
+		 * mbuf containing the ifannounce msg; otherwise allocate
+		 * a new mbuf and append.
+		 *
+		 * NB: we assume m is a single mbuf.
+		 */
+		if (data_len > M_TRAILINGSPACE(m)) {
+			struct mbuf *n = m_get(M_NOWAIT, MT_DATA);
+			if (n == NULL) {
+				m_freem(m);
+				return;
+			}
+			bcopy(data, mtod(n, void *), data_len);
+			n->m_len = data_len;
+			m->m_next = n;
+		} else if (data_len > 0) {
+			bcopy(data, mtod(m, u_int8_t *) + m->m_len, data_len);
+			m->m_len += data_len;
+		}
+		if (m->m_flags & M_PKTHDR)
+			m->m_pkthdr.len += data_len;
+		mtod(m, struct if_announcemsghdr *)->ifan_msglen += data_len;
+		rt_dispatch(m, NULL);
+	}
+}
+
 /*
  * This is called to generate routing socket messages indicating
  * network interface arrival and departure.
@@ -939,22 +1001,13 @@
 void
 rt_ifannouncemsg(struct ifnet *ifp, int what)
 {
-	struct if_announcemsghdr *ifan;
 	struct mbuf *m;
 	struct rt_addrinfo info;
 
-	if (route_cb.any_count == 0)
-		return;
-	bzero((caddr_t)&info, sizeof(info));
-	m = rt_msg1(RTM_IFANNOUNCE, &info);
-	if (m == NULL)
-		return;
-	ifan = mtod(m, struct if_announcemsghdr *);
-	ifan->ifan_index = ifp->if_index;
-	strlcpy(ifan->ifan_name, ifp->if_xname, sizeof(ifan->ifan_name));
-	ifan->ifan_what = what;
-	rt_dispatch(m, NULL);
- }
+	m = rt_makeifannouncemsg(ifp, RTM_IFANNOUNCE, what, &info);
+	if (m != NULL)
+		rt_dispatch(m, NULL);
+}
 
 static void
 rt_dispatch(struct mbuf *m, const struct sockaddr *sa)



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