dhcp: rename mudurl to mud_url

This commit is contained in:
Thomas Haller 2020-04-24 08:12:24 +02:00
parent 468c2e01ab
commit db645623ee
14 changed files with 63 additions and 63 deletions

View file

@ -768,7 +768,6 @@ nm_setting_connection_get_mud_url (NMSettingConnection *setting)
return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->mud_url;
}
/**
* nm_setting_connection_add_secondary:
* @setting: the #NMSettingConnection

View file

@ -50,7 +50,7 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMDhcpClient,
PROP_IAID_EXPLICIT,
PROP_HOSTNAME,
PROP_HOSTNAME_FLAGS,
PROP_MUDURL,
PROP_MUD_URL,
);
typedef struct _NMDhcpClientPrivate {
@ -61,7 +61,7 @@ typedef struct _NMDhcpClientPrivate {
char * uuid;
GBytes * client_id;
char * hostname;
char * mudurl;
char * mud_url;
pid_t pid;
guint timeout_id;
guint watch_id;
@ -315,11 +315,11 @@ nm_dhcp_client_get_use_fqdn (NMDhcpClient *self)
}
const char *
nm_dhcp_client_get_mudurl (NMDhcpClient *self)
nm_dhcp_client_get_mud_url (NMDhcpClient *self)
{
g_return_val_if_fail (NM_IS_DHCP_CLIENT (self), NULL);
return NM_DHCP_CLIENT_GET_PRIVATE (self)->mudurl;
return NM_DHCP_CLIENT_GET_PRIVATE (self)->mud_url;
}
/*****************************************************************************/
@ -980,8 +980,8 @@ get_property (GObject *object, guint prop_id,
case PROP_HOSTNAME:
g_value_set_string (value, priv->hostname);
break;
case PROP_MUDURL:
g_value_set_string (value, priv->mudurl);
case PROP_MUD_URL:
g_value_set_string (value, priv->mud_url);
break;
case PROP_ROUTE_METRIC:
g_value_set_uint (value, priv->route_metric);
@ -1065,9 +1065,9 @@ set_property (GObject *object, guint prop_id,
/* construct-only */
priv->hostname_flags = g_value_get_uint (value);
break;
case PROP_MUDURL:
case PROP_MUD_URL:
/* construct-only */
priv->mudurl = g_value_dup_string (value);
priv->mud_url = g_value_dup_string (value);
break;
case PROP_ROUTE_TABLE:
priv->route_table = g_value_get_uint (value);
@ -1208,8 +1208,8 @@ nm_dhcp_client_class_init (NMDhcpClientClass *client_class)
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_properties[PROP_MUDURL] =
g_param_spec_string (NM_DHCP_CLIENT_MUDURL, "", "",
obj_properties[PROP_MUD_URL] =
g_param_spec_string (NM_DHCP_CLIENT_MUD_URL, "", "",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);

View file

@ -30,7 +30,7 @@
#define NM_DHCP_CLIENT_INTERFACE "iface"
#define NM_DHCP_CLIENT_MULTI_IDX "multi-idx"
#define NM_DHCP_CLIENT_HOSTNAME "hostname"
#define NM_DHCP_CLIENT_MUDURL "mudurl"
#define NM_DHCP_CLIENT_MUD_URL "mud-url"
#define NM_DHCP_CLIENT_ROUTE_METRIC "route-metric"
#define NM_DHCP_CLIENT_ROUTE_TABLE "route-table"
#define NM_DHCP_CLIENT_TIMEOUT "timeout"
@ -142,7 +142,7 @@ gboolean nm_dhcp_client_get_iaid_explicit (NMDhcpClient *self);
GBytes *nm_dhcp_client_get_client_id (NMDhcpClient *self);
const char *nm_dhcp_client_get_hostname (NMDhcpClient *self);
const char *nm_dhcp_client_get_mudurl (NMDhcpClient *self);
const char *nm_dhcp_client_get_mud_url (NMDhcpClient *self);
NMDhcpHostnameFlags nm_dhcp_client_get_hostname_flags (NMDhcpClient *self);

View file

@ -190,19 +190,19 @@ add_hostname6 (GString *str,
}
}
static void add_mudurl_config(GString *str, const char *mudurl, int addr_family) {
if (mudurl) {
if (addr_family == AF_INET) {
g_string_append (str, MUDURLv4_DEF);
g_string_append_printf (str, MUDURLv4_FMT, mudurl);
static void add_mud_url_config(GString *str, const char *mud_url, int addr_family)
{
if (mud_url) {
if (addr_family == AF_INET) {
g_string_append (str, MUDURLv4_DEF);
g_string_append_printf (str, MUDURLv4_FMT, mud_url);
} else {
g_string_append (str, MUDURLv6_DEF);
g_string_append_printf (str, MUDURLv6_FMT, mudurl);
g_string_append (str, MUDURLv6_DEF);
g_string_append_printf (str, MUDURLv6_FMT, mud_url);
}
}
}
static GBytes *
read_client_id (const char *str)
{
@ -306,7 +306,7 @@ nm_dhcp_dhclient_create_config (const char *interface,
guint32 timeout,
gboolean use_fqdn,
NMDhcpHostnameFlags hostname_flags,
const char *mudurl,
const char *mud_url,
const char *orig_path,
const char *orig_contents,
GBytes **out_new_client_id)
@ -472,9 +472,9 @@ nm_dhcp_dhclient_create_config (const char *interface,
g_string_append_printf (new_contents, "timeout %u;\n", timeout);
}
add_mudurl_config(new_contents,mudurl,addr_family);
add_mud_url_config (new_contents, mud_url, addr_family);
if (addr_family == AF_INET) {
add_ip4_config (new_contents, client_id, hostname, use_fqdn, hostname_flags);
add_ip4_config (new_contents, client_id, hostname, use_fqdn, hostname_flags);
add_request (reqs, "rfc3442-classless-static-routes");
add_request (reqs, "ms-classless-static-routes");
add_request (reqs, "static-routes");
@ -482,7 +482,7 @@ nm_dhcp_dhclient_create_config (const char *interface,
add_request (reqs, "ntp-servers");
add_request (reqs, "root-path");
} else {
add_hostname6 (new_contents, hostname, hostname_flags);
add_hostname6 (new_contents, hostname, hostname_flags);
add_request (reqs, "dhcp6.name-servers");
add_request (reqs, "dhcp6.domain-search");

View file

@ -17,7 +17,7 @@ char *nm_dhcp_dhclient_create_config (const char *interface,
guint32 timeout,
gboolean use_fqdn,
NMDhcpHostnameFlags hostname_flags,
const char *mudurl,
const char *mud_url,
const char *orig_path,
const char *orig_contents,
GBytes **out_new_client_id);

View file

@ -147,7 +147,7 @@ merge_dhclient_config (NMDhcpDhclient *self,
guint32 timeout,
gboolean use_fqdn,
NMDhcpHostnameFlags hostname_flags,
const char *mudurl,
const char *mud_url,
const char *orig_path,
GBytes **out_new_client_id,
GError **error)
@ -177,7 +177,7 @@ merge_dhclient_config (NMDhcpDhclient *self,
timeout,
use_fqdn,
hostname_flags,
mudurl,
mud_url,
orig_path,
orig,
out_new_client_id);
@ -270,7 +270,7 @@ create_dhclient_config (NMDhcpDhclient *self,
guint32 timeout,
gboolean use_fqdn,
NMDhcpHostnameFlags hostname_flags,
const char *mudurl,
const char *mud_url,
GBytes **out_new_client_id)
{
gs_free char *orig = NULL;
@ -299,7 +299,7 @@ create_dhclient_config (NMDhcpDhclient *self,
timeout,
use_fqdn,
hostname_flags,
mudurl,
mud_url,
orig,
out_new_client_id,
&error)) {
@ -500,7 +500,7 @@ ip4_start (NMDhcpClient *client,
nm_dhcp_client_get_timeout (client),
nm_dhcp_client_get_use_fqdn (client),
nm_dhcp_client_get_hostname_flags (client),
nm_dhcp_client_get_mudurl (client),
nm_dhcp_client_get_mud_url (client),
&new_client_id);
if (!priv->conf_file) {
nm_utils_error_set_literal (error,
@ -545,7 +545,7 @@ ip6_start (NMDhcpClient *client,
nm_dhcp_client_get_timeout (client),
TRUE,
nm_dhcp_client_get_hostname_flags (client),
nm_dhcp_client_get_mudurl (client),
nm_dhcp_client_get_mud_url (client),
NULL);
if (!priv->conf_file) {
nm_utils_error_set_literal (error,

View file

@ -220,7 +220,7 @@ client_start (NMDhcpManager *self,
const char *hostname,
gboolean hostname_use_fqdn,
NMDhcpHostnameFlags hostname_flags,
const char *mudurl,
const char *mud_url,
gboolean info_only,
NMSettingIP6ConfigPrivacy privacy,
const char *last_ip4_address,
@ -304,7 +304,7 @@ client_start (NMDhcpManager *self,
NM_DHCP_CLIENT_IAID, (guint) iaid,
NM_DHCP_CLIENT_IAID_EXPLICIT, iaid_explicit,
NM_DHCP_CLIENT_HOSTNAME, hostname,
NM_DHCP_CLIENT_MUDURL, mudurl,
NM_DHCP_CLIENT_MUD_URL, mud_url,
NM_DHCP_CLIENT_ROUTE_TABLE, (guint) route_table,
NM_DHCP_CLIENT_ROUTE_METRIC, (guint) route_metric,
NM_DHCP_CLIENT_TIMEOUT, (guint) timeout,
@ -384,7 +384,7 @@ nm_dhcp_manager_start_ip4 (NMDhcpManager *self,
const char *dhcp_hostname,
const char *dhcp_fqdn,
NMDhcpHostnameFlags hostname_flags,
const char *mudurl,
const char *mud_url,
GBytes *dhcp_client_id,
guint32 timeout,
const char *dhcp_anycast_addr,
@ -443,7 +443,7 @@ nm_dhcp_manager_start_ip4 (NMDhcpManager *self,
hostname,
use_fqdn,
hostname_flags,
mudurl,
mud_url,
FALSE,
0,
last_ip_address,
@ -466,7 +466,7 @@ nm_dhcp_manager_start_ip6 (NMDhcpManager *self,
gboolean send_hostname,
const char *dhcp_hostname,
NMDhcpHostnameFlags hostname_flags,
const char *mudurl,
const char *mud_url,
GBytes *duid,
gboolean enforce_duid,
guint32 iaid,
@ -508,7 +508,7 @@ nm_dhcp_manager_start_ip6 (NMDhcpManager *self,
hostname,
TRUE,
hostname_flags,
mudurl,
mud_url,
info_only,
privacy,
NULL,

View file

@ -43,7 +43,7 @@ NMDhcpClient * nm_dhcp_manager_start_ip4 (NMDhcpManager *manager,
const char *dhcp_hostname,
const char *dhcp_fqdn,
NMDhcpHostnameFlags hostname_flags,
const char *mudurl,
const char *mud_url,
GBytes *dhcp_client_id,
guint32 timeout,
const char *dhcp_anycast_addr,
@ -63,7 +63,7 @@ NMDhcpClient * nm_dhcp_manager_start_ip6 (NMDhcpManager *manager,
gboolean send_hostname,
const char *dhcp_hostname,
NMDhcpHostnameFlags hostname_flags,
const char *mudurl,
const char *mud_url,
GBytes *duid,
gboolean enforce_duid,
guint32 iaid,

View file

@ -1285,7 +1285,7 @@ ip4_start (NMDhcpClient *client,
gs_free char *lease_file = NULL;
struct in_addr last_addr = { 0 };
const char *hostname;
const char *mudurl;
const char *mud_url;
int r, i;
g_return_val_if_fail (!priv->probe, FALSE);
@ -1342,13 +1342,15 @@ ip4_start (NMDhcpClient *client,
}
}
mudurl = nm_dhcp_client_get_mudurl (client);
if (mudurl) {
mud_url = nm_dhcp_client_get_mud_url (client);
if (mud_url) {
r = n_dhcp4_client_probe_config_append_option (config,
NM_DHCP_OPTION_DHCP4_MUDURL, mudurl, strlen (mudurl));
if ( r ) {
nm_utils_error_set_errno (error, r,
"failed to set MUD URL: %s");
NM_DHCP_OPTION_DHCP4_MUD_URL,
mud_url,
strlen (mud_url));
if (r) {
nm_utils_error_set_errno (error, r,
"failed to set MUD URL: %s");
}
}
hostname = nm_dhcp_client_get_hostname (client);

View file

@ -126,7 +126,7 @@ const NMDhcpOption _nm_dhcp_option_dhcp4_options[] = {
REQ (NM_DHCP_OPTION_DHCP4_TFTP_SERVER_ADDRESS, "tftp_server_address", FALSE ),
REQ (NM_DHCP_OPTION_DHCP4_V4_PORTPARAMS, "v4_portparams", FALSE ),
REQ (NM_DHCP_OPTION_DHCP4_V4_CAPTIVE_PORTAL, "v4_captive_portal", FALSE ),
REQ (NM_DHCP_OPTION_DHCP4_MUDURL, "mud_url", FALSE ),
REQ (NM_DHCP_OPTION_DHCP4_MUD_URL, "mud_url", FALSE ),
REQ (NM_DHCP_OPTION_DHCP4_LOADER_CONFIGFILE, "loader_configfile", FALSE ),
REQ (NM_DHCP_OPTION_DHCP4_LOADER_PATHPREFIX, "loader_pathprefix", FALSE ),
REQ (NM_DHCP_OPTION_DHCP4_LOADER_REBOOTTIME, "loader_reboottime", FALSE ),
@ -183,7 +183,8 @@ const NMDhcpOption _nm_dhcp_option_dhcp6_options[] = {
REQ (NM_DHCP_OPTION_DHCP6_DNS_SERVERS, "dhcp6_name_servers", TRUE ),
REQ (NM_DHCP_OPTION_DHCP6_DOMAIN_LIST, "dhcp6_domain_search", TRUE ),
REQ (NM_DHCP_OPTION_DHCP6_SNTP_SERVERS, "dhcp6_sntp_servers", TRUE ),
REQ (NM_DHCP_OPTION_DHCP6_MUDURL, "dhcp6_mud_url", FALSE ),
REQ (NM_DHCP_OPTION_DHCP6_MUD_URL, "dhcp6_mud_url", FALSE ),
/* Internal values */
REQ (NM_DHCP_OPTION_DHCP6_NM_IP_ADDRESS, "ip6_address", FALSE ),
REQ (NM_DHCP_OPTION_DHCP6_NM_PREFIXLEN, "ip6_prefixlen", FALSE ),

View file

@ -110,7 +110,7 @@ typedef enum {
NM_DHCP_OPTION_DHCP4_TFTP_SERVER_ADDRESS = 150,
NM_DHCP_OPTION_DHCP4_V4_PORTPARAMS = 159,
NM_DHCP_OPTION_DHCP4_V4_CAPTIVE_PORTAL = 160,
NM_DHCP_OPTION_DHCP4_MUDURL = 161,
NM_DHCP_OPTION_DHCP4_MUD_URL = 161,
NM_DHCP_OPTION_DHCP4_LOADER_CONFIGFILE = 209,
NM_DHCP_OPTION_DHCP4_LOADER_PATHPREFIX = 210,
NM_DHCP_OPTION_DHCP4_LOADER_REBOOTTIME = 211,
@ -160,7 +160,7 @@ typedef enum {
NM_DHCP_OPTION_DHCP6_DNS_SERVERS = 23,
NM_DHCP_OPTION_DHCP6_DOMAIN_LIST = 24,
NM_DHCP_OPTION_DHCP6_SNTP_SERVERS = 31,
NM_DHCP_OPTION_DHCP6_MUDURL = 112,
NM_DHCP_OPTION_DHCP6_MUD_URL = 112,
/* Internal values */
NM_DHCP_OPTION_DHCP6_NM_IP_ADDRESS = 1026,
NM_DHCP_OPTION_DHCP6_NM_PREFIXLEN = 1027,

View file

@ -573,7 +573,7 @@ ip4_start (NMDhcpClient *client,
size_t client_id_len;
struct in_addr last_addr = { 0 };
const char *hostname;
const char *mudurl;
const char *mud_url;
int r, i;
g_return_val_if_fail (!priv->client4, FALSE);
@ -689,10 +689,9 @@ ip4_start (NMDhcpClient *client,
}
}
mudurl = nm_dhcp_client_get_mudurl (client);
if ( mudurl ) {
r = sd_dhcp_client_set_mud_url (sd_client, mudurl);
mud_url = nm_dhcp_client_get_mud_url (client);
if (mud_url) {
r = sd_dhcp_client_set_mud_url (sd_client, mud_url);
if (r < 0) {
nm_utils_error_set_errno (error, r, "failed to set DHCP MUDURL: %s");
return FALSE;

View file

@ -35,7 +35,7 @@ test_config (const char *orig,
GBytes *expected_new_client_id,
const char *iface,
const char *anycast_addr,
const char *mudurl)
const char *mud_url)
{
gs_free char *new = NULL;
gs_unref_bytes GBytes *client_id = NULL;
@ -54,7 +54,7 @@ test_config (const char *orig,
timeout,
use_fqdn,
hostname_flags,
mudurl,
mud_url,
"/path/to/dhclient.conf",
orig,
&new_client_id);
@ -109,7 +109,7 @@ test_orig_missing (void)
/*****************************************************************************/
static const char *orig_missing_add_mudurl_expected = \
static const char *orig_missing_add_mud_url_expected = \
"# Created by NetworkManager\n"
"\n"
"option mudurl code 161 = text;\n"
@ -127,10 +127,10 @@ static const char *orig_missing_add_mudurl_expected = \
"\n";
static void
test_orig_missing_add_mudurl (void)
test_orig_missing_add_mud_url (void)
{
test_config (NULL,
orig_missing_add_mudurl_expected,
orig_missing_add_mud_url_expected,
AF_INET, NULL, 0, FALSE,
NM_DHCP_HOSTNAME_FLAG_NONE,
NULL, NULL, "eth0", NULL, TEST_MUDURL);
@ -1216,7 +1216,7 @@ main (int argc, char **argv)
nmtst_init_with_logging (&argc, &argv, NULL, "DEFAULT");
g_test_add_func ("/dhcp/dhclient/orig_missing", test_orig_missing);
g_test_add_func ("/dhcp/dhclient/orig_missing_add_mudurl", test_orig_missing_add_mudurl);
g_test_add_func ("/dhcp/dhclient/orig_missing_add_mud_url", test_orig_missing_add_mud_url);
g_test_add_func ("/dhcp/dhclient/override_client_id", test_override_client_id);
g_test_add_func ("/dhcp/dhclient/quote_client_id/1", test_quote_client_id);
g_test_add_func ("/dhcp/dhclient/quote_client_id/2", test_quote_client_id_2);

View file

@ -2209,7 +2209,6 @@ make_ip6_setting (shvarFile *ifcfg,
if (v && !strchr (v, '.'))
v = NULL;
}
if (v)
g_object_set (s_ip6, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, v, NULL);