From 17175b49f2b28772ffafc606715b5c72c96eafb4 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 11 Jun 2019 10:18:59 +0100 Subject: [PATCH] Add multicast interfaces to platform-specific defaults (this makes it easier to avoid bringing AWDL up by default on macOS as an example, or over L2 VPNs when not expected) --- src/config/config.go | 2 +- src/defaults/defaults.go | 3 +++ src/defaults/defaults_darwin.go | 6 ++++++ src/defaults/defaults_freebsd.go | 5 +++++ src/defaults/defaults_linux.go | 8 ++++++++ src/defaults/defaults_netbsd.go | 5 +++++ src/defaults/defaults_openbsd.go | 5 +++++ src/defaults/defaults_other.go | 5 +++++ src/defaults/defaults_windows.go | 5 +++++ 9 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/config/config.go b/src/config/config.go index 8137cac9..9f8f3f54 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -102,7 +102,7 @@ func GenerateConfig() *NodeConfig { cfg.Peers = []string{} cfg.InterfacePeers = map[string][]string{} cfg.AllowedEncryptionPublicKeys = []string{} - cfg.MulticastInterfaces = []string{".*"} + cfg.MulticastInterfaces = defaults.GetDefaults().DefaultMulticastInterfaces cfg.IfName = defaults.GetDefaults().DefaultIfName cfg.IfMTU = defaults.GetDefaults().DefaultIfMTU cfg.IfTAPMode = defaults.GetDefaults().DefaultIfTAPMode diff --git a/src/defaults/defaults.go b/src/defaults/defaults.go index 3834990e..a5784198 100644 --- a/src/defaults/defaults.go +++ b/src/defaults/defaults.go @@ -10,6 +10,9 @@ type platformDefaultParameters struct { // Configuration (used for yggdrasilctl) DefaultConfigFile string + // Multicast interfaces + DefaultMulticastInterfaces []string + // TUN/TAP MaximumIfMTU int DefaultIfMTU int diff --git a/src/defaults/defaults_darwin.go b/src/defaults/defaults_darwin.go index 9bac3aad..26fd1f2d 100644 --- a/src/defaults/defaults_darwin.go +++ b/src/defaults/defaults_darwin.go @@ -12,6 +12,12 @@ func GetDefaults() platformDefaultParameters { // Configuration (used for yggdrasilctl) DefaultConfigFile: "/etc/yggdrasil.conf", + // Multicast interfaces + DefaultMulticastInterfaces: []string{ + "en*", + "bridge*", + }, + // TUN/TAP MaximumIfMTU: 65535, DefaultIfMTU: 65535, diff --git a/src/defaults/defaults_freebsd.go b/src/defaults/defaults_freebsd.go index df1a3c65..0e523483 100644 --- a/src/defaults/defaults_freebsd.go +++ b/src/defaults/defaults_freebsd.go @@ -12,6 +12,11 @@ func GetDefaults() platformDefaultParameters { // Configuration (used for yggdrasilctl) DefaultConfigFile: "/etc/yggdrasil.conf", + // Multicast interfaces + DefaultMulticastInterfaces: []string{ + ".*", + }, + // TUN/TAP MaximumIfMTU: 32767, DefaultIfMTU: 32767, diff --git a/src/defaults/defaults_linux.go b/src/defaults/defaults_linux.go index 2f3459ca..67404e2d 100644 --- a/src/defaults/defaults_linux.go +++ b/src/defaults/defaults_linux.go @@ -12,6 +12,14 @@ func GetDefaults() platformDefaultParameters { // Configuration (used for yggdrasilctl) DefaultConfigFile: "/etc/yggdrasil.conf", + // Multicast interfaces + DefaultMulticastInterfaces: []string{ + "en*", + "eth*", + "wlan*", + "br*", + }, + // TUN/TAP MaximumIfMTU: 65535, DefaultIfMTU: 65535, diff --git a/src/defaults/defaults_netbsd.go b/src/defaults/defaults_netbsd.go index 40476dcb..52a487b7 100644 --- a/src/defaults/defaults_netbsd.go +++ b/src/defaults/defaults_netbsd.go @@ -12,6 +12,11 @@ func GetDefaults() platformDefaultParameters { // Configuration (used for yggdrasilctl) DefaultConfigFile: "/etc/yggdrasil.conf", + // Multicast interfaces + DefaultMulticastInterfaces: []string{ + ".*", + }, + // TUN/TAP MaximumIfMTU: 9000, DefaultIfMTU: 9000, diff --git a/src/defaults/defaults_openbsd.go b/src/defaults/defaults_openbsd.go index cd6d202a..d44e5714 100644 --- a/src/defaults/defaults_openbsd.go +++ b/src/defaults/defaults_openbsd.go @@ -12,6 +12,11 @@ func GetDefaults() platformDefaultParameters { // Configuration (used for yggdrasilctl) DefaultConfigFile: "/etc/yggdrasil.conf", + // Multicast interfaces + DefaultMulticastInterfaces: []string{ + ".*", + }, + // TUN/TAP MaximumIfMTU: 16384, DefaultIfMTU: 16384, diff --git a/src/defaults/defaults_other.go b/src/defaults/defaults_other.go index a01ab7af..0ba825c5 100644 --- a/src/defaults/defaults_other.go +++ b/src/defaults/defaults_other.go @@ -12,6 +12,11 @@ func GetDefaults() platformDefaultParameters { // Configuration (used for yggdrasilctl) DefaultConfigFile: "/etc/yggdrasil.conf", + // Multicast interfaces + DefaultMulticastInterfaces: []string{ + ".*", + }, + // TUN/TAP MaximumIfMTU: 65535, DefaultIfMTU: 65535, diff --git a/src/defaults/defaults_windows.go b/src/defaults/defaults_windows.go index 3b04783a..6d53225a 100644 --- a/src/defaults/defaults_windows.go +++ b/src/defaults/defaults_windows.go @@ -12,6 +12,11 @@ func GetDefaults() platformDefaultParameters { // Configuration (used for yggdrasilctl) DefaultConfigFile: "C:\\Program Files\\Yggdrasil\\yggdrasil.conf", + // Multicast interfaces + DefaultMulticastInterfaces: []string{ + ".*", + }, + // TUN/TAP MaximumIfMTU: 65535, DefaultIfMTU: 65535,