summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--config/default.go3
-rw-r--r--packet/rtr/rtr.go (renamed from packet/bgp/rtr.go)2
-rw-r--r--packet/rtr/rtr_test.go (renamed from packet/bgp/rtr_test.go)2
-rw-r--r--server/rpki.go31
4 files changed, 20 insertions, 18 deletions
diff --git a/config/default.go b/config/default.go
index 022f7458..b9ce5366 100644
--- a/config/default.go
+++ b/config/default.go
@@ -3,6 +3,7 @@ package config
import (
"fmt"
"github.com/osrg/gobgp/packet/bgp"
+ "github.com/osrg/gobgp/packet/rtr"
"github.com/spf13/viper"
"net"
)
@@ -171,7 +172,7 @@ func SetDefaultConfigValues(v *viper.Viper, b *Bgp) error {
for _, r := range b.RpkiServers {
if r.Config.Port == 0 {
- r.Config.Port = bgp.RPKI_DEFAULT_PORT
+ r.Config.Port = rtr.RPKI_DEFAULT_PORT
}
}
diff --git a/packet/bgp/rtr.go b/packet/rtr/rtr.go
index 30657e15..902f1e62 100644
--- a/packet/bgp/rtr.go
+++ b/packet/rtr/rtr.go
@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package bgp
+package rtr
import (
"encoding/binary"
diff --git a/packet/bgp/rtr_test.go b/packet/rtr/rtr_test.go
index 0f9b9527..961805d5 100644
--- a/packet/bgp/rtr_test.go
+++ b/packet/rtr/rtr_test.go
@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package bgp
+package rtr
import (
"encoding/hex"
diff --git a/server/rpki.go b/server/rpki.go
index 0c5083c8..5b2218ff 100644
--- a/server/rpki.go
+++ b/server/rpki.go
@@ -28,6 +28,7 @@ import (
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/config"
"github.com/osrg/gobgp/packet/bgp"
+ "github.com/osrg/gobgp/packet/rtr"
"github.com/osrg/gobgp/table"
"gopkg.in/tomb.v2"
)
@@ -346,10 +347,10 @@ func (m *roaManager) addROA(roa *ROA) {
func (c *roaManager) handleRTRMsg(client *roaClient, state *config.RpkiServerState, buf []byte) {
received := &state.RpkiMessages.RpkiReceived
- m, err := bgp.ParseRTR(buf)
+ m, err := rtr.ParseRTR(buf)
if err == nil {
switch msg := m.(type) {
- case *bgp.RTRSerialNotify:
+ case *rtr.RTRSerialNotify:
if before(client.serialNumber, msg.RTRCommon.SerialNumber) {
client.enable(client.serialNumber)
} else if client.serialNumber == msg.RTRCommon.SerialNumber {
@@ -359,14 +360,14 @@ func (c *roaManager) handleRTRMsg(client *roaClient, state *config.RpkiServerSta
client.softReset()
}
received.SerialNotify++
- case *bgp.RTRSerialQuery:
- case *bgp.RTRResetQuery:
- case *bgp.RTRCacheResponse:
+ case *rtr.RTRSerialQuery:
+ case *rtr.RTRResetQuery:
+ case *rtr.RTRCacheResponse:
received.CacheResponse++
client.endOfData = false
- case *bgp.RTRIPPrefix:
+ case *rtr.RTRIPPrefix:
family := bgp.AFI_IP
- if msg.Type == bgp.RTR_IPV4_PREFIX {
+ if msg.Type == rtr.RTR_IPV4_PREFIX {
received.Ipv4Prefix++
} else {
family = bgp.AFI_IP6
@@ -382,7 +383,7 @@ func (c *roaManager) handleRTRMsg(client *roaClient, state *config.RpkiServerSta
} else {
c.deleteROA(roa)
}
- case *bgp.RTREndOfData:
+ case *rtr.RTREndOfData:
received.EndOfData++
if client.sessionID != msg.RTRCommon.SessionID {
// remove all ROAs related with the
@@ -400,10 +401,10 @@ func (c *roaManager) handleRTRMsg(client *roaClient, state *config.RpkiServerSta
c.addROA(roa)
}
client.pendingROAs = make([]*ROA, 0)
- case *bgp.RTRCacheReset:
+ case *rtr.RTRCacheReset:
client.softReset()
received.CacheReset++
- case *bgp.RTRErrorReport:
+ case *rtr.RTRErrorReport:
received.Error++
}
} else {
@@ -635,7 +636,7 @@ func NewRoaClient(address, port string, ch chan *ROAEvent, lifetime int64) *roaC
func (c *roaClient) enable(serial uint32) error {
if c.conn != nil {
- r := bgp.NewRTRSerialQuery(c.sessionID, serial)
+ r := rtr.NewRTRSerialQuery(c.sessionID, serial)
data, _ := r.Serialize()
_, err := c.conn.Write(data)
if err != nil {
@@ -648,7 +649,7 @@ func (c *roaClient) enable(serial uint32) error {
func (c *roaClient) softReset() error {
if c.conn != nil {
- r := bgp.NewRTRResetQuery()
+ r := rtr.NewRTRResetQuery()
data, _ := r.Serialize()
_, err := c.conn.Write(data)
if err != nil {
@@ -702,17 +703,17 @@ func (c *roaClient) established() error {
}
for {
- header := make([]byte, bgp.RTR_MIN_LEN)
+ header := make([]byte, rtr.RTR_MIN_LEN)
_, err := io.ReadFull(c.conn, header)
if err != nil {
break
}
totalLen := binary.BigEndian.Uint32(header[4:8])
- if totalLen < bgp.RTR_MIN_LEN {
+ if totalLen < rtr.RTR_MIN_LEN {
break
}
- body := make([]byte, totalLen-bgp.RTR_MIN_LEN)
+ body := make([]byte, totalLen-rtr.RTR_MIN_LEN)
_, err = io.ReadFull(c.conn, body)
if err != nil {
break