summaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
authorMichael Brown2006-08-07 19:51:19 +0200
committerMichael Brown2006-08-07 19:51:19 +0200
commit885a630ddfbda9687181d46c98604f6fb5bfe2f6 (patch)
treec2d623505cb4d6c1060a3ce190030a060a0da3d6 /src/net
parentSet a NUL terminator before calling inet_aton. (diff)
downloadipxe-885a630ddfbda9687181d46c98604f6fb5bfe2f6.tar.gz
ipxe-885a630ddfbda9687181d46c98604f6fb5bfe2f6.tar.xz
ipxe-885a630ddfbda9687181d46c98604f6fb5bfe2f6.zip
Fix routing when a gateway exists. This should probably be split into
a separate function.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ipv4.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/net/ipv4.c b/src/net/ipv4.c
index ce985326f..a96356934 100644
--- a/src/net/ipv4.c
+++ b/src/net/ipv4.c
@@ -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;
}