bind.c revision 16e76cdd6e3cfaac7d91c3b0644ee1bc6cf52347
/*
*/
/*
* 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>
/*
* XXX this probably still needs more work.. no INADDR_ANY, and rbtrees aren't
* particularly zippy.
*
* This is now called for every incoming frame so we arguably care much more
* about it than we used to.
*/
static struct rdsv3_sock *
struct rdsv3_sock *insert)
{
struct rdsv3_sock *rs;
}
return (rs);
}
/*
* 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 *
{
struct rdsv3_sock *rs;
else
return (rs);
}
/* returns -ve errno or +ve port */
static int
{
int ret = -EADDRINUSE;
if (*port != 0) {
} else {
sizeof (uint16_t));
}
do {
if (rover == 0)
rover++;
ret = 0;
break;
}
if (ret == 0) {
RDSV3_DPRINTF5("rdsv3_add_bound",
"rs %p binding to %u.%u.%u.%u:%x",
}
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);
}