Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netbt prevent local socket address from being changed af...
details: https://anonhg.NetBSD.org/src/rev/b353b7814e3c
branches: trunk
changeset: 750528:b353b7814e3c
user: plunky <plunky%NetBSD.org@localhost>
date: Mon Jan 04 19:20:05 2010 +0000
description:
prevent local socket address from being changed after socket is
in use (connect or listen)
diffstat:
sys/netbt/l2cap_upper.c | 7 +++++--
sys/netbt/rfcomm_upper.c | 7 +++++--
sys/netbt/sco_upper.c | 7 +++++--
3 files changed, 15 insertions(+), 6 deletions(-)
diffs (84 lines):
diff -r d6cd7d04ba44 -r b353b7814e3c sys/netbt/l2cap_upper.c
--- a/sys/netbt/l2cap_upper.c Mon Jan 04 18:00:26 2010 +0000
+++ b/sys/netbt/l2cap_upper.c Mon Jan 04 19:20:05 2010 +0000
@@ -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 @@
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;
}
diff -r d6cd7d04ba44 -r b353b7814e3c sys/netbt/rfcomm_upper.c
--- a/sys/netbt/rfcomm_upper.c Mon Jan 04 18:00:26 2010 +0000
+++ b/sys/netbt/rfcomm_upper.c Mon Jan 04 19:20:05 2010 +0000
@@ -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 @@
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;
}
diff -r d6cd7d04ba44 -r b353b7814e3c sys/netbt/sco_upper.c
--- a/sys/netbt/sco_upper.c Mon Jan 04 18:00:26 2010 +0000
+++ b/sys/netbt/sco_upper.c Mon Jan 04 19:20:05 2010 +0000
@@ -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 @@
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;
}
Home |
Main Index |
Thread Index |
Old Index