2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-12-23 19:51:46 +00:00

Fix routing when a gateway exists. This should probably be split into

a separate function.
This commit is contained in:
Michael Brown 2006-08-07 17:51:19 +00:00
parent 8a3f4b7de6
commit 885a630ddf

View File

@ -311,12 +311,15 @@ static int ipv4_tx ( struct pk_buff *pkb,
/* Use routing table to identify next hop and transmitting netdev */
next_hop = iphdr->dest;
list_for_each_entry ( miniroute, &miniroutes, list ) {
if ( ( ( ( iphdr->dest.s_addr ^ miniroute->address.s_addr ) &
miniroute->netmask.s_addr ) == 0 ) ||
( miniroute->gateway.s_addr != INADDR_NONE ) ) {
int local, has_gw;
local = ( ( ( iphdr->dest.s_addr ^ miniroute->address.s_addr )
& miniroute->netmask.s_addr ) == 0 );
has_gw = ( miniroute->gateway.s_addr != INADDR_NONE );
if ( local || has_gw ) {
netdev = miniroute->netdev;
iphdr->src = miniroute->address;
if ( miniroute->gateway.s_addr != INADDR_NONE )
if ( ! local )
next_hop = miniroute->gateway;
break;
}