On Tue, Oct 31, 2000 at 06:17:26PM +0100, Davide Dozza wrote:
>
> Is it possible to setup IrDA port in order to work in passive
> way? I would like that my IrDA port doesn't partecipate to
> the discovery process but just listen what two devices
> are telling to each other.
Attached is an extremely rough patch to 2.2.17pre15 to do exactly this.
All it does it notch out discovery, and some send functions (but not all, I
couldn't work out why I had to leave some transmission enabled or irdadump
never saw anything), and removed a couple of addressing checks to fake
a sort of promiscuous mode.
With this patch I was able to get some good dumps of IrDA traffic between
two other devices.
>
> Davide
- Dick
diff -ur -x .depend leviathan/linux/net/irda/irlap_frame.c
malaclypse/linux/net/irda/irlap_frame.c
--- leviathan/linux/net/irda/irlap_frame.c Wed Jun 7 22:26:44 2000
+++ malaclypse/linux/net/irda/irlap_frame.c Sun Sep 10 18:47:18 2000
@@ -83,6 +83,11 @@
*/
void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb)
{
+#if 0
+ dev_kfree_skb(skb);
+ return;
+#endif
+
/* Some common init stuff */
skb->dev = self->netdev;
skb->h.raw = skb->nh.raw = skb->mac.raw = skb->data;
@@ -172,12 +177,14 @@
info->daddr = le32_to_cpu(frame->saddr);
info->saddr = le32_to_cpu(frame->daddr);
+#if 0
/* Only accept if addressed directly to us */
if (info->saddr != self->saddr) {
IRDA_DEBUG(2, __FUNCTION__ "(), not addressed to us!\n");
dev_kfree_skb(skb);
return;
}
+#endif
irlap_do_event(self, RECV_SNRM_CMD, skb, info);
} else
/* Signal that this SNRM frame does not contain and I-field */
@@ -302,6 +309,8 @@
__u32 bcast = BROADCAST;
__u8 *info;
+ return;
+
IRDA_DEBUG(4, __FUNCTION__ "(), s=%d, S=%d, command=%d\n", s, S,
command);
@@ -404,6 +413,7 @@
info->daddr = le32_to_cpu(xid->saddr);
info->saddr = le32_to_cpu(xid->daddr);
+#if 0
/* Make sure frame is addressed to us */
if ((info->saddr != self->saddr) && (info->saddr != BROADCAST)) {
IRDA_DEBUG(0, __FUNCTION__
@@ -411,6 +421,7 @@
dev_kfree_skb(skb);
return;
}
+#endif
if ((discovery = kmalloc(sizeof(discovery_t), GFP_ATOMIC)) == NULL) {
WARNING(__FUNCTION__ "(), kmalloc failed!\n");
@@ -472,6 +483,7 @@
info->daddr = le32_to_cpu(xid->saddr);
info->saddr = le32_to_cpu(xid->daddr);
+#if 0
/* Make sure frame is addressed to us */
if ((info->saddr != self->saddr) && (info->saddr != BROADCAST)) {
IRDA_DEBUG(0, __FUNCTION__
@@ -479,6 +491,7 @@
dev_kfree_skb(skb);
return;
}
+#endif
switch (xid->flags & 0x03) {
case 0x00:
@@ -567,6 +580,9 @@
frame[1] = RR | PF_BIT | (self->vr << 5);
+ dev_kfree_skb(skb);
+ return;
+
irlap_queue_xmit(self, skb);
}
@@ -1091,6 +1107,9 @@
/* Insert connection address */
skb->data[0] = caddr | ((command) ? CMD_FRAME : 0);
+ dev_kfree_skb(skb);
+ return;
+
irlap_queue_xmit(self, skb);
}
@@ -1109,6 +1128,9 @@
/* Insert next to receive (Vr) */
skb->data[1] |= (self->vr << 5); /* insert nr */
+ dev_kfree_skb(skb);
+ return;
+
irlap_queue_xmit(self, skb);
}
@@ -1267,12 +1289,14 @@
info->daddr = le32_to_cpu(frame->saddr);
info->saddr = le32_to_cpu(frame->daddr);
+#if 0
/* Make sure frame is addressed to us */
if ((info->saddr != self->saddr) &&
(info->saddr != BROADCAST)) {
dev_kfree_skb(skb);
return;
}
+#endif
}
if (command)
diff -ur -x .depend leviathan/linux/net/irda/irlmp_frame.c
malaclypse/linux/net/irda/irlmp_frame.c
--- leviathan/linux/net/irda/irlmp_frame.c Thu May 4 01:16:54 2000
+++ malaclypse/linux/net/irda/irlmp_frame.c Mon Sep 4 19:55:31 2000
@@ -349,6 +349,8 @@
ASSERT(self != NULL, return;);
ASSERT(self->magic == LMP_LAP_MAGIC, return;);
+ return;
+
irlmp_add_discovery(irlmp->cachelog, discovery);
#if 0 /* This will just cause a lot of connection collisions */
@@ -370,6 +372,8 @@
{
IRDA_DEBUG(4, __FUNCTION__ "()\n");
+ return;
+
ASSERT(self != NULL, return;);
ASSERT(self->magic == LMP_LAP_MAGIC, return;);
_______________________________________________
Linux-IrDA mailing list - [EMAIL PROTECTED]
http://www.pasta.cs.UiT.No/mailman/listinfo/linux-irda