nohdr: true
# MultiCast Discovery
-mcd-listen: ["em0", "igb1"]
-mcd-send: {em0: 60, igb1: 5}
+mcd-listen: ["em[0-3]", "igb_.*"]
+mcd-send: {"em[0-3]": 60, igb_.*: 5}
# Yggdrasil aliases
yggdrasil-aliases: {
@table @code
@anchor{CfgMCDListen}
@item mcd-listen
-Specifies list of network interfaces @ref{nncp-caller} will listen for
-incoming @ref{MCD} announcements.
+Specifies list of network interfaces regular expression
+@ref{nncp-caller} will listen for incoming @ref{MCD} announcements.
@anchor{CfgMCDSend}
@item mcd-send
-Specifies list of network interfaces, and intervals in seconds, where
-@ref{nncp-daemon} will send @ref{MCD} announcements.
+Specifies list of network interfaces regular expressions, and intervals
+in seconds, where @ref{nncp-daemon} will send @ref{MCD} announcements.
@end table
@anchor{CfgYggdrasilAliases}
@node Новости
@section Новости
+@node Релиз 8.4.0
+@subsection Релиз 8.4.0
+@itemize
+
+@item
+Имена интерфейсов относящихся к multicast (@code{mcd-listen} и
+@code{mcd-send} опции конфигурации) теперь являются регулярными
+выражениями. По умолчанию @command{nncp-cfgnew} не комментирует
+их теперь и прописывает @code{.*} имя интерфейса.
+
+@end itemize
+
@node Релиз 8.3.0
@subsection Релиз 8.3.0
@itemize
See also this page @ref{Новости, on russian}.
+@node Release 8_4_0
+@section Release 8.4.0
+@itemize
+
+@item
+Multicast related interface names (@code{mcd-listen} and @code{mcd-send}
+configuration options) are now regular expressions. By default
+@command{nncp-cfgnew} uncomments them now with @code{.*} interface name.
+
+@end itemize
+
@node Release 8_3_0
@section Release 8.3.0
@itemize
"flag"
"fmt"
"log"
+ "net"
"os"
+ "regexp"
"sync"
"time"
}
}
- for _, ifiName := range ctx.MCDRxIfis {
- if err = ctx.MCDRx(ifiName); err != nil {
- log.Printf("Can not run MCD reception on %s: %s", ifiName, err)
+ ifis, err := net.Interfaces()
+ if err != nil {
+ log.Fatalln("Can not get network interfaces list:", err)
+ }
+ for _, ifiReString := range ctx.MCDRxIfis {
+ ifiRe, err := regexp.CompilePOSIX(ifiReString)
+ if err != nil {
+ log.Fatalf("Can not compile POSIX regexp \"%s\": %s", ifiReString, err)
+ }
+ for _, ifi := range ifis {
+ if ifiRe.MatchString(ifi.Name) {
+ if err = ctx.MCDRx(ifi.Name); err != nil {
+ log.Printf("Can not run MCD reception on %s: %s", ifi.Name, err)
+ }
+ }
}
}
# nohdr: true
# MultiCast Discovery:
- # List of interfaces where to listen for MCD announcements
- # mcd-listen: ["em0", "igb1"]
- # Interfaces and intervals (in seconds) where to send MCD announcements
- # mcd-send: {em0: 60, igb1: 5}
+ # List of interface regular expressions where to listen for MCD announcements
+ mcd-listen: [".*"]
+ # Interfaces regular expressions and intervals (in seconds) where to send
+ # MCD announcements
+ mcd-send: {.*: 10}
# Yggdrasil related aliases:
# yggdrasil-aliases: {
"log"
"net"
"os"
+ "regexp"
"strconv"
"strings"
"time"
close(nodeIdC)
}
+func startMCDTx(ctx *nncp.Ctx, port int, zeroInterval bool) error {
+ ifis, err := net.Interfaces()
+ if err != nil {
+ return err
+ }
+ for ifiReString, secs := range ctx.MCDTxIfis {
+ ifiRe, err := regexp.CompilePOSIX(ifiReString)
+ if err != nil {
+ return err
+ }
+ var interval time.Duration
+ if !zeroInterval {
+ interval = time.Duration(secs) * time.Second
+ }
+ for _, ifi := range ifis {
+ if ifiRe.MatchString(ifi.Name) {
+ if err = ctx.MCDTx(ifi.Name, port, interval); err != nil {
+ return err
+ }
+ }
+ }
+ }
+ return nil
+}
+
func main() {
var (
cfgPath = flag.String("cfg", nncp.DefaultCfgPath, "Path to configuration file")
}
if *mcdOnce {
- for ifiName := range ctx.MCDTxIfis {
- if err = ctx.MCDTx(ifiName, port, 0); err != nil {
- log.Fatalln("Can not do MCD transmission:", err)
- }
+ if err = startMCDTx(ctx, port, true); err != nil {
+ log.Fatalln("Can not do MCD transmission:", err)
}
return
}
if err != nil {
log.Fatalln("Can not listen:", err)
}
-
- for ifiName, secs := range ctx.MCDTxIfis {
- if err = ctx.MCDTx(ifiName, port, time.Duration(secs)*time.Second); err != nil {
- log.Fatalln("Can not run MCD transmission:", err)
- }
+ if err = startMCDTx(ctx, port, false); err != nil {
+ log.Fatalln("Can not do MCD transmission:", err)
}
-
ln = netutil.LimitListener(ln, *maxConn)
go func() {
for {
const Base32Encoded32Len = 52
var (
- Version string = "8.3.0"
+ Version string = "8.4.0"
Base32Codec *base32.Encoding = base32.StdEncoding.WithPadding(base32.NoPadding)
)