diff options
Diffstat (limited to 'fs/smb/client/dns_resolve.h')
| -rw-r--r-- | fs/smb/client/dns_resolve.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/fs/smb/client/dns_resolve.h b/fs/smb/client/dns_resolve.h new file mode 100644 index 000000000000..36bc4a6a55bf --- /dev/null +++ b/fs/smb/client/dns_resolve.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: LGPL-2.1 */ +/* + * DNS Resolver upcall management for CIFS DFS + * Handles host name to IP address resolution + * + * Copyright (c) International Business Machines Corp., 2008 + * Author(s): Steve French (sfrench@us.ibm.com) + * + */ + +#ifndef _DNS_RESOLVE_H +#define _DNS_RESOLVE_H + +#include <linux/net.h> +#include "cifsglob.h" +#include "cifsproto.h" + +int dns_resolve_name(const char *dom, const char *name, + size_t namelen, struct sockaddr *ip_addr); + +static inline int dns_resolve_unc(const char *dom, const char *unc, + struct sockaddr *ip_addr) +{ + const char *name; + size_t namelen; + + if (!unc || strlen(unc) < 3) + return -EINVAL; + + extract_unc_hostname(unc, &name, &namelen); + if (!namelen) + return -EINVAL; + + return dns_resolve_name(dom, name, namelen, ip_addr); +} + +#endif /* _DNS_RESOLVE_H */ |
