• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

OpengateM Source Repository


Commit MetaInfo

修訂933b9198939b5c4c9b0c096c4f37cc3fa500d5b3 (tree)
時間2013-06-13 15:15:14
作者watanaby <watanaby@user...>
Commiterwatanaby

Log Message

fixed error on ip address conversion

Change Summary

差異

--- a/doc/Changes.html
+++ b/doc/Changes.html
@@ -212,6 +212,10 @@ OpengateM History</H3>
212212 </DT><DD>
213213 Fixed bug in script to create vendor table(opengatemsql)
214214 </DD>
215+ <DT>Ver.0.8.2 at 2013.6.13
216+ </DT><DD>
217+ Fixed bug in ip-address conversion(opengatemd)
218+ </DD>
215219 </DL>
216220
217221 </BODY>
--- a/mdsrc/opengatemd.c
+++ b/mdsrc/opengatemd.c
@@ -175,7 +175,7 @@ int main(int argc, char **argv)
175175 /* if sig-hup flag is on, reload this program */
176176 if(sigHupArrived)execlp(argv[0], argv[0], NULL);
177177
178- /* if mac addresses are received from management proc by udp,
178+ /* if mac addresses are received from management program through udp port,
179179 remove the addresses from caches */
180180 if(sigIoArrived){
181181 sigIoArrived=FALSE;
@@ -193,7 +193,8 @@ int main(int argc, char **argv)
193193 /* if no packet */
194194 if(ret==0){
195195
196- /* check useless sessions at some interval */
196+ /* check&delete useless sessions */
197+ /* when long time passed from previous check */
197198 if( time(NULL) - uselessCheckTime > checkInterval ){
198199 uselessCheckTime = time(NULL);
199200 DelUselessSessions();
@@ -216,14 +217,14 @@ int main(int argc, char **argv)
216217
217218 /* convert address from network-raw form to presentation form */
218219 ConvertMacFromRawToDisplay(macAddressRaw,macAddress);
219- if(!ConvertIpFromRawToDisplay(ipAddressRaw,ipAddrLen,ipAddress)) continue;
220+ ConvertIpFromRawToDisplay(ipAddressRaw,ipAddrLen,ipAddress);
220221
221222 /* check nat/router and save info to db */
222223 isNatOrRouter=IsSentViaNatOrRouter(ipAddress, macAddress, ttl);
223224 if(isNatOrRouter) PutLogAtNatOrRouter(isNatOrRouter,ipAddress,macAddress,ttl);
224225 PutMacInfoToWorkDb(macAddress, ttl, isNatOrRouter);
225226
226- /*** get the states of the terminal in data structures ***/
227+ /*** get the status of the terminal from session table and DB ***/
227228 /* search the address in session table */
228229 sessionFound = IsMatchedSessionFound(macAddress);
229230
--- a/mdsrc/opengatemd.h
+++ b/mdsrc/opengatemd.h
@@ -157,7 +157,7 @@ int InitPcap(void);
157157 int GetNextPacketFromPcap(unsigned char* macAddressRaw, unsigned char* ipAddressRaw, int* pIpAddrLen, int* pTtl);
158158 void ClosePcap(void);
159159 int GetMyMacAddress(char* macAddress);
160-int ConvertIpFromRawToDisplay(unsigned char* ipAddressRaw, int ipAddrLen, char* ipAddress);
160+void ConvertIpFromRawToDisplay(unsigned char* ipAddressRaw, int ipAddrLen, char* ipAddress);
161161 void ConvertMacFromRawToDisplay(unsigned char* macAddressRaw, char* macAddress);
162162
163163 /* packetcache.c */
--- a/mdsrc/pcap.c
+++ b/mdsrc/pcap.c
@@ -199,30 +199,22 @@ int getMyMacAddress(char* macAddress){
199199 /*****************************
200200 convert IP address from network raw form to display form
201201 *****************************/
202-int convertIpFromRawToDisplay(unsigned char* ipAddressRaw, int ipAddrLen, char* ipAddress){
203- int ret;
204- char zeroAddress[IPV6ADDRLN]={0};
202+void convertIpFromRawToDisplay(unsigned char* ipAddressRaw, int ipAddrLen, char* ipAddress){
205203
206204 /* convert ip address from network form to presentation form */
207205 switch (ipAddrLen) {
208206 case IPV4ADDRLN:
209207 inet_ntop(AF_INET, ipAddressRaw, ipAddress, ADDRMAXLN);
210- if(memcmp(ipAddressRaw, zeroAddress, IPV4ADDRLN)==0) ret=FALSE;
211- else ret=TRUE;
212208 break;
213209
214210 case IPV6ADDRLN:
215211 inet_ntop(AF_INET6, ipAddressRaw, ipAddress, ADDRMAXLN);
216- if(memcmp(ipAddressRaw, zeroAddress, IPV6ADDRLN)==0) ret=FALSE;
217- else ret=TRUE;
218212 break;
219213
220214 default:
221215 ipAddress[0]='\0';
222- ret=FALSE;
223216 break;
224217 }
225- return ret;
226218 }
227219
228220 /*****************************
@@ -265,12 +257,10 @@ int GetMyMacAddress(char* macAddress){
265257 return ret;
266258 }
267259
268-int ConvertIpFromRawToDisplay(unsigned char* ipAddressRaw, int ipAddrLen, char* ipAddress){
269- int ret;
260+void ConvertIpFromRawToDisplay(unsigned char* ipAddressRaw, int ipAddrLen, char* ipAddress){
270261 if(debug>1) err_msg("DEBUG:=>convertIpFromRawtoDisplay(%x,%d,)",ipAddressRaw[0],ipAddrLen);
271- ret=convertIpFromRawToDisplay(ipAddressRaw, ipAddrLen, ipAddress);
262+ convertIpFromRawToDisplay(ipAddressRaw, ipAddrLen, ipAddress);
272263 if(debug>1) err_msg("DEBUG:<=convertIpFromRawToDisplay(,,%s)",ipAddress);
273- return ret;
274264 }
275265
276266 void ConvertMacFromRawToDisplay(unsigned char* macAddressRaw, char* macAddress){