Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[ipv4] Ignore non-open net devices when performing routing
We do not discard routing table entries when closing an interface.  It
is plausible that multiple interfaces may be on the same physical
network; if so, then we may end up in a situation whereby outbound
packets attempt to route via a closed interface.

Fix by ignoring non-open net devices in ipv4_route().
  • Loading branch information
Michael Brown committed Nov 16, 2009
1 parent 55d23b1 commit 4933ccb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/net/ipv4.c
Expand Up @@ -118,6 +118,8 @@ static struct ipv4_miniroute * ipv4_route ( struct in_addr *dest ) {

/* Find first usable route in routing table */
list_for_each_entry ( miniroute, &ipv4_miniroutes, list ) {
if ( ! ( miniroute->netdev->state & NETDEV_OPEN ) )
continue;
local = ( ( ( dest->s_addr ^ miniroute->address.s_addr )
& miniroute->netmask.s_addr ) == 0 );
has_gw = ( miniroute->gateway.s_addr );
Expand Down

0 comments on commit 4933ccb

Please sign in to comment.