diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-address.c | 4 | ||||
-rw-r--r-- | src/network/networkd-dhcp4.c | 64 | ||||
-rw-r--r-- | src/network/networkd-ipv4ll.c | 16 | ||||
-rw-r--r-- | src/network/networkd-link.c | 182 | ||||
-rw-r--r-- | src/network/networkd-link.h | 16 | ||||
-rw-r--r-- | src/network/networkd-netdev-bond.c | 12 | ||||
-rw-r--r-- | src/network/networkd-netdev-macvlan.c | 2 | ||||
-rw-r--r-- | src/network/networkd-netdev-tunnel.c | 38 | ||||
-rw-r--r-- | src/network/networkd-netdev-tuntap.c | 10 | ||||
-rw-r--r-- | src/network/networkd-netdev-veth.c | 6 | ||||
-rw-r--r-- | src/network/networkd-netdev-vlan.c | 2 | ||||
-rw-r--r-- | src/network/networkd-netdev-vxlan.c | 12 | ||||
-rw-r--r-- | src/network/networkd-netdev.c | 70 | ||||
-rw-r--r-- | src/network/networkd-netdev.h | 6 | ||||
-rw-r--r-- | src/network/networkd.h | 16 |
15 files changed, 228 insertions, 228 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index ce85109d22..cf49909858 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -251,11 +251,11 @@ static int address_acquire(Link *link, Address *original, Address **ret) { * Then let's acquire something more useful from the pool. */ r = manager_address_pool_acquire(link->manager, original->family, original->prefixlen, &in_addr); if (r < 0) { - log_error_link(link, "Failed to acquire address from pool: %s", strerror(-r)); + log_link_error(link, "Failed to acquire address from pool: %s", strerror(-r)); return r; } if (r == 0) { - log_error_link(link, "Couldn't find free address for interface, all taken."); + log_link_error(link, "Couldn't find free address for interface, all taken."); return -EBUSY; } diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index 63bfa86f99..0a8c8ba8e4 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -38,7 +38,7 @@ static int dhcp4_route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, r = sd_rtnl_message_get_errno(m); if (r < 0 && r != -EEXIST) { - log_error_link(link, "could not set DHCPv4 route: %s", + log_link_error(link, "could not set DHCPv4 route: %s", strerror(-r)); link_enter_failed(link); } @@ -61,7 +61,7 @@ static int link_set_dhcp_routes(Link *link) { r = sd_dhcp_lease_get_router(link->dhcp_lease, &gateway); if (r < 0 && r != -ENOENT) { - log_warning_link(link, + log_link_warning(link, "DHCP error: could not get gateway: %s", strerror(-r)); return r; @@ -73,7 +73,7 @@ static int link_set_dhcp_routes(Link *link) { r = sd_dhcp_lease_get_address(link->dhcp_lease, &address); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "DHCP error: could not get address: %s", strerror(-r)); return r; @@ -81,7 +81,7 @@ static int link_set_dhcp_routes(Link *link) { r = route_new_dynamic(&route, RTPROT_DHCP); if (r < 0) { - log_error_link(link, + log_link_error(link, "Could not allocate route: %s", strerror(-r)); return r; @@ -89,7 +89,7 @@ static int link_set_dhcp_routes(Link *link) { r = route_new_dynamic(&route_gw, RTPROT_DHCP); if (r < 0) { - log_error_link(link, + log_link_error(link, "Could not allocate route: %s", strerror(-r)); return r; @@ -107,7 +107,7 @@ static int link_set_dhcp_routes(Link *link) { r = route_configure(route_gw, link, &dhcp4_route_handler); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "could not set host route: %s", strerror(-r)); return r; @@ -122,7 +122,7 @@ static int link_set_dhcp_routes(Link *link) { r = route_configure(route, link, &dhcp4_route_handler); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "could not set routes: %s", strerror(-r)); link_enter_failed(link); @@ -136,7 +136,7 @@ static int link_set_dhcp_routes(Link *link) { if (n == -ENOENT) return 0; if (n < 0) { - log_warning_link(link, + log_link_warning(link, "DHCP error: could not get routes: %s", strerror(-n)); @@ -148,7 +148,7 @@ static int link_set_dhcp_routes(Link *link) { r = route_new_dynamic(&route, RTPROT_DHCP); if (r < 0) { - log_error_link(link, "Could not allocate route: %s", + log_link_error(link, "Could not allocate route: %s", strerror(-r)); return r; } @@ -161,7 +161,7 @@ static int link_set_dhcp_routes(Link *link) { r = route_configure(route, link, &dhcp4_route_handler); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "could not set host route: %s", strerror(-r)); return r; @@ -184,7 +184,7 @@ static int dhcp_lease_lost(Link *link) { assert(link); assert(link->dhcp_lease); - log_warning_link(link, "DHCP lease lost"); + log_link_warning(link, "DHCP lease lost"); if (link->network->dhcp_routes) { struct sd_dhcp_route *routes; @@ -258,7 +258,7 @@ static int dhcp_lease_lost(Link *link) { if (r >= 0 && link->original_mtu != mtu) { r = link_set_mtu(link, link->original_mtu); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "DHCP error: could not reset MTU"); link_enter_failed(link); return r; @@ -273,7 +273,7 @@ static int dhcp_lease_lost(Link *link) { if (r >= 0 && hostname) { r = link_set_hostname(link, ""); if (r < 0) - log_error_link(link, + log_link_error(link, "Failed to reset transient hostname"); } } @@ -293,7 +293,7 @@ static int dhcp4_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, r = sd_rtnl_message_get_errno(m); if (r < 0 && r != -EEXIST) { - log_error_link(link, "could not set DHCPv4 address: %s", + log_link_error(link, "could not set DHCPv4 address: %s", strerror(-r)); link_enter_failed(link); } else if (r >= 0) { @@ -354,7 +354,7 @@ static int dhcp_lease_renew(sd_dhcp_client *client, Link *link) { r = sd_dhcp_client_get_lease(client, &lease); if (r < 0) { - log_warning_link(link, "DHCP error: no lease %s", + log_link_warning(link, "DHCP error: no lease %s", strerror(-r)); return r; } @@ -365,14 +365,14 @@ static int dhcp_lease_renew(sd_dhcp_client *client, Link *link) { r = sd_dhcp_lease_get_address(lease, &address); if (r < 0) { - log_warning_link(link, "DHCP error: no address: %s", + log_link_warning(link, "DHCP error: no address: %s", strerror(-r)); return r; } r = sd_dhcp_lease_get_netmask(lease, &netmask); if (r < 0) { - log_warning_link(link, "DHCP error: no netmask: %s", + log_link_warning(link, "DHCP error: no netmask: %s", strerror(-r)); return r; } @@ -381,7 +381,7 @@ static int dhcp_lease_renew(sd_dhcp_client *client, Link *link) { r = sd_dhcp_lease_get_lifetime(link->dhcp_lease, &lifetime); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "DHCP error: no lifetime: %s", strerror(-r)); return r; @@ -390,7 +390,7 @@ static int dhcp_lease_renew(sd_dhcp_client *client, Link *link) { r = dhcp4_update_address(link, &address, &netmask, lifetime); if (r < 0) { - log_warning_link(link, "could not update IP address: %s", + log_link_warning(link, "could not update IP address: %s", strerror(-r)); link_enter_failed(link); return r; @@ -413,21 +413,21 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) { r = sd_dhcp_client_get_lease(client, &lease); if (r < 0) { - log_warning_link(link, "DHCP error: no lease: %s", + log_link_warning(link, "DHCP error: no lease: %s", strerror(-r)); return r; } r = sd_dhcp_lease_get_address(lease, &address); if (r < 0) { - log_warning_link(link, "DHCP error: no address: %s", + log_link_warning(link, "DHCP error: no address: %s", strerror(-r)); return r; } r = sd_dhcp_lease_get_netmask(lease, &netmask); if (r < 0) { - log_warning_link(link, "DHCP error: no netmask: %s", + log_link_warning(link, "DHCP error: no netmask: %s", strerror(-r)); return r; } @@ -436,13 +436,13 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) { r = sd_dhcp_lease_get_router(lease, &gateway); if (r < 0 && r != -ENOENT) { - log_warning_link(link, "DHCP error: could not get gateway: %s", + log_link_warning(link, "DHCP error: could not get gateway: %s", strerror(-r)); return r; } if (r >= 0) - log_struct_link(LOG_INFO, link, + log_link_struct(LOG_INFO, link, "MESSAGE=%-*s: DHCPv4 address %u.%u.%u.%u/%u via %u.%u.%u.%u", IFNAMSIZ, link->ifname, @@ -457,7 +457,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) { ADDRESS_FMT_VAL(gateway), NULL); else - log_struct_link(LOG_INFO, link, + log_link_struct(LOG_INFO, link, "MESSAGE=%-*s: DHCPv4 address %u.%u.%u.%u/%u", IFNAMSIZ, link->ifname, @@ -478,7 +478,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) { if (r >= 0) { r = link_set_mtu(link, mtu); if (r < 0) - log_error_link(link, "Failed to set MTU " + log_link_error(link, "Failed to set MTU " "to %" PRIu16, mtu); } } @@ -490,7 +490,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) { if (r >= 0) { r = link_set_hostname(link, hostname); if (r < 0) - log_error_link(link, + log_link_error(link, "Failed to set transient hostname to '%s'", hostname); } @@ -500,7 +500,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) { r = sd_dhcp_lease_get_lifetime(link->dhcp_lease, &lifetime); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "DHCP error: no lifetime: %s", strerror(-r)); return r; @@ -509,7 +509,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) { r = dhcp4_update_address(link, &address, &netmask, lifetime); if (r < 0) { - log_warning_link(link, "could not update IP address: %s", + log_link_warning(link, "could not update IP address: %s", strerror(-r)); link_enter_failed(link); return r; @@ -533,7 +533,7 @@ static void dhcp4_handler(sd_dhcp_client *client, int event, void *userdata) { case DHCP_EVENT_STOP: case DHCP_EVENT_IP_CHANGE: if (link->network->dhcp_critical) { - log_error_link(link, + log_link_error(link, "DHCPv4 connection considered system critical, ignoring request to reconfigure it."); return; } @@ -571,11 +571,11 @@ static void dhcp4_handler(sd_dhcp_client *client, int event, void *userdata) { break; default: if (event < 0) - log_warning_link(link, + log_link_warning(link, "DHCP error: client failed: %s", strerror(-event)); else - log_warning_link(link, + log_link_warning(link, "DHCP unknown event: %d", event); break; diff --git a/src/network/networkd-ipv4ll.c b/src/network/networkd-ipv4ll.c index fd55f79693..beac939b39 100644 --- a/src/network/networkd-ipv4ll.c +++ b/src/network/networkd-ipv4ll.c @@ -40,11 +40,11 @@ static int ipv4ll_address_lost(Link *link) { if (r < 0) return 0; - log_debug_link(link, "IPv4 link-local release %u.%u.%u.%u", ADDRESS_FMT_VAL(addr)); + log_link_debug(link, "IPv4 link-local release %u.%u.%u.%u", ADDRESS_FMT_VAL(addr)); r = address_new_dynamic(&address); if (r < 0) { - log_error_link(link, "Could not allocate address: %s", strerror(-r)); + log_link_error(link, "Could not allocate address: %s", strerror(-r)); return r; } @@ -57,7 +57,7 @@ static int ipv4ll_address_lost(Link *link) { r = route_new_dynamic(&route, RTPROT_UNSPEC); if (r < 0) { - log_error_link(link, "Could not allocate route: %s", + log_link_error(link, "Could not allocate route: %s", strerror(-r)); return r; } @@ -82,7 +82,7 @@ static int ipv4ll_route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdat r = sd_rtnl_message_get_errno(m); if (r < 0 && r != -EEXIST) { - log_error_link(link, "could not set ipv4ll route: %s", strerror(-r)); + log_link_error(link, "could not set ipv4ll route: %s", strerror(-r)); link_enter_failed(link); } @@ -103,7 +103,7 @@ static int ipv4ll_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userd r = sd_rtnl_message_get_errno(m); if (r < 0 && r != -EEXIST) { - log_error_link(link, "could not set ipv4ll address: %s", strerror(-r)); + log_link_error(link, "could not set ipv4ll address: %s", strerror(-r)); link_enter_failed(link); } else if (r >= 0) { /* calling handler directly so take a ref */ @@ -134,7 +134,7 @@ static int ipv4ll_address_claimed(sd_ipv4ll *ll, Link *link) { else if (r < 0) return r; - log_debug_link(link, "IPv4 link-local claim %u.%u.%u.%u", + log_link_debug(link, "IPv4 link-local claim %u.%u.%u.%u", ADDRESS_FMT_VAL(address)); r = address_new_dynamic(&ll_addr); @@ -199,9 +199,9 @@ static void ipv4ll_handler(sd_ipv4ll *ll, int event, void *userdata){ break; default: if (event < 0) - log_warning_link(link, "IPv4 link-local error: %s", strerror(-event)); + log_link_warning(link, "IPv4 link-local error: %s", strerror(-event)); else - log_warning_link(link, "IPv4 link-local unknown event: %d", event); + log_link_warning(link, "IPv4 link-local unknown event: %d", event); break; } } diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index fcfbd3e123..b46ac5c3c3 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -89,7 +89,7 @@ static int link_update_flags(Link *link, sd_rtnl_message *m) { r = sd_rtnl_message_link_get_flags(m, &flags); if (r < 0) { - log_warning_link(link, "Could not get link flags"); + log_link_warning(link, "Could not get link flags"); return r; } @@ -103,7 +103,7 @@ static int link_update_flags(Link *link, sd_rtnl_message *m) { return 0; if (link->flags != flags) { - log_debug_link(link, "flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", + log_link_debug(link, "flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", FLAG_STRING("LOOPBACK", IFF_LOOPBACK, link->flags, flags), FLAG_STRING("MASTER", IFF_MASTER, link->flags, flags), FLAG_STRING("SLAVE", IFF_SLAVE, link->flags, flags), @@ -136,12 +136,12 @@ static int link_update_flags(Link *link, sd_rtnl_message *m) { /* link flags are currently at most 18 bits, let's align to * printing 20 */ if (unknown_flags_added) - log_debug_link(link, + log_link_debug(link, "unknown link flags gained: %#.5x (ignoring)", unknown_flags_added); if (unknown_flags_removed) - log_debug_link(link, + log_link_debug(link, "unknown link flags lost: %#.5x (ignoring)", unknown_flags_removed); } @@ -194,7 +194,7 @@ static int link_new(Manager *manager, sd_rtnl_message *message, Link **ret) { r = sd_rtnl_message_read_ether_addr(message, IFLA_ADDRESS, &link->mac); if (r < 0) - log_debug_link(link, "MAC address not found for new device, continuing without"); + log_link_debug(link, "MAC address not found for new device, continuing without"); r = asprintf(&link->state_file, "/run/systemd/netif/links/%d", link->ifindex); @@ -299,7 +299,7 @@ void link_drop(Link *link) { link->state = LINK_STATE_LINGER; - log_debug_link(link, "link removed"); + log_link_debug(link, "link removed"); link_unref(link); @@ -309,7 +309,7 @@ void link_drop(Link *link) { static void link_enter_unmanaged(Link *link) { assert(link); - log_debug_link(link, "unmanaged"); + log_link_debug(link, "unmanaged"); link->state = LINK_STATE_UNMANAGED; @@ -329,7 +329,7 @@ static int link_stop_clients(Link *link) { if (link->dhcp_client) { k = sd_dhcp_client_stop(link->dhcp_client); if (k < 0) { - log_warning_link(link, "Could not stop DHCPv4 client: %s", + log_link_warning(link, "Could not stop DHCPv4 client: %s", strerror(-r)); r = k; } @@ -338,7 +338,7 @@ static int link_stop_clients(Link *link) { if (link->ipv4ll) { k = sd_ipv4ll_stop(link->ipv4ll); if (k < 0) { - log_warning_link(link, "Could not stop IPv4 link-local: %s", + log_link_warning(link, "Could not stop IPv4 link-local: %s", strerror(-r)); r = k; } @@ -349,7 +349,7 @@ static int link_stop_clients(Link *link) { if (link->dhcp6_client) { k = sd_dhcp6_client_stop(link->dhcp6_client); if (k < 0) { - log_warning_link(link, "Could not stop DHCPv6 client: %s", + log_link_warning(link, "Could not stop DHCPv6 client: %s", strerror(-r)); r = k; } @@ -357,7 +357,7 @@ static int link_stop_clients(Link *link) { k = sd_icmp6_nd_stop(link->icmp6_router_discovery); if (k < 0) { - log_warning_link(link, + log_link_warning(link, "Could not stop ICMPv6 router discovery: %s", strerror(-r)); r = k; @@ -373,7 +373,7 @@ void link_enter_failed(Link *link) { if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)) return; - log_warning_link(link, "failed"); + log_link_warning(link, "failed"); link->state = LINK_STATE_FAILED; @@ -425,13 +425,13 @@ static int link_enter_configured(Link *link) { address = link_find_dhcp_server_address(link); if (!address) { - log_warning_link(link, + log_link_warning(link, "Failed to find suitable address for DHCPv4 server instance."); link_enter_failed(link); return 0; } - log_debug_link(link, "offering DHCPv4 leases"); + log_link_debug(link, "offering DHCPv4 leases"); r = sd_dhcp_server_set_address(link->dhcp_server, &address->in_addr.in, @@ -460,7 +460,7 @@ static int link_enter_configured(Link *link) { r = sd_dhcp_server_start(link->dhcp_server); if (r < 0) { - log_warning_link(link, "could not start DHCPv4 server " + log_link_warning(link, "could not start DHCPv4 server " "instance: %s", strerror(-r)); link_enter_failed(link); @@ -469,7 +469,7 @@ static int link_enter_configured(Link *link) { } } - log_info_link(link, "link configured"); + log_link_info(link, "link configured"); link->state = LINK_STATE_CONFIGURED; @@ -515,7 +515,7 @@ static int route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) { r = sd_rtnl_message_get_errno(m); if (r < 0 && r != -EEXIST) - log_struct_link(LOG_WARNING, link, + log_link_struct(LOG_WARNING, link, "MESSAGE=%-*s: could not set route: %s", IFNAMSIZ, link->ifname, strerror(-r), @@ -523,7 +523,7 @@ static int route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) { NULL); if (link->link_messages == 0) { - log_debug_link(link, "routes set"); + log_link_debug(link, "routes set"); link->static_configured = true; link_client_handler(link); } @@ -544,7 +544,7 @@ static int link_enter_set_routes(Link *link) { LIST_FOREACH(routes, rt, link->network->static_routes) { r = route_configure(rt, link, &route_handler); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "could not set routes: %s", strerror(-r)); link_enter_failed(link); @@ -558,7 +558,7 @@ static int link_enter_set_routes(Link *link) { link->static_configured = true; link_client_handler(link); } else - log_debug_link(link, "setting routes"); + log_link_debug(link, "setting routes"); return 0; } @@ -576,7 +576,7 @@ int link_route_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) { r = sd_rtnl_message_get_errno(m); if (r < 0 && r != -ESRCH) - log_struct_link(LOG_WARNING, link, + log_link_struct(LOG_WARNING, link, "MESSAGE=%-*s: could not drop route: %s", IFNAMSIZ, link->ifname, strerror(-r), @@ -598,14 +598,14 @@ int link_get_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) for (; m; m = sd_rtnl_message_next(m)) { r = sd_rtnl_message_get_errno(m); if (r < 0) { - log_debug_link(link, "getting address failed: %s", + log_link_debug(link, "getting address failed: %s", strerror(-r)); continue; } r = link_rtnl_process_address(rtnl, m, link->manager); if (r < 0) - log_warning_link(link, "could not process address: %s", + log_link_warning(link, "could not process address: %s", strerror(-r)); } @@ -631,7 +631,7 @@ static int address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) { r = sd_rtnl_message_get_errno(m); if (r < 0 && r != -EEXIST) - log_struct_link(LOG_WARNING, link, + log_link_struct(LOG_WARNING, link, "MESSAGE=%-*s: could not set address: %s", IFNAMSIZ, link->ifname, strerror(-r), @@ -644,7 +644,7 @@ static int address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) { } if (link->link_messages == 0) { - log_debug_link(link, "addresses set"); + log_link_debug(link, "addresses set"); link_enter_set_routes(link); } @@ -664,7 +664,7 @@ static int link_enter_set_addresses(Link *link) { LIST_FOREACH(addresses, ad, link->network->static_addresses) { r = address_configure(ad, link, &address_handler); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "could not set addresses: %s", strerror(-r)); link_enter_failed(link); @@ -677,7 +677,7 @@ static int link_enter_set_addresses(Link *link) { if (link->link_messages == 0) { link_enter_set_routes(link); } else - log_debug_link(link, "setting addresses"); + log_link_debug(link, "setting addresses"); return 0; } @@ -695,7 +695,7 @@ int link_address_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) r = sd_rtnl_message_get_errno(m); if (r < 0 && r != -EADDRNOTAVAIL) - log_struct_link(LOG_WARNING, link, + log_link_struct(LOG_WARNING, link, "MESSAGE=%-*s: could not drop address: %s", IFNAMSIZ, link->ifname, strerror(-r), @@ -717,7 +717,7 @@ static int set_hostname_handler(sd_bus *bus, sd_bus_message *m, void *userdata, r = sd_bus_message_get_errno(m); if (r > 0) - log_warning_link(link, "Could not set hostname: %s", + log_link_warning(link, "Could not set hostname: %s", strerror(r)); return 1; @@ -731,11 +731,11 @@ int link_set_hostname(Link *link, const char *hostname) { assert(link->manager); assert(hostname); - log_debug_link(link, "Setting transient hostname: '%s'", hostname); + log_link_debug(link, "Setting transient hostname: '%s'", hostname); if (!link->manager->bus) { /* TODO: replace by assert when we can rely on kdbus */ - log_info_link(link, + log_link_info(link, "Not connected to system bus, ignoring transient hostname."); return 0; } @@ -757,7 +757,7 @@ int link_set_hostname(Link *link, const char *hostname) { r = sd_bus_call_async(link->manager->bus, NULL, m, set_hostname_handler, link, 0); if (r < 0) { - log_error_link(link, "Could not set transient hostname: %s", + log_link_error(link, "Could not set transient hostname: %s", strerror(-r)); return r; } @@ -780,7 +780,7 @@ static int set_mtu_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) { r = sd_rtnl_message_get_errno(m); if (r < 0) - log_struct_link(LOG_WARNING, link, + log_link_struct(LOG_WARNING, link, "MESSAGE=%-*s: could not set MTU: %s", IFNAMSIZ, link->ifname, strerror(-r), "ERRNO=%d", -r, @@ -797,25 +797,25 @@ int link_set_mtu(Link *link, uint32_t mtu) { assert(link->manager); assert(link->manager->rtnl); - log_debug_link(link, "setting MTU: %" PRIu32, mtu); + log_link_debug(link, "setting MTU: %" PRIu32, mtu); r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINK, link->ifindex); if (r < 0) { - log_error_link(link, "Could not allocate RTM_SETLINK message"); + log_link_error(link, "Could not allocate RTM_SETLINK message"); return r; } r = sd_rtnl_message_append_u32(req, IFLA_MTU, mtu); if (r < 0) { - log_error_link(link, "Could not append MTU: %s", strerror(-r)); + log_link_error(link, "Could not append MTU: %s", strerror(-r)); return r; } r = sd_rtnl_call_async(link->manager->rtnl, req, set_mtu_handler, link, 0, NULL); if (r < 0) { - log_error_link(link, + log_link_error(link, "Could not send rtnetlink message: %s", strerror(-r)); return r; @@ -841,16 +841,16 @@ static void dhcp6_handler(sd_dhcp6_client *client, int event, void *userdata) { case DHCP6_EVENT_RESEND_EXPIRE: case DHCP6_EVENT_RETRANS_MAX: case DHCP6_EVENT_IP_ACQUIRE: - log_debug_link(link, "DHCPv6 event %d", event); + log_link_debug(link, "DHCPv6 event %d", event); break; default: if (event < 0) - log_warning_link(link, "DHCPv6 error: %s", + log_link_warning(link, "DHCPv6 error: %s", strerror(-event)); else - log_warning_link(link, "DHCPv6 unknown event: %d", + log_link_warning(link, "DHCPv6 unknown event: %d", event); return; } @@ -878,10 +878,10 @@ static void icmp6_router_handler(sd_icmp6_nd *nd, int event, void *userdata) { default: if (event < 0) - log_warning_link(link, "ICMPv6 error: %s", + log_link_warning(link, "ICMPv6 error: %s", strerror(-event)); else - log_warning_link(link, "ICMPv6 unknown event: %d", + log_link_warning(link, "ICMPv6 unknown event: %d", event); return; @@ -937,11 +937,11 @@ static int link_acquire_conf(Link *link) { if (link_ipv4ll_enabled(link)) { assert(link->ipv4ll); - log_debug_link(link, "acquiring IPv4 link-local address"); + log_link_debug(link, "acquiring IPv4 link-local address"); r = sd_ipv4ll_start(link->ipv4ll); if (r < 0) { - log_warning_link(link, "could not acquire IPv4 " + log_link_warning(link, "could not acquire IPv4 " "link-local address"); return r; } @@ -950,11 +950,11 @@ static int link_acquire_conf(Link *link) { if (link_dhcp4_enabled(link)) { assert(link->dhcp_client); - log_debug_link(link, "acquiring DHCPv4 lease"); + log_link_debug(link, "acquiring DHCPv4 lease"); r = sd_dhcp_client_start(link->dhcp_client); if (r < 0) { - log_warning_link(link, "could not acquire DHCPv4 " + log_link_warning(link, "could not acquire DHCPv4 " "lease"); return r; } @@ -963,11 +963,11 @@ static int link_acquire_conf(Link *link) { if (link_dhcp6_enabled(link)) { assert(link->icmp6_router_discovery); - log_debug_link(link, "discovering IPv6 routers"); + log_link_debug(link, "discovering IPv6 routers"); r = sd_icmp6_router_solicitation_start(link->icmp6_router_discovery); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "could not start IPv6 router discovery"); return r; } @@ -1003,7 +1003,7 @@ static int link_up_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) { if (r < 0) { /* we warn but don't fail the link, as it may be brought up later */ - log_struct_link(LOG_WARNING, link, + log_link_struct(LOG_WARNING, link, "MESSAGE=%-*s: could not bring up interface: %s", IFNAMSIZ, link->ifname, strerror(-r), @@ -1022,18 +1022,18 @@ static int link_up(Link *link) { assert(link->manager); assert(link->manager->rtnl); - log_debug_link(link, "bringing link up"); + log_link_debug(link, "bringing link up"); r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINK, link->ifindex); if (r < 0) { - log_error_link(link, "Could not allocate RTM_SETLINK message"); + log_link_error(link, "Could not allocate RTM_SETLINK message"); return r; } r = sd_rtnl_message_link_set_flags(req, IFF_UP, IFF_UP); if (r < 0) { - log_error_link(link, "Could not set link flags: %s", + log_link_error(link, "Could not set link flags: %s", strerror(-r)); return r; } @@ -1041,7 +1041,7 @@ static int link_up(Link *link) { r = sd_rtnl_call_async(link->manager->rtnl, req, link_up_handler, link, 0, NULL); if (r < 0) { - log_error_link(link, + log_link_error(link, "Could not send rtnetlink message: %s", strerror(-r)); return r; @@ -1084,7 +1084,7 @@ static int netdev_join_handler(sd_rtnl *rtnl, sd_rtnl_message *m, r = sd_rtnl_message_get_errno(m); if (r < 0 && r != -EEXIST) { - log_struct_link(LOG_ERR, link, + log_link_struct(LOG_ERR, link, "MESSAGE=%-*s: could not join netdev: %s", IFNAMSIZ, link->ifname, strerror(-r), @@ -1093,7 +1093,7 @@ static int netdev_join_handler(sd_rtnl *rtnl, sd_rtnl_message *m, link_enter_failed(link); return 1; } else - log_debug_link(link, "joined netdev"); + log_link_debug(link, "joined netdev"); if (link->enslaving <= 0) link_joined(link); @@ -1120,7 +1120,7 @@ static int link_enter_join_netdev(Link *link) { return link_joined(link); if (link->network->bond) { - log_struct_link(LOG_DEBUG, link, + log_link_struct(LOG_DEBUG, link, "MESSAGE=%-*s: enslaving by '%s'", IFNAMSIZ, link->ifname, link->network->bond->ifname, @@ -1129,7 +1129,7 @@ static int link_enter_join_netdev(Link *link) { r = netdev_join(link->network->bond, link, &netdev_join_handler); if (r < 0) { - log_struct_link(LOG_WARNING, link, + log_link_struct(LOG_WARNING, link, "MESSAGE=%-*s: could not join netdev '%s': %s", IFNAMSIZ, link->ifname, link->network->bond->ifname, @@ -1144,7 +1144,7 @@ static int link_enter_join_netdev(Link *link) { } if (link->network->bridge) { - log_struct_link(LOG_DEBUG, link, + log_link_struct(LOG_DEBUG, link, "MESSAGE=%-*s: enslaving by '%s'", IFNAMSIZ, link->ifname, link->network->bridge->ifname, @@ -1154,7 +1154,7 @@ static int link_enter_join_netdev(Link *link) { r = netdev_join(link->network->bridge, link, &netdev_join_handler); if (r < 0) { - log_struct_link(LOG_WARNING, link, + log_link_struct(LOG_WARNING, link, "MESSAGE=%-*s: could not join netdev '%s': %s", IFNAMSIZ, link->ifname, link->network->bridge->ifname, @@ -1169,7 +1169,7 @@ static int link_enter_join_netdev(Link *link) { } HASHMAP_FOREACH(netdev, link->network->stacked_netdevs, i) { - log_struct_link(LOG_DEBUG, link, + log_link_struct(LOG_DEBUG, link, "MESSAGE=%-*s: enslaving by '%s'", IFNAMSIZ, link->ifname, netdev->ifname, NETDEVIF(netdev), @@ -1177,7 +1177,7 @@ static int link_enter_join_netdev(Link *link) { r = netdev_join(netdev, link, &netdev_join_handler); if (r < 0) { - log_struct_link(LOG_WARNING, link, + log_link_struct(LOG_WARNING, link, "MESSAGE=%-*s: could not join netdev '%s': %s", IFNAMSIZ, link->ifname, netdev->ifname, @@ -1270,7 +1270,7 @@ static int link_initialized_and_synced(sd_rtnl *rtnl, sd_rtnl_message *m, if (link->state != LINK_STATE_PENDING) return 1; - log_debug_link(link, "link state is up-to-date"); + log_link_debug(link, "link state is up-to-date"); r = network_get(link->manager, link->udev_device, link->ifname, &link->mac, &network); @@ -1282,13 +1282,13 @@ static int link_initialized_and_synced(sd_rtnl *rtnl, sd_rtnl_message *m, if (link->flags & IFF_LOOPBACK) { if (network->ipv4ll) - log_debug_link(link, "ignoring IPv4LL for loopback link"); + log_link_debug(link, "ignoring IPv4LL for loopback link"); if (network->dhcp != DHCP_SUPPORT_NONE) - log_debug_link(link, "ignoring DHCP clients for loopback link"); + log_link_debug(link, "ignoring DHCP clients for loopback link"); if (network->dhcp_server) - log_debug_link(link, "ignoring DHCP server for loopback link"); + log_link_debug(link, "ignoring DHCP server for loopback link"); } r = network_apply(link->manager, network, link); @@ -1317,7 +1317,7 @@ int link_initialized(Link *link, struct udev_device *device) { if (link->udev_device) return 0; - log_debug_link(link, "udev initialized link"); + log_link_debug(link, "udev initialized link"); link->udev_device = udev_device_ref(device); @@ -1382,28 +1382,28 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, r = sd_rtnl_message_addr_get_family(message, &address->family); if (r < 0 || !IN_SET(address->family, AF_INET, AF_INET6)) { - log_warning_link(link, + log_link_warning(link, "rtnl: received address with invalid family, ignoring"); return 0; } r = sd_rtnl_message_addr_get_prefixlen(message, &address->prefixlen); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "rtnl: received address with invalid prefixlen, ignoring"); return 0; } r = sd_rtnl_message_addr_get_scope(message, &address->scope); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "rtnl: received address with invalid scope, ignoring"); return 0; } r = sd_rtnl_message_addr_get_flags(message, &address->flags); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "rtnl: received address with invalid flags, ignoring"); return 0; } @@ -1413,7 +1413,7 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, r = sd_rtnl_message_read_in_addr(message, IFA_LOCAL, &address->in_addr.in); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "rtnl: received address without valid address, ignoring"); return 0; } @@ -1424,7 +1424,7 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, r = sd_rtnl_message_read_in6_addr(message, IFA_ADDRESS, &address->in_addr.in6); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "rtnl: received address without valid address, ignoring"); return 0; } @@ -1437,7 +1437,7 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, if (!inet_ntop(address->family, &address->in_addr, buf, INET6_ADDRSTRLEN)) { - log_warning_link(link, "could not print address"); + log_link_warning(link, "could not print address"); return 0; } @@ -1467,10 +1467,10 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, switch (type) { case RTM_NEWADDR: if (!address_dropped) - log_debug_link(link, "added address: %s/%u (valid for %s)", + log_link_debug(link, "added address: %s/%u (valid for %s)", buf, address->prefixlen, valid_str); else - log_debug_link(link, "updated address: %s/%u (valid for %s)", + log_link_debug(link, "updated address: %s/%u (valid for %s)", buf, address->prefixlen, valid_str); LIST_PREPEND(addresses, link->addresses, address); @@ -1481,12 +1481,12 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, break; case RTM_DELADDR: if (address_dropped) { - log_debug_link(link, "removed address: %s/%u (valid for %s)", + log_link_debug(link, "removed address: %s/%u (valid for %s)", buf, address->prefixlen, valid_str); link_save(link); } else - log_warning_link(link, + log_link_warning(link, "removing non-existent address: %s/%u (valid for %s)", buf, address->prefixlen, valid_str); @@ -1516,7 +1516,7 @@ int link_add(Manager *m, sd_rtnl_message *message, Link **ret) { link = *ret; - log_debug_link(link, "link %d added", link->ifindex); + log_link_debug(link, "link %d added", link->ifindex); r = sd_rtnl_message_new_addr(m->rtnl, &req, RTM_GETADDR, link->ifindex, 0); @@ -1535,14 +1535,14 @@ int link_add(Manager *m, sd_rtnl_message *message, Link **ret) { sprintf(ifindex_str, "n%d", link->ifindex); device = udev_device_new_from_device_id(m->udev, ifindex_str); if (!device) { - log_warning_link(link, + log_link_warning(link, "could not find udev device: %m"); return -errno; } if (udev_device_get_is_initialized(device) <= 0) { /* not yet ready */ - log_debug_link(link, "link pending udev initialization..."); + log_link_debug(link, "link pending udev initialization..."); return 0; } @@ -1574,13 +1574,13 @@ int link_update(Link *link, sd_rtnl_message *m) { if (link->state == LINK_STATE_LINGER) { link_ref(link); - log_info_link(link, "link readded"); + log_link_info(link, "link readded"); link->state = LINK_STATE_ENSLAVING; } r = sd_rtnl_message_read_string(m, IFLA_IFNAME, &ifname); if (r >= 0 && !streq(ifname, link->ifname)) { - log_info_link(link, "renamed to %s", ifname); + log_link_info(link, "renamed to %s", ifname); free(link->ifname); link->ifname = strdup(ifname); @@ -1593,7 +1593,7 @@ int link_update(Link *link, sd_rtnl_message *m) { link->mtu = mtu; if (!link->original_mtu) { link->original_mtu = mtu; - log_debug_link(link, "saved original MTU: %" + log_link_debug(link, "saved original MTU: %" PRIu32, link->original_mtu); } @@ -1601,7 +1601,7 @@ int link_update(Link *link, sd_rtnl_message *m) { r = sd_dhcp_client_set_mtu(link->dhcp_client, link->mtu); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "Could not update MTU in DHCP client: %s", strerror(-r)); return r; @@ -1619,7 +1619,7 @@ int link_update(Link *link, sd_rtnl_message *m) { memcpy(link->mac.ether_addr_octet, mac.ether_addr_octet, ETH_ALEN); - log_debug_link(link, "MAC address: " + log_link_debug(link, "MAC address: " "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", mac.ether_addr_octet[0], mac.ether_addr_octet[1], @@ -1631,7 +1631,7 @@ int link_update(Link *link, sd_rtnl_message *m) { if (link->ipv4ll) { r = sd_ipv4ll_set_mac(link->ipv4ll, &link->mac); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "Could not update MAC address in IPv4LL client: %s", strerror(-r)); return r; @@ -1644,7 +1644,7 @@ int link_update(Link *link, sd_rtnl_message *m) { sizeof (link->mac), ARPHRD_ETHER); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "Could not update MAC address in DHCP client: %s", strerror(-r)); return r; @@ -1657,7 +1657,7 @@ int link_update(Link *link, sd_rtnl_message *m) { sizeof (link->mac), ARPHRD_ETHER); if (r < 0) { - log_warning_link(link, + log_link_warning(link, "Could not update MAC address in DHCPv6 client: %s", strerror(-r)); return r; @@ -1676,7 +1676,7 @@ int link_update(Link *link, sd_rtnl_message *m) { carrier_lost = had_carrier && !link_has_carrier(link); if (carrier_gained) { - log_info_link(link, "gained carrier"); + log_link_info(link, "gained carrier"); if (link->network) { r = link_acquire_conf(link); @@ -1686,7 +1686,7 @@ int link_update(Link *link, sd_rtnl_message *m) { } } } else if (carrier_lost) { - log_info_link(link, "lost carrier"); + log_link_info(link, "lost carrier"); r = link_stop_clients(link); if (r < 0) { @@ -1878,7 +1878,7 @@ int link_save(Link *link) { return 0; fail: - log_error_link(link, "Failed to save link data to %s: %s", link->state_file, strerror(-r)); + log_link_error(link, "Failed to save link data to %s: %s", link->state_file, strerror(-r)); unlink(link->state_file); unlink(temp_path); return r; diff --git a/src/network/networkd-link.h b/src/network/networkd-link.h index 5eb4b88931..61cdbf3132 100644 --- a/src/network/networkd-link.h +++ b/src/network/networkd-link.h @@ -132,14 +132,14 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_unref); /* Macros which append INTERFACE= to the message */ -#define log_full_link(level, link, fmt, ...) log_meta_object(level, 0, __FILE__, __LINE__, __func__, "INTERFACE=", link->ifname, "%-*s: " fmt, IFNAMSIZ, link->ifname, ##__VA_ARGS__) -#define log_debug_link(link, ...) log_full_link(LOG_DEBUG, link, ##__VA_ARGS__) -#define log_info_link(link, ...) log_full_link(LOG_INFO, link, ##__VA_ARGS__) -#define log_notice_link(link, ...) log_full_link(LOG_NOTICE, link, ##__VA_ARGS__) -#define log_warning_link(link, ...) log_full_link(LOG_WARNING, link, ##__VA_ARGS__) -#define log_error_link(link, ...) log_full_link(LOG_ERR, link, ##__VA_ARGS__) - -#define log_struct_link(level, link, ...) log_struct(level, "INTERFACE=%s", link->ifname, __VA_ARGS__) +#define log_link_full(level, link, fmt, ...) log_object_internal(level, 0, __FILE__, __LINE__, __func__, "INTERFACE=", link->ifname, "%-*s: " fmt, IFNAMSIZ, link->ifname, ##__VA_ARGS__) +#define log_link_debug(link, ...) log_link_full(LOG_DEBUG, link, ##__VA_ARGS__) +#define log_link_info(link, ...) log_link_full(LOG_INFO, link, ##__VA_ARGS__) +#define log_link_notice(link, ...) log_link_full(LOG_NOTICE, link, ##__VA_ARGS__) +#define log_link_warning(link, ...) log_link_full(LOG_WARNING, link, ##__VA_ARGS__) +#define log_link_error(link, ...) log_link_full(LOG_ERR, link, ##__VA_ARGS__) + +#define log_link_struct(level, link, ...) log_struct(level, "INTERFACE=%s", link->ifname, __VA_ARGS__) #define ADDRESS_FMT_VAL(address) \ (address).s_addr & 0xFF, \ diff --git a/src/network/networkd-netdev-bond.c b/src/network/networkd-netdev-bond.c index 46408213b7..88321ef84c 100644 --- a/src/network/networkd-netdev-bond.c +++ b/src/network/networkd-netdev-bond.c @@ -116,7 +116,7 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m r = sd_rtnl_message_append_u8(m, IFLA_BOND_MODE, bond_mode_to_kernel(b->mode)); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_BOND_MODE attribute: %s", strerror(-r)); return r; @@ -127,7 +127,7 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m r = sd_rtnl_message_append_u8(m, IFLA_BOND_XMIT_HASH_POLICY, bond_xmit_hash_policy_to_kernel(b->xmit_hash_policy)); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_BOND_XMIT_HASH_POLICY attribute: %s", strerror(-r)); return r; @@ -138,7 +138,7 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m b->mode == NETDEV_BOND_MODE_802_3AD) { r = sd_rtnl_message_append_u8(m, IFLA_BOND_AD_LACP_RATE, b->lacp_rate ); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_BOND_AD_LACP_RATE attribute: %s", strerror(-r)); return r; @@ -148,7 +148,7 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m if (b->miimon != 0) { r = sd_rtnl_message_append_u32(m, IFLA_BOND_MIIMON, b->miimon / USEC_PER_MSEC); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_BOND_BOND_MIIMON attribute: %s", strerror(-r)); return r; @@ -158,7 +158,7 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m if (b->downdelay != 0) { r = sd_rtnl_message_append_u32(m, IFLA_BOND_DOWNDELAY, b->downdelay / USEC_PER_MSEC); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_BOND_DOWNDELAY attribute: %s", strerror(-r)); return r; @@ -168,7 +168,7 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m if (b->updelay != 0) { r = sd_rtnl_message_append_u32(m, IFLA_BOND_UPDELAY, b->updelay / USEC_PER_MSEC); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_BOND_UPDELAY attribute: %s", strerror(-r)); return r; diff --git a/src/network/networkd-netdev-macvlan.c b/src/network/networkd-netdev-macvlan.c index 2e5554a172..198fb575ee 100644 --- a/src/network/networkd-netdev-macvlan.c +++ b/src/network/networkd-netdev-macvlan.c @@ -48,7 +48,7 @@ static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_rtn if (m->mode != _NETDEV_MACVLAN_MODE_INVALID) { r = sd_rtnl_message_append_u32(req, IFLA_MACVLAN_MODE, m->mode); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_MACVLAN_MODE attribute: %s", strerror(-r)); return r; diff --git a/src/network/networkd-netdev-tunnel.c b/src/network/networkd-netdev-tunnel.c index e5981a48d8..980c70ef55 100644 --- a/src/network/networkd-netdev-tunnel.c +++ b/src/network/networkd-netdev-tunnel.c @@ -45,7 +45,7 @@ static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m r = sd_rtnl_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_IPTUN_LINK attribute: %s", strerror(-r)); return r; @@ -53,7 +53,7 @@ static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &t->local.in); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_IPTUN_LOCAL attribute: %s", strerror(-r)); return r; @@ -61,7 +61,7 @@ static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_IPTUN_REMOTE attribute: %s", strerror(-r)); return r; @@ -69,7 +69,7 @@ static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_IPTUN_TTL attribute: %s", strerror(-r)); return r; @@ -77,7 +77,7 @@ static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_PMTUDISC, t->pmtudisc); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_IPTUN_PMTUDISC attribute: %s", strerror(-r)); return r; @@ -98,7 +98,7 @@ static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me r = sd_rtnl_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_IPTUN_LINK attribute: %s", strerror(-r)); return r; @@ -106,7 +106,7 @@ static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &t->local.in); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_IPTUN_LOCAL attribute: %s", strerror(-r)); return r; @@ -114,7 +114,7 @@ static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_IPTUN_REMOTE attribute: %s", strerror(-r)); return r; @@ -122,7 +122,7 @@ static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_IPTUN_TTL attribute: %s", strerror(-r)); return r; @@ -130,7 +130,7 @@ static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_PMTUDISC, t->pmtudisc); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_IPTUN_PMTUDISC attribute: %s", strerror(-r)); return r; @@ -151,7 +151,7 @@ static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me r = sd_rtnl_message_append_u32(m, IFLA_GRE_LINK, link->ifindex); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_GRE_LINK attribute: %s", strerror(-r)); return r; @@ -159,7 +159,7 @@ static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me r = sd_rtnl_message_append_in_addr(m, IFLA_GRE_LOCAL, &t->local.in); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_GRE_LOCAL attribute: %s", strerror(-r)); return r; @@ -167,7 +167,7 @@ static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me r = sd_rtnl_message_append_in_addr(m, IFLA_GRE_REMOTE, &t->remote.in); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_GRE_REMOTE attribute: %s", strerror(-r)); return r; @@ -175,7 +175,7 @@ static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me r = sd_rtnl_message_append_u8(m, IFLA_GRE_TTL, t->ttl); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_GRE_TTL attribute: %s", strerror(-r)); return r; @@ -183,7 +183,7 @@ static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me r = sd_rtnl_message_append_u8(m, IFLA_GRE_TOS, t->tos); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_GRE_TOS attribute: %s", strerror(-r)); return r; @@ -191,7 +191,7 @@ static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me r = sd_rtnl_message_append_u8(m, IFLA_GRE_PMTUDISC, t->pmtudisc); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_GRE_PMTUDISC attribute: %s", strerror(-r)); return r; @@ -212,7 +212,7 @@ static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me r = sd_rtnl_message_append_u32(m, IFLA_VTI_LINK, link->ifindex); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_IPTUN_LINK attribute: %s", strerror(-r)); return r; @@ -220,7 +220,7 @@ static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me r = sd_rtnl_message_append_in_addr(m, IFLA_VTI_LOCAL, &t->local.in); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_IPTUN_LOCAL attribute: %s", strerror(-r)); return r; @@ -228,7 +228,7 @@ static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me r = sd_rtnl_message_append_in_addr(m, IFLA_VTI_REMOTE, &t->remote.in); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_IPTUN_REMOTE attribute: %s", strerror(-r)); return r; diff --git a/src/network/networkd-netdev-tuntap.c b/src/network/networkd-netdev-tuntap.c index eaf5df4971..7767d75507 100644 --- a/src/network/networkd-netdev-tuntap.c +++ b/src/network/networkd-netdev-tuntap.c @@ -70,13 +70,13 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) { fd = open(TUN_DEV, O_RDWR); if (fd < 0) { - log_error_netdev(netdev, "Failed to open tun dev: %m"); + log_netdev_error(netdev, "Failed to open tun dev: %m"); return -errno; } r = ioctl(fd, TUNSETIFF, ifr); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "TUNSETIFF failed on tun dev: %s", strerror(-r)); return r; @@ -102,7 +102,7 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) { r = ioctl(fd, TUNSETOWNER, uid); if ( r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "TUNSETOWNER failed on tun dev: %s", strerror(-r)); } @@ -121,7 +121,7 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) { r = ioctl(fd, TUNSETGROUP, gid); if( r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "TUNSETGROUP failed on tun dev: %s", strerror(-r)); return r; @@ -131,7 +131,7 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) { r = ioctl(fd, TUNSETPERSIST, 1); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "TUNSETPERSIST failed on tun dev: %s", strerror(-r)); return r; diff --git a/src/network/networkd-netdev-veth.c b/src/network/networkd-netdev-veth.c index ca2bb0718a..859c26e931 100644 --- a/src/network/networkd-netdev-veth.c +++ b/src/network/networkd-netdev-veth.c @@ -38,7 +38,7 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m r = sd_rtnl_message_open_container(m, VETH_INFO_PEER); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append VETH_INFO_PEER attribute: %s", strerror(-r)); return r; @@ -55,7 +55,7 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m if (v->mac_peer) { r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, v->mac_peer); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_ADDRESS attribute: %s", strerror(-r)); return r; @@ -64,7 +64,7 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m r = sd_rtnl_message_close_container(m); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_INFO_DATA attribute: %s", strerror(-r)); return r; diff --git a/src/network/networkd-netdev-vlan.c b/src/network/networkd-netdev-vlan.c index 13c4456733..665559f895 100644 --- a/src/network/networkd-netdev-vlan.c +++ b/src/network/networkd-netdev-vlan.c @@ -37,7 +37,7 @@ static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m if (v->id <= VLANID_MAX) { r = sd_rtnl_message_append_u16(req, IFLA_VLAN_ID, v->id); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_VLAN_ID attribute: %s", strerror(-r)); return r; diff --git a/src/network/networkd-netdev-vxlan.c b/src/network/networkd-netdev-vxlan.c index 326ac547a3..7dec69d0f6 100644 --- a/src/network/networkd-netdev-vxlan.c +++ b/src/network/networkd-netdev-vxlan.c @@ -41,7 +41,7 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_ if (v->id <= VXLAN_VID_MAX) { r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_ID, v->id); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_VXLAN_ID attribute: %s", strerror(-r)); return r; @@ -50,7 +50,7 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_ r = sd_rtnl_message_append_in_addr(m, IFLA_VXLAN_GROUP, &v->group.in); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_VXLAN_GROUP attribute: %s", strerror(-r)); return r; @@ -58,7 +58,7 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_ r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_LINK, link->ifindex); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_VXLAN_LINK attribute: %s", strerror(-r)); return r; @@ -67,7 +67,7 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_ if(v->ttl) { r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TTL, v->ttl); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_VXLAN_TTL attribute: %s", strerror(-r)); return r; @@ -77,7 +77,7 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_ if(v->tos) { r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TOS, v->tos); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_VXLAN_TOS attribute: %s", strerror(-r)); return r; @@ -86,7 +86,7 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_ r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_LEARNING, v->learning); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_VXLAN_LEARNING attribute: %s", strerror(-r)); return r; diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index bdb0b888a0..310b20ae3e 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -136,7 +136,7 @@ void netdev_drop(NetDev *netdev) { netdev->state = NETDEV_STATE_LINGER; - log_debug_netdev(netdev, "netdev removed"); + log_netdev_debug(netdev, "netdev removed"); netdev_cancel_callbacks(netdev); @@ -184,7 +184,7 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand r = sd_rtnl_message_new_link(netdev->manager->rtnl, &req, RTM_SETLINK, link->ifindex); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not allocate RTM_SETLINK message: %s", strerror(-r)); return r; @@ -192,7 +192,7 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand r = sd_rtnl_message_append_u32(req, IFLA_MASTER, netdev->ifindex); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_MASTER attribute: %s", strerror(-r)); return r; @@ -200,7 +200,7 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand r = sd_rtnl_call_async(netdev->manager->rtnl, req, callback, link, 0, NULL); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not send rtnetlink message: %s", strerror(-r)); return r; @@ -208,7 +208,7 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand link_ref(link); - log_debug_netdev(netdev, "enslaving link '%s'", link->ifname); + log_netdev_debug(netdev, "enslaving link '%s'", link->ifname); return 0; } @@ -251,7 +251,7 @@ static int netdev_create_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userda r = sd_rtnl_message_get_errno(m); if (r == -EEXIST) - log_debug_netdev(netdev, "netdev exists, using existing"); + log_netdev_debug(netdev, "netdev exists, using existing"); else if (r < 0) { log_warning_netdev(netdev, "netdev could not be created: %s", strerror(-r)); netdev_drop(netdev); @@ -259,7 +259,7 @@ static int netdev_create_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userda return 1; } - log_debug_netdev(netdev, "created"); + log_netdev_debug(netdev, "created"); return 1; } @@ -288,7 +288,7 @@ int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callbac LIST_PREPEND(callbacks, netdev->callbacks, cb); - log_debug_netdev(netdev, "will enslave '%s', when reday", + log_netdev_debug(netdev, "will enslave '%s', when reday", link->ifname); } @@ -307,29 +307,29 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) { r = sd_rtnl_message_get_type(message, &type); if (r < 0) { - log_error_netdev(netdev, "Could not get rtnl message type"); + log_netdev_error(netdev, "Could not get rtnl message type"); return r; } if (type != RTM_NEWLINK) { - log_error_netdev(netdev, "Can not set ifindex from unexpected rtnl message type"); + log_netdev_error(netdev, "Can not set ifindex from unexpected rtnl message type"); return -EINVAL; } r = sd_rtnl_message_link_get_ifindex(message, &ifindex); if (r < 0) { - log_error_netdev(netdev, "Could not get ifindex: %s", strerror(-r)); + log_netdev_error(netdev, "Could not get ifindex: %s", strerror(-r)); netdev_enter_failed(netdev); return r; } else if (ifindex <= 0) { - log_error_netdev(netdev, "Got invalid ifindex: %d", ifindex); + log_netdev_error(netdev, "Got invalid ifindex: %d", ifindex); netdev_enter_failed(netdev); return r; } if (netdev->ifindex > 0) { if (netdev->ifindex != ifindex) { - log_error_netdev(netdev, "Could not set ifindex to %d, already set to %d", + log_netdev_error(netdev, "Could not set ifindex to %d, already set to %d", ifindex, netdev->ifindex); netdev_enter_failed(netdev); return -EEXIST; @@ -340,12 +340,12 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) { r = sd_rtnl_message_read_string(message, IFLA_IFNAME, &received_name); if (r < 0) { - log_error_netdev(netdev, "Could not get IFNAME"); + log_netdev_error(netdev, "Could not get IFNAME"); return r; } if (!streq(netdev->ifname, received_name)) { - log_error_netdev(netdev, "Received newlink with wrong IFNAME %s", + log_netdev_error(netdev, "Received newlink with wrong IFNAME %s", received_name); netdev_enter_failed(netdev); return r; @@ -353,19 +353,19 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) { r = sd_rtnl_message_enter_container(message, IFLA_LINKINFO); if (r < 0) { - log_error_netdev(netdev, "Could not get LINKINFO"); + log_netdev_error(netdev, "Could not get LINKINFO"); return r; } r = sd_rtnl_message_read_string(message, IFLA_INFO_KIND, &received_kind); if (r < 0) { - log_error_netdev(netdev, "Could not get KIND"); + log_netdev_error(netdev, "Could not get KIND"); return r; } r = sd_rtnl_message_exit_container(message); if (r < 0) { - log_error_netdev(netdev, "Could not exit container"); + log_netdev_error(netdev, "Could not exit container"); return r; } @@ -375,14 +375,14 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) { else { kind = netdev_kind_to_string(netdev->kind); if (!kind) { - log_error_netdev(netdev, "Could not get kind"); + log_netdev_error(netdev, "Could not get kind"); netdev_enter_failed(netdev); return -EINVAL; } } if (!streq(kind, received_kind)) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Received newlink with wrong KIND %s, " "expected %s", received_kind, kind); netdev_enter_failed(netdev); @@ -391,7 +391,7 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) { netdev->ifindex = ifindex; - log_debug_netdev(netdev, "netdev has index %d", netdev->ifindex); + log_netdev_debug(netdev, "netdev has index %d", netdev->ifindex); netdev_enter_ready(netdev); @@ -459,13 +459,13 @@ static int netdev_create(NetDev *netdev, Link *link, if (r < 0) return r; - log_debug_netdev(netdev, "created"); + log_netdev_debug(netdev, "created"); } else { _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL; r = sd_rtnl_message_new_link(netdev->manager->rtnl, &m, RTM_NEWLINK, 0); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not allocate RTM_NEWLINK message: %s", strerror(-r)); return r; @@ -473,7 +473,7 @@ static int netdev_create(NetDev *netdev, Link *link, r = sd_rtnl_message_append_string(m, IFLA_IFNAME, netdev->ifname); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_IFNAME, attribute: %s", strerror(-r)); return r; @@ -482,7 +482,7 @@ static int netdev_create(NetDev *netdev, Link *link, if (netdev->mac) { r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, netdev->mac); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_ADDRESS attribute: %s", strerror(-r)); return r; @@ -492,7 +492,7 @@ static int netdev_create(NetDev *netdev, Link *link, if (netdev->mtu) { r = sd_rtnl_message_append_u32(m, IFLA_MTU, netdev->mtu); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_MTU attribute: %s", strerror(-r)); return r; @@ -502,7 +502,7 @@ static int netdev_create(NetDev *netdev, Link *link, if (link) { r = sd_rtnl_message_append_u32(m, IFLA_LINK, link->ifindex); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Colud not append IFLA_LINK attribute: %s", strerror(-r)); return r; @@ -511,7 +511,7 @@ static int netdev_create(NetDev *netdev, Link *link, r = sd_rtnl_message_open_container(m, IFLA_LINKINFO); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_LINKINFO attribute: %s", strerror(-r)); return r; @@ -520,7 +520,7 @@ static int netdev_create(NetDev *netdev, Link *link, r = sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA, netdev_kind_to_string(netdev->kind)); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_INFO_DATA attribute: %s", strerror(-r)); return r; @@ -534,7 +534,7 @@ static int netdev_create(NetDev *netdev, Link *link, r = sd_rtnl_message_close_container(m); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_LINKINFO attribute: %s", strerror(-r)); return r; @@ -542,7 +542,7 @@ static int netdev_create(NetDev *netdev, Link *link, r = sd_rtnl_message_close_container(m); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not append IFLA_LINKINFO attribute: %s", strerror(-r)); return r; @@ -553,7 +553,7 @@ static int netdev_create(NetDev *netdev, Link *link, r = sd_rtnl_call_async(netdev->manager->rtnl, m, callback, link, 0, NULL); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not send rtnetlink message: %s", strerror(-r)); return r; @@ -565,7 +565,7 @@ static int netdev_create(NetDev *netdev, Link *link, netdev_create_handler, netdev, 0, NULL); if (r < 0) { - log_error_netdev(netdev, + log_netdev_error(netdev, "Could not send rtnetlink message: %s", strerror(-r)); return r; @@ -576,7 +576,7 @@ static int netdev_create(NetDev *netdev, Link *link, netdev->state = NETDEV_STATE_CREATING; - log_debug_netdev(netdev, "creating"); + log_netdev_debug(netdev, "creating"); } return 0; @@ -713,7 +713,7 @@ static int netdev_load_one(Manager *manager, const char *filename) { LIST_HEAD_INIT(netdev->callbacks); - log_debug_netdev(netdev, "loaded %s", netdev_kind_to_string(netdev->kind)); + log_netdev_debug(netdev, "loaded %s", netdev_kind_to_string(netdev->kind)); switch (NETDEV_VTABLE(netdev)->create_type) { case NETDEV_CREATE_MASTER: diff --git a/src/network/networkd-netdev.h b/src/network/networkd-netdev.h index 54339aec73..c1e05c21fb 100644 --- a/src/network/networkd-netdev.h +++ b/src/network/networkd-netdev.h @@ -192,12 +192,12 @@ const struct ConfigPerfItem* network_netdev_gperf_lookup(const char *key, unsign /* Macros which append INTERFACE= to the message */ -#define log_full_netdev(level, netdev, fmt, ...) log_meta_object(level, 0, __FILE__, __LINE__, __func__, "INTERFACE=", netdev->ifname, "%-*s: " fmt, IFNAMSIZ, netdev->ifname, ##__VA_ARGS__) -#define log_debug_netdev(netdev, ...) log_full_netdev(LOG_DEBUG, netdev, ##__VA_ARGS__) +#define log_full_netdev(level, netdev, fmt, ...) log_object_internal(level, 0, __FILE__, __LINE__, __func__, "INTERFACE=", netdev->ifname, "%-*s: " fmt, IFNAMSIZ, netdev->ifname, ##__VA_ARGS__) +#define log_netdev_debug(netdev, ...) log_full_netdev(LOG_DEBUG, netdev, ##__VA_ARGS__) #define log_info_netdev(netdev, ...) log_full_netdev(LOG_INFO, netdev, ##__VA_ARGS__) #define log_notice_netdev(netdev, ...) log_full_netdev(LOG_NOTICE, netdev, ##__VA_ARGS__) #define log_warning_netdev(netdev, ...) log_full_netdev(LOG_WARNING, netdev,## __VA_ARGS__) -#define log_error_netdev(netdev, ...) log_full_netdev(LOG_ERR, netdev, ##__VA_ARGS__) +#define log_netdev_error(netdev, ...) log_full_netdev(LOG_ERR, netdev, ##__VA_ARGS__) #define log_struct_netdev(level, netdev, ...) log_struct(level, "INTERFACE=%s", netdev->ifname, __VA_ARGS__) diff --git a/src/network/networkd.h b/src/network/networkd.h index 9acf31cd1d..263cc61eef 100644 --- a/src/network/networkd.h +++ b/src/network/networkd.h @@ -336,14 +336,14 @@ int address_pool_acquire(AddressPool *p, unsigned prefixlen, union in_addr_union /* Macros which append INTERFACE= to the message */ -#define log_full_link(level, link, fmt, ...) log_meta_object(level, 0, __FILE__, __LINE__, __func__, "INTERFACE=", link->ifname, "%-*s: " fmt, IFNAMSIZ, link->ifname, ##__VA_ARGS__) -#define log_debug_link(link, ...) log_full_link(LOG_DEBUG, link, ##__VA_ARGS__) -#define log_info_link(link, ...) log_full_link(LOG_INFO, link, ##__VA_ARGS__) -#define log_notice_link(link, ...) log_full_link(LOG_NOTICE, link, ##__VA_ARGS__) -#define log_warning_link(link, ...) log_full_link(LOG_WARNING, link, ##__VA_ARGS__) -#define log_error_link(link, ...) log_full_link(LOG_ERR, link, ##__VA_ARGS__) - -#define log_struct_link(level, link, ...) log_struct(level, "INTERFACE=%s", link->ifname, __VA_ARGS__) +#define log_link_full(level, link, fmt, ...) log_object_internal(level, 0, __FILE__, __LINE__, __func__, "INTERFACE=", link->ifname, "%-*s: " fmt, IFNAMSIZ, link->ifname, ##__VA_ARGS__) +#define log_link_debug(link, ...) log_link_full(LOG_DEBUG, link, ##__VA_ARGS__) +#define log_link_info(link, ...) log_link_full(LOG_INFO, link, ##__VA_ARGS__) +#define log_link_notice(link, ...) log_link_full(LOG_NOTICE, link, ##__VA_ARGS__) +#define log_link_warning(link, ...) log_link_full(LOG_WARNING, link, ##__VA_ARGS__) +#define log_link_error(link, ...) log_link_full(LOG_ERR, link, ##__VA_ARGS__) + +#define log_link_struct(level, link, ...) log_struct(level, "INTERFACE=%s", link->ifname, __VA_ARGS__) #define ADDRESS_FMT_VAL(address) \ (address).s_addr & 0xFF, \ |