Updated PROMISC patch

Gerald Britton gbritton
Thu Nov 21 19:39:55 PST 2002


Updated for the current hostap CVS.  This patch does not quiet the RX error
messages, I'm not sure what the best thing to do with them really is.
While in promiscuous mode, we receive errors like these:

device wlan0 entered promiscuous mode
wlan0: RX: dropped FCSErr frame (status=01)
wlan0: RX: unknown MACPort 3
wlan0: RX: unknown MACPort 5
wlan0: RX: dropped FCSErr frame (status=01)
device wlan0 left promiscuous mode

But it appears to otherwise work.  The linux-wlan-ng driver simply silences
these warnings and drops the invalid rx packets.  This seems to be similar
to the receive problems with monitor mode:

wlan0: prism2_rx_80211: len(21582) > MAX(2304)
wlan0: Received frame with invalid length 0xa3d9
wlan0: RX status=0x0700 (port=7, type=0, fcserr=0) silence=7 signal=8
rate=10 rxflow=0; jiffies=62641
   FC=0x00d4 (type=1:13) dur=0x0000 seq=0xaa02 data_len=41945
   A1=00:00:00:00:00:00 A2=45:47:be:d2:37:8e A3=cc:8b:16:bf:ed:ab
   A4=a3:e1:35:3f:c4:5b
   dst=34:6c:9f:c4:db:e3 src=c1:56:07:de:1e:b1 len=1304
wlan0: prism2_rx_80211: len(19466) > MAX(2304)
wlan0: prism2_rx_80211: len(19466) > MAX(2304)
wlan0: prism2_rx_80211: len(13615) > MAX(2304)

Are these really garbage? or is the firmware simply doing something that
isn't fully understood yet?

				-- Gerald

-------------- next part --------------
--- hostap/driver/modules/hostap.c.promisc	2002-11-21 21:29:53.000000000 -0500
+++ hostap/driver/modules/hostap.c	2002-11-21 22:24:32.000000000 -0500
@@ -56,6 +56,7 @@
 			  int rtnl_locked);
 static int prism2_wds_del(local_info_t *local, u8 *remote_addr,
 			  int rtnl_locked, int do_not_remove);
+static void prism2_set_multicast_list_queue(void *data);
 
 /* hostap_ap.c */
 #ifdef WIRELESS_EXT
@@ -671,6 +672,9 @@
 
 	__MOD_INC_USE_COUNT(local->hw_module);
 
