diff --git a/bwtester/bwtestclient/bwtestclient.go b/bwtester/bwtestclient/bwtestclient.go index 064658e..3838ab9 100644 --- a/bwtester/bwtestclient/bwtestclient.go +++ b/bwtester/bwtestclient/bwtestclient.go @@ -240,8 +240,9 @@ func getPacketCount(count string) int { func main() { var ( - sciondAddr string + sciondPath string sciondFromIA bool + dispatcherPath string clientCCAddrStr string serverCCAddrStr string clientISDASIP string @@ -275,8 +276,10 @@ func main() { receiveDone sync.Mutex // used to signal when the HandleDCConnReceive goroutine has completed ) - flag.StringVar(&sciondAddr, "sciond", "", "Path to sciond socket") + flag.StringVar(&sciondPath, "sciond", "", "Path to sciond socket") flag.BoolVar(&sciondFromIA, "sciondFromIA", false, "SCIOND socket path from IA address:ISD-AS") + flag.StringVar(&dispatcherPath, "dispatcher", "/run/shm/dispatcher/default.sock", + "Path to dispatcher socket") flag.StringVar(&clientCCAddrStr, "c", "", "Client SCION Address") flag.StringVar(&serverCCAddrStr, "s", "", "Server SCION Address") flag.StringVar(&serverBwpStr, "sc", DefaultBwtestParameters, "Server->Client test parameter") @@ -312,18 +315,14 @@ func main() { } if sciondFromIA { - if sciondAddr != "" { + if sciondPath != "" { LogFatal("Only one of -sciond or -sciondFromIA can be specified") } - sciondAddr = sciond.GetDefaultSCIONDPath(&serverCCAddr.IA) - } else if sciondAddr == "" { - sciondAddr = sciond.GetDefaultSCIONDPath(nil) + sciondPath = sciond.GetDefaultSCIONDPath(&clientCCAddr.IA) + } else if sciondPath == "" { + sciondPath = sciond.GetDefaultSCIONDPath(nil) } - // sciondAddr := fmt.Sprintf("/run/shm/sciond/sd%d-%s.sock", clientCCAddr.IA.I, clientCCAddr.IA.A.FileFmt()) - sciondAddr = "/run/shm/sciond/default.sock" - - dispatcherAddr := "/run/shm/dispatcher/default.sock" - snet.Init(clientCCAddr.IA, sciondAddr, dispatcherAddr) + snet.Init(clientCCAddr.IA, sciondPath, dispatcherPath) var pathEntry *sciond.PathReplyEntry if !serverCCAddr.IA.Eq(clientCCAddr.IA) { diff --git a/bwtester/bwtestserver/bwtestserver.go b/bwtester/bwtestserver/bwtestserver.go index 5512565..8b983df 100644 --- a/bwtester/bwtestserver/bwtestserver.go +++ b/bwtester/bwtestserver/bwtestserver.go @@ -55,8 +55,9 @@ var ( serverCCAddr *snet.Addr err error CCConn *snet.Conn - sciondAddr *string + sciondPath *string sciondFromIA *bool + dispatcherPath *string ) func main() { @@ -67,8 +68,10 @@ func main() { flag.StringVar(&serverCCAddrStr, "s", "", "Server SCION Address") id := flag.String("id", "bwtester", "Element ID") logDir := flag.String("log_dir", "./logs", "Log directory") - sciondAddr = flag.String("sciond", "", "Path to sciond socket") + sciondPath = flag.String("sciond", "", "Path to sciond socket") sciondFromIA = flag.Bool("sciondFromIA", false, "SCIOND socket path from IA address:ISD-AS") + dispatcherPath = flag.String("dispatcher", "/run/shm/dispatcher/default.sock", + "Path to dispatcher socket") flag.Parse() // Setup logging @@ -105,19 +108,15 @@ func runServer(serverCCAddrStr string) { } if *sciondFromIA { - if *sciondAddr != "" { + if *sciondPath != "" { LogFatal("Only one of -sciond or -sciondFromIA can be specified") } - *sciondAddr = sciond.GetDefaultSCIONDPath(&serverCCAddr.IA) - } else if *sciondAddr == "" { - *sciondAddr = sciond.GetDefaultSCIONDPath(nil) + *sciondPath = sciond.GetDefaultSCIONDPath(&serverCCAddr.IA) + } else if *sciondPath == "" { + *sciondPath = sciond.GetDefaultSCIONDPath(nil) } - // sciondAddr := fmt.Sprintf("/run/shm/sciond/sd%d-%s.sock", serverCCAddr.IA.I, serverCCAddr.IA.A.FileFmt()) - sciondAddrStr := "/run/shm/sciond/default.sock" - - dispatcherAddr := "/run/shm/dispatcher/default.sock" log.Info("Starting server") - snet.Init(serverCCAddr.IA, sciondAddrStr, dispatcherAddr) + snet.Init(serverCCAddr.IA, *sciondPath, *dispatcherPath) ci := strings.LastIndex(serverCCAddrStr, ":") if ci < 0 { diff --git a/camerapp/imagefetcher/imagefetcher.go b/camerapp/imagefetcher/imagefetcher.go index e6448bd..2b21c43 100644 --- a/camerapp/imagefetcher/imagefetcher.go +++ b/camerapp/imagefetcher/imagefetcher.go @@ -12,6 +12,7 @@ import ( "log" "time" + "github.com/scionproto/scion/go/lib/sciond" "github.com/scionproto/scion/go/lib/snet" ) @@ -157,8 +158,11 @@ func main() { startTime := time.Now() var ( - clientAddress string - serverAddress string + clientAddress string + serverAddress string + sciondPath string + sciondFromIA bool + dispatcherPath string err error local *snet.Addr @@ -169,7 +173,10 @@ func main() { flag.StringVar(&clientAddress, "c", "", "Client SCION Address") flag.StringVar(&serverAddress, "s", "", "Server SCION Address") - + flag.StringVar(&sciondPath, "sciond", "", "Path to sciond socket") + flag.BoolVar(&sciondFromIA, "sciondFromIA", false, "SCIOND socket path from IA address:ISD-AS") + flag.StringVar(&dispatcherPath, "dispatcher", "/run/shm/dispatcher/default.sock", + "Path to dispatcher socket") flag.Parse() // Create SCION UDP socket @@ -188,10 +195,15 @@ func main() { check(fmt.Errorf("Error, server address needs to be specified with -s")) } - //sciondAddr := fmt.Sprintf("/run/shm/sciond/sd%d-%d.sock", local.IA.I, local.IA.A) - sciondAddr := "/run/shm/sciond/sciond.sock" - dispatcherAddr := "/run/shm/dispatcher/default.sock" - snet.Init(local.IA, sciondAddr, dispatcherAddr) + if sciondFromIA { + if sciondPath != "" { + log.Fatal("Only one of -sciond or -sciondFromIA can be specified") + } + sciondPath = sciond.GetDefaultSCIONDPath(&local.IA) + } else if sciondPath == "" { + sciondPath = sciond.GetDefaultSCIONDPath(nil) + } + snet.Init(local.IA, sciondPath, dispatcherPath) udpConnection, err = snet.DialSCION("udp4", local, remote) check(err) diff --git a/camerapp/imageserver/imageserver.go b/camerapp/imageserver/imageserver.go index 55d11c5..1acfe3b 100644 --- a/camerapp/imageserver/imageserver.go +++ b/camerapp/imageserver/imageserver.go @@ -16,6 +16,7 @@ import ( "time" "github.com/scionproto/scion/go/lib/snet" + "github.com/scionproto/scion/go/lib/sciond" ) const ( @@ -108,7 +109,10 @@ func main() { go HandleImageFiles() var ( - serverAddress string + serverAddress string + sciondPath string + sciondFromIA bool + dispatcherPath string err error server *snet.Addr @@ -118,6 +122,10 @@ func main() { // Fetch arguments from command line flag.StringVar(&serverAddress, "s", "", "Server SCION Address") + flag.StringVar(&sciondPath, "sciond", "", "Path to sciond socket") + flag.BoolVar(&sciondFromIA, "sciondFromIA", false, "SCIOND socket path from IA address:ISD-AS") + flag.StringVar(&dispatcherPath, "dispatcher", "/run/shm/dispatcher/default.sock", + "Path to dispatcher socket") flag.Parse() // Create the SCION UDP socket @@ -129,11 +137,15 @@ func main() { check(fmt.Errorf("Error, server address needs to be specified with -s")) } - //sciondAddr := fmt.Sprintf("/run/shm/sciond/sd%d-%d.sock", server.IA.I, server.IA.A) - sciondAddr := "/run/shm/sciond/sciond.sock" - dispatcherAddr := "/run/shm/dispatcher/default.sock" - snet.Init(server.IA, sciondAddr, dispatcherAddr) - + if sciondFromIA { + if sciondPath != "" { + log.Fatal("Only one of -sciond or -sciondFromIA can be specified") + } + sciondPath = sciond.GetDefaultSCIONDPath(&server.IA) + } else if sciondPath == "" { + sciondPath = sciond.GetDefaultSCIONDPath(nil) + } + snet.Init(server.IA, sciondPath, dispatcherPath) udpConnection, err = snet.ListenSCION("udp4", server) check(err) diff --git a/roughtime/utils/connection.go b/roughtime/utils/connection.go index 19659ad..0554564 100644 --- a/roughtime/utils/connection.go +++ b/roughtime/utils/connection.go @@ -2,14 +2,11 @@ package utils; import ( "log" - "fmt" "github.com/scionproto/scion/go/lib/snet" + "github.com/scionproto/scion/go/lib/sciond" ) -func getSciondAddr(scionAddr *snet.Addr)(string){ - return fmt.Sprintf("/run/shm/sciond/sd%d-%d.sock", scionAddr.IA.I, scionAddr.IA.A) -} func getDispatcherAddr(scionAddr *snet.Addr)(string){ return "/run/shm/dispatcher/default.sock" @@ -23,7 +20,8 @@ func InitSCIONConnection(scionAddressString string)(*snet.Addr, error){ return nil, err } - err = snet.Init(scionAddress.IA, getSciondAddr(scionAddress), getDispatcherAddr(scionAddress)) + err = snet.Init(scionAddress.IA, sciond.GetDefaultSCIONDPath(nil), + getDispatcherAddr(scionAddress)) if err != nil { return scionAddress, err } diff --git a/sensorapp/sensorfetcher/sensorfetcher.go b/sensorapp/sensorfetcher/sensorfetcher.go index 094e5d3..2185ea8 100644 --- a/sensorapp/sensorfetcher/sensorfetcher.go +++ b/sensorapp/sensorfetcher/sensorfetcher.go @@ -9,6 +9,7 @@ import ( "log" "github.com/scionproto/scion/go/lib/snet" + "github.com/scionproto/scion/go/lib/sciond" ) func check(e error) { @@ -27,6 +28,9 @@ func main() { var ( clientAddress string serverAddress string + sciondPath string + sciondFromIA bool + dispatcherPath string err error local *snet.Addr @@ -38,6 +42,10 @@ func main() { // Fetch arguments from command line flag.StringVar(&clientAddress, "c", "", "Client SCION Address") flag.StringVar(&serverAddress, "s", "", "Server SCION Address") + flag.StringVar(&sciondPath, "sciond", "", "Path to sciond socket") + flag.BoolVar(&sciondFromIA, "sciondFromIA", false, "SCIOND socket path from IA address:ISD-AS") + flag.StringVar(&dispatcherPath, "dispatcher", "/run/shm/dispatcher/default.sock", + "Path to dispatcher socket") flag.Parse() // Create the SCION UDP socket @@ -56,11 +64,15 @@ func main() { check(fmt.Errorf("Error, server address needs to be specified with -s")) } - // sciondAddr := fmt.Sprintf("/run/shm/sciond/sd%d-%d.sock", local.IA.I, local.IA.A) - sciondAddr := "/run/shm/sciond/default.sock" - dispatcherAddr := "/run/shm/dispatcher/default.sock" - snet.Init(local.IA, sciondAddr, dispatcherAddr) - + if sciondFromIA { + if sciondPath != "" { + log.Fatal("Only one of -sciond or -sciondFromIA can be specified") + } + sciondPath = sciond.GetDefaultSCIONDPath(&local.IA) + } else if sciondPath == "" { + sciondPath = sciond.GetDefaultSCIONDPath(nil) + } + snet.Init(local.IA, sciondPath, dispatcherPath) udpConnection, err = snet.DialSCION("udp4", local, remote) check(err) diff --git a/sensorapp/sensorserver/sensorserver.go b/sensorapp/sensorserver/sensorserver.go index cf6dc22..d1391b1 100644 --- a/sensorapp/sensorserver/sensorserver.go +++ b/sensorapp/sensorserver/sensorserver.go @@ -13,6 +13,7 @@ import ( "sync" "github.com/scionproto/scion/go/lib/snet" + "github.com/scionproto/scion/go/lib/sciond" ) const ( @@ -70,6 +71,9 @@ func main() { var ( serverAddress string + sciondPath string + sciondFromIA bool + dispatcherPath string err error server *snet.Addr @@ -79,6 +83,10 @@ func main() { // Fetch arguments from command line flag.StringVar(&serverAddress, "s", "", "Server SCION Address") + flag.StringVar(&sciondPath, "sciond", "", "Path to sciond socket") + flag.BoolVar(&sciondFromIA, "sciondFromIA", false, "SCIOND socket path from IA address:ISD-AS") + flag.StringVar(&dispatcherPath, "dispatcher", "/run/shm/dispatcher/default.sock", + "Path to dispatcher socket") flag.Parse() // Create the SCION UDP socket @@ -90,11 +98,15 @@ func main() { check(fmt.Errorf("Error, server address needs to be specified with -s")) } - //sciondsciondAddr := fmt.Sprintf("/run/shm/sciond/sd%d-%d.sock", server.IA.I, server.IA.A) - sciondAddr := "/run/shm/sciond/default.sock" - dispatcherAddr := "/run/shm/dispatcher/default.sock" - snet.Init(server.IA, sciondAddr, dispatcherAddr) - + if sciondFromIA { + if sciondPath != "" { + log.Fatal("Only one of -sciond or -sciondFromIA can be specified") + } + sciondPath = sciond.GetDefaultSCIONDPath(&server.IA) + } else if sciondPath == "" { + sciondPath = sciond.GetDefaultSCIONDPath(nil) + } + snet.Init(server.IA, sciondPath, dispatcherPath) udpConnection, err = snet.ListenSCION("udp4", server) check(err)