[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Bug in ip_addr.c concerning Broadcast.
From: |
Leon Woestenberg |
Subject: |
Re: [lwip-users] Bug in ip_addr.c concerning Broadcast. |
Date: |
Thu, 25 Nov 2004 14:11:21 +0100 |
Rodney,
your observation is correct, ip_addr_isbroadcast() did not
check whether the given address argument actually was on the
same network as the given interface was on.
I have fixes this in CVS.
It could be argued that this should be checked elsewhere (BSD
does that check elsewhere).
So, what I wonder, did you find cases in lwIP where the function
could be called with an IP address outside the netif network address?
Regards,
Leon.
On Fri, 19 Nov 2004 16:54:34 -0600, "Rodney Brown" <address@hidden>
said:
> I believe I've found a bug in ipp_addr.c and wanted some confirmation
> before
> fixing it.
>
> Snippet from ip_addr_isbroadcast(struct ip_addr *addr, struct netif
> *netif)
> .
> .
> /* host identifier bits are all ones? => network broadcast address */
> else if ((addr->addr & ~netif->netmask.addr) ==
> (ip_addr_broadcast.addr & ~netif->netmask.addr))
> return 1;
>
>
> addr is the destination. netif is the device's information. If the
> destination IP is 123.123.123.63, and the local subnet is
> 255.255.255.192,
> the routine will return true, no matter what subnet the address is on.
>
> Should the code read: ??
>
> else if (((addr->addr & ~netif->netmask.addr) ==
> (ip_addr_broadcast.addr & ~netif->netmask.addr)) &&
> ((addr->addr & netif->netmask.addr) ==
> (netif->ip_addr.addr & netif->netmask.addr)))
>
> return 1;
>
> This checks to be sure the device and destination are on the same subnet,
> and that the last address on that subnet is the destination.
>
> Thanks,
> Rodney
>
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users