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>
-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;
ss='insertions'>+10 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@107 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-04-21added Dan Maas' rawiso docsGravatar ddennedy 1-32/+295 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@106 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-04-07new_handle_on_port() error path fix from Jim RadfordGravatar dmaas 1-1/+3 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@105 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-03-26add raw1394_new_handle_on_port() convenience functionGravatar dmaas 2-1/+41 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@104 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-02-22Updates for new rawiso ioctl interface.Gravatar bencollins 3-37/+125 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@103 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-01-15add iso_xmit_sync() and iso_xmit_write(); clean up iso handling a bitGravatar dmaas 5-39/+161 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@102 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-01-15implement tag matching for rawiso receptionGravatar dmaas 3-4/+12 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@101 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-01-06back out previous commit - don't drop the legacy API just yetGravatar dmaas 6-173/+130 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@100 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-01-05emulate legacy ISO reception API on top of new rawiso APIGravatar dmaas 7-131/+174 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@99 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-24update iso API for multi-channel reception and new packet buffer layoutGravatar dmaas 4-123/+236 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@98 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-20oops, irq_interval needs to be signedGravatar anonymous 1-1/+1 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@97 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-20dmaas - renamed exported arm definitions into the raw1394_ namespace; ↵Gravatar anonymous 3-124/+48 brought kernel-raw1394.h back in sync with the kernel version git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@96 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-16rawiso updates:Gravatar dmaas 3-18/+25 - changed return type of rawiso xmit/recv handlers from int to enum raw1394_iso_disposition - added an ioctl (RAW1394_ISO_QUEUE_ACTIVITY) to force an ISO_ACTIVITY event into the queue. This is needed for handling RAW1394_ISO_DEFER, to kick us out of the next read() instead of sleeping forever. - removed references to "8-byte" isochronous header - this is an OHCI-specific implementation detail git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@95 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-11-18fix cplusplus extern C blockGravatar ddennedy 1-4/+4 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@94 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-11-18merged rawiso branchGravatar ddennedy 7-6/+488 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@93 53a565d1-3bb7-0310-b661-cf11e63c67ab