mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-21 10:14:41 +00:00
initrd: parse 'rd.net.timeout.dhcp' option
This commit is contained in:
parent
93d7a9b005
commit
fbf54ab182
|
@ -132,6 +132,7 @@
|
|||
<member><option>nameserver</option></member>
|
||||
<member><option>rd.peerdns</option></member>
|
||||
<member><option>rd.bootif</option></member>
|
||||
<member><option>rd.net.timeout.dhcp</option></member>
|
||||
<member><option>BOOTIF</option></member>
|
||||
</simplelist>
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ typedef struct {
|
|||
|
||||
/* Parameters to be set for all connections */
|
||||
gboolean ignore_auto_dns;
|
||||
int dhcp_timeout;
|
||||
} Reader;
|
||||
|
||||
static Reader *
|
||||
|
@ -93,6 +94,7 @@ reader_create_connection (Reader *reader,
|
|||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
|
||||
NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, reader->ignore_auto_dns,
|
||||
NM_SETTING_IP_CONFIG_DHCP_TIMEOUT, reader->dhcp_timeout,
|
||||
NULL);
|
||||
|
||||
setting = nm_setting_ip6_config_new ();
|
||||
|
@ -102,6 +104,7 @@ reader_create_connection (Reader *reader,
|
|||
NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
|
||||
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE, (int) NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64,
|
||||
NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, reader->ignore_auto_dns,
|
||||
NM_SETTING_IP_CONFIG_DHCP_TIMEOUT, reader->dhcp_timeout,
|
||||
NULL);
|
||||
|
||||
setting = nm_setting_connection_new ();
|
||||
|
@ -898,6 +901,10 @@ nmi_cmdline_reader_parse (const char *sysfs_dir, const char *const*argv, char **
|
|||
net_ifnames = strcmp (argument, "0") != 0;
|
||||
else if (strcmp (tag, "rd.peerdns") == 0)
|
||||
reader->ignore_auto_dns = !_nm_utils_ascii_str_to_bool (argument, TRUE);
|
||||
else if (strcmp (tag, "rd.net.timeout.dhcp") == 0) {
|
||||
reader->dhcp_timeout = _nm_utils_ascii_str_to_int64 (argument,
|
||||
10, 0, G_MAXINT32, 0);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; argv[i]; i++) {
|
||||
|
|
|
@ -623,7 +623,9 @@ static void
|
|||
test_bridge (void)
|
||||
{
|
||||
gs_unref_hashtable GHashTable *connections = NULL;
|
||||
const char *const*ARGV = NM_MAKE_STRV ("bridge=bridge0:eth0,eth1", "rd.route=192.0.2.53::bridge0");
|
||||
const char *const*ARGV = NM_MAKE_STRV ("bridge=bridge0:eth0,eth1",
|
||||
"rd.route=192.0.2.53::bridge0",
|
||||
"rd.net.timeout.dhcp=10");
|
||||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
|
@ -653,6 +655,7 @@ test_bridge (void)
|
|||
g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip4), ==, 0);
|
||||
g_assert (!nm_setting_ip_config_get_gateway (s_ip4));
|
||||
g_assert_cmpint (nm_setting_ip_config_get_num_routes (s_ip4), ==, 1);
|
||||
g_assert_cmpint (nm_setting_ip_config_get_dhcp_timeout(s_ip4), ==, 10);
|
||||
ip_route = nm_setting_ip_config_get_route (s_ip4, 0);
|
||||
g_assert_cmpstr (nm_ip_route_get_dest (ip_route), ==, "192.0.2.53");
|
||||
g_assert_cmpint (nm_ip_route_get_family (ip_route), ==, AF_INET);
|
||||
|
@ -667,6 +670,8 @@ test_bridge (void)
|
|||
g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip6), ==, 0);
|
||||
g_assert (!nm_setting_ip_config_get_gateway (s_ip6));
|
||||
g_assert_cmpint (nm_setting_ip_config_get_num_routes (s_ip6), ==, 0);
|
||||
g_assert_cmpint (nm_setting_ip_config_get_dhcp_timeout(s_ip6), ==, 10);
|
||||
|
||||
|
||||
s_bridge = nm_connection_get_setting_bridge (connection);
|
||||
g_assert (s_bridge);
|
||||
|
|
Loading…
Reference in a new issue