lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] [lwip] v.0.5.3 UDP demultiplexing question.


From: Adel Mamin
Subject: [lwip-users] [lwip] v.0.5.3 UDP demultiplexing question.
Date: Wed, 08 Jan 2003 23:16:21 -0000

Hello, all.

This is a fragment from udp.c file (function 'udp_input').

  /* Demultiplex packet. First, go for a perfect match. */
  for(pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) {
    DEBUGF(UDP_DEBUG, ("udp_input: pcb local port %d (dgram %d)\n",
                       pcb->local_port, ntohs(udphdr->dest)));
    if(pcb->remote_port == src &&
       pcb->local_port == dest &&
       (ip_addr_isany(&pcb->remote_ip) ||
        ip_addr_cmp(&(pcb->remote_ip), &(iphdr->src))) &&
       (ip_addr_isany(&pcb->local_ip) ||
        ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest)))) {
      break;
    }
  }

  if(pcb == NULL) {
    for(pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) {
      DEBUGF(UDP_DEBUG, ("udp_input: pcb local port %d (dgram %d)\n",
                         pcb->local_port, dest));
      if(pcb->local_port == dest &&
         (ip_addr_isany(&pcb->remote_ip) ||
          ip_addr_cmp(&(pcb->remote_ip), &(iphdr->src))) &&
         (ip_addr_isany(&pcb->local_ip) ||
          ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest)))) {
        break;
      }      
    }
  }

And this is a fragment from ip6_addr.c:

int
ip_addr_isany(struct ip_addr *addr)
{
  if(addr == NULL) return 1;
  return((addr->addr[0] | addr->addr[1] | addr->addr[2] | addr->addr[3]) ==
0);
}

My problem - my application doesn't receive incoming datagrams.
In my application:
       pcb->remote_ip == 0xFFFFFFFF, i.e. my application sends broadcast
datagrams only.
       pcb->remote_port ==  0x409C
       pcb->local_port == 0x419C
       pcb->local_ip == 0x00000000

As I see from demultiplexing conditions my apllication will never receive
any datagram because:
             (pcb->local_port == dest &&
(may be  TRUE)
             (ip_addr_isany(&pcb->remote_ip) ||
(always FALSE)
             ip_addr_cmp(&(pcb->remote_ip), &(iphdr->src))) &&  (   !!!!!
ALWAYS FALSE  !!!!!  - and this is the reason 
 
I will never receive anything)
             (ip_addr_isany(&pcb->local_ip) ||
(always FALSE)
             ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest))))       (does not
matter)

As I understand incoming datagrams will never have a broadcast address as a
source address but I can't see
the reason why my application can't receive in this case.

What is wrong in my case?
Should I reconstruct my application?

Thanks in advance.

Adel Mamin.
[This message was sent through the lwip discussion list.]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]