Skip to content

Commit

Permalink
/etc/scion/hosts and /etc/resolv.conf
Browse files Browse the repository at this point in the history
  • Loading branch information
Tilmann Zäschke committed Apr 3, 2024
1 parent 4f0ac31 commit c550289
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ attempt to get network information in the following order until it succeeds:
- For debugging: Check for local topology file (if file name is given)
- For debugging: Check for bootstrap server address (if address is given)
- For debugging: Check for DNS NAPTR record (if record entry name is given)
- Check search domain (as given in /etc/resolv.conf) for topology server
- Check for to daemon
- Check search domain (as given in /etc/resolv.conf) for topology server

The reason that the daemon is checked last is that it has a default setting (`localhost:30255`)
while the other options are skipped if no property or environment variable is defined.
Expand Down
26 changes: 14 additions & 12 deletions src/main/java/org/scion/ScionService.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,25 +163,27 @@ static ScionService defaultService() {
return defaultService;
}

// TODO try local daemon before trying discovery service
if (ScionUtil.getPropertyOrEnv(
PROPERTY_USE_OS_SEARCH_DOMAINS,
ENV_USE_OS_SEARCH_DOMAINS,
DEFAULT_USE_OS_SEARCH_DOMAINS)) {
String dnsResolver = DNSHelper.searchForDiscoveryService();
defaultService = new ScionService(dnsResolver, Mode.BOOTSTRAP_SERVER_IP);
return defaultService;
}

// try daemon
String daemon = ScionUtil.getPropertyOrEnv(PROPERTY_DAEMON, ENV_DAEMON, DEFAULT_DAEMON);
try {
defaultService = new ScionService(daemon, Mode.DAEMON);
return defaultService;
} catch (ScionRuntimeException e) {
throw new ScionRuntimeException(
"Could not connect to daemon, DNS or bootstrap resource.", e);
LOG.info(e.getMessage());
// Ignore!
}

// try normal network
if (ScionUtil.getPropertyOrEnv(
PROPERTY_USE_OS_SEARCH_DOMAINS,
ENV_USE_OS_SEARCH_DOMAINS,
DEFAULT_USE_OS_SEARCH_DOMAINS)) {
String dnsResolver = DNSHelper.searchForDiscoveryService();
defaultService = new ScionService(dnsResolver, Mode.BOOTSTRAP_SERVER_IP);
return defaultService;

Check warning on line 183 in src/main/java/org/scion/ScionService.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/scion/ScionService.java#L181-L183

Added lines #L181 - L183 were not covered by tests
}
throw new ScionRuntimeException(
"Could not connect to daemon, DNS or bootstrap resource.");
}
}

Expand Down

0 comments on commit c550289

Please sign in to comment.