From c3d5d876a9b974f53c13c98e2a199653b896b33c Mon Sep 17 00:00:00 2001 From: zhangsz Date: Thu, 17 Apr 2025 16:56:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20mcc/mnc=E7=9A=84*=E9=80=9A=E9=85=8D?= =?UTF-8?q?=EF=BC=8CGetAccountBundlePlanInfo()=E5=88=A4=E6=96=AD=E5=A5=97?= =?UTF-8?q?=E9=A4=90=E7=B1=BB=E5=9E=8B=E6=9D=A1=E4=BB=B6=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mss/pps/src/main/mfunc.c | 81 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 76 insertions(+), 5 deletions(-) diff --git a/mss/pps/src/main/mfunc.c b/mss/pps/src/main/mfunc.c index 5acf5eb..79a3ecd 100644 --- a/mss/pps/src/main/mfunc.c +++ b/mss/pps/src/main/mfunc.c @@ -3139,7 +3139,7 @@ int GetAccountBundlePlanInfo(_account_info *ptr, long ret_value[6], _state_data ret_value[5] = usr_redis.warning_sms_flag; #else #ifdef HAS_BUNDLE_ROAMING - if((shmp != NULL) || (shmp->process_info.bundle_flag == BUNDLE_OTHER_NETWORK)) + if((shmp != NULL) && (shmp->process_info.bundle_flag == BUNDLE_OTHER_NETWORK)) { // see if we have to set bundle to 0=================================== if ((sub_ptr->bundle_roam.validity_date > 0) && (sub_ptr->bundle_roam.validity_date < tvnow.tv_sec))// 1) set bundle to 0, if expired when querying. @@ -4840,7 +4840,7 @@ static void PureDigitAscii(u_char *string) char GetTariffLacInfo(u_char *cgi) { - int loc = -1, loop, matchFlag=0,len; + int loc = -1, loop, matchFlag=0,len, matchMcc=0, matchMnc=0, mMccLen=0, mMncLen=0, matchTz=-1; u_short cell, lac; u_char MCC[32]={0},MNC[32]={0}; BasicTariffZone *pBTZ; @@ -4866,14 +4866,81 @@ GetTariffLacInfo(u_char *cgi) continue; matchFlag = 0; len = strlen((char *)pBTZ->mcc); - if(len == 0) + if((len == 0) || (pBTZ->mcc[0] == '*')) + { + if ((matchMnc==0) && (matchMcc==0)) + { + matchMcc = 1; + mMccLen = 0; + matchTz = loop; + } continue; + } + else if ((len>=2)&&(pBTZ->mcc[1]=='*')) + { + if (pBTZ->mcc[0]==MCC[0]) + { + if ((matchMnc==0) && (mMccLen<=0)) + { + matchMcc = 1; + mMccLen = 1; + matchTz = loop; + } + } + continue; + } + else if ((len>=3)&&(pBTZ->mcc[2]=='*')) + { + if(memcmp(pBTZ->mcc,MCC,2) == 0) + { + if ((matchMnc==0) && (mMccLen<=1)) + { + matchMcc = 1; + mMccLen = 2; + matchTz = loop; + } + } + continue; + } if(memcmp(pBTZ->mcc,MCC,len) == 0) { len = strlen((char *)pBTZ->mnc); - if(len == 0 || (pBTZ->mnc[0] == '*')) + if((len == 0) || (pBTZ->mnc[0] == '*')) { - matchFlag = 1; + //matchFlag = 1; + if (matchMnc==0) + { + matchMnc = 1; + mMncLen = 0; + matchTz = loop; + } + continue; + } + else if ((len>=2)&&(pBTZ->mnc[1]=='*')) + { + if (pBTZ->mnc[0]==MNC[0]) + { + if (mMncLen<=0) + { + matchMnc = 1; + mMncLen = 1; + matchTz = loop; + } + } + continue; + } + else if ((len>=3)&&(pBTZ->mnc[2]=='*')) + { + if(memcmp(pBTZ->mnc,MNC,2) == 0) + { + if (mMncLen<=1) + { + matchMnc = 1; + mMncLen = 2; + matchTz = loop; + } + } + continue; } else if(memcmp(pBTZ->mnc,MNC,len) ==0 ) { @@ -4912,6 +4979,10 @@ GetTariffLacInfo(u_char *cgi) } }//if mcc }/* for */ + if ((matchMcc==1) || (matchMnc==1)) + { + return matchTz; + } return loc; }