lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] How do I receive UDP packets with unconfigred IP addres


From: Rogier Wolff
Subject: Re: [lwip-users] How do I receive UDP packets with unconfigred IP address.
Date: Thu, 21 Jan 2021 11:58:22 +0100

On Thu, Jan 21, 2021 at 10:37:52AM +0100, Indan Zupancic wrote:
> Hello Roger,
> 
> On 2021-01-20 23:03, Rogier Wolff wrote:
> > I would have hoped that even with ip address wronly configured, it
> > would pass the packet on to my udp-recieve function and that I could
> > then decide what to do. But it seems that the packet is discarded as
> > "not for me".
> 
> You probably also have to call ip_set_option(pcb, SOF_BROADCAST);
> and of course tell lwIP that the network interface is up.

The "upping" of the interface, I think that happens inside the call: 

  lwipInit(&opts);


but this made me look at the initialization of opts: 

 
  if (config.ipmode == IP_DHCP) {
    opts->addrMode =  NET_ADDRESS_DHCP;
  } else {
    //    opts.address = 0x64eaa8c0;
    opts->address = config.ipaddr;
    opts->netmask = config.netmask;
    opts->gateway = config.gateway;
    opts->addrMode = NET_ADDRESS_STATIC;
  }


when I don't have an IP address: I now initialize everything to
0.0.0.0 and tell it that's "static and correct". Is this acceptable.

I've now researched the other options instead of "static" and
options are 1) DHCP (not working on that branch now) 2) statuc
3) AUTO. 

So if I set AUTO it will chose a link local 169.254.x.y address but
will it then recognize 192.168.x.255 as a broadcast that should be
processed, or will it throw it away as "not my address"

I have now added the code to use "AUTO" if no ip address is
configured. I'll test this shortly because I have to transport
to meet the hardware... :-) 

        Roger. 

-- 
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.



reply via email to

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