Repository: scionproto/scion
Pull request #3665 (2020-02-14 15:40:27)

SIG: Move definition of SIG control messages to go/lib/ctrl


<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/scionproto/scion/3665)
<!-- Reviewable:end -->



Patch:
diff --git a/go/lib/ctrl/BUILD.bazel b/go/lib/ctrl/BUILD.bazel
index c542260fa..1384acf82 100644
--- a/go/lib/ctrl/BUILD.bazel
+++ b/go/lib/ctrl/BUILD.bazel
@@ -19,8 +19,8 @@ go_library(
         "//go/lib/ctrl/ifid:go_default_library",
         "//go/lib/ctrl/path_mgmt:go_default_library",
         "//go/lib/ctrl/seg:go_default_library",
+        "//go/lib/ctrl/sig_mgmt:go_default_library",
         "//go/lib/scrypto:go_default_library",
         "//go/proto:go_default_library",
-        "//go/sig/mgmt:go_default_library",
     ],
 )
diff --git a/go/sig/mgmt/BUILD.bazel b/go/lib/ctrl/sig_mgmt/BUILD.bazel
similarity index 86%
rename from go/sig/mgmt/BUILD.bazel
rename to go/lib/ctrl/sig_mgmt/BUILD.bazel
index a3a483960..f3b9d403d 100644
--- a/go/sig/mgmt/BUILD.bazel
+++ b/go/lib/ctrl/sig_mgmt/BUILD.bazel
@@ -8,7 +8,7 @@ go_library(
         "pld.go",
         "poll.go",
     ],
