2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. 2N/A * Internet utility functions. 2N/A * Given a host-order address, calculate client's default net mask. 2N/A * Consult netmasks database to see if net is further subnetted. 2N/A * We'll only snag the first netmask that matches our criteria. 2N/A * We return the resultant netmask in host order. 2N/A * First check if VLSM is in use. 2N/A * Fall back on standard classed networks. 2N/A * Checks if the IP addresses `ssp1' and `ssp2' are equal. 2N/A * Stores the netmask in `mask' for the given prefixlen `plen' and also sets 2N/A * `sa_family' in `mask'. Because this function does not require aligned 2N/A * access to the data inside of the sockaddr_in/6 structures, the code can 2N/A * use offsetof() to find the right place in the incoming structure. Why is 2N/A * using that beneficial? Less issues with lint. When using a direct cast 2N/A * of the struct sockaddr_storage structure to sockaddr_in6, a lint warning 2N/A * is generated because the former is composed of 16bit & 8bit elements whilst 2N/A * sockaddr_in6 has a 32bit alignment requirement. 2N/A * Convert a mask to a prefix length. 2N/A * Returns prefix length on success, -1 otherwise. 2N/A * The comments (above) for plen2mask about the use of `mask' also apply 2N/A * to this function and the choice to use offsetof here too. 2N/A * Returns B_TRUE if the address in `ss' is INADDR_ANY for IPv4 or 2N/A * :: for IPv6. Otherwise, returns B_FALSE. 2N/A * IP protcols to string mapping -- Special exception for SDP 2N/A * Validate the given hostname value according to RFC 952 and 1123. But we do 2N/A * allow the first and last char of the given hostname to have a period or 2N/A * hyphen or underscore. We allow the underscore ('_') as is often used on MS 2N/A * A recursive function to generate an alphabetized string from a given 2N/A * decimal number. Decimal 1 to 26 maps to 'a' to 'z' and then the counting 2N/A * continues with 'aa', 'ab', 'ac', et al. This function is used by ipmgmtd 2N/A * and libnwam to automatically generate address object names.