⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wvlan_cs-1.0.1-spycache.patch

📁 mobile ip 在linux下的一种实现
💻 PATCH
字号:
*** wvlan_cs.c	Thu Jan  6 16:31:20 2000--- wvlan_cs.c.SPYCACHE	Thu Jan  6 16:35:31 2000****************** 48,53 ****--- 48,57 ----  #error "Wireless extension v5 or newer required"  #endif  #define WIRELESS_SPY		// enable iwspy support+ /*#define SPYCACHE*/                // use spy cache+ #ifdef SPYCACHE+ #include <limits.h>             // for INT_MAX+ #endif // SPYCACHE  #undef HISTOGRAM		// disable histogram of signal levels  #endif  ****************** 81,87 ****  /********************************************************************   * MISC   */! static char *version = "1.0.1";  static dev_info_t dev_info = "wvlan_cs";  static dev_link_t *dev_list = NULL;  --- 85,91 ----  /********************************************************************   * MISC   */! static char *version = "1.0.2";  static dev_info_t dev_info = "wvlan_cs";  static dev_link_t *dev_list = NULL;  ****************** 147,152 ****--- 151,159 ----  	u_char			spy_address[IW_MAX_SPY][MAC_ADDR_SIZE];  	struct iw_quality	spy_stat[IW_MAX_SPY];  #endif+ #ifdef SPYCACHE+ 	int                     age[IW_MAX_SPY];// cache entry age+ #endif  #ifdef HISTOGRAM  	int			his_number;  	u_char			his_range[16];****************** 1494,1499 ****--- 1501,1509 ----  	struct net_local *local = (struct net_local *)dev->priv;  	struct sk_buff *skb;  	char *p;+ #ifdef SPYCACHE+ 	int in_cache = -1;+ #endif // SPYCACHE    	DEBUG(DEBUG_CALLTRACE, "-> wvlan_rx(%s)\n", dev->name);  ****************** 1543,1548 ****--- 1553,1561 ----  #ifdef HISTOGRAM  		(local->his_number > 0) ||  #endif+ #ifdef SPYCACHE+ 		1 ||+ #endif // SPYCACHE  		0 )  	{  #if (LINUX_VERSION_CODE >= VERSION(1,3,0))****************** 1570,1581 ****--- 1583,1639 ----  #else // Therefore WIRELESS_SPY only !!!  		memset(&stats, 0, sizeof(stats));  		// Query only for addresses in our list !+ 		in_cache = -1;  		for (i=0; i<local->spy_number; i++)+ #ifdef SPYCACHE+ 		{+ 			if (local->age[i] == INT_MAX)+ 				local->age[i] = -1;  /* entry to be discarded */+ 			else + 				local->age[i]++;+ #endif // SPYCACHE  			if (!memcmp(srcaddr, local->spy_address[i], MAC_ADDR_SIZE))  			{+ #ifdef SPYCACHE+ 				in_cache = i;+ #else  				rc = hcf_get_data(&local->ifb, HFS_Q_INFO, stats, 2);+ #endif // SPYCACHE  				break;  			}+ #ifdef SPYCACHE+ 		}+ 		/* this generates load */+ 		rc = hcf_get_data(&local->ifb, HFS_Q_INFO, stats, 2);+ 		/* Insert the entry into the cache. If cache is full, + 		   then replace the oldest entry */+ 		if (in_cache == -1) {+ 			printk(KERN_INFO "inserting new entry into the cache\n");+ 			if (local->spy_number < IW_MAX_SPY) {+ 				in_cache = local->spy_number++;+ 				printk(KERN_INFO "cache was not full yet: %d/%d\n",in_cache+1, IW_MAX_SPY);+ 			} else {+ 				int max_age = -1;+ 				printk(KERN_INFO "cache is full\n");+ 				/* Replace the LRU entry */+ 				for (i = 0; i < IW_MAX_SPY; i++) {+ 					if (local->age[i] == -1) { /* very old entry */+ 						in_cache = i;+ 						break;+ 					}+ 					if (local->age[i] > max_age) {+ 						max_age = local->age[i];+ 						in_cache = i;+ 					}+ 				}+ 				printk(KERN_INFO "max_age: %d, index: %d\n", max_age, in_cache);+ 			}+ 			memcpy((char *)local->spy_address[in_cache], + 			       (char *)srcaddr, MAC_ADDR_SIZE);+ 			local->age[in_cache] = 0;+ 		}+ #endif // SPYCACHE+ 		  #endif  		DEBUG(DEBUG_NOISY, "%s: hcf_get_data(HFS_Q_INFO) returned 0x%x\n", dev_info, rc);  		stats[2] = stats[0];****************** 1583,1589 ****--- 1641,1655 ----  		stats[1] = max(min(stats[2], 0x8a), 0x2f);  		stats[2] = stats[0] - stats[1];  #ifdef WIRELESS_SPY+ #ifdef SPYCACHE+ 		/* we know the index already */+ 		local->spy_stat[in_cache].qual = stats[2];+ 		local->spy_stat[in_cache].level = stats[0] - 0x95;+ 		local->spy_stat[in_cache].noise = stats[1] - 0x95;+ 		local->spy_stat[in_cache].updated = 7;+ #else  		wvlan_spy_gather(dev, srcaddr, stats);  + #endif // SPYCACHE  #endif  #ifdef HISTOGRAM  		wvlan_his_gather(dev, stats);****************** 1723,1730 ****  		}    		// HREG_EV_INFO_DROP: WMAC did not have sufficient RAM to build unsollicited frame! 		if (ev & HREG_EV_INFO_DROP)! 			printk(KERN_WARNING "%s: WMAC did not have sufficient RAM to build unsollicited frame!\n", dev_info);    		// HREG_EV_INFO: WMAC controller asynchronous information frame  		if (ev & HREG_EV_INFO)--- 1789,1796 ----  		}    		// HREG_EV_INFO_DROP: WMAC did not have sufficient RAM to build unsollicited frame! //		if (ev & HREG_EV_INFO_DROP)! //			printk(KERN_WARNING "%s: WMAC did not have sufficient RAM to build unsollicited frame!\n", dev_info);    		// HREG_EV_INFO: WMAC controller asynchronous information frame  		if (ev & HREG_EV_INFO)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -