aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/lockd/host.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 012e49aaecd1..780918acd6f4 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -105,6 +105,13 @@ static void nlm_clear_port(struct sockaddr *sap)
105 } 105 }
106} 106}
107 107
108static void nlm_display_ipv4_address(const struct sockaddr *sap, char *buf,
109 const size_t len)
110{
111 const struct sockaddr_in *sin = (struct sockaddr_in *)sap;
112 snprintf(buf, len, "%pI4", &sin->sin_addr.s_addr);
113}
114
108static void nlm_display_ipv6_address(const struct sockaddr *sap, char *buf, 115static void nlm_display_ipv6_address(const struct sockaddr *sap, char *buf,
109 const size_t len) 116 const size_t len)
110{ 117{
@@ -122,11 +129,9 @@ static void nlm_display_ipv6_address(const struct sockaddr *sap, char *buf,
122static void nlm_display_address(const struct sockaddr *sap, 129static void nlm_display_address(const struct sockaddr *sap,
123 char *buf, const size_t len) 130 char *buf, const size_t len)
124{ 131{
125 const struct sockaddr_in *sin = (struct sockaddr_in *)sap;
126
127 switch (sap->sa_family) { 132 switch (sap->sa_family) {
128 case AF_INET: 133 case AF_INET:
129 snprintf(buf, len, "%pI4", &sin->sin_addr.s_addr); 134 nlm_display_ipv4_address(sap, buf, len);
130 break; 135 break;
131 case AF_INET6: 136 case AF_INET6:
132 nlm_display_ipv6_address(sap, buf, len); 137 nlm_display_ipv6_address(sap, buf, len);