@@ -2377,7 +2377,8 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal
2377
2377
interface_virtual_create ($ realhwif );
2378
2378
2379
2379
$ ifconfig_details = legacy_interfaces_details ();
2380
- if (empty ($ ifconfig_details [$ realhwif ])) {
2380
+ if ((strpos ($ realhwif , '/ ' ) === false && empty ($ ifconfig_details [$ realhwif ])) ||
2381
+ (strpos ($ realhwif , '/ ' ) === 0 && !file_exists ($ realhwif ))) {
2381
2382
log_error (sprintf ('Unable to configure non-existent interface %s (%s) ' , $ interface , $ realhwif ));
2382
2383
return ;
2383
2384
}
@@ -2387,7 +2388,9 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal
2387
2388
flush ();
2388
2389
}
2389
2390
2390
- /* XXX mpd5 $realif(v6) does not exist at this point in time */
2391
+ /* XXX mpd5 $realif(v6) may not exist at this point in time */
2392
+ /* XXX mpd5 $realhwif may be a device node path */
2393
+
2391
2394
if (!file_exists ('/var/run/booting ' ) && substr ($ realif , 0 , 4 ) != 'ovpn ' ) {
2392
2395
interfaces_addresses_flush ($ realif , 4 , $ ifconfig_details );
2393
2396
interfaces_addresses_flush ($ realifv6 , 6 , $ ifconfig_details );
@@ -2410,7 +2413,7 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal
2410
2413
* spoof the MAC again which cycles the link again...
2411
2414
*/
2412
2415
if (!empty ($ wancfg ['spoofmac ' ]) && strcasecmp ($ wancfg ['spoofmac ' ], get_interface_mac ($ realhwif ))) {
2413
- mwexecf ('/sbin/ifconfig %s link %s ' , array ( $ realhwif , $ wancfg ['spoofmac ' ]) );
2416
+ mwexecf ('/sbin/ifconfig %s link %s ' , [ $ realhwif , $ wancfg ['spoofmac ' ]] );
2414
2417
}
2415
2418
2416
2419
/* only try to set media properties when requested */
@@ -2433,11 +2436,13 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal
2433
2436
}
2434
2437
2435
2438
/* set p(ermanent)-promiscuous mode required for e.g. VLAN MAC spoofing */
2436
- if (in_array ('ppromisc ' , $ ifconfig_details [$ realhwif ]['flags ' ]) !== !empty ($ wancfg ['promisc ' ])) {
2437
- mwexec ( " /sbin/ifconfig " . $ realhwif . " " . ( empty ($ wancfg ['promisc ' ]) ? " - " : "" ) . " promisc " );
2439
+ if (in_array ('ppromisc ' , $ ifconfig_details [$ realhwif ]['flags ' ] ?? [] ) !== !empty ($ wancfg ['promisc ' ])) {
2440
+ mwexecf ( ' /sbin/ifconfig %s %spromisc ' , [ $ realhwif, empty ($ wancfg ['promisc ' ]) ? ' - ' : '' ] );
2438
2441
}
2439
2442
2440
2443
/* apply interface hardware settings (tso, lro, ..) */
2444
+ /* XXX pass down $ifconfig_details */
2445
+ /* XXX maybe spoofmac, media and promisc can live here too? */
2441
2446
configure_interface_hardware ($ realhwif );
2442
2447
2443
2448
switch ($ wancfg ['ipaddr ' ]) {
0 commit comments