network: add more debugging logs when adding, removing, updateing and configuring route
This commit is contained in:
parent
860e636cf6
commit
156ed65e3c
|
@ -422,6 +422,28 @@ int manager_rtnl_process_route(sd_netlink *rtnl, sd_netlink_message *message, vo
|
||||||
|
|
||||||
(void) route_get(link, family, &dst, dst_prefixlen, tos, priority, table, &route);
|
(void) route_get(link, family, &dst, dst_prefixlen, tos, priority, table, &route);
|
||||||
|
|
||||||
|
if (DEBUG_LOGGING) {
|
||||||
|
_cleanup_free_ char *buf_dst = NULL, *buf_dst_prefixlen = NULL,
|
||||||
|
*buf_src = NULL, *buf_gw = NULL, *buf_prefsrc = NULL;
|
||||||
|
|
||||||
|
if (!in_addr_is_null(family, &dst)) {
|
||||||
|
(void) in_addr_to_string(family, &dst, &buf_dst);
|
||||||
|
(void) asprintf(&buf_dst_prefixlen, "/%u", dst_prefixlen);
|
||||||
|
}
|
||||||
|
if (!in_addr_is_null(family, &src))
|
||||||
|
(void) in_addr_to_string(family, &src, &buf_src);
|
||||||
|
if (!in_addr_is_null(family, &gw))
|
||||||
|
(void) in_addr_to_string(family, &gw, &buf_gw);
|
||||||
|
if (!in_addr_is_null(family, &prefsrc))
|
||||||
|
(void) in_addr_to_string(family, &prefsrc, &buf_prefsrc);
|
||||||
|
|
||||||
|
log_link_debug(link,
|
||||||
|
"%s route: dst: %s%s, src: %s, gw: %s, prefsrc: %s",
|
||||||
|
type == RTM_DELROUTE ? "Removing" : route ? "Updating" : "Adding",
|
||||||
|
strna(buf_dst), strempty(buf_dst_prefixlen),
|
||||||
|
strna(buf_src), strna(buf_gw), strna(buf_prefsrc));
|
||||||
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case RTM_NEWROUTE:
|
case RTM_NEWROUTE:
|
||||||
if (!route) {
|
if (!route) {
|
||||||
|
|
|
@ -513,6 +513,24 @@ int route_configure(
|
||||||
set_size(link->routes) >= routes_max())
|
set_size(link->routes) >= routes_max())
|
||||||
return -E2BIG;
|
return -E2BIG;
|
||||||
|
|
||||||
|
if (DEBUG_LOGGING) {
|
||||||
|
_cleanup_free_ char *dst = NULL, *dst_prefixlen = NULL, *src = NULL, *gw = NULL, *prefsrc = NULL;
|
||||||
|
|
||||||
|
if (!in_addr_is_null(route->family, &route->dst)) {
|
||||||
|
(void) in_addr_to_string(route->family, &route->dst, &dst);
|
||||||
|
(void) asprintf(&dst_prefixlen, "/%u", route->dst_prefixlen);
|
||||||
|
}
|
||||||
|
if (!in_addr_is_null(route->family, &route->src))
|
||||||
|
(void) in_addr_to_string(route->family, &route->src, &src);
|
||||||
|
if (!in_addr_is_null(route->family, &route->gw))
|
||||||
|
(void) in_addr_to_string(route->family, &route->gw, &gw);
|
||||||
|
if (!in_addr_is_null(route->family, &route->prefsrc))
|
||||||
|
(void) in_addr_to_string(route->family, &route->prefsrc, &prefsrc);
|
||||||
|
|
||||||
|
log_link_debug(link, "Configuring route: dst: %s%s, src: %s, gw: %s, prefsrc: %s",
|
||||||
|
strna(dst), strempty(dst_prefixlen), strna(src), strna(gw), strna(prefsrc));
|
||||||
|
}
|
||||||
|
|
||||||
r = sd_rtnl_message_new_route(link->manager->rtnl, &req,
|
r = sd_rtnl_message_new_route(link->manager->rtnl, &req,
|
||||||
RTM_NEWROUTE, route->family,
|
RTM_NEWROUTE, route->family,
|
||||||
route->protocol);
|
route->protocol);
|
||||||
|
|
Loading…
Reference in New Issue