Ver código fonte

[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().
tags/v1.0.0-rc1
Michael Brown 14 anos atrás
pai
commit
4933ccbf65
1 arquivos alterados com 2 adições e 0 exclusões
  1. 2
    0
      src/net/ipv4.c

+ 2
- 0
src/net/ipv4.c Ver arquivo

@@ -118,6 +118,8 @@ static struct ipv4_miniroute * ipv4_route ( struct in_addr *dest ) {
118 118
 
119 119
 	/* Find first usable route in routing table */
120 120
 	list_for_each_entry ( miniroute, &ipv4_miniroutes, list ) {
121
+		if ( ! ( miniroute->netdev->state & NETDEV_OPEN ) )
122
+			continue;
121 123
 		local = ( ( ( dest->s_addr ^ miniroute->address.s_addr )
122 124
 			    & miniroute->netmask.s_addr ) == 0 );
123 125
 		has_gw = ( miniroute->gateway.s_addr );

Carregando…
Cancelar
Salvar