Add the GUI part for IGMPproxy that has been on the snapshots for a while.

This commit is contained in:
Ermal Luci 2009-01-28 18:13:50 +00:00
parent f668d15972
commit 41997fbbeb
4 changed files with 76 additions and 1 deletions

View File

@ -329,6 +329,61 @@ EOD;
return 0;
}
function services_igmpproxy_configure() {
global $config, $g;
$iflist = get_configured_interface_list();
/* kill any running igmpproxy */
killbyname("igmpproxy");
if (!is_array($config['igmpproxy']['igmpentry']))
return 1;
$igmpconf = <<<EOD
##------------------------------------------------------
## Enable Quickleave mode (Sends Leave instantly)
##------------------------------------------------------
quickleave
EOD;
foreach ($config['igmpproxy']['igmpentry'] as $igmpcf) {
unset($iflist[$igmpcf['ifname']]);
$realif = get_real_interface($igmpcf['ifname']);
if (empty($igmpcf['threshold']))
$threshld = 1;
else
$threshld = $igmpcf['threshold'];
$igmpconf .= "phyint {$realif} {$igmpcf['type']} ratelimit 0 threshold {$threshld}\n";
if ($igmpcf['address'] <> "") {
$item = explode(" ", $igmpcf['address']);
foreach($item as $iww)
$igmpconf .= "altnet {$iww}\n";
}
$igmpconf .= "\n";
}
foreach ($iflist as $ifn) {
$realif = get_real_interface($ifn);
$igmpconf .= "phyint {$realif} disabled\n";
}
$igmpfl = fopen($g['tmp_path'] . "/igmpproxy.conf", "w");
if (!$igmpfl) {
log_error("Could not write Igmpproxy configuration file!");
return;
}
fwrite($igmpfl, $igmpconf);
fclose($igmpfl);
mwexec("/usr/local/sbin/igmpproxy -c " . $g['tmp_path'] . "/igmpproxy.conf");
log_error("Started Igmpproxy service sucsesfully.");
return 0;
}
function interfaces_staticarp_configure($if) {
global $config, $g;
if(isset($config['system']['developerspew'])) {

View File

@ -279,6 +279,9 @@
if($kern_hz == "1000")
mwexec("sysctl net.inet.tcp.rexmit_min=30");
/* start the igmpproxy daemon
services_igmpproxy_configure();
/* start the upnp daemon if it is enabled */
upnp_start();
@ -288,4 +291,4 @@
unlink("{$g['varrun_path']}/booting");
$g['booting'] = FALSE;
?>
?>

View File

@ -186,6 +186,7 @@ if ($_REQUEST['noticeaction'] == 'acknowledge') {
output_menu_item("/services_dhcp.php", "DHCP Server");
?>
<?=output_menu_item("/services_dyndns.php", "Dynamic DNS");?>
<?=output_menu_item("/services_igmpproxy.php", "IGMP proxy");?>
<?=output_menu_item("/load_balancer_pool.php", "Load Balancer");?>
<?=output_menu_item("/pkg_edit.php?xml=olsrd.xml&id=0", "OLSR");?>
<?=output_menu_item("/vpn_pppoe.php", "PPPoE Server");?>

View File

@ -64,6 +64,9 @@ if($_GET['mode'] == "restartservice" and $_GET['service']) {
case 'dhcpd':
services_dhcpd_configure();
break;
case 'igmpproxy':
services_igmpproxy_configure();
break;
case 'miniupnpd':
upnp_action('restart');
break;
@ -107,6 +110,9 @@ if($_GET['mode'] == "startservice" and $_GET['service']) {
case 'dhcpd':
services_dhcpd_configure();
break;
case 'igmpproxy':
services_igmpproxy_configure();
break;
case 'miniupnpd':
upnp_action('start');
break;
@ -154,6 +160,9 @@ if($_GET['mode'] == "stopservice" && $_GET['service']) {
case 'dnsmasq':
killbypid("{$g['varrun_path']}/dnsmasq.pid");
break;
case 'igmpproxy':
killbyname("igmpproxy");
break;
case 'miniupnpd':
upnp_action('stop');
break;
@ -286,6 +295,13 @@ if(isset($config['proxyarp']['proxyarpnet'])) {
unset($pconfig);
}
if (count($config['igmpproxy']['igmpentry']) > 0) {
$pconfig['name'] = "igmpproxy";
$pconfig['descritption'] = "IGMP proxy";
$services[] = $pconfig;
unset($pconfig);
}
if($config['installedpackages']['miniupnpd']['config'][0]['enable']) {
$pconfig['name'] = "miniupnpd";
$pconfig['description'] = gettext("UPnP Service");