|
@@ -311,12 +311,15 @@ static int ipv4_tx ( struct pk_buff *pkb,
|
311
|
311
|
/* Use routing table to identify next hop and transmitting netdev */
|
312
|
312
|
next_hop = iphdr->dest;
|
313
|
313
|
list_for_each_entry ( miniroute, &miniroutes, list ) {
|
314
|
|
- if ( ( ( ( iphdr->dest.s_addr ^ miniroute->address.s_addr ) &
|
315
|
|
- miniroute->netmask.s_addr ) == 0 ) ||
|
316
|
|
- ( miniroute->gateway.s_addr != INADDR_NONE ) ) {
|
|
314
|
+ int local, has_gw;
|
|
315
|
+
|
|
316
|
+ local = ( ( ( iphdr->dest.s_addr ^ miniroute->address.s_addr )
|
|
317
|
+ & miniroute->netmask.s_addr ) == 0 );
|
|
318
|
+ has_gw = ( miniroute->gateway.s_addr != INADDR_NONE );
|
|
319
|
+ if ( local || has_gw ) {
|
317
|
320
|
netdev = miniroute->netdev;
|
318
|
321
|
iphdr->src = miniroute->address;
|
319
|
|
- if ( miniroute->gateway.s_addr != INADDR_NONE )
|
|
322
|
+ if ( ! local )
|
320
|
323
|
next_hop = miniroute->gateway;
|
321
|
324
|
break;
|
322
|
325
|
}
|