Changeset 728 for nepenthes/branches
- Timestamp:
- 01/04/07 20:27:35 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
nepenthes/branches/nepenthes-scriptgen/modules/module-peiros/TapInterface.cpp
r688 r728 59 59 TapInterface::TapInterface() : POLLSocket() 60 60 { 61 // logPF();62 61 m_encapsulator = 0; 63 62 } … … 65 64 bool TapInterface::Init(uint32_t netmask, bool manageRoute) 66 65 { 67 #if defined(__linux_ )66 #if defined(__linux__) 68 67 logPF(); 69 68 struct ifreq ifr; … … 118 117 119 118 g_Nepenthes->getSocketMgr()->addPOLLSocket(this); 119 120 addAddress(inet_addr("10.0.0.1")); 120 121 121 122 if((m_manageRoute = manageRoute)) … … 142 143 { 143 144 logCrit("Could not add peiros default route: %s!\n", strerror(errno)); 144 //return false;145 return false; 145 146 } 146 147 … … 150 151 return true; 151 152 #else 152 logCrit(" this module does not work on your operating system, use linux\n");153 logCrit("This module does not work on your operating system, use Linux.\n"); 153 154 return false; 154 155 … … 169 170 bool TapInterface::Exit() 170 171 { 171 #if defined(__linux_ )172 #if defined(__linux__) 172 173 if(m_manageRoute) 173 174 { … … 250 251 } 251 252 253 void TapInterface::releaseEncapsulator(TapEncapsulator * e) 254 { 255 if(m_encapsulator == e) 256 { 257 logInfo("Successful, neccessary release of encapsulator.\n"); 258 m_encapsulator = 0; 259 } 260 else 261 logCrit("Race condition bug avoided!\n"); 262 } 263 252 264 bool TapInterface::addAddress(uint32_t address) 253 265 { … … 289 301 } 290 302 } 291 303 304 addr.sin_addr.s_addr = address; 292 305 logInfo("Added address %s.\n", inet_ntoa(addr.sin_addr)); 293 306 … … 300 313 { 301 314 logPF(); 302 // TODO: implement 303 } 315 316 // obsolete 317 } nepenthes/branches/nepenthes-scriptgen/modules/module-peiros/TapInterface.hpp
r687 r728 70 70 71 71 void setEncapsulator(TapEncapsulator * encapsulator); 72 void releaseEncapsulator(TapEncapsulator * encapsulator); 73 72 74 int getSocket(); 73 75 virtual int32_t getsockOpt(int32_t level, int32_t optname,void *optval,socklen_t *optlen); nepenthes/branches/nepenthes-scriptgen/modules/module-peiros/module-peiros.cpp
r687 r728 138 138 port = m_Config->getValInt("module-peiros.port"); 139 139 140 timeout = 30;140 timeout = m_Config->getValInt("module-peiros.timeout"); 141 141 142 142 if(!initializeNetrange(m_Config->getValString("module-peiros.netrange"))) … … 381 381 rbuf = m_peirosParser.renderRequest(&response); 382 382 m_Socket->doRespond((char *) rbuf.data(), rbuf.size()); 383 383 /* 384 384 if(!m_tapInterface->addAddress(m_address)) 385 385 { 386 386 logCrit("Failed to add address %s to TUN.\n", inet_ntoa(conv)); 387 387 return false; 388 } 388 }*/ 389 389 390 390 m_saidHello = true; … … 588 588 logPF(); 589 589 590 m_tapInterface-> setEncapsulator(0);590 m_tapInterface->releaseEncapsulator(this); 591 591 return CL_DROP; 592 592 } … … 597 597 logPF(); 598 598 599 m_tapInterface-> setEncapsulator(0);599 m_tapInterface->releaseEncapsulator(this); 600 600 return CL_DROP; 601 601 } … … 603 603 ConsumeLevel PeirosDialogue::connectionShutdown(Message *msg) 604 604 { 605 m_tapInterface->releaseEncapsulator(this); 606 605 607 logPF(); 606 608 return CL_DROP;
