613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * CDDL HEADER START
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * The contents of this file are subject to the terms of the
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * Common Development and Distribution License (the "License").
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * You may not use this file except in compliance with the License.
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * See the License for the specific language governing permissions
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * and limitations under the License.
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * When distributing Covered Code, include this CDDL HEADER in each
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * If applicable, add the following below this CDDL HEADER, with the
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * fields enclosed by brackets "[]" replaced with your own identifying
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * information: Portions Copyright [yyyy] [name of copyright owner]
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * CDDL HEADER END
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * Use is subject to license terms.
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * Find existing an VC given a list of addresses.
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * Ask the driver if it has a VC with this IP address.
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * Copy the passed address into ssn_srvaddr,
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * but first sanity-check lengths. Also,
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * zero it first to avoid trailing junk.
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross bzero(&ssn->ssn_srvaddr, sizeof (ssn->ssn_srvaddr));
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross bcopy(ai->ai_addr, &ssn->ssn_srvaddr, ai->ai_addrlen);
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross if (ioctl(ctx->ct_dev_fd, SMBIOC_SSN_FIND, ssn) == -1)
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * Find (and reuse) an existing VC.
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross /* Should already have the address list. */
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross for (ai = ctx->ct_addrinfo; ai; ai = ai->ai_next) {
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross /* re-use an existing VC */
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * Forcibly disconnect the current session, even if
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * there are others using it! This is used by the
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * SMB server netlogon when it wants to setup a new
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * logon session and does not want any re-use.