From 41997fbbeb2b5c50507ad18fa4ea2bb6fbea4ee2 Mon Sep 17 00:00:00 2001 From: Ermal Luci Date: Wed, 28 Jan 2009 18:13:50 +0000 Subject: [PATCH] Add the GUI part for IGMPproxy that has been on the snapshots for a while. --- etc/inc/services.inc | 55 +++++++++++++++++++++++++++++++ etc/rc.bootup | 5 ++- usr/local/www/fbegin.inc | 1 + usr/local/www/status_services.php | 16 +++++++++ 4 files changed, 76 insertions(+), 1 deletion(-) diff --git a/etc/inc/services.inc b/etc/inc/services.inc index ea7e82f6d6..bd1e75bb17 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -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 = << "") { + $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'])) { diff --git a/etc/rc.bootup b/etc/rc.bootup index 622991033a..53bcf1fc03 100755 --- a/etc/rc.bootup +++ b/etc/rc.bootup @@ -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; -?> \ No newline at end of file +?> diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc index 68e01bb880..b465ad9079 100755 --- a/usr/local/www/fbegin.inc +++ b/usr/local/www/fbegin.inc @@ -186,6 +186,7 @@ if ($_REQUEST['noticeaction'] == 'acknowledge') { output_menu_item("/services_dhcp.php", "DHCP Server"); ?> + diff --git a/usr/local/www/status_services.php b/usr/local/www/status_services.php index c7e9891256..a7eef1cfaa 100755 --- a/usr/local/www/status_services.php +++ b/usr/local/www/status_services.php @@ -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");