/*----------------------------------------------------------------------------*/ int mtk_cfg80211_add_key ( struct wiphy *wiphy, struct net_device *ndev, u8 key_index, bool pairwise, const u8 *mac_addr, struct key_params *params ) { PARAM_KEY_T rKey; P_GLUE_INFO_T prGlueInfo = NULL; WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; INT_32 i4Rslt = -EINVAL; UINT_32 u4BufLen = 0; UINT_8 tmp1[8]; UINT_8 tmp2[8]; prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); ASSERT(prGlueInfo); kalMemZero(&rKey, sizeof(PARAM_KEY_T)); rKey.u4KeyIndex = key_index; if(mac_addr) { COPY_MAC_ADDR(rKey.arBSSID, mac_addr); if ((rKey.arBSSID[0] == 0x00) && (rKey.arBSSID[1] == 0x00) && (rKey.arBSSID[2] == 0x00) && (rKey.arBSSID[3] == 0x00) && (rKey.arBSSID[4] == 0x00) && (rKey.arBSSID[5] == 0x00)) { rKey.arBSSID[0] = 0xff; rKey.arBSSID[1] = 0xff; rKey.arBSSID[2] = 0xff; rKey.arBSSID[3] = 0xff; rKey.arBSSID[4] = 0xff; rKey.arBSSID[5] = 0xff; } if (rKey.arBSSID[0] != 0xFF) { rKey.u4KeyIndex |= BIT(31); if ((rKey.arBSSID[0] != 0x00) || (rKey.arBSSID[1] != 0x00) || (rKey.arBSSID[2] != 0x00) || (rKey.arBSSID[3] != 0x00) || (rKey.arBSSID[4] != 0x00) || (rKey.arBSSID[5] != 0x00)) rKey.u4KeyIndex |= BIT(30); } } else { rKey.arBSSID[0] = 0xff; rKey.arBSSID[1] = 0xff; rKey.arBSSID[2] = 0xff; rKey.arBSSID[3] = 0xff; rKey.arBSSID[4] = 0xff; rKey.arBSSID[5] = 0xff; //rKey.u4KeyIndex |= BIT(31); //Enable BIT 31 will make tx use bc key id, should use pairwise key id 0 } if(params->key) { //rKey.aucKeyMaterial[0] = kalMemAlloc(params->key_len, VIR_MEM_TYPE); kalMemCopy(rKey.aucKeyMaterial, params->key, params->key_len); if (params->key_len == 32) { kalMemCopy(tmp1, ¶ms->key[16], 8); kalMemCopy(tmp2, ¶ms->key[24], 8); kalMemCopy(&rKey.aucKeyMaterial[16], tmp2, 8); kalMemCopy(&rKey.aucKeyMaterial[24], tmp1, 8); } } rKey.u4KeyLength = params->key_len; rKey.u4Length = ((UINT_32)&(((P_P2P_PARAM_KEY_T)0)->aucKeyMaterial)) + rKey.u4KeyLength; rStatus = kalIoctl(prGlueInfo, wlanoidSetAddKey, &rKey, rKey.u4Length, FALSE, FALSE, TRUE, FALSE, &u4BufLen); if (rStatus == WLAN_STATUS_SUCCESS) i4Rslt = 0; return i4Rslt; }
int mtk_cfg80211_get_station ( struct wiphy *wiphy, struct net_device *ndev, u8 *mac, struct station_info *sinfo ) { P_GLUE_INFO_T prGlueInfo = NULL; WLAN_STATUS rStatus; PARAM_MAC_ADDRESS arBssid; UINT_32 u4BufLen, u4Rate; INT_32 i4Rssi; prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); ASSERT(prGlueInfo); kalMemZero(arBssid, MAC_ADDR_LEN); wlanQueryInformation(prGlueInfo->prAdapter, wlanoidQueryBssid, &arBssid[0], sizeof(arBssid), &u4BufLen); /* 1. check BSSID */ if(UNEQUAL_MAC_ADDR(arBssid, mac)) { /* wrong MAC address */ DBGLOG(REQ, WARN, ("incorrect BSSID: ["MACSTR"] currently connected BSSID["MACSTR"]\n", MAC2STR(mac), MAC2STR(arBssid))); return -ENOENT; } /* 2. fill TX rate */ rStatus = kalIoctl(prGlueInfo, wlanoidQueryLinkSpeed, &u4Rate, sizeof(u4Rate), TRUE, FALSE, FALSE, FALSE, &u4BufLen); if (rStatus != WLAN_STATUS_SUCCESS) { DBGLOG(REQ, WARN, ("unable to retrieve link speed\n")); } else { sinfo->filled |= STATION_INFO_TX_BITRATE; sinfo->txrate.legacy = u4Rate / 1000; /* convert from 100bps to 100kbps */ } if(prGlueInfo->eParamMediaStateIndicated != PARAM_MEDIA_STATE_CONNECTED) { /* not connected */ DBGLOG(REQ, WARN, ("not yet connected\n")); } else { /* 3. fill RSSI */ rStatus = kalIoctl(prGlueInfo, wlanoidQueryRssi, &i4Rssi, sizeof(i4Rssi), TRUE, FALSE, FALSE, FALSE, &u4BufLen); if (rStatus != WLAN_STATUS_SUCCESS) { DBGLOG(REQ, WARN, ("unable to retrieve link speed\n")); } else { sinfo->filled |= STATION_INFO_SIGNAL; //in the cfg80211 layer, the signal is a signed char variable. if(i4Rssi < -128) sinfo->signal = -128; else sinfo->signal = i4Rssi; /* dBm */ } } return 0; }
int mtk_cfg80211_testmode_set_key_ext( IN struct wiphy *wiphy, IN void *data, IN int len) { P_GLUE_INFO_T prGlueInfo = NULL; P_NL80211_DRIVER_SET_KEY_EXTS prParams = (P_NL80211_DRIVER_SET_KEY_EXTS)NULL; struct iw_encode_exts *prIWEncExt = (struct iw_encode_exts *)NULL; WLAN_STATUS rstatus = WLAN_STATUS_SUCCESS; int fgIsValid = 0; UINT_32 u4BufLen = 0; P_PARAM_WPI_KEY_T prWpiKey = (P_PARAM_WPI_KEY_T) keyStructBuf; memset(keyStructBuf, 0, sizeof(keyStructBuf)); ASSERT(wiphy); prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); #if 1 printk("--> %s()\n", __func__); #endif if(data && len) { prParams = (P_NL80211_DRIVER_SET_KEY_EXTS)data; } if(prParams) { prIWEncExt = (struct iw_encode_exts *) &prParams->ext; } if (prIWEncExt->alg == IW_ENCODE_ALG_SMS4) { /* KeyID */ prWpiKey->ucKeyID = prParams->key_index; prWpiKey->ucKeyID --; if (prWpiKey->ucKeyID > 1) { /* key id is out of range */ //printk(KERN_INFO "[wapi] add key error: key_id invalid %d\n", prWpiKey->ucKeyID); return -EINVAL; } if (prIWEncExt->key_len != 32) { /* key length not valid */ //printk(KERN_INFO "[wapi] add key error: key_len invalid %d\n", prIWEncExt->key_len); return -EINVAL; } //printk(KERN_INFO "[wapi] %d ext_flags %d\n", prEnc->flags, prIWEncExt->ext_flags); if (prIWEncExt->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { prWpiKey->eKeyType = ENUM_WPI_GROUP_KEY; prWpiKey->eDirection = ENUM_WPI_RX; } else if (prIWEncExt->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { prWpiKey->eKeyType = ENUM_WPI_PAIRWISE_KEY; prWpiKey->eDirection = ENUM_WPI_RX_TX; } //#if CFG_SUPPORT_WAPI //handle_sec_msg_final(prIWEncExt->key, 32, prIWEncExt->key, NULL); //#endif /* PN */ memcpy(prWpiKey->aucPN, prIWEncExt->tx_seq, IW_ENCODE_SEQ_MAX_SIZE * 2); /* BSSID */ memcpy(prWpiKey->aucAddrIndex, prIWEncExt->addr, 6); memcpy(prWpiKey->aucWPIEK, prIWEncExt->key, 16); prWpiKey->u4LenWPIEK = 16; memcpy(prWpiKey->aucWPICK, &prIWEncExt->key[16], 16); prWpiKey->u4LenWPICK = 16; rstatus = kalIoctl(prGlueInfo, wlanoidSetWapiKey, prWpiKey, sizeof(PARAM_WPI_KEY_T), FALSE, FALSE, TRUE, FALSE, &u4BufLen); if (rstatus != WLAN_STATUS_SUCCESS) { //printk(KERN_INFO "[wapi] add key error:%lx\n", rStatus); fgIsValid = -EFAULT; } } return fgIsValid; }
static int netdev_event(struct notifier_block *nb, unsigned long notification, void *ptr) { UINT_8 ip[4] = { 0 }; UINT_32 u4NumIPv4 = 0; //#ifdef CONFIG_IPV6 #if 0 UINT_8 ip6[16] = { 0 }; // FIX ME: avoid to allocate large memory in stack UINT_32 u4NumIPv6 = 0; #endif struct in_ifaddr *ifa = (struct in_ifaddr *) ptr; struct net_device *prDev = ifa->ifa_dev->dev; UINT_32 i; P_PARAM_NETWORK_ADDRESS_IP prParamIpAddr; P_GLUE_INFO_T prGlueInfo = NULL; if (prDev == NULL) { DBGLOG(REQ, INFO, ("netdev_event: device is empty.\n")); return NOTIFY_DONE; } if ((strncmp(prDev->name, "p2p", 3) != 0) && (strncmp(prDev->name, "wlan", 4) != 0)) { DBGLOG(REQ, INFO, ("netdev_event: xxx\n")); return NOTIFY_DONE; } prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); if (prGlueInfo == NULL) { DBGLOG(REQ, INFO, ("netdev_event: prGlueInfo is empty.\n")); return NOTIFY_DONE; } ASSERT(prGlueInfo); // <3> get the IPv4 address if(!prDev || !(prDev->ip_ptr)||\ !((struct in_device *)(prDev->ip_ptr))->ifa_list||\ !(&(((struct in_device *)(prDev->ip_ptr))->ifa_list->ifa_local))){ DBGLOG(REQ, INFO, ("ip is not avaliable.\n")); return NOTIFY_DONE; } kalMemCopy(ip, &(((struct in_device *)(prDev->ip_ptr))->ifa_list->ifa_local), sizeof(ip)); DBGLOG(REQ, INFO, ("ip is %d.%d.%d.%d\n", ip[0],ip[1],ip[2],ip[3])); // todo: traverse between list to find whole sets of IPv4 addresses if (!((ip[0] == 0) && (ip[1] == 0) && (ip[2] == 0) && (ip[3] == 0))) { u4NumIPv4++; } if (fgIsUnderEarlierSuspend == false) { #if defined(MTK_WLAN_ARP_OFFLOAD) if(NETDEV_UP == notification && PARAM_MEDIA_STATE_CONNECTED == prGlueInfo->eParamMediaStateIndicated){ PARAM_CUSTOM_SW_CTRL_STRUC_T SwCtrlInfo; UINT_32 u4SetInfoLen; WLAN_STATUS rStatus = WLAN_STATUS_FAILURE; SwCtrlInfo.u4Id = 0x90110000; SwCtrlInfo.u4Data = 1; rStatus = kalIoctl(prGlueInfo, wlanoidSetSwCtrlWrite, (PVOID)&SwCtrlInfo, sizeof(SwCtrlInfo), FALSE, FALSE, TRUE, FALSE, &u4SetInfoLen); if (rStatus != WLAN_STATUS_SUCCESS) { DBGLOG(REQ, INFO, ("ARP OFFLOAD fail 0x%lx\n", rStatus)); } return NOTIFY_DONE; }else { #endif DBGLOG(REQ, INFO, ("netdev_event: PARAM_MEDIA_STATE_DISCONNECTED. (%d)\n", prGlueInfo->eParamMediaStateIndicated)); return NOTIFY_DONE; #if defined(MTK_WLAN_ARP_OFFLOAD) } #endif } //#ifdef CONFIG_IPV6 #if 0 if(!prDev || !(prDev->ip6_ptr)||\ !((struct in_device *)(prDev->ip6_ptr))->ifa_list||\ !(&(((struct in_device *)(prDev->ip6_ptr))->ifa_list->ifa_local))){ printk(KERN_INFO "ipv6 is not avaliable.\n"); return NOTIFY_DONE; } kalMemCopy(ip6, &(((struct in_device *)(prDev->ip6_ptr))->ifa_list->ifa_local), sizeof(ip6)); printk(KERN_INFO"ipv6 is %d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d\n", ip6[0],ip6[1],ip6[2],ip6[3], ip6[4],ip6[5],ip6[6],ip6[7], ip6[8],ip6[9],ip6[10],ip6[11], ip6[12],ip6[13],ip6[14],ip6[15] ); // todo: traverse between list to find whole sets of IPv6 addresses if (!((ip6[0] == 0) && (ip6[1] == 0) && (ip6[2] == 0) && (ip6[3] == 0) && (ip6[4] == 0) && (ip6[5] == 0))) { //u4NumIPv6++; } #endif // here we can compare the dev with other network's netdev to // set the proper arp filter // // IMPORTANT: please make sure if the context can sleep, if the context can't sleep // we should schedule a kernel thread to do this for us // <7> set up the ARP filter { WLAN_STATUS rStatus = WLAN_STATUS_FAILURE; UINT_32 u4SetInfoLen = 0; UINT_8 aucBuf[32] = {0}; UINT_32 u4Len = OFFSET_OF(PARAM_NETWORK_ADDRESS_LIST, arAddress); P_PARAM_NETWORK_ADDRESS_LIST prParamNetAddrList = (P_PARAM_NETWORK_ADDRESS_LIST)aucBuf; P_PARAM_NETWORK_ADDRESS prParamNetAddr = prParamNetAddrList->arAddress; //#ifdef CONFIG_IPV6 #if 0 prParamNetAddrList->u4AddressCount = u4NumIPv4 + u4NumIPv6; #else prParamNetAddrList->u4AddressCount = u4NumIPv4; #endif prParamNetAddrList->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP; for (i = 0; i < u4NumIPv4; i++) { prParamNetAddr->u2AddressLength = sizeof(PARAM_NETWORK_ADDRESS_IP);//4;; prParamNetAddr->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP;; #if 0 kalMemCopy(prParamNetAddr->aucAddress, ip, sizeof(ip)); prParamNetAddr = (P_PARAM_NETWORK_ADDRESS)((UINT_32)prParamNetAddr + sizeof(ip)); u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(ip); #else prParamIpAddr = (P_PARAM_NETWORK_ADDRESS_IP)prParamNetAddr->aucAddress; kalMemCopy(&prParamIpAddr->in_addr, ip, sizeof(ip)); prParamNetAddr = (P_PARAM_NETWORK_ADDRESS)((UINT_32)prParamNetAddr + sizeof(PARAM_NETWORK_ADDRESS)); u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(PARAM_NETWORK_ADDRESS); #endif } //#ifdef CONFIG_IPV6 #if 0 for (i = 0; i < u4NumIPv6; i++) { prParamNetAddr->u2AddressLength = 6;; prParamNetAddr->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP;; kalMemCopy(prParamNetAddr->aucAddress, ip6, sizeof(ip6)); prParamNetAddr = (P_PARAM_NETWORK_ADDRESS)((UINT_32)prParamNetAddr + sizeof(ip6)); u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(ip6); } #endif ASSERT(u4Len <= sizeof(aucBuf)); DBGLOG(REQ, INFO, ("kalIoctl (0x%x, 0x%x)\n", prGlueInfo, prParamNetAddrList)); rStatus = kalIoctl(prGlueInfo, wlanoidSetNetworkAddress, (PVOID)prParamNetAddrList, u4Len, FALSE, FALSE, TRUE, FALSE, &u4SetInfoLen); if (rStatus != WLAN_STATUS_SUCCESS) { DBGLOG(REQ, INFO, ("set HW pattern filter fail 0x%lx\n", rStatus)); } } return NOTIFY_DONE; }
static void wlanP2PEarlySuspend(void) { struct net_device *prDev = NULL; P_GLUE_INFO_T prGlueInfo = NULL; UINT_8 ip[4] = { 0 }; UINT_32 u4NumIPv4 = 0; #ifdef CONFIG_IPV6 UINT_8 ip6[16] = { 0 }; /* FIX ME: avoid to allocate large memory in stack */ UINT_32 u4NumIPv6 = 0; #endif UINT_32 i; P_PARAM_NETWORK_ADDRESS_IP prParamIpAddr; printk(KERN_INFO "*********p2pEarlySuspend************\n"); if (!wlanExportGlueInfo(&prGlueInfo)) { printk(KERN_INFO "*********p2pEarlySuspend ignored************\n"); return; } ASSERT(prGlueInfo); /* <1> Sanity check and acquire the net_device */ prDev = prGlueInfo->prP2PInfo->prDevHandler; ASSERT(prDev); /* <3> get the IPv4 address */ if (!prDev || !(prDev->ip_ptr) || !((struct in_device *)(prDev->ip_ptr))->ifa_list || !(&(((struct in_device *)(prDev->ip_ptr))->ifa_list->ifa_local))) { printk(KERN_INFO "ip is not avaliable.\n"); return; } /* <4> copy the IPv4 address */ kalMemCopy(ip, &(((struct in_device *)(prDev->ip_ptr))->ifa_list->ifa_local), sizeof(ip)); printk(KERN_INFO "ip is %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]); /* todo: traverse between list to find whole sets of IPv4 addresses */ if (!((ip[0] == 0) && (ip[1] == 0) && (ip[2] == 0) && (ip[3] == 0))) { u4NumIPv4++; } #ifdef CONFIG_IPV6 /* <5> get the IPv6 address */ if (!prDev || !(prDev->ip6_ptr) || !((struct in_device *)(prDev->ip6_ptr))->ifa_list || !(&(((struct in_device *)(prDev->ip6_ptr))->ifa_list->ifa_local))) { printk(KERN_INFO "ipv6 is not avaliable.\n"); return; } /* <6> copy the IPv6 address */ kalMemCopy(ip6, &(((struct in_device *)(prDev->ip6_ptr))->ifa_list->ifa_local), sizeof(ip6)); printk(KERN_INFO "ipv6 is %d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d\n", ip6[0], ip6[1], ip6[2], ip6[3], ip6[4], ip6[5], ip6[6], ip6[7], ip6[8], ip6[9], ip6[10], ip6[11], ip6[12], ip6[13], ip6[14], ip6[15] ); /* todo: traverse between list to find whole sets of IPv6 addresses */ if (!((ip6[0] == 0) && (ip6[1] == 0) && (ip6[2] == 0) && (ip6[3] == 0) && (ip6[4] == 0) && (ip6[5] == 0))) { } #endif /* <7> set up the ARP filter */ { WLAN_STATUS rStatus = WLAN_STATUS_FAILURE; UINT_32 u4SetInfoLen = 0; /* UINT_8 aucBuf[32] = {0}; */ UINT_32 u4Len = OFFSET_OF(PARAM_NETWORK_ADDRESS_LIST, arAddress); P_PARAM_NETWORK_ADDRESS_LIST prParamNetAddrList = (P_PARAM_NETWORK_ADDRESS_LIST) g_aucBufIpAddr; /* aucBuf; */ P_PARAM_NETWORK_ADDRESS prParamNetAddr = prParamNetAddrList->arAddress; kalMemZero(g_aucBufIpAddr, sizeof(g_aucBufIpAddr)); prParamNetAddrList->u4AddressCount = u4NumIPv4 + u4NumIPv6; prParamNetAddrList->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP; for (i = 0; i < u4NumIPv4; i++) { prParamNetAddr->u2AddressLength = sizeof(PARAM_NETWORK_ADDRESS_IP); /* 4;; */ prParamNetAddr->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP; #if 0 kalMemCopy(prParamNetAddr->aucAddress, ip, sizeof(ip)); prParamNetAddr = (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prParamNetAddr + sizeof(ip)); u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(ip); #else prParamIpAddr = (P_PARAM_NETWORK_ADDRESS_IP) prParamNetAddr->aucAddress; kalMemCopy(&prParamIpAddr->in_addr, ip, sizeof(ip)); /* prParamNetAddr = (P_PARAM_NETWORK_ADDRESS)((UINT_32)prParamNetAddr + sizeof(PARAM_NETWORK_ADDRESS)); // TODO: frog. The pointer is not right. */ prParamNetAddr = (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prParamNetAddr + (UINT_32) (prParamNetAddr-> u2AddressLength + OFFSET_OF (PARAM_NETWORK_ADDRESS, aucAddress))); u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(PARAM_NETWORK_ADDRESS_IP); #endif } #ifdef CONFIG_IPV6 for (i = 0; i < u4NumIPv6; i++) { prParamNetAddr->u2AddressLength = 6; prParamNetAddr->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP; kalMemCopy(prParamNetAddr->aucAddress, ip6, sizeof(ip6)); /* prParamNetAddr = (P_PARAM_NETWORK_ADDRESS)((UINT_32)prParamNetAddr + sizeof(ip6)); */ prParamNetAddr = (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prParamNetAddr + (UINT_32) (prParamNetAddr-> u2AddressLength + OFFSET_OF (PARAM_NETWORK_ADDRESS, aucAddress))); u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(ip6); } #endif ASSERT(u4Len <= sizeof(g_aucBufIpAddr /*aucBuf */)); rStatus = kalIoctl(prGlueInfo, wlanoidSetP2pSetNetworkAddress, (PVOID) prParamNetAddrList, u4Len, FALSE, FALSE, TRUE, TRUE, &u4SetInfoLen); if (rStatus != WLAN_STATUS_SUCCESS) { printk(KERN_INFO DRV_NAME "set HW pattern filter fail 0x%lx\n", rStatus); } } }
static void wlanP2PLateResume(void) { struct net_device *prDev = NULL; P_GLUE_INFO_T prGlueInfo = NULL; UINT_8 ip[4] = { 0 }; #ifdef CONFIG_IPV6 UINT_8 ip6[16] = { 0 }; /* FIX ME: avoid to allocate large memory in stack */ #endif printk(KERN_INFO "*********wlanP2PLateResume************\n"); if (!wlanExportGlueInfo(&prGlueInfo)) { printk(KERN_INFO "*********p2pLateResume ignored************\n"); return; } ASSERT(prGlueInfo); /* <1> Sanity check and acquire the net_device */ prDev = prGlueInfo->prP2PInfo->prDevHandler; ASSERT(prDev); /* <3> get the IPv4 address */ if (!prDev || !(prDev->ip_ptr) || !((struct in_device *)(prDev->ip_ptr))->ifa_list || !(&(((struct in_device *)(prDev->ip_ptr))->ifa_list->ifa_local))) { printk(KERN_INFO "ip is not avaliable.\n"); return; } /* <4> copy the IPv4 address */ kalMemCopy(ip, &(((struct in_device *)(prDev->ip_ptr))->ifa_list->ifa_local), sizeof(ip)); printk(KERN_INFO "ip is %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]); #ifdef CONFIG_IPV6 /* <5> get the IPv6 address */ if (!prDev || !(prDev->ip6_ptr) || !((struct in_device *)(prDev->ip6_ptr))->ifa_list || !(&(((struct in_device *)(prDev->ip6_ptr))->ifa_list->ifa_local))) { printk(KERN_INFO "ipv6 is not avaliable.\n"); return; } /* <6> copy the IPv6 address */ kalMemCopy(ip6, &(((struct in_device *)(prDev->ip6_ptr))->ifa_list->ifa_local), sizeof(ip6)); printk(KERN_INFO "ipv6 is %d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d\n", ip6[0], ip6[1], ip6[2], ip6[3], ip6[4], ip6[5], ip6[6], ip6[7], ip6[8], ip6[9], ip6[10], ip6[11], ip6[12], ip6[13], ip6[14], ip6[15] ); #endif /* <7> clear the ARP filter */ { WLAN_STATUS rStatus = WLAN_STATUS_FAILURE; UINT_32 u4SetInfoLen = 0; /* UINT_8 aucBuf[32] = {0}; */ UINT_32 u4Len = sizeof(PARAM_NETWORK_ADDRESS_LIST); P_PARAM_NETWORK_ADDRESS_LIST prParamNetAddrList = (P_PARAM_NETWORK_ADDRESS_LIST) g_aucBufIpAddr; /* aucBuf; */ kalMemZero(g_aucBufIpAddr, sizeof(g_aucBufIpAddr)); prParamNetAddrList->u4AddressCount = 0; prParamNetAddrList->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP; ASSERT(u4Len <= sizeof(g_aucBufIpAddr /*aucBuf */)); rStatus = kalIoctl(prGlueInfo, wlanoidSetP2pSetNetworkAddress, (PVOID) prParamNetAddrList, u4Len, FALSE, FALSE, TRUE, TRUE, &u4SetInfoLen); if (rStatus != WLAN_STATUS_SUCCESS) { printk(KERN_INFO DRV_NAME "set HW pattern filter fail 0x%lx\n", rStatus); } } }
/*----------------------------------------------------------------------------*/ static int procMCRWrite ( struct file *file, const char *buffer, unsigned long count, void *data ) { P_GLUE_INFO_T prGlueInfo; char acBuf[PROC_MCR_ACCESS_MAX_USER_INPUT_LEN + 1]; // + 1 for "\0" int i4CopySize; PARAM_CUSTOM_MCR_RW_STRUC_T rMcrInfo; UINT_32 u4BufLen; WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; ASSERT(data); i4CopySize = (count < (sizeof(acBuf) - 1)) ? count : (sizeof(acBuf) - 1); if (copy_from_user(acBuf, buffer, i4CopySize)) { return 0; } acBuf[i4CopySize] = '\0'; switch (sscanf(acBuf, "0x%lx 0x%lx", &rMcrInfo.u4McrOffset, &rMcrInfo.u4McrData)) { case 2: /* NOTE: Sometimes we want to test if bus will still be ok, after accessing * the MCR which is not align to DW boundary. */ //if (IS_ALIGN_4(rMcrInfo.u4McrOffset)) { prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv((struct net_device *)data)); u4McrOffset = rMcrInfo.u4McrOffset; //printk("Write 0x%lx to MCR 0x%04lx\n", //rMcrInfo.u4McrOffset, rMcrInfo.u4McrData); rStatus = kalIoctl(prGlueInfo, wlanoidSetMcrWrite, (PVOID)&rMcrInfo, sizeof(rMcrInfo), FALSE, FALSE, TRUE, FALSE, &u4BufLen); } break; case 1: //if (IS_ALIGN_4(rMcrInfo.u4McrOffset)) { u4McrOffset = rMcrInfo.u4McrOffset; } break; default: break; } return count; } /* end of procMCRWrite() */