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) 1990, 2011, Oracle and/or its affiliates. All rights reserved. 2N/A/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 2N/A/* All Rights Reserved */ 2N/A * Portions of this source code were derived from Berkeley 2N/A * 4.3 BSD under license from the Regents of the University of 2N/A * This routine is typically called on the server side if the server 2N/A * wants to know the caller ucred. Called typically by rpcbind. It 2N/A * depends upon the t_optmgmt call to local transport driver so that 2N/A * return the uid value in options in T_CONN_IND, T_CONN_CON and 2N/A * With the advent of the credential in the mblk, this is simply 2N/A * extended to all transports when the packet travels over the 2N/A * loopback network; for UDP we use a special socket option and for 2N/A * tcp we don't need to do any setup, we just call getpeerucred() 2N/A * Version for Solaris with new local transport code and ucred. 2N/A /* For tcp we use getpeerucred and it needs no initialization. */ 2N/A * This returns the ucred of the caller. It assumes that the optbuf 2N/A * information is stored at xprt->xp_p2. 2N/A * There are three distinct cases: the option buffer is headed 2N/A * with a "struct opthdr" and the credential option is the only 2N/A * one, or it's a T_opthdr and our option may follow others; or there 2N/A * are no options and we attempt getpeerucred(). 2N/A /* LINTED pointer alignment */ 2N/A * Always from inside our zone because zones use a separate name 2N/A * space for loopback; at this time, the kernel may send a 2N/A * packet pretending to be from the global zone when it's 2N/A * really from our zone so we skip the zone check. 2N/A /* LINTED pointer cast */ 2N/A /* Return 0 only for the local zone */ 2N/A * Version for Solaris with new local transport code 2N/A /* LINTED - pointer alignment */ 2N/A * Return local credentials. 2N/A /* LINTED - pointer alignment */ 2N/A * Return local ucred. 2N/A /* LINTED - pointer alignment */ 2N/A * get local ip address 2N/A /* Make sure the start of the buffer is aligned */ 2N/A /* LINTED pointer alignment */ 2N/A * Look for the desired option header 2N/A "__rpc_get_ltaddr for IP_RECVDSTADDR: %s",
2N/A "dev udp open failed");
2N/A "get_ltaddr:ioctl for udp failed");
2N/A "__rpc_get_ltaddr for IPV6_PKTINFO: %s",
2N/A "dev udp6 open failed");
2N/A "get_ltaddr:ioctl for udp6 failed");
2N/A /* LINTED improper alignment */ 2N/A * Format an error message corresponding to the given TLI and system error 2N/A * Depending on the specified RPC number, attempt to set mac_exempt 2N/A * option on the opened socket; these requests need to be able to do MAC 2N/A * MAC read-down operations. Privilege is needed to set this option.