|
|
| 432 |
// |
432 |
// |
| 433 |
// Execute the socket creation process image. |
433 |
// Execute the socket creation process image. |
| 434 |
// |
434 |
// |
| 435 |
status = ::execl (FindCreator ("tap-creator").c_str (), |
435 |
status = ::execlp ("tap-creator", |
| 436 |
FindCreator ("tap-creator").c_str (), // argv[0] (filename) |
436 |
"tap-creator", // argv[0] (filename) |
| 437 |
ossDeviceName.str ().c_str (), // argv[1] (-d<device name>) |
437 |
ossDeviceName.str ().c_str (), // argv[1] (-d<device name>) |
| 438 |
ossGateway.str ().c_str (), // argv[2] (-g<gateway>) |
438 |
ossGateway.str ().c_str (), // argv[2] (-g<gateway>) |
| 439 |
ossIp.str ().c_str (), // argv[3] (-i<IP address>) |
439 |
ossIp.str ().c_str (), // argv[3] (-i<IP address>) |
|
|
| 444 |
(char *)NULL); |
444 |
(char *)NULL); |
| 445 |
|
445 |
|
| 446 |
// |
446 |
// |
| 447 |
// If the execl successfully completes, it never returns. If it returns it failed or the OS is |
447 |
// If the execlp successfully completes, it never returns. If it returns it failed or the OS is |
| 448 |
// broken. In either case, we bail. |
448 |
// broken. In either case, we bail. |
| 449 |
// |
449 |
// |
| 450 |
NS_FATAL_ERROR ("TapBridge::CreateTap(): Back from execl(), errno = " << ::strerror (errno)); |
450 |
NS_FATAL_ERROR ("TapBridge::CreateTap(): Back from execlp(), errno = " << ::strerror (errno)); |
| 451 |
} |
451 |
} |
| 452 |
else |
452 |
else |
| 453 |
{ |
453 |
{ |
|
|
| 569 |
} |
569 |
} |
| 570 |
} |
570 |
} |
| 571 |
|
571 |
|
| 572 |
std::string |
|
|
| 573 |
TapBridge::FindCreator (std::string creatorName) |
| 574 |
{ |
| 575 |
NS_LOG_FUNCTION (creatorName); |
| 576 |
|
| 577 |
std::list<std::string> locations; |
| 578 |
|
| 579 |
// The path to the bits if we're sitting in the root of the repo |
| 580 |
locations.push_back ("./build/optimized/src/devices/tap-bridge/"); |
| 581 |
locations.push_back ("./build/debug/src/devices/tap-bridge/"); |
| 582 |
|
| 583 |
// if in src |
| 584 |
locations.push_back ("../build/optimized/src/devices/tap-bridge/"); |
| 585 |
locations.push_back ("../build/debug/src/devices/tap-bridge/"); |
| 586 |
|
| 587 |
// if in src/devices |
| 588 |
locations.push_back ("../../build/optimized/src/devices/tap-bridge/"); |
| 589 |
locations.push_back ("../../build/debug/src/devices/tap-bridge/"); |
| 590 |
|
| 591 |
// if in src/devices/tap-bridge |
| 592 |
locations.push_back ("../../../build/optimized/src/devices/tap-bridge/"); |
| 593 |
locations.push_back ("../../../build/debug/src/devices/tap-bridge/"); |
| 594 |
|
| 595 |
for (std::list<std::string>::const_iterator i = locations.begin (); i != locations.end (); ++i) |
| 596 |
{ |
| 597 |
struct stat st; |
| 598 |
|
| 599 |
if (::stat ((*i + creatorName).c_str (), &st) == 0) |
| 600 |
{ |
| 601 |
NS_LOG_INFO ("Found Creator " << *i + creatorName); |
| 602 |
return *i + creatorName; |
| 603 |
} |
| 604 |
} |
| 605 |
|
| 606 |
NS_FATAL_ERROR ("TapBridge::FindCreator(): Couldn't find creator"); |
| 607 |
return ""; // quiet compiler |
| 608 |
} |
| 609 |
|
| 610 |
void |
572 |
void |
| 611 |
TapBridge::ReadThread (void) |
573 |
TapBridge::ReadThread (void) |
| 612 |
{ |
574 |
{ |