/*
*/
/*
* This file contains code imported from the OFED rds source file bind.c
* Oracle elects to have and use the contents of bind.c under and governed
* by the OpenIB.org BSD license (see below for full license text). However,
* the following notice accompanied the original version of this file:
*/
/*
* Copyright (c) 2006 Oracle. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* provided with the distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
#include <sys/sysmacros.h>
/*
* Each node in the rdsv3_bind_tree is of this type.
*/
struct rdsv3_ip_bucket {
};
static int
rdsv3_bind_node_compare(const void *a, const void *b)
{
return (+1);
return (-1);
return (0);
}
void
{
sizeof (struct rdsv3_ip_bucket),
}
/* called on detach */
void
{
while ((bucketp =
}
}
struct rdsv3_ip_bucket *
{
/* allocate a new bucket for this IP & zone */
bucketp =
}
return (bucketp);
}
/*
* Return the rdsv3_sock bound at the given local address.
*
* The rx path can race with rdsv3_release. We notice if rdsv3_release() has
* marked this socket and don't return a rs ref to the rx path.
*/
struct rdsv3_sock *
{
else
return (rs);
}
/* returns -ve errno or +ve port */
static int
{
if (*port != 0) {
} else {
sizeof (uint16_t));
}
/* leave the bind lock and get the bucket lock */
do {
if (rover == 0)
rover++;
ret = 0;
break;
}
if (ret == 0) {
RDSV3_DPRINTF5("rdsv3_add_bound",
"rs %p binding to %u.%u.%u.%u:%d",
}
return (ret);
}
void
{
if (rs->rs_bound_addr) {
RDSV3_DPRINTF5("rdsv3_remove_bound",
"rs %p unbinding from %u.%u.%u.%u:%x",
rs->rs_bound_addr = 0;
}
}
/* ARGSUSED */
int
{
int ret;
return (EINVAL);
}
return (EINVAL);
}
/* We don't allow multiple binds */
if (rs->rs_bound_addr) {
return (EINVAL);
}
if (ret) {
return (ret);
}
if (!rs->rs_transport) {
if (rdsv3_printk_ratelimit()) {
RDSV3_DPRINTF1("rdsv3_bind",
"RDS: rdsv3_bind() could not find a transport.\n");
}
return (EADDRNOTAVAIL);
}
return (0);
}