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: Leon Woestenberg
Subject: Re: [lwip-devel] Non-broadcast interfaces (patch)
Date: Tue, 24 Feb 2004 23:01:20 +0100
User-agent: Mozilla Thunderbird 0.5 (Windows/20040207)

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




reply via email to

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