1 /* SPDX-License-Identifier: LGPL-2.1 */
2 /*
3 * DNS Resolver upcall management for CIFS DFS
4 * Handles host name to IP address resolution
5 *
6 * Copyright (c) International Business Machines Corp., 2008
7 * Author(s): Steve French ([email protected])
8 *
9 */
10
11 #ifndef _DNS_RESOLVE_H
12 #define _DNS_RESOLVE_H
13
14 #include <linux/net.h>
15 #include "cifsglob.h"
16 #include "cifsproto.h"
17
18 #ifdef __KERNEL__
19
20 int dns_resolve_name(const char *dom, const char *name,
21 size_t namelen, struct sockaddr *ip_addr);
22
dns_resolve_unc(const char * dom,const char * unc,struct sockaddr * ip_addr)23 static inline int dns_resolve_unc(const char *dom, const char *unc,
24 struct sockaddr *ip_addr)
25 {
26 const char *name;
27 size_t namelen;
28
29 if (!unc || strlen(unc) < 3)
30 return -EINVAL;
31
32 extract_unc_hostname(unc, &name, &namelen);
33 if (!namelen)
34 return -EINVAL;
35
36 return dns_resolve_name(dom, name, namelen, ip_addr);
37 }
38
39 #endif /* KERNEL */
40
41 #endif /* _DNS_RESOLVE_H */
42