MCPcopy Create free account
hub / github.com/apache/mesos / eth0

Function eth0

src/linux/routing/link/link.cpp:62–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60namespace link {
61
62Result<string> eth0()
63{
64 Try<vector<route::Rule>> mainRoutingTable = route::table();
65 if (mainRoutingTable.isError()) {
66 return Error(
67 "Failed to retrieve the main routing table on the host: " +
68 mainRoutingTable.error());
69 }
70
71 foreach (const route::Rule& rule, mainRoutingTable.get()) {
72 if (rule.destination.isNone()) {
73 // Check if the public interface exists.
74 Try<bool> exists = link::exists(rule.link);
75 if (exists.isError()) {
76 return Error(
77 "Failed to check if " + rule.link + " exists: " + exists.error());
78 } else if (!exists.get()) {
79 return Error(
80 rule.link + " is in the routing table but not in the system");
81 }
82
83 return rule.link;
84 }
85 }
86
87 return None();
88}
89
90
91Result<string> lo()

Callers 4

TEST_FFunction · 0.85
SetUpMethod · 0.85
SetUpMethod · 0.85
createMethod · 0.85

Calls 5

tableFunction · 0.85
NoneClass · 0.85
errorMethod · 0.65
ErrorFunction · 0.50
isErrorMethod · 0.45

Tested by 3

TEST_FFunction · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68