networkd: support setting dhcp client listen port (#4631)

Allow setting custom port for the DHCP client to listen on in networkd.

[DHCP]
ListenPort=6677
This commit is contained in:
Susant Sahani
2016-11-10 18:34:19 -05:00
committed by Zbigniew Jędrzejewski-Szmek
parent a1ef6bd1e3
commit 9faed222fc
10 changed files with 50 additions and 16 deletions
+6
View File
@@ -630,6 +630,12 @@ int dhcp4_configure(Link *link) {
return r;
}
if (link->network->dhcp_client_port) {
r = sd_dhcp_client_set_client_port(link->dhcp_client, link->network->dhcp_client_port);
if (r < 0)
return r;
}
switch (link->network->dhcp_client_identifier) {
case DHCP_CLIENT_ID_DUID: {
/* If configured, apply user specified DUID and/or IAID */
+1
View File
@@ -100,6 +100,7 @@ DHCP.RouteMetric, config_parse_unsigned,
DHCP.RouteTable, config_parse_dhcp_route_table, 0, offsetof(Network, dhcp_route_table)
DHCP.UseTimezone, config_parse_bool, 0, offsetof(Network, dhcp_use_timezone)
DHCP.IAID, config_parse_iaid, 0, offsetof(Network, iaid)
DHCP.ListenPort, config_parse_uint32, 0, offsetof(Network, dhcp_client_port)
IPv6AcceptRA.UseDNS, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_dns)
IPv6AcceptRA.UseDomains, config_parse_dhcp_use_domains, 0, offsetof(Network, ipv6_accept_ra_use_domains)
IPv6AcceptRA.RouteTable, config_parse_dhcp_route_table, 0, offsetof(Network, ipv6_accept_ra_route_table)
+1
View File
@@ -124,6 +124,7 @@ struct Network {
bool dhcp_use_timezone;
unsigned dhcp_route_metric;
uint32_t dhcp_route_table;
uint32_t dhcp_client_port;
/* DHCP Server Support */
bool dhcp_server;