Revision 1098cb94
Added by Viktor Gurov over 3 years ago
src/etc/inc/services.inc | ||
---|---|---|
1920 | 1920 |
return 0; |
1921 | 1921 |
} |
1922 | 1922 |
|
1923 |
function services_igmpproxy_configure() { |
|
1923 |
function services_igmpproxy_configure($interface='') {
|
|
1924 | 1924 |
global $config, $g; |
1925 | 1925 |
|
1926 |
/* kill any running igmpproxy */ |
|
1927 |
killbyname("igmpproxy"); |
|
1926 |
if (!empty($interface) && is_array($config['igmpproxy']['igmpentry'])) { |
|
1927 |
foreach ($config['igmpproxy']['igmpentry'] as $igmpentry) { |
|
1928 |
if ($igmpentry['ifname'] == $interface) { |
|
1929 |
$igmpinf = true; |
|
1930 |
break; |
|
1931 |
} |
|
1932 |
} |
|
1933 |
if (!$igmpinf) { |
|
1934 |
return false; |
|
1935 |
} |
|
1936 |
} |
|
1928 | 1937 |
|
1929 | 1938 |
if (!isset($config['igmpproxy']['enable'])) { |
1930 |
return 0; |
|
1939 |
if (isvalidproc("igmpproxy")) { |
|
1940 |
log_error(gettext("Stopping IGMP Proxy service.")); |
|
1941 |
killbyname("igmpproxy"); |
|
1942 |
} |
|
1943 |
return true; |
|
1931 | 1944 |
} |
1932 | 1945 |
if (!is_array($config['igmpproxy']['igmpentry']) || (count($config['igmpproxy']['igmpentry']) == 0)) { |
1933 |
return 1; |
|
1946 |
return false; |
|
1947 |
} |
|
1948 |
|
|
1949 |
if (platform_booting()) { |
|
1950 |
echo gettext("Starting IGMP Proxy service..."); |
|
1951 |
} |
|
1952 |
|
|
1953 |
if (isvalidproc("igmpproxy")) { |
|
1954 |
log_error(gettext("Restarting IGMP Proxy service.")); |
|
1955 |
killbyname("igmpproxy"); |
|
1934 | 1956 |
} |
1935 | 1957 |
|
1936 | 1958 |
$iflist = get_configured_interface_list(); |
... | ... | |
1945 | 1967 |
EOD; |
1946 | 1968 |
|
1947 | 1969 |
foreach ($config['igmpproxy']['igmpentry'] as $igmpcf) { |
1970 |
if (empty($config['interfaces'][$igmpcf['ifname']]['ipaddr'])) { |
|
1971 |
continue; |
|
1972 |
} |
|
1948 | 1973 |
unset($iflist[$igmpcf['ifname']]); |
1949 | 1974 |
$realif = get_real_interface($igmpcf['ifname']); |
1950 | 1975 |
if (empty($igmpcf['threshold'])) { |
... | ... | |
1961 | 1986 |
} |
1962 | 1987 |
} |
1963 | 1988 |
$igmpconf .= "\n"; |
1989 |
if ($igmpcf['type'] == 'upstream') { |
|
1990 |
$upstream = true; |
|
1991 |
} else { |
|
1992 |
$downstream = true; |
|
1993 |
} |
|
1964 | 1994 |
} |
1965 | 1995 |
foreach ($iflist as $ifn) { |
1966 | 1996 |
$realif = get_real_interface($ifn); |
... | ... | |
1968 | 1998 |
} |
1969 | 1999 |
$igmpconf .= "\n"; |
1970 | 2000 |
|
2001 |
if (!$upstream || !$downstream) { |
|
2002 |
log_error(gettext("Could not find upstream or downstream IGMP Proxy interfaces!")); |
|
2003 |
return; |
|
2004 |
} |
|
2005 |
|
|
1971 | 2006 |
$igmpfl = fopen($g['varetc_path'] . "/igmpproxy.conf", "w"); |
1972 | 2007 |
if (!$igmpfl) { |
1973 |
log_error(gettext("Could not write Igmpproxy configuration file!"));
|
|
2008 |
log_error(gettext("Could not write IGMP Proxy configuration file!"));
|
|
1974 | 2009 |
return; |
1975 | 2010 |
} |
1976 | 2011 |
fwrite($igmpfl, $igmpconf); |
... | ... | |
1983 | 2018 |
mwexec_bg("/usr/local/sbin/igmpproxy {$g['varetc_path']}/igmpproxy.conf"); |
1984 | 2019 |
} |
1985 | 2020 |
|
1986 |
log_error(gettext("Started IGMP proxy service."));
|
|
2021 |
log_error(gettext("Started IGMP Proxy service."));
|
|
1987 | 2022 |
|
1988 |
return 0; |
|
2023 |
if (platform_booting()) { |
|
2024 |
echo gettext("done.") . "\n"; |
|
2025 |
} |
|
2026 |
|
|
2027 |
return true; |
|
1989 | 2028 |
} |
1990 | 2029 |
|
1991 | 2030 |
function services_dhcrelay_configure() { |
src/etc/rc.newwanip | ||
---|---|---|
265 | 265 |
enable_rrd_graphing(); |
266 | 266 |
|
267 | 267 |
/* reload igmpproxy */ |
268 |
services_igmpproxy_configure(); |
|
268 |
services_igmpproxy_configure($interface);
|
|
269 | 269 |
|
270 | 270 |
/* restart snmp */ |
271 | 271 |
services_snmpd_configure(); |
src/usr/local/www/interfaces.php | ||
---|---|---|
527 | 527 |
if (isset($config['syslog']['enable']) && ($ifapply == $config['syslog']['sourceip'])) { |
528 | 528 |
system_syslogd_start(); |
529 | 529 |
} |
530 |
|
|
531 |
services_igmpproxy_configure($ifapply); |
|
530 | 532 |
} |
531 | 533 |
@unlink("{$g['tmp_path']}/.interfaces.apply"); |
532 | 534 |
} else if ($_POST['save']) { |
src/usr/local/www/services_igmpproxy.php | ||
---|---|---|
56 | 56 |
$pconfig['igmpxverbose'] = isset($config['syslog']['igmpxverbose']); |
57 | 57 |
|
58 | 58 |
if ($_POST['save']) { |
59 |
unset($input_errors); |
|
59 | 60 |
$pconfig = $_POST; |
61 |
|
|
60 | 62 |
if (isset($pconfig['enable'])) { |
61 |
$config['igmpproxy']['enable'] = true; |
|
62 |
} else { |
|
63 |
unset($config['igmpproxy']['enable']); |
|
63 |
if (is_array($config['igmpproxy']['igmpentry']) && |
|
64 |
!empty($config['igmpproxy']['igmpentry'])) { |
|
65 |
foreach ($config['igmpproxy']['igmpentry'] as $igmpcf) { |
|
66 |
if ($igmpcf['type'] == 'upstream') { |
|
67 |
$upstream = true; |
|
68 |
} else { |
|
69 |
$downstream = true; |
|
70 |
} |
|
71 |
} |
|
72 |
} |
|
73 |
if (!$upstream || !$downstream) { |
|
74 |
$input_errors[] = gettext("At least one upstream and one downstream interface must be added."); |
|
75 |
} |
|
76 |
} |
|
77 |
|
|
78 |
if (!$input_errors) { |
|
79 |
if (isset($pconfig['enable'])) { |
|
80 |
$config['igmpproxy']['enable'] = true; |
|
81 |
} else { |
|
82 |
unset($config['igmpproxy']['enable']); |
|
83 |
} |
|
84 |
$config['syslog']['igmpxverbose'] = $_POST['igmpxverbose'] ? true : false; |
|
85 |
write_config("IGMP Proxy settings saved"); |
|
86 |
mark_subsystem_dirty('igmpproxy'); |
|
87 |
header("Location: services_igmpproxy.php"); |
|
88 |
exit; |
|
64 | 89 |
} |
65 |
$config['syslog']['igmpxverbose'] = $_POST['igmpxverbose'] ? true : false; |
|
66 |
write_config("IGMP Proxy settings saved"); |
|
67 |
mark_subsystem_dirty('igmpproxy'); |
|
68 |
header("Location: services_igmpproxy.php"); |
|
69 |
exit; |
|
70 | 90 |
} |
71 | 91 |
|
72 | 92 |
if ($_POST['act'] == "del") { |
... | ... | |
82 | 102 |
$pgtitle = array(gettext("Services"), gettext("IGMP Proxy")); |
83 | 103 |
include("head.inc"); |
84 | 104 |
|
105 |
if ($input_errors) { |
|
106 |
print_input_errors($input_errors); |
|
107 |
} |
|
108 |
|
|
85 | 109 |
if ($changes_applied) { |
86 | 110 |
print_apply_result_box($retval); |
87 | 111 |
} |
src/usr/local/www/services_igmpproxy_edit.php | ||
---|---|---|
155 | 155 |
$iflist = get_configured_interface_with_descr(); |
156 | 156 |
|
157 | 157 |
foreach ($iflist as $ifnam => $ifdescr) { |
158 |
$optionlist[$ifnam] = $ifdescr; |
|
158 |
if (!empty($config['interfaces'][$ifnam]['ipaddr'])) { |
|
159 |
$optionlist[$ifnam] = $ifdescr; |
|
160 |
} |
|
159 | 161 |
} |
160 | 162 |
|
161 | 163 |
$section->addInput(new Form_Select( |
Also available in: Unified diff
IGMP Proxy service improvements. Fixes #12609