/* This tries to identify the valid syntaxes for the our synthetic "gateway" host. */
return STRCASE_IN_SET(hostname, "_gateway", "_gateway.");
}
+
+static inline bool is_outbound_hostname(const char *hostname) {
+ /* This tries to identify the valid syntaxes for the our synthetic "outbound" host. */
+ return STRCASE_IN_SET(hostname, "_outbound", "_outbound.");
+}
assert(h_errnop);
if (is_localhost(name)) {
- /* We respond to 'localhost', so that /etc/hosts
- * is optional */
+ /* We respond to 'localhost', so that /etc/hosts is optional */
canonical = "localhost";
local_address_ipv4 = htobe32(INADDR_LOOPBACK);
canonical = "_gateway";
+ } else if (is_outbound_hostname(name)) {
+
+ n_addresses = local_outbounds(NULL, 0, AF_UNSPEC, &addresses);
+ if (n_addresses <= 0)
+ goto not_found;
+
+ canonical = "_outbound";
+
} else {
hn = gethostname_malloc();
if (!hn) {
canonical = "_gateway";
+ } else if (is_outbound_hostname(name)) {
+
+ n_addresses = local_outbounds(NULL, 0, af, &addresses);
+ if (n_addresses <= 0)
+ goto not_found;
+
+ canonical = "_outbound";
+
} else {
hn = gethostname_malloc();
if (!hn) {
} else {
_cleanup_free_ char *hostname;
assert_se(hostname = gethostname_malloc());
-
- assert_se(names = strv_new("localhost", "_gateway", "foo_no_such_host", hostname));
+ assert_se(names = strv_new("localhost", "_gateway", "_outbound", "foo_no_such_host", hostname));
n = make_addresses(&addrs);
assert_se(n >= 0);