Project

General

Profile

« Previous | Next » 

Revision 2eb3efc2

Added by Ermal Luçi over 10 years ago

Lock rc.linkup based on interface to avoid races in between up/down events which might create a loop. This is more a timing issue but better enforce serialization here. check_reload_status forces this but not between start and stop but just between similar events. Probably need to bring more inteligence there.

View differences:

etc/rc.linkup
110 110
	$action = $argv[1];
111 111
	$realiface = $argv[2];
112 112
}
113

  
113 114
switch($action) {
114 115
case "start":
115 116
case "stop":
......
120 121
	/* NOTREACHED */
121 122
	break;
122 123
}
124

  
123 125
if (!empty($realiface)) {
124 126
	if (substr($realiface, 0, 4) == 'ovpn') {
125 127
		log_error("Ignoring link event for ovpn interface");
126 128
		return;
127 129
	}
130
	$rclinkuplock = lock("rclinkup{$realiface}", LOCK_EX);
128 131
	$interface = convert_real_interface_to_friendly_interface_name($realiface);
129 132
	if (!empty($interface))
130 133
		handle_argument_group($interface, $action);
......
145 148
			}
146 149
		}
147 150
	}
151
	unlock($rclinkuplock);
148 152
}
149

  
150 153
?>

Also available in: Unified diff