aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/netmisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/netmisc.c')
-rw-r--r--fs/cifs/netmisc.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index d35d52889cb5..3489468d070b 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -164,7 +164,7 @@ cifs_inet_pton(const int address_family, const char *cp, void *dst)
164 * Returns 0 on failure. 164 * Returns 0 on failure.
165 */ 165 */
166int 166int
167cifs_convert_address(char *src, void *dst) 167cifs_convert_address(struct sockaddr *dst, char *src)
168{ 168{
169 int rc; 169 int rc;
170 char *pct, *endp; 170 char *pct, *endp;
@@ -201,6 +201,27 @@ cifs_convert_address(char *src, void *dst)
201 return rc; 201 return rc;
202} 202}
203 203
204int
205cifs_fill_sockaddr(struct sockaddr *dst, char *src,
206 const unsigned short int port)
207{
208 if (!cifs_convert_address(dst, src))
209 return 0;
210
211 switch (dst->sa_family) {
212 case AF_INET:
213 ((struct sockaddr_in *)dst)->sin_port = htons(port);
214 break;
215 case AF_INET6:
216 ((struct sockaddr_in6 *)dst)->sin6_port = htons(port);
217 break;
218 default:
219 return 0;
220 }
221
222 return 1;
223}
224
204/***************************************************************************** 225/*****************************************************************************
205convert a NT status code to a dos class/code 226convert a NT status code to a dos class/code
206 *****************************************************************************/ 227 *****************************************************************************/