prevent local socket address from being changed after socket is
in use (connect or listen)
This commit is contained in:
parent
e3420c6750
commit
1e2b8c6e0e
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: l2cap_upper.c,v 1.10 2009/09/25 19:44:57 plunky Exp $ */
|
||||
/* $NetBSD: l2cap_upper.c,v 1.11 2010/01/04 19:20:05 plunky Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 Iain Hibbert.
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: l2cap_upper.c,v 1.10 2009/09/25 19:44:57 plunky Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: l2cap_upper.c,v 1.11 2010/01/04 19:20:05 plunky Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -110,6 +110,9 @@ int
|
||||
l2cap_bind(struct l2cap_channel *chan, struct sockaddr_bt *addr)
|
||||
{
|
||||
|
||||
if (chan->lc_lcid != L2CAP_NULL_CID)
|
||||
return EINVAL;
|
||||
|
||||
memcpy(&chan->lc_laddr, addr, sizeof(struct sockaddr_bt));
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rfcomm_upper.c,v 1.12 2009/11/22 19:09:16 mbalmer Exp $ */
|
||||
/* $NetBSD: rfcomm_upper.c,v 1.13 2010/01/04 19:20:05 plunky Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 Itronix Inc.
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rfcomm_upper.c,v 1.12 2009/11/22 19:09:16 mbalmer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rfcomm_upper.c,v 1.13 2010/01/04 19:20:05 plunky Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -106,6 +106,9 @@ int
|
||||
rfcomm_bind(struct rfcomm_dlc *dlc, struct sockaddr_bt *addr)
|
||||
{
|
||||
|
||||
if (dlc->rd_state != RFCOMM_DLC_CLOSED)
|
||||
return EINVAL;
|
||||
|
||||
memcpy(&dlc->rd_laddr, addr, sizeof(struct sockaddr_bt));
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sco_upper.c,v 1.8 2008/08/06 15:01:24 plunky Exp $ */
|
||||
/* $NetBSD: sco_upper.c,v 1.9 2010/01/04 19:20:05 plunky Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 Itronix Inc.
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sco_upper.c,v 1.8 2008/08/06 15:01:24 plunky Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sco_upper.c,v 1.9 2010/01/04 19:20:05 plunky Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -90,6 +90,9 @@ int
|
||||
sco_bind(struct sco_pcb *pcb, struct sockaddr_bt *addr)
|
||||
{
|
||||
|
||||
if (pcb->sp_link != NULL || pcb->sp_flags & SP_LISTENING)
|
||||
return EINVAL;
|
||||
|
||||
bdaddr_copy(&pcb->sp_laddr, &addr->bt_bdaddr);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user