Parcourir la source

[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 il y a 15 ans
Parent
révision
4933ccbf65
1 fichiers modifiés avec 2 ajouts et 0 suppressions
  1. 2
    0
      src/net/ipv4.c

+ 2
- 0
src/net/ipv4.c Voir le fichier

@@ -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 );

Chargement…
Annuler
Enregistrer