diff --git a/go.mod b/go.mod index 06fa93f..b4af179 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module pndpd go 1.18 require ( - golang.org/x/net v0.0.0-20220225172249-27dd8689420f - golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 + golang.org/x/net v0.7.0 + golang.org/x/sys v0.5.0 ) diff --git a/go.sum b/go.sum index af3f36e..c39cfd0 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,4 @@ -golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs= -golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/main.go b/main.go index 8fbc31e..d6061ce 100644 --- a/main.go +++ b/main.go @@ -15,7 +15,7 @@ import ( var Version = "Custom_Build" func main() { - fmt.Println("PNDPD Version", Version, "- Kioubit 2022") + fmt.Println("PNDPD Version", Version, "- Kioubit") if len(os.Args) <= 2 { printUsage() diff --git a/modules/userInterface/userInterface.go b/modules/userInterface/userInterface.go index c197aef..58cccde 100644 --- a/modules/userInterface/userInterface.go +++ b/modules/userInterface/userInterface.go @@ -14,13 +14,13 @@ import ( func init() { commands := []modules.Command{{ CommandText: "proxy", - Description: "pndpd proxy ", + Description: "pndpd proxy <[optional] 'auto' to determine filters from the external interface or whitelist of CIDRs separated by a semicolon>", BlockTerminate: true, ConfigEnabled: true, CommandLineEnabled: true, }, { CommandText: "responder", - Description: "pndpd responder ", + Description: "pndpd responder <[optional] 'auto' to determine filters from the internal interface or whitelist of CIDRs separated by a semicolon>", BlockTerminate: true, ConfigEnabled: true, CommandLineEnabled: true, @@ -58,11 +58,17 @@ func initCallback(callback modules.CallbackInfo) { case "proxy": switch len(callback.Arguments) { case 3: + var filter = callback.Arguments[2] + var autosense = "" + if callback.Arguments[2] == "auto" { + filter = "" + autosense = callback.Arguments[1] + } allProxies = append(allProxies, &configProxy{ Iface1: callback.Arguments[0], Iface2: callback.Arguments[1], - Filter: callback.Arguments[2], - autosense: "", + Filter: filter, + autosense: autosense, instance: nil, }) case 2: @@ -78,10 +84,16 @@ func initCallback(callback modules.CallbackInfo) { } case "responder": if len(callback.Arguments) == 2 { + var filter = callback.Arguments[1] + var autosense = "" + if callback.Arguments[1] == "auto" { + filter = "" + autosense = callback.Arguments[0] + } allResponders = append(allResponders, &configResponder{ Iface: callback.Arguments[0], - Filter: callback.Arguments[1], - autosense: "", + Filter: filter, + autosense: autosense, instance: nil, }) } else { @@ -109,11 +121,11 @@ func initCallback(callback modules.CallbackInfo) { obj := configProxy{} filter := "" for _, n := range callback.Arguments { - if strings.HasPrefix(n, "iface1") { - obj.Iface1 = strings.TrimSpace(strings.TrimPrefix(n, "iface1")) + if strings.HasPrefix(n, "ext-iface") { + obj.Iface1 = strings.TrimSpace(strings.TrimPrefix(n, "ext-iface")) } - if strings.HasPrefix(n, "iface2") { - obj.Iface2 = strings.TrimSpace(strings.TrimPrefix(n, "iface2")) + if strings.HasPrefix(n, "int-iface") { + obj.Iface2 = strings.TrimSpace(strings.TrimPrefix(n, "int-iface")) } if strings.HasPrefix(n, "filter") { filter += strings.TrimSpace(strings.TrimPrefix(n, "filter")) + ";" @@ -133,7 +145,7 @@ func initCallback(callback modules.CallbackInfo) { showError("config: cannot have both a filter and autosense enabled on a proxy object") } if obj.Iface2 == "" || obj.Iface1 == "" { - showError("config: two interfaces need to be specified in the config file for a proxy object. (iface1 and iface2 parameters)") + showError("config: two interfaces need to be specified in the config file for a proxy object. (ext-iface and int-iface parameters)") } allProxies = append(allProxies, &obj) case "responder": diff --git a/pndpd.conf b/pndpd.conf index f15083f..fc03b13 100644 --- a/pndpd.conf +++ b/pndpd.conf @@ -13,28 +13,28 @@ responder { } // Proxy example -// Create an NDP proxy for proxying NDP between iface1 ("eth0") and iface2 ("eth1") -// The whitelist is applied on iface2 +// Create an NDP proxy for proxying NDP between the external ext-iface ("eth0") and the internal int-iface ("eth1") proxy { - iface1 eth0 - iface2 eth1 + ext-iface eth0 + int-iface eth1 filter fd01::/64 filter fd02::/64 } // Responder example with autoconfigured whitelist -// The whitelist is configured based on the addresses assigned to the interface specified. This works even if the IP addresses change frequently. +// The whitelist is configured based on the addresses assigned to the interface specified via the autosense parameter. +// This works even if the IP addresses change frequently. responder { iface eth0 autosense eth0 } // Proxy example with autoconfigured whitelist -// The whitelist is configured based on the addresses assigned to the interface specified. This works even if the IP addresses change frequently. -// The whitelist is applied to iface2 +// The whitelist is configured based on the addresses assigned to the interface specified via the autosense parameter. +// This works even if the IP addresses change frequently. proxy { - iface1 eth0 - iface2 eth1 + ext-iface eth0 + int-iface eth1 autosense eth1 }