[PATCH 1/1] vpn: use platform to_string functions for logging IP configuration of VPN



Note that this changes the format of <info> log lines.

Signed-off-by: Thomas Haller <thaller redhat com>
---
 src/vpn-manager/nm-vpn-connection.c | 33 ++++++++-------------------------
 1 file changed, 8 insertions(+), 25 deletions(-)

diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index 96a9aca..c76af70 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -582,11 +582,8 @@ static void
 print_vpn_config (NMVPNConnection *connection)
 {
        NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
-       const NMPlatformIP4Address *address4;
-       const NMPlatformIP6Address *address6;
        char *dns_domain = NULL;
        guint32 num, i;
-       char buf[NM_UTILS_INET_ADDRSTRLEN];
 
        if (priv->ip4_external_gw) {
                nm_log_info (LOGD_VPN, "VPN Gateway: %s",
@@ -601,23 +598,16 @@ print_vpn_config (NMVPNConnection *connection)
        if (priv->ip4_config) {
                nm_log_info (LOGD_VPN, "IPv4 configuration:");
 
-               address4 = nm_ip4_config_get_address (priv->ip4_config, 0);
-
                if (priv->ip4_internal_gw)
                        nm_log_info (LOGD_VPN, "  Internal Gateway: %s", nm_utils_inet4_ntop 
(priv->ip4_internal_gw, NULL));
-               nm_log_info (LOGD_VPN, "  Internal Address: %s", nm_utils_inet4_ntop (address4->address, 
NULL));
-               nm_log_info (LOGD_VPN, "  Internal Prefix: %d", address4->plen);
-               nm_log_info (LOGD_VPN, "  Internal Point-to-Point Address: %s", nm_utils_inet4_ntop 
(address4->peer_address, NULL));
+               nm_log_info (LOGD_VPN, "  Internal Address: %s",
+                            nm_platform_ip4_address_to_string (nm_ip4_config_get_address (priv->ip4_config, 
0)));
                nm_log_info (LOGD_VPN, "  Maximum Segment Size (MSS): %d", nm_ip4_config_get_mss 
(priv->ip4_config));
 
                num = nm_ip4_config_get_num_routes (priv->ip4_config);
                for (i = 0; i < num; i++) {
-                       const NMPlatformIP4Route *route = nm_ip4_config_get_route (priv->ip4_config, i);
-
-                       nm_log_info (LOGD_VPN, "  Static Route: %s/%d   Next Hop: %s",
-                                    nm_utils_inet4_ntop (route->network, NULL),
-                                    route->plen,
-                                    nm_utils_inet4_ntop (route->gateway, buf));
+                       nm_log_info (LOGD_VPN, "  Static Route: %s",
+                                    nm_platform_ip4_route_to_string (nm_ip4_config_get_route 
(priv->ip4_config, i)));
                }
 
                nm_log_info (LOGD_VPN, "  Forbid Default Route: %s",
@@ -639,23 +629,16 @@ print_vpn_config (NMVPNConnection *connection)
        if (priv->ip6_config) {
                nm_log_info (LOGD_VPN, "IPv6 configuration:");
 
-               address6 = nm_ip6_config_get_address (priv->ip6_config, 0);
-
                if (priv->ip6_internal_gw)
                        nm_log_info (LOGD_VPN, "  Internal Gateway: %s", nm_utils_inet6_ntop 
(priv->ip6_internal_gw, NULL));
-               nm_log_info (LOGD_VPN, "  Internal Address: %s", nm_utils_inet6_ntop (&address6->address, 
NULL));
-               nm_log_info (LOGD_VPN, "  Internal Prefix: %d", address6->plen);
-               nm_log_info (LOGD_VPN, "  Internal Point-to-Point Address: %s", nm_utils_inet6_ntop 
(&address6->peer_address, NULL));
+               nm_log_info (LOGD_VPN, "  Internal Address: %s",
+                            nm_platform_ip6_address_to_string (nm_ip6_config_get_address (priv->ip6_config, 
0)));
                nm_log_info (LOGD_VPN, "  Maximum Segment Size (MSS): %d", nm_ip6_config_get_mss 
(priv->ip6_config));
 
                num = nm_ip6_config_get_num_routes (priv->ip6_config);
                for (i = 0; i < num; i++) {
-                       const NMPlatformIP6Route *route = nm_ip6_config_get_route (priv->ip6_config, i);
-
-                       nm_log_info (LOGD_VPN, "  Static Route: %s/%d   Next Hop: %s",
-                                    nm_utils_inet6_ntop (&route->network, NULL),
-                                    route->plen,
-                                    nm_utils_inet6_ntop (&route->gateway, buf));
+                       nm_log_info (LOGD_VPN, "  Static Route: %s",
+                                    nm_platform_ip6_route_to_string (nm_ip6_config_get_route 
(priv->ip6_config, i)));
                }
 
                nm_log_info (LOGD_VPN, "  Forbid Default Route: %s",
-- 
1.8.5.3



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]