diff --git a/fw-prompt/fw-prompt.go b/fw-prompt/fw-prompt.go index 5b03297..9782732 100644 --- a/fw-prompt/fw-prompt.go +++ b/fw-prompt/fw-prompt.go @@ -13,6 +13,7 @@ import ( "strconv" "strings" "sync" + "time" "github.com/subgraph/fw-daemon/sgfw" ) @@ -318,6 +319,27 @@ func createListStore(general bool) *gtk.ListStore { func addRequest(listStore *gtk.ListStore, path, proto string, pid int, ipaddr, hostname string, port, uid, gid int, origin string, is_socks bool, optstring string, sandbox string) *decisionWaiter { if listStore == nil { listStore = globalLS + waitTimes := []int{ 1, 2, 5, 10 } + + if listStore == nil { + log.Print("SGFW prompter was not ready to receive firewall request... waiting") + } + + for _, wtime := range waitTimes { + time.Sleep(time.Duration(wtime) * time.Second) + listStore = globalLS + + if listStore != nil { + break + } + + log.Print("SGFW prompter is still waiting...") + } + + } + + if listStore == nil { + log.Fatal("SGFW prompter GUI failed to load for unknown reasons") } iter := listStore.Append() diff --git a/sgfw/prompt.go b/sgfw/prompt.go index f461a20..22df84f 100644 --- a/sgfw/prompt.go +++ b/sgfw/prompt.go @@ -15,7 +15,7 @@ import ( var DoMultiPrompt = true -const MAX_PROMPTS = 3 +const MAX_PROMPTS = 5 var outstandingPrompts = 0 var promptLock = &sync.Mutex{} diff --git a/vendor/github.com/subgraph/go-nfnetlink/nfnl_sock.go b/vendor/github.com/subgraph/go-nfnetlink/nfnl_sock.go index 550fc8d..b817358 100644 --- a/vendor/github.com/subgraph/go-nfnetlink/nfnl_sock.go +++ b/vendor/github.com/subgraph/go-nfnetlink/nfnl_sock.go @@ -347,10 +347,10 @@ func readErrno(data []byte) uint32 { // is returned as an error. func (s *NetlinkSocket) fillRecvBuffer() (int, error) { n, from, err := syscall.Recvfrom(s.fd, s.recvBuffer, 0) - sa := from.(*syscall.SockaddrNetlink) if err != nil { return 0, err } + sa := from.(*syscall.SockaddrNetlink) if s.flags.isSet(FlagDebug) { fmt.Printf("from: %d\n", sa.Groups) }