summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Stefan Richter 2010-06-20 21:50:09 +0200
committerGravatar Stefan Richter 2010-09-07 11:27:03 +0200
commit926e9ea3ad43b3db4f5fea96699718677d747bac (patch)
tree2a43298065d0451c993d45080cc7a65be6ef315c
parentFix FCP and ARM source node ID on firewire-core (diff)
Filter incoming requests per card
If multiple cards are installed, firewire-core will emit requests from nodes on any of the cards to clients. This is not expected by libraw1394 clients since a raw1394handle_t is bound to a single card alias port. On kernel 2.6.36 and newer we can filter out requests from other cards. Note that we still need to call the response ioctl in order to release kernel resources associated with an inbound transaction. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to '')
-rw-r--r--src/fw.c19
-rw-r--r--src/fw.h1
2 files changed, 17 insertions, 3 deletions
diff --git a/src/fw.c b/src/fw.c
index e5c23d1..03974a2 100644
--- a/src/fw.c
+++ b/src/fw.c
@@ -220,14 +220,14 @@ handle_lost_device(fw_handle_t handle, int i)
struct address_closure {
int (*callback)(raw1394handle_t handle, struct address_closure *ac,
int tcode, unsigned long long offset,
- int source_node_id, unsigned kernel_handle,
+ int source_node_id, int card, unsigned kernel_handle,
size_t length, void *data);
};
static int
handle_fcp_request(raw1394handle_t handle, struct address_closure *ac,
int tcode, unsigned long long offset, int source_node_id,
- unsigned kernel_handle, size_t length, void *data)
+ int card, unsigned kernel_handle, size_t length, void *data)
{
struct fw_cdev_send_response response;
int is_response;
@@ -247,6 +247,9 @@ handle_fcp_request(raw1394handle_t handle, struct address_closure *ac,
FW_CDEV_IOC_SEND_RESPONSE, &response) < 0)
return -1;
+ if (card != handle->mode.fw->card)
+ return 0;
+
if (response.rcode != RCODE_COMPLETE)
return 0;
@@ -315,6 +318,7 @@ handle_device_event(raw1394handle_t handle,
u->request.offset,
/* wild guess, but can't do better */
fwhandle->devices[i].node_id,
+ fwhandle->card,
u->request.handle,
u->request.length, u->request.data);
@@ -324,6 +328,7 @@ handle_device_event(raw1394handle_t handle,
return ac->callback(handle, ac, u->request2.tcode,
u->request2.offset,
u->request2.source_node_id,
+ u->request2.card,
u->request2.handle,
u->request2.length, u->request2.data);
#endif
@@ -673,6 +678,7 @@ int fw_set_port(fw_handle_t handle, int port)
if (reset.node_id == reset.local_node_id)
handle->local_device = &handle->devices[i];
+ handle->card = get_info.card;
handle->generation = reset.generation;
handle->abi_version = get_info.version;
@@ -730,7 +736,7 @@ struct allocation {
static int
handle_arm_request(raw1394handle_t handle, struct address_closure *ac,
int tcode, unsigned long long offset, int source_node_id,
- unsigned kernel_handle, size_t length, void *data)
+ int card, unsigned kernel_handle, size_t length, void *data)
{
fw_handle_t fwhandle = handle->mode.fw;
struct allocation *allocation = (struct allocation *) ac;
@@ -809,6 +815,13 @@ handle_arm_request(raw1394handle_t handle, struct address_closure *ac,
return -1;
}
+ /*
+ * libraw1394 clients do not expect requests from nodes on
+ * a card other than the one set by raw1394_set_port().
+ */
+ if (card != fwhandle->card)
+ return 0;
+
if (!(allocation->notification_options & type))
return 0;
diff --git a/src/fw.h b/src/fw.h
index fe61b20..b0ff169 100644
--- a/src/fw.h
+++ b/src/fw.h
@@ -79,6 +79,7 @@ struct fw_handle {
struct port ports[MAX_PORTS];
int port_count;
int err;
+ int card;
int generation;
int abi_version;
void *userdata;
13Re-add the pdf buildGravatar bencollins 1-0/+1 2003-07-13Update Debian files.Gravatar bencollins 4-25/+73 2003-07-13Ok, the Debian package was way out of sync with upstreamGravatar bencollins 1-1/+1 2003-07-13Ooops...libtool works a bit different than I thought, but atleast it worksGravatar bencollins 2-6/+1 2003-07-13Generate and install the pdf in the Debian package.Gravatar bencollins 3-3/+4 2003-07-13Don't run configure at the end of autogen.sh. Also, remove autom4te.cache.Gravatar bencollins 1-1/+1 2003-07-13Update Debian maintainerGravatar bencollins 1-1/+2 2003-07-13Update Debian changelog.Gravatar bencollins 1-0/+8 2003-07-13File doesn't really seem needed. The NEWS file gives a good overview, andGravatar bencollins 1-4/+0 2003-07-13Fix compiler warnings.Gravatar bencollins 4-12/+22 2003-07-13Updates from 0.10.0 release.Gravatar bencollins 4-5/+14 2003-04-23add libtoolize to bootstrapGravatar ddennedy 1-1/+10 2003-04-21added Dan Maas' rawiso docsGravatar ddennedy 1-32/+295 2003-04-07new_handle_on_port() error path fix from Jim RadfordGravatar dmaas 1-1/+3 2003-03-26add raw1394_new_handle_on_port() convenience functionGravatar dmaas 2-1/+41 2003-02-22Updates for new rawiso ioctl interface.Gravatar bencollins 3-37/+125 2003-01-15add iso_xmit_sync() and iso_xmit_write(); clean up iso handling a bitGravatar dmaas 5-39/+161 2003-01-15implement tag matching for rawiso receptionGravatar dmaas 3-4/+12 2003-01-06back out previous commit - don't drop the legacy API just yetGravatar dmaas 6-173/+130 2003-01-05emulate legacy ISO reception API on top of new rawiso APIGravatar dmaas 7-131/+174 2002-12-24update iso API for multi-channel reception and new packet buffer layoutGravatar dmaas 4-123/+236 2002-12-20oops, irq_interval needs to be signedGravatar anonymous 1-1/+1 2002-12-20dmaas - renamed exported arm definitions into the raw1394_ namespace; brought...Gravatar anonymous 3-124/+48 2002-12-16rawiso updates:Gravatar dmaas 3-18/+25 2002-11-18fix cplusplus extern C blockGravatar ddennedy 1-4/+4 2002-11-18merged rawiso branchGravatar ddennedy 7-6/+488