Problem receiving data generated from click

Lakshminarayanan Subramanian lakme at CS.Berkeley.EDU
Tue Dec 12 14:58:50 EST 2000


Dear Click Team,

We are having some trouble receiving packets generated by the Click
router, and were hoping you could help us out.  We are sending UDP packets
from click to a sink, both running Linux.  We are using UDPIPEncap and
EtherEncap to create the headers, and sending packets in kernel mode with
ToDevice, like this:

	...
	-> UDPIPEncap(click, 1234, sink1, 1111)
        -> EtherEncap(0x0800, click, switch)
	-> ToDevice("eth1");

At the sink, a tcpdump reveals that the packets are arriving at the
device, but are not received by a user level program listening for UDP
packets.  The user level sink receives the data just fine if I send the
exact same packets using the regular unix socket syscalls instead of the
click linux module.

The only difference that we can see between the packets generated by click
and those generated by linux are the TTL and ID fields in the IP header.
Is it possible that the receiving host is refusing packets because of an
incorrect ID?

Below are the packets captured at the sink using tcpdump.  One is from
click, and one is from a user level process.  I've also included a snippet
of code we used to receive UDP packets.

George Lee
Lakshmi


Click generated packet:

Ethernet II
    Destination: 00:00:00:00:00:01 (00:00:00:00:00:01)
    Source: 00:80:2d:6e:a1:81 (00:80:2d:6e:a1:81)
    Type: IP (0x0800)
Internet Protocol
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default)
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..00 = Currently Unused: 0
    Total Length: 114
    Identification: 0x0000
    Flags: 0x00
        .0.. = Don't fragment: Not set
        ..0. = More fragments: Not set
    Fragment offset: 0
    Time to live: 249
    Protocol: UDP (0x11)
    Header checksum: 0xa8f4 (correct)
    Source: forwarder (10.2.2.127)
    Destination: crashbox2 (10.2.2.4)
User Datagram Protocol
    Source port: 1234 (1234)
    Destination port: 1162 (1162)
    Length: 94
    Checksum: 0x9312
Data (86 bytes)

   0  0000 0000 0001 0080 2d6e a181 0800 4500   ........-n....E.
  10  0072 0000 0000 f911 a8f4 0a02 027f 0a02   .r..............
  20  0204 04d2 048a 005e 9312 3025 0201 0004   .......^..0%....
  30  0363 6800 a482 0048 060c 2b06 0102 0101   .ch....H..+.....
  40  0500 0000 0000 4004 0a02 0204 0201 0602   ...... at .........
  50  0101 4304 2763 0f72 3082 0024 3082 000e   ..C.'c.r0..$0...
  60  0606 2b06 0000 0000 0204 0000 0000 3082   ..+...........0.
  70  000e 0606 2b06 0000 0001 0204 0000 0000   ....+...........



User program generated packet:

Ethernet II
    Destination: 00:00:00:00:00:01 (00:00:00:00:00:01)
    Source: 00:80:2d:6e:a1:81 (00:80:2d:6e:a1:81)
    Type: IP (0x0800)
Internet Protocol
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default)
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..00 = Currently Unused: 0
    Total Length: 114
    Identification: 0x5d6a
    Flags: 0x00
        .0.. = Don't fragment: Not set
        ..0. = More fragments: Not set
    Fragment offset: 0
    Time to live: 63
    Protocol: UDP (0x11)
    Header checksum: 0x058b (correct)
    Source: forwarder (10.2.2.127)
    Destination: crashbox2 (10.2.2.4)
User Datagram Protocol
    Source port: 1036 (1036)
    Destination port: 1162 (1162)
    Length: 94
    Checksum: 0xd596
Data (86 bytes)

   0  0000 0000 0001 0080 2d6e a181 0800 4500   ........-n....E.
  10  0072 5d6a 0000 3f11 058b 0a02 027f 0a02   .r]j..?.........
  20  0204 040c 048a 005e d596 3025 0201 0004   .......^..0%....
  30  0363 6800 a482 0048 060c 2b06 0102 0101   .ch....H..+.....
  40  0500 0000 0000 4004 0a02 0204 0201 0602   ...... at .........
  50  0101 4304 2773 d6a3 3082 0024 3082 000e   ..C.'s..0..$0...
  60  0606 2b06 0000 0000 0204 0000 0000 3082   ..+...........0.
  70  000e 0606 2b06 0000 0001 0204 0000 0000   ....+...........



Code used to read UDP packets:

  struct sockaddr_in sin;
  int sd;

  memset(&sin, 0, sizeof(sin));
  sin.sin_port = htons(1162); // listen for traps
  sin.sin_family = AF_INET;
  sin.sin_addr.s_addr = host_ip;

  sd = socket(AF_INET, SOCK_DGRAM, 0);

  if (bind(sd, (struct sockaddr *)&sin, sizeof(sin)) == -1)
    printf("error binding to socket\n");

  int len;
  unsigned char buffer[1500];
  struct sockaddr_in from;
  socklen_t fromlen;
  len = recvfrom(sd, buffer, SSIZE_MAX, 0, (struct sockaddr *)&from,
&fromlen);
    }




More information about the click mailing list