select()/AppleTalk/pcap

select()/AppleTalk/pcap

Post by Hiro Sugawa » Tue, 12 Dec 1995 04:00:00



I am writing a gateway program between MacIP (IP carried by AppleTalk's DDP)
and plain IP using netalk and pcap (supplied with tcpdump).

The problem is, if I only open the AppleTalk side socket, the socket detects
incoming packets and select() returns correctly. But if I open both the
AppleTalk socket and pcap socket, the ApplTalk socket never wakes up
while the pcap socket detects IP packets. Below is the code skelton.

as = socket(AF_APPLETALK, SOCK_DGRAM, 0);
/* bind() etc. */
pd = pcap_open_live("blackhole_device", ...);

while (1)
{
        FD_CLR(&fdset);
        FD_SET(as, &fdset);
        FD_SET(pd->socket, &fdset);      /* If this is set     ------+ */
        select(..., &fdset, .....); /* For receiving            | */
                                                                /*                          | */
        if (FD_ISSET(as, &fdset))   /* This never happens <-----+
                /* Receive from AppleTalk */;
        if (FD_ISSET(pd->socket, &fdset))
                /* Receive from pcap device */;

        ...

Quote:}

Any clue?

hiro
--

Oracle Corporation                           MPP Development
500 Oracle Parkway, Box 659107, Redwood Shores, CA 94065 USA

 
 
 

1. Pcap/Libnet Interaction - Can I make pcap ignore locally generated frames?

Hello,

I am building a simple bridge with libpcap and libnet as a quick hack
solution to another problem.

A problem I've encountered is that when a frame is received by libpcap
on interface A and retransmitted with libnet (using PF_PACKET) on
interface B, libpcap "hears" the same same frame on interface B
resulting in a loop.

Is there any way to prevent locally generated traffic from coming back
up in libpcap? Clearly the source ethernet address is of no help as this
is a bridge.

Any suggestions would be appreciated. I'm using libnet 1.0.1b, libpcap
0.4, and kernel 2.2.12.

mhe

--
Michael H. Evangelista

2. installation prob: wont read cdrom

3. YDL/CS 1.2: How to select Appletalk printers?

4. S3 ViRGE supported yet?

5. if change date during select ( ), select is hang

6. PLEASE HELP ME!!!!!!!!!

7. How does select() function "select"?

8. Problems setting up firewall with RedHat 5.0 on Alpha

9. select field n to last? select last field?

10. Does select() return if the FD changed before select() was called?

11. select() and ignore work, reissue select.

12. pcap problem.

13. pcap