[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] [lwip] ip_route and ip_addr_isbroadcast
From: |
Ivarsson Magnus |
Subject: |
[lwip-users] [lwip] ip_route and ip_addr_isbroadcast |
Date: |
Wed, 08 Jan 2003 23:38:02 -0000 |
Hi,
When dealing with PPP there are only two IP adresses per link.
These IP adresses does not always belong to the same 'subnet'
and thus the need for a netmask of 255.255.255.255 arises.
Also the routing is affected. I had to make some changes in
ip_addr.h and ip.c to make it work.
First question:
Does anybody see that this change in ip_addr_isbroadcast is erroneous?
#define ip_addr_isbroadcast(addr1, mask) \
( \
( \
( \
( \
(((addr1)->addr) & ~((mask)->addr)) \
== \
(0xffffffff & ~((mask)->addr)) \
) \
new: && !((mask)->addr == 0xffffffff) \
) \
) \
|| ((addr1)->addr == 0xffffffff) \
|| ((addr1)->addr == 0x00000000) \
)
Second question:
In ip_route (see below) we are searching for a subnet which is matching
our destination IP adress. To support the PPP specific behaivor without
subnets I would like to compare with &(netif->gw) instead. Is it safe to
assume that gw always is set to something useful (like an adress within
the subnet)?
---8<----
struct netif *
ip_route(struct ip_addr *dest)
{
struct netif *netif;
for(netif = netif_list; netif != NULL; netif = netif->next) {
if(ip_addr_maskcmp(dest, &(netif->ip_addr), &(netif->netmask))) {
return netif;
}
}
return netif_default;
}
---->8---
BR, Magnus Ivarsson
[This message was sent through the lwip discussion list.]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-users] [lwip] ip_route and ip_addr_isbroadcast,
Ivarsson Magnus <=