Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sciond path #52

Merged
merged 1 commit into from
Jul 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions bwtester/bwtestclient/bwtestclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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) {
Expand Down
21 changes: 10 additions & 11 deletions bwtester/bwtestserver/bwtestserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ var (
serverCCAddr *snet.Addr
err error
CCConn *snet.Conn
sciondAddr *string
sciondPath *string
sciondFromIA *bool
dispatcherPath *string
)

func main() {
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
26 changes: 19 additions & 7 deletions camerapp/imagefetcher/imagefetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"log"
"time"

"github.com/scionproto/scion/go/lib/sciond"
"github.com/scionproto/scion/go/lib/snet"
)

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)

Expand Down
24 changes: 18 additions & 6 deletions camerapp/imageserver/imageserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"time"

"github.com/scionproto/scion/go/lib/snet"
"github.com/scionproto/scion/go/lib/sciond"
)

const (
Expand Down Expand Up @@ -108,7 +109,10 @@ func main() {
go HandleImageFiles()

var (
serverAddress string
serverAddress string
sciondPath string
sciondFromIA bool
dispatcherPath string

err error
server *snet.Addr
Expand All @@ -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
Expand All @@ -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)

Expand Down
8 changes: 3 additions & 5 deletions roughtime/utils/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}
Expand Down
22 changes: 17 additions & 5 deletions sensorapp/sensorfetcher/sensorfetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"log"

"github.com/scionproto/scion/go/lib/snet"
"github.com/scionproto/scion/go/lib/sciond"
)

func check(e error) {
Expand All @@ -27,6 +28,9 @@ func main() {
var (
clientAddress string
serverAddress string
sciondPath string
sciondFromIA bool
dispatcherPath string

err error
local *snet.Addr
Expand All @@ -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
Expand All @@ -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)

Expand Down
22 changes: 17 additions & 5 deletions sensorapp/sensorserver/sensorserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"sync"

"github.com/scionproto/scion/go/lib/snet"
"github.com/scionproto/scion/go/lib/sciond"
)

const (
Expand Down Expand Up @@ -70,6 +71,9 @@ func main() {

var (
serverAddress string
sciondPath string
sciondFromIA bool
dispatcherPath string

err error
server *snet.Addr
Expand All @@ -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
Expand All @@ -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)

Expand Down