-    importpath = "github.com/scionproto/scion/go/sig/mgmt",
+    importpath = "github.com/scionproto/scion/go/lib/ctrl/sig_mgmt",
     visibility = ["//visibility:public"],
     deps = [
         "//go/lib/addr:go_default_library",
diff --git a/go/sig/mgmt/addr.go b/go/lib/ctrl/sig_mgmt/addr.go
similarity index 98%
rename from go/sig/mgmt/addr.go
rename to go/lib/ctrl/sig_mgmt/addr.go
index 98c0a56b3..464f6caf4 100644
--- a/go/sig/mgmt/addr.go
+++ b/go/lib/ctrl/sig_mgmt/addr.go
@@ -13,7 +13,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package mgmt
+package sig_mgmt
 
 import (
 	"fmt"
diff --git a/go/sig/mgmt/common.go b/go/lib/ctrl/sig_mgmt/common.go
similarity index 98%
rename from go/sig/mgmt/common.go
rename to go/lib/ctrl/sig_mgmt/common.go
index 1f168d54b..63e18c349 100644
--- a/go/sig/mgmt/common.go
+++ b/go/lib/ctrl/sig_mgmt/common.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package mgmt
+package sig_mgmt
 
 import (
 	"encoding/json"
diff --git a/go/sig/mgmt/pld.go b/go/lib/ctrl/sig_mgmt/pld.go
similarity index 99%
rename from go/sig/mgmt/pld.go
rename to go/lib/ctrl/sig_mgmt/pld.go
index 0f8156792..92cbd7921 100644
--- a/go/sig/mgmt/pld.go
+++ b/go/lib/ctrl/sig_mgmt/pld.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package mgmt
+package sig_mgmt
 
 import (
 	"fmt"
diff --git a/go/sig/mgmt/poll.go b/go/lib/ctrl/sig_mgmt/poll.go
similarity index 98%
rename from go/sig/mgmt/poll.go
rename to go/lib/ctrl/sig_mgmt/poll.go
index e87957f25..b646e89c1 100644
--- a/go/sig/mgmt/poll.go
+++ b/go/lib/ctrl/sig_mgmt/poll.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package mgmt
+package sig_mgmt
 
 import (
 	"fmt"
diff --git a/go/lib/ctrl/union.go b/go/lib/ctrl/union.go
index 38ee76427..2557c67de 100644
--- a/go/lib/ctrl/union.go
+++ b/go/lib/ctrl/union.go
@@ -23,8 +23,8 @@ import (
 	"github.com/scionproto/scion/go/lib/ctrl/ifid"
 	"github.com/scionproto/scion/go/lib/ctrl/path_mgmt"
 	"github.com/scionproto/scion/go/lib/ctrl/seg"
+	"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
 	"github.com/scionproto/scion/go/proto"
-	sigmgmt "github.com/scionproto/scion/go/sig/mgmt"
 )
 
 // union represents the contents of the unnamed capnp union.
@@ -36,7 +36,7 @@ type union struct {
 	PathMgmt  *path_mgmt.Pld
 	Sibra     []byte `capnp:"-"` // Omit for now
 	DRKeyMgmt []byte `capnp:"-"` // Omit for now
-	Sig       *sigmgmt.Pld
+	Sig       *sig_mgmt.Pld
 	Extn      *extn.CtrlExtnDataList
 	Ack       *ack.Ack
 }
@@ -52,7 +52,7 @@ func (u *union) set(c proto.Cerealizable) error {
 	case *path_mgmt.Pld:
 		u.Which = proto.CtrlPld_Which_pathMgmt
 		u.PathMgmt = p
-	case *sigmgmt.Pld:
+	case *sig_mgmt.Pld:
 		u.Which = proto.CtrlPld_Which_sig
 		u.Sig = p
 	case *cert_mgmt.Pld:
diff --git a/go/sig/egress/dispatcher/BUILD.bazel b/go/sig/egress/dispatcher/BUILD.bazel
index 56205eb05..b4b07c026 100644
--- a/go/sig/egress/dispatcher/BUILD.bazel
+++ b/go/sig/egress/dispatcher/BUILD.bazel
@@ -8,10 +8,10 @@ go_library(
     deps = [
         "//go/lib/addr:go_default_library",
         "//go/lib/common:go_default_library",
+        "//go/lib/ctrl/sig_mgmt:go_default_library",
         "//go/lib/log:go_default_library",
         "//go/lib/ringbuf:go_default_library",
         "//go/sig/egress/iface:go_default_library",
         "//go/sig/internal/metrics:go_default_library",
-        "//go/sig/mgmt:go_default_library",
     ],
 )
diff --git a/go/sig/egress/dispatcher/dispatcher.go b/go/sig/egress/dispatcher/dispatcher.go
index 91e952778..d812d0514 100644
--- a/go/sig/egress/dispatcher/dispatcher.go
+++ b/go/sig/egress/dispatcher/dispatcher.go
@@ -20,11 +20,11 @@ package dispatcher
 import (
 	"github.com/scionproto/scion/go/lib/addr"
 	"github.com/scionproto/scion/go/lib/common"
+	"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
 	"github.com/scionproto/scion/go/lib/log"
 	"github.com/scionproto/scion/go/lib/ringbuf"
 	"github.com/scionproto/scion/go/sig/egress/iface"
 	"github.com/scionproto/scion/go/sig/internal/metrics"
-	"github.com/scionproto/scion/go/sig/mgmt"
 )
 
 type egressDispatcher struct {
@@ -69,7 +69,9 @@ func (ed *egressDispatcher) Run() {
 	ed.Info("EgressDispatcher: stopping")
 }
 
-func (ed *egressDispatcher) updateMetrics(remoteIA addr.IAInt, sessId mgmt.SessionType, read int) {
+func (ed *egressDispatcher) updateMetrics(remoteIA addr.IAInt, sessId sig_mgmt.SessionType,
+	read int) {
+
 	key := metrics.CtrPairKey{RemoteIA: remoteIA, SessId: sessId}
 	counters, ok := ed.pktsRecvCounters[key]
 	if !ok {
diff --git a/go/sig/egress/iface/BUILD.bazel b/go/sig/egress/iface/BUILD.bazel
index df2634631..054218336 100644
--- a/go/sig/egress/iface/BUILD.bazel
+++ b/go/sig/egress/iface/BUILD.bazel
@@ -12,11 +12,11 @@ go_library(
     deps = [
         "//go/lib/addr:go_default_library",
         "//go/lib/common:go_default_library",
+        "//go/lib/ctrl/sig_mgmt:go_default_library",
         "//go/lib/log:go_default_library",
         "//go/lib/ringbuf:go_default_library",
         "//go/lib/snet:go_default_library",
         "//go/lib/spath/spathmeta:go_default_library",
         "//go/sig/egress/siginfo:go_default_library",
-        "//go/sig/mgmt:go_default_library",
     ],
 )
diff --git a/go/sig/egress/iface/interface.go b/go/sig/egress/iface/interface.go
index 26f7569c2..8bcb661f7 100644
--- a/go/sig/egress/iface/interface.go
+++ b/go/sig/egress/iface/interface.go
@@ -22,12 +22,12 @@ import (
 
 	"github.com/scionproto/scion/go/lib/addr"
 	"github.com/scionproto/scion/go/lib/common"
+	"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
 	"github.com/scionproto/scion/go/lib/log"
 	"github.com/scionproto/scion/go/lib/ringbuf"
 	"github.com/scionproto/scion/go/lib/snet"
 	"github.com/scionproto/scion/go/lib/spath/spathmeta"
 	"github.com/scionproto/scion/go/sig/egress/siginfo"
-	"github.com/scionproto/scion/go/sig/mgmt"
 )
 
 func Init() {
@@ -53,7 +53,7 @@ type Session interface {
 	// IA returns the session's remote IA
 	IA() addr.IA
 	// ID returns the session's ID.
-	ID() mgmt.SessionType
+	ID() sig_mgmt.SessionType
 	// Conn returns the session's outbound snet Conn.
 	// The returned value must be the same for the entire lifetime of the object.
 	Conn() snet.Conn
diff --git a/go/sig/egress/iface/mock_iface/BUILD.bazel b/go/sig/egress/iface/mock_iface/BUILD.bazel
index ae247a097..03bb78623 100644
--- a/go/sig/egress/iface/mock_iface/BUILD.bazel
+++ b/go/sig/egress/iface/mock_iface/BUILD.bazel
@@ -7,11 +7,11 @@ go_library(
     visibility = ["//visibility:public"],
     deps = [
         "//go/lib/addr:go_default_library",
+        "//go/lib/ctrl/sig_mgmt:go_default_library",
         "//go/lib/log:go_default_library",
         "//go/lib/ringbuf:go_default_library",
         "//go/lib/snet:go_default_library",
         "//go/sig/egress/iface:go_default_library",
-        "//go/sig/mgmt:go_default_library",
         "@com_github_golang_mock//gomock:go_default_library",
     ],
 )
diff --git a/go/sig/egress/iface/mock_iface/iface.go b/go/sig/egress/iface/mock_iface/iface.go
index 260e50a29..7210b1125 100644
--- a/go/sig/egress/iface/mock_iface/iface.go
+++ b/go/sig/egress/iface/mock_iface/iface.go
@@ -7,11 +7,11 @@ package mock_iface
 import (
 	gomock "github.com/golang/mock/gomock"
 	addr "github.com/scionproto/scion/go/lib/addr"
+	sig_mgmt "github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
 	log "github.com/scionproto/scion/go/lib/log"
 	ringbuf "github.com/scionproto/scion/go/lib/ringbuf"
 	snet "github.com/scionproto/scion/go/lib/snet"
 	iface "github.com/scionproto/scion/go/sig/egress/iface"
-	mgmt "github.com/scionproto/scion/go/sig/mgmt"
 	reflect "reflect"
 )
 
@@ -172,10 +172,10 @@ func (mr *MockSessionMockRecorder) IA() *gomock.Call {
 }
 
 // ID mocks base method
-func (m *MockSession) ID() mgmt.SessionType {
+func (m *MockSession) ID() sig_mgmt.SessionType {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "ID")
-	ret0, _ := ret[0].(mgmt.SessionType)
+	ret0, _ := ret[0].(sig_mgmt.SessionType)
 	return ret0
 }
 
diff --git a/go/sig/egress/session/BUILD.bazel b/go/sig/egress/session/BUILD.bazel
index 30789edd0..c27eb4fc2 100644
--- a/go/sig/egress/session/BUILD.bazel
+++ b/go/sig/egress/session/BUILD.bazel
@@ -12,6 +12,7 @@ go_library(
         "//go/lib/addr:go_default_library",
         "//go/lib/common:go_default_library",
         "//go/lib/ctrl:go_default_library",
+        "//go/lib/ctrl/sig_mgmt:go_default_library",
         "//go/lib/infra:go_default_library",
         "//go/lib/log:go_default_library",
         "//go/lib/pktdisp:go_default_library",
@@ -25,6 +26,5 @@ go_library(
         "//go/sig/internal/metrics:go_default_library",
         "//go/sig/internal/pathmgr:go_default_library",
         "//go/sig/internal/sigcmn:go_default_library",
-        "//go/sig/mgmt:go_default_library",
     ],
 )
diff --git a/go/sig/egress/session/session.go b/go/sig/egress/session/session.go
index 68a69bbff..cc27ec46f 100644
--- a/go/sig/egress/session/session.go
+++ b/go/sig/egress/session/session.go
@@ -26,6 +26,7 @@ import (
 
 	"github.com/scionproto/scion/go/lib/addr"
 	"github.com/scionproto/scion/go/lib/common"
+	"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
 	"github.com/scionproto/scion/go/lib/log"
 	"github.com/scionproto/scion/go/lib/pktdisp"
 	"github.com/scionproto/scion/go/lib/ringbuf"
@@ -35,7 +36,6 @@ import (
 	"github.com/scionproto/scion/go/sig/egress/worker"
 	"github.com/scionproto/scion/go/sig/internal/pathmgr"
 	"github.com/scionproto/scion/go/sig/internal/sigcmn"
-	"github.com/scionproto/scion/go/sig/mgmt"
 )
 
 var _ iface.Session = (*Session)(nil)
@@ -45,7 +45,7 @@ var _ iface.Session = (*Session)(nil)
 type Session struct {
 	log.Logger
 	ia     addr.IA
-	SessId mgmt.SessionType
+	SessId sig_mgmt.SessionType
 
 	// pool contains paths managed by pathmgr.
 	pool iface.PathPool
@@ -62,7 +62,7 @@ type Session struct {
 	workerStopped  chan struct{}
 }
 
-func NewSession(dstIA addr.IA, sessId mgmt.SessionType, logger log.Logger,
+func NewSession(dstIA addr.IA, sessId sig_mgmt.SessionType, logger log.Logger,
 	pool iface.PathPool) (*Session, error) {
 
 	var err error
@@ -140,7 +140,7 @@ func (s *Session) IA() addr.IA {
 	return s.ia
 }
 
-func (s *Session) ID() mgmt.SessionType {
+func (s *Session) ID() sig_mgmt.SessionType {
 	return s.SessId
 }
 
diff --git a/go/sig/egress/session/sessmon.go b/go/sig/egress/session/sessmon.go
index 8b81a0892..359be0fd0 100644
--- a/go/sig/egress/session/sessmon.go
+++ b/go/sig/egress/session/sessmon.go
@@ -21,6 +21,7 @@ import (
 	"github.com/scionproto/scion/go/lib/addr"
 	"github.com/scionproto/scion/go/lib/common"
 	"github.com/scionproto/scion/go/lib/ctrl"
+	"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
 	"github.com/scionproto/scion/go/lib/infra"
 	"github.com/scionproto/scion/go/lib/log"
 	"github.com/scionproto/scion/go/sig/egress/iface"
@@ -28,7 +29,6 @@ import (
 	"github.com/scionproto/scion/go/sig/internal/disp"
 	"github.com/scionproto/scion/go/sig/internal/metrics"
 	"github.com/scionproto/scion/go/sig/internal/sigcmn"
-	"github.com/scionproto/scion/go/sig/mgmt"
 )
 
 const (
@@ -56,7 +56,7 @@ type sessMonitor struct {
 	// when sessMonitor is trying to switch SIGs/paths, this is the id of the
 	// last PollReq sent, so that sessMonitor can correlate replies to the
 	// remoteInfo used for the request.
-	updateMsgId mgmt.MsgIdType
+	updateMsgId sig_mgmt.MsgIdType
 	// the last time a PollRep was received.
 	lastReply time.Time
 }
@@ -256,8 +256,9 @@ func (sm *sessMonitor) sendReq() {
 	if sm.smRemote == nil || sm.smRemote.SessPath == nil {
 		return
 	}
-	sm.updateMsgId = mgmt.MsgIdType(time.Now().UnixNano())
-	spld, err := mgmt.NewPld(sm.updateMsgId, mgmt.NewPollReq(sigcmn.MgmtAddr, sm.sess.SessId))
+	sm.updateMsgId = sig_mgmt.MsgIdType(time.Now().UnixNano())
+	spld, err := sig_mgmt.NewPld(sm.updateMsgId, sig_mgmt.NewPollReq(sigcmn.MgmtAddr,
+		sm.sess.SessId))
 	if err != nil {
 		sm.Error("sessMonitor: Error creating SIGCtrl payload", "err", err)
 		return
@@ -292,7 +293,7 @@ func (sm *sessMonitor) sendReq() {
 }
 
 func (sm *sessMonitor) handleRep(rpld *disp.RegPld) {
-	pollRep, ok := rpld.P.(*mgmt.PollRep)
+	pollRep, ok := rpld.P.(*sig_mgmt.PollRep)
 	if !ok {
 		sm.Error("sessMonitor: non-SIGPollRep payload received",
 			"src", rpld.Addr, "type", common.TypeOf(rpld.P), "pld", rpld.P)
diff --git a/go/sig/egress/worker/BUILD.bazel b/go/sig/egress/worker/BUILD.bazel
index 4b02125c5..7b8b77758 100644
--- a/go/sig/egress/worker/BUILD.bazel
+++ b/go/sig/egress/worker/BUILD.bazel
@@ -7,6 +7,7 @@ go_library(
     visibility = ["//visibility:public"],
     deps = [
         "//go/lib/common:go_default_library",
+        "//go/lib/ctrl/sig_mgmt:go_default_library",
         "//go/lib/l4:go_default_library",
         "//go/lib/log:go_default_library",
         "//go/lib/ringbuf:go_default_library",
@@ -17,7 +18,6 @@ go_library(
         "//go/sig/egress/siginfo:go_default_library",
         "//go/sig/internal/metrics:go_default_library",
         "//go/sig/internal/sigcmn:go_default_library",
-        "//go/sig/mgmt:go_default_library",
     ],
 )
 
@@ -28,13 +28,13 @@ go_test(
     deps = [
         "//go/lib/addr:go_default_library",
         "//go/lib/common:go_default_library",
+        "//go/lib/ctrl/sig_mgmt:go_default_library",
         "//go/lib/log:go_default_library",
         "//go/lib/ringbuf:go_default_library",
         "//go/lib/snet:go_default_library",
         "//go/sig/egress/iface:go_default_library",
         "//go/sig/egress/iface/mock_iface:go_default_library",
         "//go/sig/egress/worker/mock_worker:go_default_library",
-        "//go/sig/mgmt:go_default_library",
         "@com_github_golang_mock//gomock:go_default_library",
         "@com_github_stretchr_testify//assert:go_default_library",
     ],
diff --git a/go/sig/egress/worker/worker.go b/go/sig/egress/worker/worker.go
index 2077c565a..39ba9265f 100644
--- a/go/sig/egress/worker/worker.go
+++ b/go/sig/egress/worker/worker.go
@@ -21,6 +21,7 @@ import (
 	"time"
 
 	"github.com/scionproto/scion/go/lib/common"
+	"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
 	"github.com/scionproto/scion/go/lib/l4"
 	"github.com/scionproto/scion/go/lib/log"
 	"github.com/scionproto/scion/go/lib/ringbuf"
@@ -31,7 +32,6 @@ import (
 	"github.com/scionproto/scion/go/sig/egress/siginfo"
 	"github.com/scionproto/scion/go/sig/internal/metrics"
 	"github.com/scionproto/scion/go/sig/internal/sigcmn"
-	"github.com/scionproto/scion/go/sig/mgmt"
 )
 
 //   SIG Frame Header, used to encapsulate SIG to SIG traffic. The sequence
@@ -276,7 +276,7 @@ func (f *frame) startPkt(pktLen uint16) {
 	f.offset += PktLenSize
 }
 
-func (f *frame) writeHdr(sessId mgmt.SessionType, epoch uint16, seq uint32) {
+func (f *frame) writeHdr(sessId sig_mgmt.SessionType, epoch uint16, seq uint32) {
 	f.b[0] = uint8(sessId)
 	common.Order.PutUint16(f.b[1:3], epoch)
 	common.Order.PutUintN(f.b[3:6], uint64(seq), 3)
diff --git a/go/sig/internal/base/BUILD.bazel b/go/sig/internal/base/BUILD.bazel
index fb57af189..a06aa39f3 100644
--- a/go/sig/internal/base/BUILD.bazel
+++ b/go/sig/internal/base/BUILD.bazel
@@ -12,11 +12,11 @@ go_library(
         "//go/lib/addr:go_default_library",
         "//go/lib/common:go_default_library",
         "//go/lib/ctrl:go_default_library",
+        "//go/lib/ctrl/sig_mgmt:go_default_library",
         "//go/lib/infra:go_default_library",
         "//go/lib/log:go_default_library",
         "//go/lib/snet:go_default_library",
         "//go/sig/internal/disp:go_default_library",
         "//go/sig/internal/sigcmn:go_default_library",
-        "//go/sig/mgmt:go_default_library",
     ],
 )
diff --git a/go/sig/internal/base/pollhdlr.go b/go/sig/internal/base/pollhdlr.go
index 0b2e869e0..c0d630b93 100644
--- a/go/sig/internal/base/pollhdlr.go
+++ b/go/sig/internal/base/pollhdlr.go
@@ -18,18 +18,18 @@ package base
 import (
 	"github.com/scionproto/scion/go/lib/common"
 	"github.com/scionproto/scion/go/lib/ctrl"
+	"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
 	"github.com/scionproto/scion/go/lib/infra"
 	"github.com/scionproto/scion/go/lib/log"
 	"github.com/scionproto/scion/go/lib/snet"
 	"github.com/scionproto/scion/go/sig/internal/disp"
 	"github.com/scionproto/scion/go/sig/internal/sigcmn"
-	"github.com/scionproto/scion/go/sig/mgmt"
 )
 
 func PollReqHdlr() {
 	log.Info("PollReqHdlr: starting")
 	for rpld := range disp.Dispatcher.PollReqC {
-		req, ok := rpld.P.(*mgmt.PollReq)
+		req, ok := rpld.P.(*sig_mgmt.PollReq)
 		if !ok {
 			log.Error("PollReqHdlr: non-SIGPollReq payload received",
 				"src", rpld.Addr, "type", common.TypeOf(rpld.P), "Id", rpld.Id, "pld", rpld.P)
@@ -37,7 +37,7 @@ func PollReqHdlr() {
 		}
 		//log.Debug("PollReqHdlr: got PollReq", "src", rpld.Addr, "pld", req,
 		//	"replyAddr", sigcmn.MgmtAddr, "replySession", req.Session)
-		spld, err := mgmt.NewPld(rpld.Id, mgmt.NewPollRep(sigcmn.MgmtAddr, req.Session))
+		spld, err := sig_mgmt.NewPld(rpld.Id, sig_mgmt.NewPollRep(sigcmn.MgmtAddr, req.Session))
 		if err != nil {
 			log.Error("PollReqHdlr: Error creating SIGCtrl payload", "err", err)
 			break
diff --git a/go/sig/internal/disp/BUILD.bazel b/go/sig/internal/disp/BUILD.bazel
index f463c6a95..99b8cce13 100644
--- a/go/sig/internal/disp/BUILD.bazel
+++ b/go/sig/internal/disp/BUILD.bazel
@@ -9,9 +9,9 @@ go_library(
         "//go/lib/addr:go_default_library",
         "//go/lib/common:go_default_library",
         "//go/lib/ctrl:go_default_library",
+        "//go/lib/ctrl/sig_mgmt:go_default_library",
         "//go/lib/log:go_default_library",
         "//go/lib/pktdisp:go_default_library",
         "//go/lib/snet:go_default_library",
-        "//go/sig/mgmt:go_default_library",
     ],
 )
diff --git a/go/sig/internal/disp/disp.go b/go/sig/internal/disp/disp.go
index 177a47629..b6124f878 100644
--- a/go/sig/internal/disp/disp.go
+++ b/go/sig/internal/disp/disp.go
@@ -22,10 +22,10 @@ import (
 	"github.com/scionproto/scion/go/lib/addr"
 	"github.com/scionproto/scion/go/lib/common"
 	"github.com/scionproto/scion/go/lib/ctrl"
+	"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
 	"github.com/scionproto/scion/go/lib/log"
 	"github.com/scionproto/scion/go/lib/pktdisp"
 	"github.com/scionproto/scion/go/lib/snet"
-	"github.com/scionproto/scion/go/sig/mgmt"
 )
 
 func Init(conn snet.Conn, useid bool) {
@@ -51,7 +51,7 @@ func (rt RegType) String() string {
 }
 
 type RegPld struct {
-	Id   mgmt.MsgIdType
+	Id   sig_mgmt.MsgIdType
 	P    interface{}
 	Addr *snet.UDPAddr
 }
@@ -100,7 +100,7 @@ func (dm *dispRegistry) Unregister(regType RegType, key RegPollKey) error {
 	return nil
 }
 
-func (dm *dispRegistry) sigCtrl(pld *mgmt.Pld, addr *snet.UDPAddr) {
+func (dm *dispRegistry) sigCtrl(pld *sig_mgmt.Pld, addr *snet.UDPAddr) {
 	dm.Lock()
 	defer dm.Unlock()
 	u, err := pld.Union()
@@ -110,9 +110,9 @@ func (dm *dispRegistry) sigCtrl(pld *mgmt.Pld, addr *snet.UDPAddr) {
 	}
 	msgId := pld.Id
 	switch pld := u.(type) {
-	case *mgmt.PollReq:
+	case *sig_mgmt.PollReq:
 		dm.PollReqC <- &RegPld{Id: msgId, P: pld, Addr: addr}
-	case *mgmt.PollRep:
+	case *sig_mgmt.PollRep:
 		regPld := &RegPld{Id: msgId, P: pld, Addr: addr}
 		if pld.Addr == nil || pld.Addr.Ctrl == nil {
 			log.Error("Incomplete SIG PollRep received", "src", addr, "pld", pld)
@@ -159,7 +159,7 @@ func dispFunc(dp *pktdisp.DispPkt) {
 		return
 	}
 	switch pld := u.(type) {
-	case *mgmt.Pld:
+	case *sig_mgmt.Pld:
 		Dispatcher.sigCtrl(pld, src)
 	default:
 		log.Error("Unsupported ctrl payload type", "type", common.TypeOf(pld))
@@ -168,7 +168,7 @@ func dispFunc(dp *pktdisp.DispPkt) {
 
 type RegPollKey string
 
-func MkRegPollKey(ia addr.IA, session mgmt.SessionType, id mgmt.MsgIdType) RegPollKey {
+func MkRegPollKey(ia addr.IA, session sig_mgmt.SessionType, id sig_mgmt.MsgIdType) RegPollKey {
 	if useID {
 		return RegPollKey(fmt.Sprintf("%s-%s-%d", ia, session, id))
 	} else {
diff --git a/go/sig/internal/ingress/BUILD.bazel b/go/sig/internal/ingress/BUILD.bazel
index 4548e74bd..e4613a03b 100644
--- a/go/sig/internal/ingress/BUILD.bazel
+++ b/go/sig/internal/ingress/BUILD.bazel
@@ -14,6 +14,7 @@ go_library(
     deps = [
         "//go/lib/addr:go_default_library",
         "//go/lib/common:go_default_library",
+        "//go/lib/ctrl/sig_mgmt:go_default_library",
         "//go/lib/fatal:go_default_library",
         "//go/lib/log:go_default_library",
         "//go/lib/ringbuf:go_default_library",
@@ -22,7 +23,6 @@ go_library(
         "//go/lib/util:go_default_library",
         "//go/sig/internal/metrics:go_default_library",
         "//go/sig/internal/sigcmn:go_default_library",
-        "//go/sig/mgmt:go_default_library",
     ],
 )
 
diff --git a/go/sig/internal/ingress/dispatcher.go b/go/sig/internal/ingress/dispatcher.go
index 31349d65d..0eddeaafd 100644
--- a/go/sig/internal/ingress/dispatcher.go
+++ b/go/sig/internal/ingress/dispatcher.go
@@ -22,12 +22,12 @@ import (
 
 	"github.com/scionproto/scion/go/lib/addr"
 	"github.com/scionproto/scion/go/lib/common"
+	"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
 	"github.com/scionproto/scion/go/lib/log"
 	"github.com/scionproto/scion/go/lib/ringbuf"
 	"github.com/scionproto/scion/go/lib/snet"
 	"github.com/scionproto/scion/go/lib/sock/reliable"
 	"github.com/scionproto/scion/go/sig/internal/metrics"
-	"github.com/scionproto/scion/go/sig/mgmt"
 )
 
 const (
@@ -78,7 +78,7 @@ func (d *Dispatcher) read() error {
 				switch v := src.(type) {
 				case *snet.UDPAddr:
 					frame.frameLen = read
-					frame.sessId = mgmt.SessionType((frame.raw[0]))
+					frame.sessId = sig_mgmt.SessionType((frame.raw[0]))
 					d.updateMetrics(v.IA.IAInt(), frame.sessId, read)
 					d.dispatch(frame, v)
 				default:
@@ -129,7 +129,7 @@ func (d *Dispatcher) cleanup() {
 	}
 }
 
-func (d *Dispatcher) updateMetrics(remoteIA addr.IAInt, sessId mgmt.SessionType, read int) {
+func (d *Dispatcher) updateMetrics(remoteIA addr.IAInt, sessId sig_mgmt.SessionType, read int) {
 	key := metrics.CtrPairKey{RemoteIA: remoteIA, SessId: sessId}
 	counters, ok := d.framesRecvCounters[key]
 	if !ok {
diff --git a/go/sig/internal/ingress/framebuf.go b/go/sig/internal/ingress/framebuf.go
index 5552193e5..3379926d2 100644
--- a/go/sig/internal/ingress/framebuf.go
+++ b/go/sig/internal/ingress/framebuf.go
@@ -19,10 +19,10 @@ import (
 	"fmt"
 
 	"github.com/scionproto/scion/go/lib/common"
+	"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
 	"github.com/scionproto/scion/go/lib/log"
 	"github.com/scionproto/scion/go/lib/ringbuf"
 	"github.com/scionproto/scion/go/lib/util"
-	"github.com/scionproto/scion/go/sig/mgmt"
 )
 
 const (
@@ -49,7 +49,7 @@ func NewFrameBufs(frames ringbuf.EntryList) int {
 // multiple SIG frames. It contains the raw bytes and metadata needed for reassembly.
 type FrameBuf struct {
 	// Session Id of the frame.
-	sessId mgmt.SessionType
+	sessId sig_mgmt.SessionType
 	// Sequence number of the frame.
 	seqNr int
 	// Index of the frame.
diff --git a/go/sig/internal/ingress/worker.go b/go/sig/internal/ingress/worker.go
index 1cb5865ea..4d73625d2 100644
--- a/go/sig/internal/ingress/worker.go
+++ b/go/sig/internal/ingress/worker.go
@@ -21,11 +21,11 @@ import (
 	"time"
 
 	"github.com/scionproto/scion/go/lib/common"
+	"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
 	"github.com/scionproto/scion/go/lib/log"
 	"github.com/scionproto/scion/go/lib/ringbuf"
 	"github.com/scionproto/scion/go/lib/snet"
 	"github.com/scionproto/scion/go/sig/internal/metrics"
-	"github.com/scionproto/scion/go/sig/mgmt"
 )
 
 const (
@@ -43,7 +43,7 @@ type sender interface {
 type Worker struct {
 	log.Logger
 	Remote           *snet.UDPAddr
-	SessId           mgmt.SessionType
+	SessId           sig_mgmt.SessionType
 	Ring             *ringbuf.Ring
 	rlists           map[int]*ReassemblyList
 	markedForCleanup bool
@@ -51,7 +51,9 @@ type Worker struct {
 	tunIO            io.ReadWriteCloser
 }
 
-func NewWorker(remote *snet.UDPAddr, sessId mgmt.SessionType, tunIO io.ReadWriteCloser) *Worker {
+func NewWorker(remote *snet.UDPAddr, sessId sig_mgmt.SessionType,
+	tunIO io.ReadWriteCloser) *Worker {
+
 	worker := &Worker{
 		Logger: log.New("ingress", remote.String(), "sessId", sessId),
 		Remote: remote,
diff --git a/go/sig/internal/metrics/BUILD.bazel b/go/sig/internal/metrics/BUILD.bazel
index a327772c6..d86aabc4d 100644
--- a/go/sig/internal/metrics/BUILD.bazel
+++ b/go/sig/internal/metrics/BUILD.bazel
@@ -7,8 +7,8 @@ go_library(
     visibility = ["//visibility:public"],
     deps = [
         "//go/lib/addr:go_default_library",
+        "//go/lib/ctrl/sig_mgmt:go_default_library",
         "//go/lib/prom:go_default_library",
-        "//go/sig/mgmt:go_default_library",
         "@com_github_prometheus_client_golang//prometheus:go_default_library",
     ],
 )
diff --git a/go/sig/internal/metrics/metrics.go b/go/sig/internal/metrics/metrics.go
index 677f0d4bd..211d34acf 100644
--- a/go/sig/internal/metrics/metrics.go
+++ b/go/sig/internal/metrics/metrics.go
@@ -25,8 +25,8 @@ import (
 	"github.com/prometheus/client_golang/prometheus"
 
 	"github.com/scionproto/scion/go/lib/addr"
+	"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
 	"github.com/scionproto/scion/go/lib/prom"
-	"github.com/scionproto/scion/go/sig/mgmt"
 )
 
 // Namespace is the metrics namespace for the SIG.
@@ -131,5 +131,5 @@ type CtrPair struct {
 
 type CtrPairKey struct {
 	RemoteIA addr.IAInt
-	SessId   mgmt.SessionType
+	SessId   sig_mgmt.SessionType
 }
diff --git a/go/sig/internal/sigcmn/BUILD.bazel b/go/sig/internal/sigcmn/BUILD.bazel
index 71566f743..f1d0b73f4 100644
--- a/go/sig/internal/sigcmn/BUILD.bazel
+++ b/go/sig/internal/sigcmn/BUILD.bazel
@@ -9,6 +9,7 @@ go_library(
         "//go/godispatcher/dispatcher:go_default_library",
         "//go/lib/addr:go_default_library",
         "//go/lib/common:go_default_library",
+        "//go/lib/ctrl/sig_mgmt:go_default_library",
         "//go/lib/env:go_default_library",
         "//go/lib/log:go_default_library",
         "//go/lib/sciond/fake:go_default_library",
@@ -18,6 +19,5 @@ go_library(
         "//go/sig/internal/pathmgr:go_default_library",
         "//go/sig/internal/sigconfig:go_default_library",
         "//go/sig/internal/snetmigrate:go_default_library",
-        "//go/sig/mgmt:go_default_library",
     ],
 )
diff --git a/go/sig/internal/sigcmn/common.go b/go/sig/internal/sigcmn/common.go
index c21f94e0e..8f0f296b7 100644
--- a/go/sig/internal/sigcmn/common.go
+++ b/go/sig/internal/sigcmn/common.go
@@ -23,6 +23,7 @@ import (
 	"github.com/scionproto/scion/go/godispatcher/dispatcher"
 	"github.com/scionproto/scion/go/lib/addr"
 	"github.com/scionproto/scion/go/lib/common"
+	"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
 	"github.com/scionproto/scion/go/lib/env"
 	"github.com/scionproto/scion/go/lib/log"
 	"github.com/scionproto/scion/go/lib/sciond/fake"
@@ -32,7 +33,6 @@ import (
 	"github.com/scionproto/scion/go/sig/internal/pathmgr"
 	"github.com/scionproto/scion/go/sig/internal/sigconfig"
 	"github.com/scionproto/scion/go/sig/internal/snetmigrate"
-	"github.com/scionproto/scion/go/sig/mgmt"
 )
 
 const (
@@ -53,14 +53,14 @@ var (
 	Dispatcher reliable.Dispatcher
 	Network    *snet.SCIONNetwork
 	CtrlConn   snet.Conn
-	MgmtAddr   *mgmt.Addr
+	MgmtAddr   *sig_mgmt.Addr
 	encapPort  uint16
 )
 
 func Init(cfg sigconfig.SigConf, sdCfg env.SCIONDClient) error {
 	IA = cfg.IA
 	Host = addr.HostFromIP(cfg.IP)
-	MgmtAddr = mgmt.NewAddr(Host, cfg.CtrlPort, cfg.EncapPort)
+	MgmtAddr = sig_mgmt.NewAddr(Host, cfg.CtrlPort, cfg.EncapPort)
 	encapPort = cfg.EncapPort
 
 	network, resolver, err := initNetwork(cfg, sdCfg)


Test patch:
diff --git a/go/sig/egress/worker/worker_test.go b/go/sig/egress/worker/worker_test.go
index 70b3416c4..c4458324d 100644
--- a/go/sig/egress/worker/worker_test.go
+++ b/go/sig/egress/worker/worker_test.go
@@ -24,13 +24,13 @@ import (
 
 	"github.com/scionproto/scion/go/lib/addr"
 	"github.com/scionproto/scion/go/lib/common"
+	"github.com/scionproto/scion/go/lib/ctrl/sig_mgmt"
 	"github.com/scionproto/scion/go/lib/log"
 	"github.com/scionproto/scion/go/lib/ringbuf"
 	"github.com/scionproto/scion/go/lib/snet"
 	"github.com/scionproto/scion/go/sig/egress/iface"
 	"github.com/scionproto/scion/go/sig/egress/iface/mock_iface"
 	"github.com/scionproto/scion/go/sig/egress/worker/mock_worker"
-	"github.com/scionproto/scion/go/sig/mgmt"
 )
 
 func TestMain(m *testing.M) {
@@ -109,7 +109,7 @@ func (wt *WorkerTester) Run() {
 	ia, _ := addr.IAFromString("1-ff00:0:300")
 	s := mock_iface.NewMockSession(wt.mockCtrl)
 	s.EXPECT().IA().AnyTimes().Return(ia)
-	s.EXPECT().ID().AnyTimes().Return(mgmt.SessionType(0))
+	s.EXPECT().ID().AnyTimes().Return(sig_mgmt.SessionType(0))
 	s.EXPECT().Conn().AnyTimes().Return(nil)
 	s.EXPECT().Ring().AnyTimes().Return(wt.ring)
 	s.EXPECT().Remote().AnyTimes().Return(nil)