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:
parent
8a3f4b7de6
commit
885a630ddf
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user