// SPDX-License-Identifier: LGPL-2.1 /* * * Copyright (c) 2007 Igor Mammedov * Author(s): Igor Mammedov (niallain@gmail.com) * Steve French (sfrench@us.ibm.com) * Wang Lei (wang840925@gmail.com) * David Howells (dhowells@redhat.com) * * Contains the CIFS DFS upcall routines used for hostname to * IP address translation. *
*/
/** * dns_resolve_name - Perform an upcall to resolve hostname to an ip address. * @dom: DNS domain name (or NULL) * @name: Name to look up * @namelen: Length of name * @ip_addr: Where to return the IP address * * Returns zero on success, -ve code otherwise.
*/ int dns_resolve_name(constchar *dom, constchar *name,
size_t namelen, struct sockaddr *ip_addr)
{
size_t len; char *s; int rc;
cifs_dbg(FYI, "%s: hostname=%.*s\n", __func__, (int)namelen, name); /* Try to interpret hostname as an IPv4 or IPv6 address */
rc = cifs_convert_address(ip_addr, name, namelen); if (rc > 0) {
cifs_dbg(FYI, "%s: unc is IP, skipping dns upcall: %*.*s\n",
__func__, (int)namelen, (int)namelen, name); return 0;
}
/* * If @name contains a NetBIOS name and @dom has been specified, then * convert @name to an FQDN and try resolving it first.
*/ if (dom && *dom && cifs_netbios_name(name, namelen)) {
len = strnlen(dom, CIFS_MAX_DOMAINNAME_LEN) + namelen + 2;
s = kmalloc(len, GFP_KERNEL); if (!s) return -ENOMEM;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.