lwip-devel
[Top][All Lists]
Advanced

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

RE: [lwip-devel] Non-broadcast interfaces (patch)


From: Mountifield, Tony
Subject: RE: [lwip-devel] Non-broadcast interfaces (patch)
Date: Wed, 25 Feb 2004 13:44:53 -0000

Hi Leon,

Three typos:

1. The first if needs another opening paren.

2. The line:

   else if (netif->flags &= NETIF_FLAG_BROADCAST == 0)

should be:

   else if ((netif->flags & NETIF_FLAG_BROADCAST) == 0)

i.e. &= should be &, and parens needed for precedence.

3. In the last condition also, the & clauses need parens, since == binds
more tightly than & (one of C's classic gotchas)

Cheers,
Tony

> -----Original Message-----
> From: Leon Woestenberg [mailto:address@hidden
> Sent: 24 February 2004 22:01
> To: lwip-devel
> Subject: Re: [lwip-devel] Non-broadcast interfaces (patch)
> 
> 
> Hello,
> 
> the proposed replacement for the broadcast check macro.
> 
> I have committed this (disabled, untested) code to ip_addr.c
> revision 1.8 for review.
> 
> Heavily inspired by BSD.
> 
> Regards,
> 
> Leon.
> 
> 
> 
> /* work in progress - meant to replace ip_addr.h macro
>  * as it does not support non-broadcast interfaces.
>  * lwip-devel 18-2-2004
>  */
> #if 0
> #include "lwip/netif.h"
> 
> bool ip_addr_isbroadcast(ip_addr *addr1, struct netif *netif)
> 
> bool ip_addr_isbroadcast(addr1, netif)
> {
>   /* all ones (broadcast) or all zeroes (old skool broadcast) */
>   if (addr1->addr == ip_addr_broadcast.ip_addr) ||
>       addr1->addr == ip_addr_any.ip_addr))
>     return 1;
>   /* no broadcast support on this network interface
>    * we cannot proceed matching against broadcast addresses */
>   else if (netif->flags &= NETIF_FLAG_BROADCAST == 0)
>     return 0;
>   /* address matches network interface address exactly? */
>   else if (netif->ip_addr.addr == addr1->addr)
>     return 0;
>   /* host identifier bits are all ones? => broadcast address */
>   else if (~netif->netmask.addr & addr1->addr ==
>            ~netif->netmask.addr & ip_addr_broadcast.ip_addr)
>     return 1;
>   else
>     return 0;
> }
> #endif
> 
> 
> _______________________________________________
> lwip-devel mailing list
> address@hidden
> http://mail.nongnu.org/mailman/listinfo/lwip-devel
> 


***********************************************************************************
This email, its content and any attachments is PRIVATE AND
CONFIDENTIAL to TANDBERG Television. If received in error please
notify the sender and destroy the original message and attachments.

www.tandbergtv.com
***********************************************************************************





reply via email to

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