|
osdir.com mailing list archive F.A.Q. -since 2001! |
|
|
|
Subject: Re: detect IP/UDP destination address - msg#00033List: network.lwip.general
by Date: Prev Next Date Index by Thread: Prev Next Thread Index
On Mon, 2006-12-18 at 11:17 +0100,
beach.dk-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx wrote: > Maybe I was a bit careless with my vocabulary if unicast/broadcast is > only related to the ethernet layer. > It's the destination adress at the IP-layer (not ethernet layer) I'm > interested in. Ahh, apologies, it was me who was confused! So, you have the IP address of the sender, and you need the IP address the packet was sent to so you can work out if that was a broadcast or unicast? I don't think the API supplies that at the moment. Kieran
Thread at a glance:
Previous Message by Date:Re: detect IP/UDP destination addressOn 12/18/06, Kieran Mansley <kieran-1e/NZYDlv+odnm+yROfE0A@xxxxxxxxxxxxxxxx> wrote: On Mon, 2006-12-18 at 10:54 +0100, beach.dk-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx wrote: > Hi, > > I have set up an UDP-server using the raw API > > upcb= udp_new(); > udp_recv( upcb, callback_recv, get_nic_netif() ); > udp_bind( upcb, IP_ADDR_ANY, 1234 ); > > In my callback_recv function I can see the IP address of the UDP-client > so I can reply to it. > > But........ I would like to detect if the client sent the incoming UDP > packet using unicast or broadcast (so I can respond with a > corresponding unicats/broacast packet). > > Is this possible? Someone may correct me, as I'm not sure about this, but unicast/broadcast is a rather Ethernet specific concept, and so I'd be surprised if it was visible at the higher layers as these have to interoperate on many different physical networks. Kieran Maybe I was a bit careless with my vocabulary if unicast/broadcast is only related to the ethernet layer. It's the destination adress at the IP-layer (not ethernet layer) I'm interested in. /Beach/ Next Message by Date:Race condition with lwip_select (and potential fix)Hi all, I've been noticing occasional crashes within lwip when using select(). I think I've tracked the problem down to a race condition hidden in the interaction between lwip_select() and event_callback() (both in sockets.c). The failure case is as follows: User Thread: Calls lwip_select(): - Creates a select_cb on the stack. - Creates select_cb.sem. - Takes selectsem. - Inserts the select_cb into select_cb_list. - Releases selectsem. - Waits for select_cb.sem to be signalled (or timeout to expire). LwIP Thread: Data arrives, so calls event_callback(): - Takes selectsem. - select_cb_list is examined and scb stores a pointer to the select_cb. - Releases selectsem. User Thread: Timeout expires, so resumes execution of lwip_select(): - Takes selectsem. - Removes the select_cb from select_cb_list. - Releases selectsem. - Frees select_cb.sem. LwIP Thread: Resumes execution of event_callback(): - Tries to signal scb->sem, but select_cb and/or sem no longer exist. Based on the above analysis, the fix would appear to be to swap the order in which event_callback() signals the two semaphores. I've tried this and so far it appears to work. I'd appreciate any thoughts from other LwIP users though! Regards, Chris. Previous Message by Thread:Re: detect IP/UDP destination addressOn 12/18/06, Kieran Mansley <kieran-1e/NZYDlv+odnm+yROfE0A@xxxxxxxxxxxxxxxx> wrote: On Mon, 2006-12-18 at 10:54 +0100, beach.dk-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx wrote: > Hi, > > I have set up an UDP-server using the raw API > > upcb= udp_new(); > udp_recv( upcb, callback_recv, get_nic_netif() ); > udp_bind( upcb, IP_ADDR_ANY, 1234 ); > > In my callback_recv function I can see the IP address of the UDP-client > so I can reply to it. > > But........ I would like to detect if the client sent the incoming UDP > packet using unicast or broadcast (so I can respond with a > corresponding unicats/broacast packet). > > Is this possible? Someone may correct me, as I'm not sure about this, but unicast/broadcast is a rather Ethernet specific concept, and so I'd be surprised if it was visible at the higher layers as these have to interoperate on many different physical networks. Kieran Maybe I was a bit careless with my vocabulary if unicast/broadcast is only related to the ethernet layer. It's the destination adress at the IP-layer (not ethernet layer) I'm interested in. /Beach/ Next Message by Thread:Race condition with lwip_select (and potential fix)Hi all, I've been noticing occasional crashes within lwip when using select(). I think I've tracked the problem down to a race condition hidden in the interaction between lwip_select() and event_callback() (both in sockets.c). The failure case is as follows: User Thread: Calls lwip_select(): - Creates a select_cb on the stack. - Creates select_cb.sem. - Takes selectsem. - Inserts the select_cb into select_cb_list. - Releases selectsem. - Waits for select_cb.sem to be signalled (or timeout to expire). LwIP Thread: Data arrives, so calls event_callback(): - Takes selectsem. - select_cb_list is examined and scb stores a pointer to the select_cb. - Releases selectsem. User Thread: Timeout expires, so resumes execution of lwip_select(): - Takes selectsem. - Removes the select_cb from select_cb_list. - Releases selectsem. - Frees select_cb.sem. LwIP Thread: Resumes execution of event_callback(): - Tries to signal scb->sem, but select_cb and/or sem no longer exist. Based on the above analysis, the fix would appear to be to swap the order in which event_callback() signals the two semaphores. I've tried this and so far it appears to work. I'd appreciate any thoughts from other LwIP users though! Regards, Chris.
blog comments powered by Disqus
|
|