diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-03-30 18:58:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-30 18:58:26 +0200 |
commit | 1f4faf21e8fc0605c1ee2b2c6ad4eedee1ab1825 (patch) | |
tree | 41acbe1cde2572998459eaaf4ac32485ae185d95 /src | |
parent | Merge pull request #13084 from ddstreet/log_time (diff) | |
parent | networkctl: Add support to display DHCP SMTP servers (diff) | |
download | systemd-1f4faf21e8fc0605c1ee2b2c6ad4eedee1ab1825.tar.xz systemd-1f4faf21e8fc0605c1ee2b2c6ad4eedee1ab1825.zip |
Merge pull request #15197 from ssahani/smtp-dhcp
DHCP4: Add support to emit and receive SMTP servers.
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd-network/dhcp-lease-internal.h | 3 | ||||
-rw-r--r-- | src/libsystemd-network/dhcp-server-internal.h | 4 | ||||
-rw-r--r-- | src/libsystemd-network/sd-dhcp-lease.c | 28 | ||||
-rw-r--r-- | src/libsystemd-network/sd-dhcp-server.c | 35 | ||||
-rw-r--r-- | src/libsystemd/sd-network/sd-network.c | 4 | ||||
-rw-r--r-- | src/network/networkctl.c | 6 | ||||
-rw-r--r-- | src/network/networkd-dhcp-server.c | 148 | ||||
-rw-r--r-- | src/network/networkd-dhcp-server.h | 1 | ||||
-rw-r--r-- | src/network/networkd-link.c | 15 | ||||
-rw-r--r-- | src/network/networkd-manager.c | 16 | ||||
-rw-r--r-- | src/network/networkd-network-gperf.gperf | 1 | ||||
-rw-r--r-- | src/network/networkd-network.c | 1 | ||||
-rw-r--r-- | src/network/networkd-network.h | 4 | ||||
-rw-r--r-- | src/systemd/sd-dhcp-client.h | 1 | ||||
-rw-r--r-- | src/systemd/sd-dhcp-lease.h | 1 | ||||
-rw-r--r-- | src/systemd/sd-dhcp-server.h | 1 | ||||
-rw-r--r-- | src/systemd/sd-network.h | 3 |
17 files changed, 254 insertions, 18 deletions
diff --git a/src/libsystemd-network/dhcp-lease-internal.h b/src/libsystemd-network/dhcp-lease-internal.h index efc7976838..5cbebb4a34 100644 --- a/src/libsystemd-network/dhcp-lease-internal.h +++ b/src/libsystemd-network/dhcp-lease-internal.h @@ -64,6 +64,9 @@ struct sd_dhcp_lease { struct in_addr *pop3_server; size_t pop3_server_size; + struct in_addr *smtp_server; + size_t smtp_server_size; + struct sd_dhcp_route *static_route; size_t static_route_size, static_route_allocated; diff --git a/src/libsystemd-network/dhcp-server-internal.h b/src/libsystemd-network/dhcp-server-internal.h index 468bd303dc..1b42712479 100644 --- a/src/libsystemd-network/dhcp-server-internal.h +++ b/src/libsystemd-network/dhcp-server-internal.h @@ -55,8 +55,8 @@ struct sd_dhcp_server { char *timezone; - struct in_addr *ntp, *dns, *sip, *pop3_server; - unsigned n_ntp, n_dns, n_sip, n_pop3_server; + struct in_addr *ntp, *dns, *sip, *pop3_server, *smtp_server; + unsigned n_ntp, n_dns, n_sip, n_pop3_server, n_smtp_server; OrderedHashmap *extra_options; OrderedHashmap *vendor_options; diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c index 4a6c56ecbf..1b7b6e1068 100644 --- a/src/libsystemd-network/sd-dhcp-lease.c +++ b/src/libsystemd-network/sd-dhcp-lease.c @@ -140,6 +140,17 @@ int sd_dhcp_lease_get_pop3_server(sd_dhcp_lease *lease, const struct in_addr **a return (int) lease->pop3_server_size; } +int sd_dhcp_lease_get_smtp_server(sd_dhcp_lease *lease, const struct in_addr **addr) { + assert_return(lease, -EINVAL); + assert_return(addr, -EINVAL); + + if (lease->smtp_server_size <= 0) + return -ENODATA; + + *addr = lease->smtp_server; + return (int) lease->smtp_server_size; +} + int sd_dhcp_lease_get_domainname(sd_dhcp_lease *lease, const char **domainname) { assert_return(lease, -EINVAL); assert_return(domainname, -EINVAL); @@ -291,6 +302,7 @@ static sd_dhcp_lease *dhcp_lease_free(sd_dhcp_lease *lease) { free(lease->ntp); free(lease->sip); free(lease->pop3_server); + free(lease->smtp_server); free(lease->static_route); free(lease->client_id); free(lease->vendor_specific); @@ -619,6 +631,12 @@ int dhcp_lease_parse_options(uint8_t code, uint8_t len, const void *option, void log_debug_errno(r, "Failed to parse POP3 server, ignoring: %m"); break; + case SD_DHCP_OPTION_SMTP_SERVER: + r = lease_parse_in_addrs(option, len, &lease->smtp_server, &lease->smtp_server_size); + if (r < 0) + log_debug_errno(r, "Failed to parse SMTP server, ignoring: %m"); + break; + case SD_DHCP_OPTION_STATIC_ROUTE: r = lease_parse_routes(option, len, &lease->static_route, &lease->static_route_size, &lease->static_route_allocated); if (r < 0) @@ -1056,6 +1074,7 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) { *ntp = NULL, *sip = NULL, *pop3_server = NULL, + *smtp_server = NULL, *mtu = NULL, *routes = NULL, *domains = NULL, @@ -1086,6 +1105,7 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) { "NTP", &ntp, "SIP", &sip, "POP3_SERVERS", &pop3_server, + "SMTP_SERVERS", &smtp_server, "MTU", &mtu, "DOMAINNAME", &lease->domainname, "HOSTNAME", &lease->hostname, @@ -1206,6 +1226,14 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) { lease->pop3_server_size = r; } + if (smtp_server) { + r = deserialize_in_addrs(&lease->smtp_server, smtp_server); + if (r < 0) + log_debug_errno(r, "Failed to deserialize SMTP server %s, ignoring: %m", smtp_server); + else + lease->smtp_server_size = r; + } + if (mtu) { r = safe_atou16(mtu, &lease->mtu); if (r < 0) diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c index 89a487cf01..ee4a7249c2 100644 --- a/src/libsystemd-network/sd-dhcp-server.c +++ b/src/libsystemd-network/sd-dhcp-server.c @@ -141,6 +141,7 @@ static sd_dhcp_server *dhcp_server_free(sd_dhcp_server *server) { free(server->ntp); free(server->sip); free(server->pop3_server); + free(server->smtp_server); hashmap_free(server->leases_by_client_id); @@ -523,6 +524,15 @@ static int server_send_ack(sd_dhcp_server *server, DHCPRequest *req, return r; } + if (server->n_smtp_server > 0) { + r = dhcp_option_append( + &packet->dhcp, req->max_optlen, &offset, 0, + SD_DHCP_OPTION_SMTP_SERVER, + sizeof(struct in_addr) * server->n_smtp_server, server->smtp_server); + if (r < 0) + return r; + } + if (server->timezone) { r = dhcp_option_append( &packet->dhcp, req->max_optlen, &offset, 0, @@ -1216,6 +1226,31 @@ int sd_dhcp_server_set_pop3_server(sd_dhcp_server *server, const struct in_addr return 1; } +int sd_dhcp_server_set_smtp_server(sd_dhcp_server *server, const struct in_addr smtp_server[], unsigned n) { + assert_return(server, -EINVAL); + assert_return(smtp_server || n <= 0, -EINVAL); + + if (server->n_smtp_server == n && + memcmp(server->smtp_server, smtp_server, sizeof(struct in_addr) * n) == 0) + return 0; + + if (n <= 0) { + server->smtp_server = mfree(server->smtp_server); + server->n_smtp_server = 0; + } else { + struct in_addr *c; + + c = newdup(struct in_addr, smtp_server, n); + if (!c) + return -ENOMEM; + + free_and_replace(server->smtp_server, c); + server->n_smtp_server = n; + } + + return 1; +} + int sd_dhcp_server_set_emit_router(sd_dhcp_server *server, int enabled) { assert_return(server, -EINVAL); diff --git a/src/libsystemd/sd-network/sd-network.c b/src/libsystemd/sd-network/sd-network.c index a5ab5b3c36..acfab8ed74 100644 --- a/src/libsystemd/sd-network/sd-network.c +++ b/src/libsystemd/sd-network/sd-network.c @@ -260,6 +260,10 @@ _public_ int sd_network_link_get_pop3_servers(int ifindex, char ***pop3) { return network_link_get_strv(ifindex, "POP3_SERVERS", pop3); } +_public_ int sd_network_link_get_smtp_servers(int ifindex, char ***ret) { + return network_link_get_strv(ifindex, "SMTP_SERVERS", ret); +} + _public_ int sd_network_link_get_dns_default_route(int ifindex) { char path[STRLEN("/run/systemd/netif/links/") + DECIMAL_STR_MAX(ifindex) + 1]; _cleanup_free_ char *s = NULL; diff --git a/src/network/networkctl.c b/src/network/networkctl.c index cfe511c387..58f79b3754 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -1241,7 +1241,7 @@ static int link_status_one( const LinkInfo *info) { _cleanup_strv_free_ char **dns = NULL, **ntp = NULL, **sip = NULL, **search_domains = NULL, **route_domains = NULL, - **pop3_server = NULL; + **pop3_server = NULL, **smtp_server = NULL; _cleanup_free_ char *setup_state = NULL, *operational_state = NULL, *tz = NULL; _cleanup_free_ char *t = NULL, *network = NULL; const char *driver = NULL, *path = NULL, *vendor = NULL, *model = NULL, *link = NULL; @@ -1269,6 +1269,7 @@ static int link_status_one( (void) sd_network_link_get_ntp(info->ifindex, &ntp); (void) sd_network_link_get_sip(info->ifindex, &sip); (void) sd_network_link_get_pop3_servers(info->ifindex, &pop3_server); + (void) sd_network_link_get_smtp_servers(info->ifindex, &smtp_server); if (info->sd_device) { (void) sd_device_get_property_value(info->sd_device, "ID_NET_LINK_FILE", &link); @@ -1834,6 +1835,9 @@ static int link_status_one( r = dump_list(table, "POP3 servers:", pop3_server); if (r < 0) return r; + r = dump_list(table, "SMTP servers:", smtp_server); + if (r < 0) + return r; r = dump_ifindexes(table, "Carrier Bound To:", carrier_bound_to); if (r < 0) return r; diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c index 83caef6fc0..bbaa10f5ab 100644 --- a/src/network/networkd-dhcp-server.c +++ b/src/network/networkd-dhcp-server.c @@ -189,6 +189,55 @@ static int link_push_uplink_pop3_to_dhcp_server(Link *link, sd_dhcp_server *s) { return sd_dhcp_server_set_pop3_server(s, addresses, n_addresses); } +static int link_push_uplink_smtp_to_dhcp_server(Link *link, sd_dhcp_server *s) { + _cleanup_free_ struct in_addr *addresses = NULL; + size_t n_addresses = 0, n_allocated = 0; + char **a; + + if (!link->network) + return 0; + + log_link_debug(link, "Copying SMTP server information from link"); + + STRV_FOREACH(a, link->network->smtp) { + union in_addr_union ia; + + /* Only look for IPv4 addresses */ + if (in_addr_from_string(AF_INET, *a, &ia) <= 0) + continue; + + /* Never propagate obviously borked data */ + if (in4_addr_is_null(&ia.in) || in4_addr_is_localhost(&ia.in)) + continue; + + if (!GREEDY_REALLOC(addresses, n_allocated, n_addresses + 1)) + return log_oom(); + + addresses[n_addresses++] = ia.in; + } + + if (link->dhcp_lease) { + const struct in_addr *da = NULL; + int j, n; + + n = sd_dhcp_lease_get_smtp_server(link->dhcp_lease, &da); + if (n > 0) { + + if (!GREEDY_REALLOC(addresses, n_allocated, n_addresses + n)) + return log_oom(); + + for (j = 0; j < n; j++) + if (in4_addr_is_non_local(&da[j])) + addresses[n_addresses++] = da[j]; + } + } + + if (n_addresses <= 0) + return 0; + + return sd_dhcp_server_set_smtp_server(s, addresses, n_addresses); +} + static int link_push_uplink_sip_to_dhcp_server(Link *link, sd_dhcp_server *s) { _cleanup_free_ struct in_addr *addresses = NULL; size_t n_addresses = 0, n_allocated = 0; @@ -330,21 +379,36 @@ int dhcp4_server_configure(Link *link) { log_link_warning_errno(link, r, "Failed to set SIP server for DHCP server, ignoring: %m"); } - if (link->network->n_dhcp_server_pop3 > 0) - r = sd_dhcp_server_set_pop3_server(link->dhcp_server, link->network->dhcp_server_pop3, link->network->n_dhcp_server_pop3); - else { - if (!acquired_uplink) - uplink = manager_find_uplink(link->manager, link); + if (link->network->n_dhcp_server_pop3 > 0) + r = sd_dhcp_server_set_pop3_server(link->dhcp_server, link->network->dhcp_server_pop3, link->network->n_dhcp_server_pop3); + else { + if (!acquired_uplink) + uplink = manager_find_uplink(link->manager, link); - if (!uplink) { - log_link_debug(link, "Not emitting POP3 server information on link, couldn't find suitable uplink."); - r = 0; - } else - r = link_push_uplink_pop3_to_dhcp_server(uplink, link->dhcp_server); + if (!uplink) { + log_link_debug(link, "Not emitting POP3 server information on link, couldn't find suitable uplink."); + r = 0; + } else + r = link_push_uplink_pop3_to_dhcp_server(uplink, link->dhcp_server); + } + if (r < 0) + log_link_warning_errno(link, r, "Failed to set POP3 server for DHCP server, ignoring: %m"); + + if (link->network->n_dhcp_server_smtp > 0) + r = sd_dhcp_server_set_smtp_server(link->dhcp_server, link->network->dhcp_server_smtp, link->network->n_dhcp_server_smtp); + else { + if (!acquired_uplink) + uplink = manager_find_uplink(link->manager, link); + + if (!uplink) { + log_link_debug(link, "Not emitting SMTP server information on link, couldn't find suitable uplink."); + r = 0; + } else + r = link_push_uplink_smtp_to_dhcp_server(uplink, link->dhcp_server); + } + if (r < 0) + log_link_warning_errno(link, r, "Failed to SMTP server for DHCP server, ignoring: %m"); - } - if (r < 0) - log_link_warning_errno(link, r, "Failed to set POP3 server for DHCP server, ignoring: %m"); r = sd_dhcp_server_set_emit_router(link->dhcp_server, link->network->dhcp_server_emit_router); if (r < 0) @@ -550,6 +614,8 @@ int config_parse_dhcp_server_sip( m[n->n_dhcp_server_sip++] = a.in; n->dhcp_server_sip = m; } + + return 0; } int config_parse_dhcp_server_pop3_servers( @@ -602,4 +668,60 @@ int config_parse_dhcp_server_pop3_servers( m[n->n_dhcp_server_pop3++] = a.in; n->dhcp_server_pop3 = m; } + + return 0; +} + +int config_parse_dhcp_server_smtp_servers( + const char *unit, + const char *filename, + unsigned line, + const char *section, + unsigned section_line, + const char *lvalue, + int ltype, + const char *rvalue, + void *data, + void *userdata) { + + Network *n = data; + const char *p = rvalue; + int r; + + assert(filename); + assert(lvalue); + assert(rvalue); + + for (;;) { + _cleanup_free_ char *w = NULL; + union in_addr_union a; + struct in_addr *m; + + r = extract_first_word(&p, &w, NULL, 0); + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_ERR, filename, line, r, + "Failed to extract word, ignoring: %s", rvalue); + return 0; + } + if (r == 0) + return 0; + + r = in_addr_from_string(AF_INET, w, &a); + if (r < 0) { + log_syntax(unit, LOG_ERR, filename, line, r, + "Failed to parse SMTP server address '%s', ignoring: %m", w); + continue; + } + + m = reallocarray(n->dhcp_server_smtp, n->n_dhcp_server_smtp + 1, sizeof(struct in_addr)); + if (!m) + return log_oom(); + + m[n->n_dhcp_server_smtp++] = a.in; + n->dhcp_server_smtp = m; + } + + return 0; } diff --git a/src/network/networkd-dhcp-server.h b/src/network/networkd-dhcp-server.h index a388f6b81c..9da475dd3f 100644 --- a/src/network/networkd-dhcp-server.h +++ b/src/network/networkd-dhcp-server.h @@ -13,3 +13,4 @@ CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_server_dns); CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_server_ntp); CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_server_sip); CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_server_pop3_servers); +CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_server_smtp_servers); diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 376596bf57..7672b33128 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -4106,6 +4106,12 @@ int link_save(Link *link) { space = false; fputstrv(f, link->network->pop3, NULL, &space); + fputc('\n', f); + + fputs("SMTP_SERVERS=", f); + space = false; + fputstrv(f, link->network->smtp, NULL, &space); + if (link->dhcp_lease) { const struct in_addr *addresses; @@ -4115,6 +4121,15 @@ int link_save(Link *link) { space = true; } + if (link->dhcp_lease) { + const struct in_addr *addresses; + + r = sd_dhcp_lease_get_smtp_server(link->dhcp_lease, &addresses); + if (r > 0) + if (serialize_in_addrs(f, addresses, r, space, in4_addr_is_non_local) > 0) + space = true; + } + if (link->network->dhcp6_use_ntp && dhcp6_lease) { struct in6_addr *in6_addrs; char **hosts; diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index 066c72ab5b..1348fcb9b3 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -1490,7 +1490,7 @@ static int ordered_set_put_in4_addrv(OrderedSet *s, static int manager_save(Manager *m) { _cleanup_ordered_set_free_free_ OrderedSet *dns = NULL, *ntp = NULL, *sip = NULL, *pop3 = NULL, - *search_domains = NULL, *route_domains = NULL; + *smtp = NULL, *search_domains = NULL, *route_domains = NULL; const char *operstate_str, *carrier_state_str, *address_state_str; LinkOperationalState operstate = LINK_OPERSTATE_OFF; LinkCarrierState carrier_state = LINK_CARRIER_STATE_OFF; @@ -1521,6 +1521,10 @@ static int manager_save(Manager *m) { pop3 = ordered_set_new(&string_hash_ops); if (!pop3) + return -ENOMEM; + + smtp = ordered_set_new(&string_hash_ops); + if (!smtp) return -ENOMEM; search_domains = ordered_set_new(&dns_name_hash_ops); @@ -1598,7 +1602,6 @@ static int manager_save(Manager *m) { return r; } - r = sd_dhcp_lease_get_pop3_server(link->dhcp_lease, &addresses); if (r > 0) { r = ordered_set_put_in4_addrv(pop3, addresses, r, in4_addr_is_non_local); @@ -1607,6 +1610,14 @@ static int manager_save(Manager *m) { } else if (r < 0 && r != -ENODATA) return r; + r = sd_dhcp_lease_get_smtp_server(link->dhcp_lease, &addresses); + if (r > 0) { + r = ordered_set_put_in4_addrv(smtp, addresses, r, in4_addr_is_non_local); + if (r < 0) + return r; + } else if (r < 0 && r != -ENODATA) + return r; + if (link->network->dhcp_use_domains != DHCP_USE_DOMAINS_NO) { const char *domainname; char **domains = NULL; @@ -1659,6 +1670,7 @@ static int manager_save(Manager *m) { ordered_set_print(f, "NTP=", ntp); ordered_set_print(f, "SIP=", sip); ordered_set_print(f, "POP3_SERVERS=", pop3); + ordered_set_print(f, "SMTP_SERVERS=", smtp); ordered_set_print(f, "DOMAINS=", search_domains); ordered_set_print(f, "ROUTE_DOMAINS=", route_domains); diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 25730b58f7..04d411c4ad 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -208,6 +208,7 @@ DHCPServer.NTP, config_parse_dhcp_server_ntp, DHCPServer.EmitSIP, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_sip) DHCPServer.SIP, config_parse_dhcp_server_sip, 0, 0 DHCPServer.POP3Servers, config_parse_dhcp_server_pop3_servers, 0, 0 +DHCPServer.SMTPServers, config_parse_dhcp_server_smtp_servers, 0, 0 DHCPServer.EmitRouter, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_router) DHCPServer.EmitTimezone, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_timezone) DHCPServer.Timezone, config_parse_timezone, 0, offsetof(Network, dhcp_server_timezone) diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 0007f78ae3..a71fac6790 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -652,6 +652,7 @@ static Network *network_free(Network *network) { strv_free(network->ntp); free(network->dns); strv_free(network->sip); + strv_free(network->smtp); ordered_set_free_free(network->search_domains); ordered_set_free_free(network->route_domains); strv_free(network->bind_carrier); diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h index 58b310f59e..fe28789784 100644 --- a/src/network/networkd-network.h +++ b/src/network/networkd-network.h @@ -150,6 +150,9 @@ struct Network { struct in_addr *dhcp_server_pop3; unsigned n_dhcp_server_pop3; + struct in_addr *dhcp_server_smtp; + unsigned n_dhcp_server_smtp; + bool dhcp_server_emit_router; bool dhcp_server_emit_timezone; char *dhcp_server_timezone; @@ -300,6 +303,7 @@ struct Network { char **ntp; char **sip; char **pop3; + char **smtp; char **bind_carrier; }; diff --git a/src/systemd/sd-dhcp-client.h b/src/systemd/sd-dhcp-client.h index b8ffe78468..dc2fd02afe 100644 --- a/src/systemd/sd-dhcp-client.h +++ b/src/systemd/sd-dhcp-client.h @@ -83,6 +83,7 @@ enum { SD_DHCP_OPTION_REBINDING_T2_TIME = 59, SD_DHCP_OPTION_VENDOR_CLASS_IDENTIFIER = 60, SD_DHCP_OPTION_CLIENT_IDENTIFIER = 61, + SD_DHCP_OPTION_SMTP_SERVER = 69, SD_DHCP_OPTION_POP3_SERVER = 70, SD_DHCP_OPTION_USER_CLASS = 77, SD_DHCP_OPTION_FQDN = 81, diff --git a/src/systemd/sd-dhcp-lease.h b/src/systemd/sd-dhcp-lease.h index e216c768d4..1ed5bf27a3 100644 --- a/src/systemd/sd-dhcp-lease.h +++ b/src/systemd/sd-dhcp-lease.h @@ -46,6 +46,7 @@ int sd_dhcp_lease_get_dns(sd_dhcp_lease *lease, const struct in_addr **addr); int sd_dhcp_lease_get_ntp(sd_dhcp_lease *lease, const struct in_addr **addr); int sd_dhcp_lease_get_sip(sd_dhcp_lease *lease, const struct in_addr **addr); int sd_dhcp_lease_get_pop3_server(sd_dhcp_lease *lease, const struct in_addr **addr); +int sd_dhcp_lease_get_smtp_server(sd_dhcp_lease *lease, const struct in_addr **addr); int sd_dhcp_lease_get_mtu(sd_dhcp_lease *lease, uint16_t *mtu); int sd_dhcp_lease_get_domainname(sd_dhcp_lease *lease, const char **domainname); int sd_dhcp_lease_get_search_domains(sd_dhcp_lease *lease, char ***domains); diff --git a/src/systemd/sd-dhcp-server.h b/src/systemd/sd-dhcp-server.h index 98db7aded5..5f04034b82 100644 --- a/src/systemd/sd-dhcp-server.h +++ b/src/systemd/sd-dhcp-server.h @@ -51,6 +51,7 @@ int sd_dhcp_server_set_dns(sd_dhcp_server *server, const struct in_addr dns[], u int sd_dhcp_server_set_ntp(sd_dhcp_server *server, const struct in_addr ntp[], unsigned n); int sd_dhcp_server_set_sip(sd_dhcp_server *server, const struct in_addr sip[], unsigned n); int sd_dhcp_server_set_pop3_server(sd_dhcp_server *server, const struct in_addr pop3_server[], unsigned n); +int sd_dhcp_server_set_smtp_server(sd_dhcp_server *server, const struct in_addr smtp_server[], unsigned n); int sd_dhcp_server_set_emit_router(sd_dhcp_server *server, int enabled); int sd_dhcp_server_add_option(sd_dhcp_server *server, sd_dhcp_option *v); diff --git a/src/systemd/sd-network.h b/src/systemd/sd-network.h index ea06c9d875..c185e2ce30 100644 --- a/src/systemd/sd-network.h +++ b/src/systemd/sd-network.h @@ -170,6 +170,9 @@ int sd_network_link_get_sip_servers(int ifindex, char ***sip); /* Get the pop3 servers for a given link. */ int sd_network_link_get_pop3_servers(int ifindex, char ***pop3); +/* Get the SMTP servers for a given link. */ +int sd_network_link_get_smtp_servers(int ifindex, char ***smtp); + /* Get whether this link shall be used as 'default route' for DNS queries */ int sd_network_link_get_dns_default_route(int ifindex); |