Revision 1cb3a834
Added by Ryan Wagoner almost 18 years ago
etc/inc/services.inc | ||
---|---|---|
1269 | 1269 |
conf_mount_ro(); |
1270 | 1270 |
} |
1271 | 1271 |
|
1272 |
function upnp_action ($action) { |
|
1273 |
switch($action) { |
|
1274 |
case "start": |
|
1275 |
if(file_exists('/var/etc/miniupnpd.conf')) |
|
1276 |
mwexec_bg('/usr/local/sbin/miniupnpd -f /var/etc/miniupnpd.conf'); |
|
1277 |
break; |
|
1278 |
case "stop": |
|
1279 |
while((int)exec("pgrep miniupnpd | wc -l") > 0) |
|
1280 |
mwexec('killall miniupnpd 2>/dev/null'); |
|
1281 |
mwexec('/sbin/pfctl -aminiupnpd -Fr 2>&1 >/dev/null'); |
|
1282 |
mwexec('/sbin/pfctl -aminiupnpd -Fn 2>&1 >/dev/null'); |
|
1283 |
break; |
|
1284 |
case "restart": |
|
1285 |
upnp_action('stop'); |
|
1286 |
upnp_action('start'); |
|
1287 |
break; |
|
1288 |
} |
|
1289 |
} |
|
1290 |
|
|
1272 | 1291 |
function upnp_start() { |
1273 |
global $config; |
|
1274 |
if($config['installedpackages']['miniupnpd']['config'][0]["enable"]) { |
|
1275 |
mwexec_bg("/usr/local/sbin/miniupnpd -f /var/etc/miniupnpd.conf"); |
|
1292 |
global $config, $g; |
|
1293 |
if($config['installedpackages']['miniupnpd']['config'][0]['enable']) { |
|
1294 |
if($g['booting']) { |
|
1295 |
echo "Starting UPnP service..."; |
|
1296 |
include('/usr/local/pkg/miniupnpd.inc'); |
|
1297 |
sync_package_miniupnpd(); |
|
1298 |
echo "done.\n"; |
|
1299 |
} |
|
1300 |
else { |
|
1301 |
upnp_action('start'); |
|
1302 |
} |
|
1276 | 1303 |
} |
1277 | 1304 |
} |
1278 | 1305 |
|
1279 |
?> |
|
1306 |
?> |
Also available in: Unified diff
-move upnp_action to services.inc
-make sure to clear rules when stopping miniupnpd
-fix status_upnp and status_services pages so they use upnp_action and not the rcfile