+	HOSTAP_QUEUE_INIT(&local->set_multicast_list_queue,
+		prism2_set_multicast_list_queue, dev);
+
 	if (!local->dev_enabled && local->func->hw_enable(dev, 1)) {
 		printk(KERN_WARNING "%s: could not enable MAC port\n",
 		       dev->name);
@@ -718,6 +722,36 @@
 #endif /* HAVE_SET_MAC_ADDR */
 
 
+/* TODO: to be further implemented as soon as Prism2 fully supports
+ *       GroupAddresses and correct documentation is available */
+static void prism2_set_multicast_list_queue(void *data)
+{
+	struct net_device *dev = (struct net_device *)data;
+	local_info_t *local = (local_info_t *) dev->priv;
+
+	if (hostap_set_word(dev, HFA384X_RID_PROMISCUOUSMODE,
+	                    local->is_promisc)) {
+		printk("%s: %sabling promiscuous mode failed\n",
+		       dev->name, local->is_promisc ? "en" : "dis");
+	}
+
+	MOD_DEC_USE_COUNT;
+}
+
+static void prism2_set_multicast_list(struct net_device *dev)
+{
+	local_info_t *local = (local_info_t *) dev->priv;
+
+	if ((dev->flags & IFF_ALLMULTI) || (dev->flags & IFF_PROMISC)) {
+		local->is_promisc = 1;
+	} else {
+		local->is_promisc = 0;
+	}
+
+	PRISM2_SCHEDULE_TASK(&local->set_multicast_list_queue);
+}
+
+
 static int prism2_change_mtu(struct net_device *dev, int new_mtu)
 {
 	if (new_mtu < PRISM2_MIN_MTU || new_mtu > PRISM2_MAX_MTU)
@@ -771,12 +805,7 @@
 #ifdef HAVE_SET_MAC_ADDR
 	dev->set_mac_address = prism2_set_mac_address;
 #endif /* HAVE_SET_MAC_ADDR */
-#ifdef HAVE_MULTICAST
-	/* FIX: to be implemented as soon as Prism2 supports GroupAddresses
-	 * and correct documentation is available */
-
-	/* dev->set_multicast_list = prism2_set_multicast_list; */
-#endif
+	dev->set_multicast_list = prism2_set_multicast_list;
 #ifdef HAVE_PRIVATE_IOCTL
 	dev->do_ioctl = main_dev ? hostap_ioctl : NULL;
 #endif
--- hostap/driver/modules/hostap_hw.c.promisc	2002-11-21 21:36:23.000000000 -0500
+++ hostap/driver/modules/hostap_hw.c	2002-11-21 22:24:45.000000000 -0500
@@ -973,6 +973,13 @@
 			goto fail;
 	}
 
+	/* Start with PROMISC off, the net subsystem sets this when the
+	   device is opened and when flags are changed */
+	local->is_promisc = 0;
+	ret = hostap_set_word(dev, HFA384X_RID_PROMISCUOUSMODE, 0);
+	if (ret)
+		printk("%s: Clearing promiscuous mode failed\n", dev->name);
+
 	if (!local->fw_ap) {
 		ret = hostap_set_string(dev, HFA384X_RID_CNFDESIREDSSID,
 					local->essid);
--- hostap/driver/modules/hostap_wlan.h.promisc	2002-11-21 21:37:29.000000000 -0500
+++ hostap/driver/modules/hostap_wlan.h	2002-11-21 21:43:21.000000000 -0500
@@ -1121,11 +1121,11 @@
 
 	/* if card timeout is detected in interrupt context, reset_queue is
 	 * used to schedule card reseting to be done in user context */
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44))
-	struct tq_struct reset_queue;
-#else
-	struct work_struct reset_queue;
-#endif
+	HOSTAP_QUEUE reset_queue;
+
+	/* For scheduling a change of the promiscuous mode RID */
+	int is_promisc;
+	HOSTAP_QUEUE set_multicast_list_queue;
 
 	prism2_wds_info_t *wds; /* list of established wds connections */
 	int wds_max_connections;
@@ -1214,11 +1214,7 @@
 	unsigned long last_join_time; /* time of last JoinRequest */
 	struct hfa384x_scan_result *last_scan_results;
 	int last_scan_results_count;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44))
-	struct tq_struct info_queue;
-#else
-	struct work_struct info_queue;
-#endif
+	HOSTAP_QUEUE info_queue;
 	long pending_info; /* bit field of pending info_queue items */
 #define PRISM2_INFO_PENDING_LINKSTATUS 0
 #define PRISM2_INFO_PENDING_SCANRESULTS 1
--- hostap/driver/modules/hostap_compat.h.promisc	2002-11-21 21:40:36.000000000 -0500
+++ hostap/driver/modules/hostap_compat.h	2002-11-21 21:40:46.000000000 -0500
@@ -14,6 +14,8 @@
 #define PRISM2_NETDEV_EXTRA IFNAMSIZ
 #define prism2_set_dev_name(dev, pos) (dev)->name = (char *) (pos)
 
+#define HOSTAP_QUEUE struct tq_struct
+
 /* tq_scheduler was removed in 2.4.0-test12 */
 #define PRISM2_SCHEDULE_TASK(q) \
 MOD_INC_USE_COUNT; \
@@ -64,6 +66,9 @@
 #define prism2_set_dev_name(dev, pos) do { } while (0)
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44))
+
+#define HOSTAP_QUEUE struct tq_struct
+
 #define PRISM2_SCHEDULE_TASK(q) \
 MOD_INC_USE_COUNT; \
 if (schedule_task((q)) == 0) \
@@ -79,7 +84,11 @@
 	tq->routine = routine;
 	tq->data = data;
 }
+
 #else /* kernel < 2.5.44 */
+
+#define HOSTAP_QUEUE struct work_struct
+
 #define PRISM2_SCHEDULE_TASK(q) \
 MOD_INC_USE_COUNT; \
 if (schedule_work((q)) == 0) \



More information about the Hostap mailing list