Allow snooping of the loopback medium
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 21 Sep 2016 19:58:41 +0000 (15:58 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 21 Sep 2016 21:28:01 +0000 (17:28 -0400)
Snoopy either directly tries to clone a devether conversation or opens a
 #ip/ipifc/snoop file.  The only medium that supported that snoop was
pktmedium.  This commit adds support for loopback.

Incidentally, I'm not sure why devether doesn't use the ethermedium snoop.
Maybe it has something to do with setting promiscuous.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/src/net/loopbackmedium.c

index 5d47a95..19b80c3 100644 (file)
@@ -129,10 +129,12 @@ static void loopbackread(void *a)
                        runlock(&ifc->rwlock);
                        nexterror();
                }
-               if (ifc->lifc == NULL)
+               if (ifc->lifc == NULL) {
                        freeb(bp);
-               else
+               } else {
+                       ipifc_trace_block(ifc, bp);
                        ipiput4(lb->f, ifc, bp);
+               }
                runlock(&ifc->rwlock);
                poperror();
        }