aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2015-09-16 01:36:56 -0500
committerChris Buechler <cmb@pfsense.org>2015-09-16 01:36:56 -0500
commit5984bb3ba0c995cd0b44d9d565cdfde081856bb5 (patch)
tree57ae75a7283f4b49d820b4eb87bd359203c71e74
parent7b568b72634a5befb048ac38898c07647886087f (diff)
parentf38c9f21aec51b66e7cca29ea1be42031b81f97b (diff)
downloadpfsense-packages-5984bb3ba0c995cd0b44d9d565cdfde081856bb5.tar.gz
pfsense-packages-5984bb3ba0c995cd0b44d9d565cdfde081856bb5.tar.bz2
pfsense-packages-5984bb3ba0c995cd0b44d9d565cdfde081856bb5.zip
Merge pull request #1068 from doktornotor/patch-2
-rw-r--r--config/avahi/avahi.inc118
-rw-r--r--config/avahi/avahi.xml211
-rw-r--r--pkg_config.10.xml2
-rw-r--r--pkg_config.8.xml2
-rw-r--r--pkg_config.8.xml.amd642
5 files changed, 290 insertions, 45 deletions
diff --git a/config/avahi/avahi.inc b/config/avahi/avahi.inc
index 4c824e71..ba89676f 100644
--- a/config/avahi/avahi.inc
+++ b/config/avahi/avahi.inc
@@ -63,23 +63,36 @@ function avahi_deinstall() {
}
function avahi_write_config() {
- global $config;
+ global $config, $avahi_config;
conf_mount_rw();
// Pull some various values out of config.xml
+ if (isset($config['installedpackages']['avahi']['config'][0])) {
+ $avahi_config = $config['installedpackages']['avahi']['config'][0];
+ }
+ // Server Options
$hostname = $config['system']['hostname'];
$domain = $config['system']['domain'];
- $enable = $config['installedpackages']['avahi']['config'][0]['enable'];
- $browsedomains = $config['installedpackages']['avahi']['config'][0]['browsedomains'];
- $denyif = $config['installedpackages']['avahi']['config'][0]['denyinterfaces'];
- $useipv4 = ($config['installedpackages']['avahi']['config'][0]['disable_ipv4']) ? "no" : "yes";
- $useipv6 = ($config['installedpackages']['avahi']['config'][0]['disable_ipv6']) ? "no" : "yes";
- $usedbus = ($config['installedpackages']['avahi']['config'][0]['disable_dbus']) ? "no" : "yes";
-
- // No supplied domains? Use the defaults.
- if (!$browsedomains) {
- $browsedomains = "local, 0pointer.de, zeroconf.org";
- }
+ $enable = $avahi_config['enable'];
+ $browsedomains = $avahi_config['browsedomains'] ?: "local";
+ $denyif = $avahi_config['denyinterfaces'];
+ $useipv4 = ($avahi_config['enable_ipv4']) ? "yes" : "no";
+ $useipv6 = ($avahi_config['enable_ipv6']) ? "yes" : "no";
+ $usedbus = ($avahi_config['disable_dbus']) ? "no" : "yes";
+ // Wide Area
+ $widearea = ($avahi_config['enable_wide_area']) ? "yes" : "no";
+ // Publishing Options
+ $publish = ($avahi_config['disable_publishing']) ? "no" : "yes";
+ $userpublish = ($avahi_config['disable_user_service_publishing']) ? "no" : "yes";
+ $addresspublish = ($avahi_config['publish_addresses']) ? "yes" : "no";
+ $cookie = ($avahi_config['add_service_cookie']) ? "yes" : "no";
+ $hinfopublish = ($avahi_config['publish_hinfo']) ? "yes" : "no";
+ $wspublish = ($avahi_config['publish_workstation']) ? "yes" : "no";
+ $aaaaonv4 = ($avahi_config['publish_aaaa_on_ipv4']) ? "yes" : "no";
+ $aonv6 = ($avahi_config['publish_a_on_ipv6']) ? "yes" : "no";
+ // Reflector Options
+ $reflect = ($avahi_config['enable_reflector']) ? "yes" : "no";
+ $reflectipv = ($avahi_config['reflect_ipv']) ? "yes" : "no";
// Never pass along WAN. Bad.
$denyinterfaces = $config['interfaces']['wan']['if'];
@@ -94,6 +107,15 @@ function avahi_write_config() {
}
}
}
+
+ // Process DNS servers and omit localhost if present in /etc/resolv.conf
+ $publishdns = '';
+ $dns = implode(" ", get_dns_servers());
+ $dns = trim(str_replace('127.0.0.1', '', $dns));
+ $dns = str_replace(' ', ', ', $dns);
+ if ($dns) {
+ $publishdns = "publish-dns-servers={$dns}";
+ }
// Construct the avahi configuration
$avahiconfig = <<<EOF
@@ -116,24 +138,24 @@ enable-dbus={$usedbus}
allow-point-to-point=yes
[wide-area]
-enable-wide-area=yes
+enable-wide-area={$widearea}
[publish]
-#disable-publishing=no
-#disable-user-service-publishing=no
-#add-service-cookie=no
-#publish-addresses=yes
-#publish-hinfo=yes
-#publish-workstation=yes
+disable-publishing={$publish}
+disable-user-service-publishing={$userpublish}
+add-service-cookie={$cookie}
+publish-addresses={$addresspublish}
+publish-hinfo={$hinfopublish}
+publish-workstation={$wspublish}
#publish-domain=yes
-#publish-dns-servers=192.168.50.1, 192.168.50.2
+{$publishdns}
#publish-resolv-conf-dns-servers=yes
-#publish-aaaa-on-ipv4=yes
-#publish-a-on-ipv6=no
+publish-aaaa-on-ipv4={$aaaaonv4}
+publish-a-on-ipv6={$aonv6}
[reflector]
-enable-reflector=yes
-#reflect-ipv=no
+enable-reflector={$reflect}
+reflect-ipv={$reflectipv}
[rlimits]
rlimit-core=0
@@ -162,7 +184,7 @@ EOF;
$start .= " /bin/ln -sf " . AVAHI_BASE . "/etc/gnome.subr /usr/local/etc/gnome.subr\n";
$start .= "fi\n";
$start .= "/usr/bin/killall avahi-daemon >/dev/null 2>&1\n";
- if (!$config['installedpackages']['avahi']['config'][0]['disable_dbus']) {
+ if (!$avahi_config['disable_dbus']) {
$start .= "if [ ! -d /var/run/dbus ]; then\n";
$start .= " /bin/mkdir /var/run/dbus\n";
$start .= " /usr/sbin/chown messagebus:messagebus /var/run/dbus\n";
@@ -178,7 +200,7 @@ EOF;
$start .= "/etc/rc.conf_mount_ro\n";
$stop = "/usr/bin/killall avahi-daemon >/dev/null 2>&1\n";
- if (!$config['installedpackages']['avahi']['config'][0]['disable_dbus']) {
+ if (!$avahi_config['disable_dbus']) {
if (file_exists(AVAHI_BASE . "/etc/rc.d/dbus")) {
$stop .= AVAHI_BASE . "/etc/rc.d/dbus onestop\n";
$stop .= "/bin/rm /var/run/dbus/dbus.pid >/dev/null 2>&1\n";
@@ -203,9 +225,51 @@ function avahi_sync() {
}
avahi_write_config();
// Is package enabled?
- if (($config['installedpackages']['avahi']['config'][0]['enable']) && file_exists("/usr/local/etc/rc.d/avahi-daemon.sh")) {
+ if ($config['installedpackages']['avahi']['config'][0]['enable']) {
start_service("avahi");
}
}
+function avahi_upgrade_config() {
+ global $config, $avahi_config;
+
+ $avahi_config =& $config['installedpackages']['avahi']['config'][0];
+ if (!is_array($avahi_config)) {
+ $avahi_config = array();
+ }
+ $changes = 0;
+ // Convert previous disable values to enable ones
+ // If broken settings were configured due to lack of validation, just set to defaults
+ if (isset($avahi_config['disable_ipv4']) && isset($avahi_config['disable_ipv6']) && $avahi_config['disable_ipv4'] == "on" && $avahi_config['disable_ipv6'] == "on") {
+ $avahi_config['enable_ipv4'] = "on";
+ $avahi_config['enable_ipv6'] = "on";
+ unset($avahi_config['disable_ipv4']);
+ unset($avahi_config['disable_ipv6']);
+ $changes++;
+ } elseif (isset($avahi_config['disable_ipv4']) && $avahi_config['disable_ipv4'] != "on") {
+ $avahi_config['enable_ipv4'] = "on";
+ unset($avahi_config['disable_ipv4']);
+ $changes++;
+ } elseif (isset($avahi_config['disable_ipv6']) && $avahi_config['disable_ipv6'] != "on") {
+ $avahi_config['enable_ipv6'] = "on";
+ unset($avahi_config['disable_ipv6']);
+ $changes++;
+ }
+ if ($changes > 0 ) {
+ write_config("[avahi] Upgraded old package configuration.");
+ }
+}
+
+function avahi_validate_input($post, &$input_errors) {
+ if (($post['enable_ipv4'] != "on" ) && ($post['enable_ipv6'] != "on" )) {
+ $input_errors[] = gettext("You cannot disable both IPv4 and IPv6!");
+ }
+ if (($post['enable_ipv4'] != "on" ) && ($post['publish_aaaa_on_ipv4'] == "on" )) {
+ $input_errors[] = gettext("'Publish AAAA records on IPv4' makes no sense with IPv4 disabled.");
+ }
+ if (($post['enable_ipv6'] != "on" ) && ($post['publish_a_on_ipv6'] == "on" )) {
+ $input_errors[] = gettext("'Publish A records on IPv6' makes no sense with IPv6 disabled.");
+ }
+}
+
?>
diff --git a/config/avahi/avahi.xml b/config/avahi/avahi.xml
index 0b49fea3..0c18e097 100644
--- a/config/avahi/avahi.xml
+++ b/config/avahi/avahi.xml
@@ -51,7 +51,7 @@
<name>Avahi</name>
<tooltiptext>Modify avahi settings.</tooltiptext>
<section>Services</section>
- <url>pkg_edit.php?xml=avahi.xml&amp;id=0</url>
+ <url>pkg_edit.php?xml=avahi.xml</url>
</menu>
<service>
<name>avahi</name>
@@ -73,61 +73,242 @@
</additional_files_needed>
<fields>
<field>
+ <name>Server Options</name>
+ <type>listtopic</type>
+ </field>
+ <field>
<fielddescr>Enable</fielddescr>
<fieldname>enable</fieldname>
<description>Enable Avahi Bonjour/Zeroconf proxy.</description>
<type>checkbox</type>
</field>
<field>
- <fielddescr>Browse domains (comma separated)</fielddescr>
+ <fielddescr>Browse Domains</fielddescr>
<fieldname>browsedomains</fieldname>
<description>
<![CDATA[
- Enter the domains that you would like proxied.<br />
- (Example: local, pfsense.org, mydomain.com)
+ Enter the (comma separated) list of domains that you would like proxied. (Example: local, pfsense.org, mydomain.com)<br />
+ (Default: local)
]]>
</description>
<type>input</type>
+ <default_value>local</default_value>
</field>
<field>
<fielddescr>Deny interfaces</fielddescr>
<fieldname>denyinterfaces</fieldname>
<description>
<![CDATA[
- Interfaces that you do NOT want Avahi to listen on.
- <strong>NOTE: WAN is always disabled (so it is not shown here).</strong>
+ Interfaces that you do NOT want Avahi to listen on.<br />
+ <strong>Note: WAN is always disabled (so it is not shown here).</strong>
]]>
</description>
<type>interfaces_selection</type>
- <hideinterfaceregex>wan</hideinterfaceregex>
+ <hideinterfaceregex>(wan|loopback)</hideinterfaceregex>
<multiple>true</multiple>
</field>
<field>
- <fielddescr>Disable IPv6</fielddescr>
- <fieldname>disable_ipv6</fieldname>
- <description>Disable IPv6 support in Avahi.</description>
+ <fielddescr>Enable IPv4</fielddescr>
+ <fieldname>enable_ipv4</fieldname>
+ <description>Enable IPv4 support in Avahi. (Default: enabled)</description>
<type>checkbox</type>
+ <default_value>on</default_value>
+ <enablefields>publish_aaaa_on_ipv4</enablefields>
</field>
<field>
- <fielddescr>Disable IPv4</fielddescr>
- <fieldname>disable_ipv4</fieldname>
- <description>Disable IPv4 support in Avahi.</description>
+ <fielddescr>Enable IPv6</fielddescr>
+ <fieldname>enable_ipv6</fieldname>
+ <description>Enable IPv6 support in Avahi. (Default: enabled)</description>
<type>checkbox</type>
+ <default_value>on</default_value>
+ <enablefields>publish_a_on_ipv6</enablefields>
</field>
<field>
- <fielddescr>Disable D-BUS</fielddescr>
+ <fielddescr>Disable D-Bus</fielddescr>
<fieldname>disable_dbus</fieldname>
- <description>Disable D-BUS client API support in Avahi.</description>
+ <description>Disable D-Bus client API support in Avahi. (Default: no)</description>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <name>Wide Area</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <fielddescr>Enable Wide-Area DNS-SD</fielddescr>
+ <fieldname>enable_wide_area</fieldname>
+ <description>
+ <![CDATA[
+ Enable wide-area DNS-SD, aka DNS-SD over unicast DNS. If this is enabled only
+ domains ending in .local will be resolved on mDNS, all other domains are resolved via unicast DNS.<br />
+ If you want to maintain multiple different multicast DNS domains even with this option enabled,
+ use subdomains of .local, such as "kitchen.local".<br />
+ (Default: enabled)
+ ]]>
+ </description>
+ <type>checkbox</type>
+ <default_value>on</default_value>
+ </field>
+ <field>
+ <name>Publishing Options</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <fielddescr>Disable Publishing</fielddescr>
+ <fieldname>disable_publishing</fieldname>
+ <description>
+ <![CDATA[
+ If checked, no record will be published by Avahi, not even address records for the local host. Avahi will be started in a querying-only mode.<br />
+ You can use this is a security measure. <strong>Warning: Do NOT disable publishing unless you know what you are doing!</strong><br />
+ (Default: no)
+ ]]>
+ </description>
+ <type>checkbox</type>
+ <default_value>off</default_value>
+ </field>
+ <field>
+ <fielddescr>Disable User Service Publishing</fielddescr>
+ <fieldname>disable_user_service_publishing</fieldname>
+ <description>
+ <![CDATA[
+ If checked, Avahi will still publish address records and suchlike but will not allow user applications to publish services.
+ You can use this is a security measure.<br />
+ (Default: no)
+ ]]>
+ </description>
+ <type>checkbox</type>
+ <default_value>off</default_value>
+ </field>
+ <field>
+ <fielddescr>Add Service Cookie</fielddescr>
+ <fieldname>add_service_cookie</fieldname>
+ <description>
+ <![CDATA[
+ If enabled, an implicit TXT entry will be added to all locally registered services.
+ This can be used to detect if two services on two different interfaces/protocols are actually identical.<br />
+ (Default: disabled)
+ ]]>
+ </description>
+ <type>checkbox</type>
+ <default_value>off</default_value>
+ </field>
+ <field>
+ <fielddescr>Publish Addresses</fielddescr>
+ <fieldname>publish_addresses</fieldname>
+ <description>
+ <![CDATA[
+ If enabled, Avahi will register mDNS address records for all local IP addresses. Unless you want to use Avahi exclusively
+ for browsing it’s recommended to enable this. If you want to register local services you need to enable this option.<br />
+ (Default: enabled)
+ ]]>
+ </description>
+ <type>checkbox</type>
+ <default_value>on</default_value>
+ </field>
+ <field>
+ <fielddescr>Publish HINFO</fielddescr>
+ <fieldname>publish_hinfo</fieldname>
+ <description>
+ <![CDATA[
+ If enabled, Avahi will register an mDNS HINFO record on all interfaces which contains information about the local operating system and CPU.<br />
+ This is recommended by the mDNS specification but not required. For the sake of privacy you might choose to disable this feature.<br />
+ (Default: enabled)
+ ]]>
+ </description>
+ <type>checkbox</type>
+ <default_value>on</default_value>
+ </field>
+ <field>
+ <fielddescr>Publish Workstation</fielddescr>
+ <fieldname>publish_workstation</fieldname>
+ <description>
+ <![CDATA[
+ If enabled, Avahi will register will register a service of type "_workstation._tcp" on the local LAN.
+ This might be useful for administrative purposes (i.e. browse for all PCs on the LAN).<br />
+ (Default: enabled)
+ ]]>
+ </description>
+ <type>checkbox</type>
+ <default_value>on</default_value>
+ </field>
+ <field>
+ <fielddescr>Publish DNS Servers</fielddescr>
+ <fieldname>publish_resolv_conf_dns_servers</fieldname>
+ <description>
+ <![CDATA[
+ If enabled, Avahi will publish the unicast DNS servers configured in System - General settings.
+ You can use this to announce unicast DNS servers via mDNS.<br />
+ When used in conjunction with avahi-dnsconfd on the client side this allows DHCP-like configuration of unicast DNS servers.<br />
+ (Default: disabled)
+ ]]>
+ </description>
+ <type>checkbox</type>
+ <default_value>off</default_value>
+ </field>
+ <field>
+ <fielddescr>Publish AAAA records on IPv4</fielddescr>
+ <fieldname>publish_aaaa_on_ipv4</fieldname>
+ <description>
+ <![CDATA[
+ If enabled, Avahi will publish an IPv6 AAAA record via IPv4, i.e. the local IPv6 addresses can be resolved using an IPv4 transport.<br />
+ (Default: enabled)
+ ]]>
+ </description>
+ <type>checkbox</type>
+ <default_value>on</default_value>
+ </field>
+ <field>
+ <fielddescr>Publish A records on IPv6</fielddescr>
+ <fieldname>publish_a_on_ipv6</fieldname>
+ <description>
+ <![CDATA[
+ If enabled, Avahi will publish an IPv4 A record via IPv6, i.e. the local IPv4 addresses can be resolved using an IPv6 transport.<br />
+ (Default: disabled)
+ ]]>
+ </description>
+ <type>checkbox</type>
+ <default_value>off</default_value>
+ </field>
+ <field>
+ <name>Reflector Options</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <fielddescr>Enable Reflector</fielddescr>
+ <fieldname>enable_reflector</fieldname>
+ <description>
+ <![CDATA[
+ If enabled, Avahi will reflect incoming mDNS requests to all local network interfaces,
+ effectively allowing clients to browse mDNS/DNS-SD services on all networks connected to the gateway.<br />
+ (Default: enabled)
+ ]]>
+ </description>
+ <type>checkbox</type>
+ <default_value>on</default_value>
+ </field>
+ <field>
+ <fielddescr>Reflect IPv</fielddescr>
+ <fieldname>reflect_ipv</fieldname>
+ <description>
+ <![CDATA[
+ If enabled, Avahi will forward mDNS traffic between IPv4 and IPv6, which is usually not recommended.<br />
+ (Default: disabled)
+ ]]>
+ </description>
<type>checkbox</type>
+ <default_value>off</default_value>
</field>
</fields>
<custom_php_resync_config_command>
avahi_sync();
</custom_php_resync_config_command>
<custom_php_install_command>
+ avahi_upgrade_config();
avahi_install();
</custom_php_install_command>
<custom_php_deinstall_command>
avahi_deinstall();
</custom_php_deinstall_command>
+ <custom_php_validation_command>
+ avahi_validate_input($_POST, $input_errors);
+ </custom_php_validation_command>
</packagegui>
diff --git a/pkg_config.10.xml b/pkg_config.10.xml
index 3d98aa91..0a89df05 100644
--- a/pkg_config.10.xml
+++ b/pkg_config.10.xml
@@ -261,7 +261,7 @@
<ports_after>net/avahi-app devel/dbus</ports_after>
</build_pbi>
<depends_on_package_pbi>avahi-0.6.31-##ARCH##.pbi</depends_on_package_pbi>
- <version>1.10.1</version>
+ <version>1.10.2</version>
<status>BETA</status>
<required_version>2.2</required_version>
<config_file>https://packages.pfsense.org/packages/config/avahi/avahi.xml</config_file>
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index ee96c08e..cd82d816 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -316,7 +316,7 @@
</build_pbi>
<depends_on_package>avahi-app-0.6.29_1.tbz</depends_on_package>
<depends_on_package_pbi>avahi-0.6.31-i386.pbi</depends_on_package_pbi>
- <version>0.6.31 pkg v1.08</version>
+ <version>0.6.31 pkg v1.10.2</version>
<status>ALPHA</status>
<required_version>1.2.3</required_version>
<config_file>https://packages.pfsense.org/packages/config/avahi/avahi.xml</config_file>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index d327b11e..489e61e9 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -303,7 +303,7 @@
</build_pbi>
<depends_on_package>avahi-0.6.29.tbz</depends_on_package>
<depends_on_package_pbi>avahi-0.6.31-amd64.pbi</depends_on_package_pbi>
- <version>0.6.31 pkg v1.08</version>
+ <version>0.6.31 pkg v1.10.2</version>
<status>ALPHA</status>
<required_version>1.2.3</required_version>
<config_file>https://packages.pfsense.org/packages/config/avahi/avahi.xml</config_file>