[network-manager-sstp] Fixing build against NetworkManager 1.41.2



commit 906546671c7ed60918c17b601f59ae30e79d49e4
Author: Eivind Naess <eivnaes yahoo com>
Date:   Wed Sep 21 16:42:24 2022 -0700

    Fixing build against NetworkManager 1.41.2
    
    Signed-off-by: Eivind Naess <eivnaes yahoo com>

 shared/nm-utils/nm-shared-utils.h | 5 +++++
 src/nm-sstp-pppd-plugin.c         | 8 +++-----
 src/nm-sstp-service.c             | 2 +-
 3 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/shared/nm-utils/nm-shared-utils.h b/shared/nm-utils/nm-shared-utils.h
index d983cfc..1487f97 100644
--- a/shared/nm-utils/nm-shared-utils.h
+++ b/shared/nm-utils/nm-shared-utils.h
@@ -26,6 +26,11 @@
 
 /*****************************************************************************/
 
+#ifndef NM_INET_ADDRSTRLEN
+#define NM_INET_ADDRSTRLEN INET6_ADDRSTRLEN
+#endif
+
+
 static inline char
 nm_utils_addr_family_to_char (int addr_family)
 {
diff --git a/src/nm-sstp-pppd-plugin.c b/src/nm-sstp-pppd-plugin.c
index 28484cf..0d8b03f 100644
--- a/src/nm-sstp-pppd-plugin.c
+++ b/src/nm-sstp-pppd-plugin.c
@@ -233,7 +233,7 @@ nm_sstp_getaddr(struct sockaddr_storage *addr)
     int ret    = (-1);
     int cnt    = (SSTP_API_ATTR_MAX+1);
     char name[255] = {};
-    char ipstr[INET6_ADDRSTRLEN];
+    char ipstr[NM_INET_ADDRSTRLEN];
     sstp_api_msg_st msg;
     sstp_api_msg_t  type;
     sstp_api_attr_st *attr;
@@ -302,12 +302,10 @@ nm_sstp_getaddr(struct sockaddr_storage *addr)
     switch (addr->ss_family)
     {
         case AF_INET:
-            inet_ntop(addr->ss_family, &((struct sockaddr_in*)addr)->sin_addr,
-                    ipstr, sizeof(ipstr));
+            nm_utils_inet4_ntop(((struct sockaddr_in*)addr)->sin_addr.s_addr, ipstr);
             break;
         case AF_INET6:
-            inet_ntop(addr->ss_family, &((struct sockaddr_in6*)addr)->sin6_addr,
-                    ipstr, sizeof(ipstr));
+            nm_utils_inet6_ntop(&((struct sockaddr_in6*)addr)->sin6_addr, ipstr);
             break;
     }
 
diff --git a/src/nm-sstp-service.c b/src/nm-sstp-service.c
index 61b3b96..0b1eea4 100644
--- a/src/nm-sstp-service.c
+++ b/src/nm-sstp-service.c
@@ -587,7 +587,7 @@ construct_pppd_args (NMSstpPlugin *plugin,
             const char *ipv4_str = NULL;
             const char *gway_str = NULL;
             const char *mask_str = NULL;
-            char buf[NM_UTILS_INET_ADDRSTRLEN];
+            char buf[NM_INET_ADDRSTRLEN];
             NMIPAddress *ipv4 = NULL;
 
             // IF <local:remote> is specified, the IPCP negotiation will fail unless


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