platform: avoid double log messages

Certain platform operations are logged both in nm-platform.c and
nm-linux-platform.c, resulting in duplicate messages.  Drop log prints
from the latter.
This commit is contained in:
Beniamino Galvani
2018-05-28 17:42:56 +02:00
parent 052d76cf82
commit 2ac5860a06
2 changed files with 9 additions and 90 deletions

View File

@@ -233,8 +233,6 @@ G_STATIC_ASSERT (RTA_MAX == (__RTA_MAX - 1));
} \
} G_STMT_END
#define LOG_FMT_IP_TUNNEL "adding %s '%s' parent %u local %s remote %s"
/******************************************************************
* Forward declarations and enums
******************************************************************/
@@ -4906,8 +4904,6 @@ link_set_netns (NMPlatform *platform,
{
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
_LOGD ("link: move link %d to network namespace with fd %d", ifindex, netns_fd);
nlmsg = _nl_msg_new_link (RTM_NEWLINK,
0,
ifindex,
@@ -5107,10 +5103,6 @@ link_set_address (NMPlatform *platform, int ifindex, gconstpointer address, size
if (!address || !length)
g_return_val_if_reached (NM_PLATFORM_ERROR_BUG);
_LOGD ("link: change %d: address: %s (%lu bytes)", ifindex,
(mac = nm_utils_hwaddr_ntoa (address, length)),
(unsigned long) length);
nlmsg = _nl_msg_new_link (RTM_NEWLINK,
0,
ifindex,
@@ -5132,8 +5124,6 @@ link_set_name (NMPlatform *platform, int ifindex, const char *name)
{
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
_LOGD ("link: change %d: name: %s", ifindex, name);
nlmsg = _nl_msg_new_link (RTM_NEWLINK,
0,
ifindex,
@@ -5169,8 +5159,6 @@ link_set_mtu (NMPlatform *platform, int ifindex, guint32 mtu)
{
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
_LOGD ("link: change %d: mtu: %u", ifindex, (unsigned) mtu);
nlmsg = _nl_msg_new_link (RTM_NEWLINK,
0,
ifindex,
@@ -5294,10 +5282,6 @@ vlan_add (NMPlatform *platform,
G_STATIC_ASSERT (NM_VLAN_FLAG_MVRP == (guint32) VLAN_FLAG_MVRP);
vlan_flags &= (guint32) NM_VLAN_FLAGS_ALL;
_LOGD ("link: add vlan '%s', parent %d, vlan id %d, flags %X",
name, parent, vlan_id, (unsigned) vlan_flags);
nlmsg = _nl_msg_new_link (RTM_NEWLINK,
NLM_F_CREATE | NLM_F_EXCL,
0,
@@ -5333,14 +5317,6 @@ link_gre_add (NMPlatform *platform,
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
struct nlattr *info;
struct nlattr *data;
char buffer[INET_ADDRSTRLEN];
_LOGD (LOG_FMT_IP_TUNNEL,
"gre",
name,
props->parent_ifindex,
nm_utils_inet4_ntop (props->local, NULL),
nm_utils_inet4_ntop (props->remote, buffer));
nlmsg = _nl_msg_new_link (RTM_NEWLINK,
NLM_F_CREATE | NLM_F_EXCL,
@@ -5388,16 +5364,8 @@ link_ip6tnl_add (NMPlatform *platform,
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
struct nlattr *info;
struct nlattr *data;
char buffer[INET_ADDRSTRLEN];
guint32 flowinfo;
_LOGD (LOG_FMT_IP_TUNNEL,
"ip6tnl",
name,
props->parent_ifindex,
nm_utils_inet6_ntop (&props->local, NULL),
nm_utils_inet6_ntop (&props->remote, buffer));
nlmsg = _nl_msg_new_link (RTM_NEWLINK,
NLM_F_CREATE | NLM_F_EXCL,
0,
@@ -5450,14 +5418,6 @@ link_ipip_add (NMPlatform *platform,
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
struct nlattr *info;
struct nlattr *data;
char buffer[INET_ADDRSTRLEN];
_LOGD (LOG_FMT_IP_TUNNEL,
"ipip",
name,
props->parent_ifindex,
nm_utils_inet4_ntop (props->local, NULL),
nm_utils_inet4_ntop (props->remote, buffer));
nlmsg = _nl_msg_new_link (RTM_NEWLINK,
NLM_F_CREATE | NLM_F_EXCL,
@@ -5503,11 +5463,6 @@ link_macsec_add (NMPlatform *platform,
struct nlattr *info;
struct nlattr *data;
_LOGD ("adding macsec '%s' parent %u sci %llx",
name,
parent,
(unsigned long long) props->sci);
nlmsg = _nl_msg_new_link (RTM_NEWLINK,
NLM_F_CREATE | NLM_F_EXCL,
0,
@@ -5565,12 +5520,6 @@ link_macvlan_add (NMPlatform *platform,
struct nlattr *info;
struct nlattr *data;
_LOGD ("adding %s '%s' parent %u mode %u",
props->tap ? "macvtap" : "macvlan",
name,
parent,
props->mode);
nlmsg = _nl_msg_new_link (RTM_NEWLINK,
NLM_F_CREATE | NLM_F_EXCL,
0,
@@ -5612,14 +5561,6 @@ link_sit_add (NMPlatform *platform,
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
struct nlattr *info;
struct nlattr *data;
char buffer[INET_ADDRSTRLEN];
_LOGD (LOG_FMT_IP_TUNNEL,
"sit",
name,
props->parent_ifindex,
nm_utils_inet4_ntop (props->local, NULL),
nm_utils_inet4_ntop (props->remote, buffer));
nlmsg = _nl_msg_new_link (RTM_NEWLINK,
NLM_F_CREATE | NLM_F_EXCL,
@@ -5723,9 +5664,6 @@ link_vxlan_add (NMPlatform *platform,
g_return_val_if_fail (props, FALSE);
_LOGD ("link: add vxlan '%s', parent %d, vxlan id %d",
name, props->parent_ifindex, props->id);
nlmsg = _nl_msg_new_link (RTM_NEWLINK,
NLM_F_CREATE | NLM_F_EXCL,
0,
@@ -5912,9 +5850,6 @@ link_vlan_change (NMPlatform *platform,
guint new_n_egress_map = 0;
gs_free NMVlanQosMapping *new_ingress_map = NULL;
gs_free NMVlanQosMapping *new_egress_map = NULL;
char s_flags[64];
char s_ingress[256];
char s_egress[256];
obj_cache = nmp_cache_lookup_link (nm_platform_get_cache (platform), ifindex);
if ( !obj_cache
@@ -5945,26 +5880,6 @@ link_vlan_change (NMPlatform *platform,
&new_egress_map,
&new_n_egress_map);
_LOGD ("link: change %d: vlan:%s%s%s",
ifindex,
flags_mask
? nm_sprintf_buf (s_flags, " flags 0x%x/0x%x", (unsigned) flags_set, (unsigned) flags_mask)
: "",
new_n_ingress_map
? nm_platform_vlan_qos_mapping_to_string (" ingress-qos-map",
new_ingress_map,
new_n_ingress_map,
s_ingress,
sizeof (s_ingress))
: "",
new_n_egress_map
? nm_platform_vlan_qos_mapping_to_string (" egress-qos-map",
new_egress_map,
new_n_egress_map,
s_egress,
sizeof (s_egress))
: "");
nlmsg = _nl_msg_new_link (RTM_NEWLINK,
0,
ifindex,
@@ -5991,8 +5906,6 @@ link_enslave (NMPlatform *platform, int master, int slave)
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
int ifindex = slave;
_LOGD ("link: change %d: enslave: master %d", slave, master);
nlmsg = _nl_msg_new_link (RTM_NEWLINK,
0,
ifindex,

View File

@@ -986,7 +986,7 @@ nm_platform_link_set_netns (NMPlatform *self, int ifindex, int netns_fd)
if (!pllink)
return FALSE;
_LOGD ("link: ifindex %d changing network namespace to %d", ifindex, netns_fd);
_LOGD ("link: move link %d to network namespace with fd %d", ifindex, netns_fd);
return klass->link_set_netns (self, ifindex, netns_fd);
}
@@ -1355,15 +1355,18 @@ nm_platform_link_set_user_ipv6ll_enabled (NMPlatform *self, int ifindex, gboolea
NMPlatformError
nm_platform_link_set_address (NMPlatform *self, int ifindex, gconstpointer address, size_t length)
{
gs_free char *mac = NULL;
_CHECK_SELF (self, klass, NM_PLATFORM_ERROR_BUG);
g_return_val_if_fail (ifindex > 0, NM_PLATFORM_ERROR_BUG);
g_return_val_if_fail (address, NM_PLATFORM_ERROR_BUG);
g_return_val_if_fail (length > 0, NM_PLATFORM_ERROR_BUG);
_LOGD ("link: setting %s (%d) hardware address",
_LOGD ("link: setting %s (%d) hardware address to %s",
nm_strquote_a (20, nm_platform_link_get_name (self, ifindex)),
ifindex);
ifindex,
(mac = nm_utils_hwaddr_ntoa (address, length)));
return klass->link_set_address (self, ifindex, address, length);
}
@@ -2437,6 +2440,9 @@ _infiniband_add_add_or_delete (NMPlatform *self,
if (!klass->infiniband_partition_add (self, parent, p_key, out_link))
return NM_PLATFORM_ERROR_UNSPECIFIED;
} else {
_LOGD ("link: deleting infiniband partition %s for parent '%s' (%d), key %d",
name, parent_link->name, parent, p_key);
if (!klass->infiniband_partition_delete (self, parent, p_key))
return NM_PLATFORM_ERROR_UNSPECIFIED;
}