Project

General

Profile

« Previous | Next » 

Revision 13720b18

Added by Viktor Gurov over 3 years ago

Start/stop PPPoE interface on parent interface events. Fixes #12633

View differences:

src/etc/rc.linkup
173 173
	if (!empty($interface)) {
174 174
		handle_argument_group($interface, $action);
175 175
	}
176
	if ($action == 'start') {
177
		/* Check if there is any child on this one as ppp types and trigger them */
178
		if (is_array($config['ppps']['ppp'])) {
179
			foreach ($config['ppps']['ppp'] as $pppidx => $ppp) {
180
				if ($ppp['type'] == 'ppp') {
176
	/* Check if there is any child on this one as ppp types and trigger them */
177
	init_config_arr(array('ppps', 'ppp'));
178
	if (is_array($config['ppps']['ppp'])) {
179
		foreach ($config['ppps']['ppp'] as $pppidx => $ppp) {
180
			if ($ppp['type'] == 'ppp') {
181
				continue;
182
			}
183
			$ports = explode(',', $ppp['ports']);
184
			foreach ($ports as $pid => $parent_if) {
185
				/* The loop here is because ppp types can have real and assigned interfaces as members */
186
				$tmpiface = get_real_interface($parent_if);
187
				if ($tmpiface != $realiface) {
181 188
					continue;
182 189
				}
183
				$ports = explode(',', $ppp['ports']);
184
				foreach ($ports as $pid => $parent_if) {
185
					/* The loop here is because ppp types can have real and assigned interfaces as members */
186
					$tmpiface = get_real_interface($parent_if);
187
					if ($tmpiface != $realiface) {
188
						continue;
189
					}
190
					$tmpiface = convert_real_interface_to_friendly_interface_name($ppp['if']);
191
					if (!empty($tmpiface)) {
190
				$tmpiface = convert_real_interface_to_friendly_interface_name($ppp['if']);
191
				if (!empty($tmpiface)) {
192
					if (($action == 'start') || ($action == 'up')) {
192 193
						interface_configure($tmpiface, true, true);
194
					} elseif (($action == 'stop') || ($action == 'down')) {
195
						interface_bring_down($tmpiface);
193 196
					}
194 197
				}
195 198
			}

Also available in: Unified diff