Skip to content

Commit

Permalink
Clean up more RTR v2 remnants
Browse files Browse the repository at this point in the history
  • Loading branch information
job committed Sep 11, 2024
1 parent 00470a4 commit 7fbfc04
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 23 deletions.
9 changes: 2 additions & 7 deletions cmd/rtrdump/rtrdump.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,11 @@ func main() {
}

targetVersion := rtr.PROTOCOL_VERSION_0
if *FlagVersion > 2 {
log.Fatalf("Invalid RTR Version provided, the highest version this release supports is 2")
if *FlagVersion > 1 {
log.Fatalf("Invalid RTR Version provided, the highest version this release supports is 1")
}
if *FlagVersion == 1 {
targetVersion = rtr.PROTOCOL_VERSION_1
} else if *FlagVersion == 2 {
targetVersion = rtr.PROTOCOL_VERSION_2
}

lvl, _ := log.ParseLevel(*LogLevel)
Expand Down Expand Up @@ -225,9 +223,6 @@ func main() {
log.Infof("Connecting with %v to %v", *ConnType, *Connect)
err := clientSession.Start(*Connect, typeToId[*ConnType], configTLS, configSSH)
if err != nil {
if err == io.EOF && targetVersion == rtr.PROTOCOL_VERSION_2 {
log.Warnf("EOF From remote side, This might be due to version 2 being requested, try using -rtr.version 1")
}
log.Fatal(err)
}

Expand Down
1 change: 0 additions & 1 deletion cmd/stayrtr/stayrtr.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ var (
protoverToLib = map[int]uint8{
0: rtr.PROTOCOL_VERSION_0,
1: rtr.PROTOCOL_VERSION_1,
2: rtr.PROTOCOL_VERSION_2,
}
)

Expand Down
14 changes: 0 additions & 14 deletions lib/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,6 @@ func (c *ClientSession) StartRW(rd io.Reader, wr io.Writer) error {
}
c.version = PROTOCOL_VERSION_0
}
if c.version == PROTOCOL_VERSION_2 {
downgraded := false
switch dec.GetVersion() {
case PROTOCOL_VERSION_0:
c.version = PROTOCOL_VERSION_0
downgraded = true
case PROTOCOL_VERSION_1:
c.version = PROTOCOL_VERSION_1
downgraded = true
}
if c.log != nil && downgraded {
c.log.Infof("Downgrading to version %d", c.version)
}
}

if c.handler != nil {
c.handler.HandlePDU(c, dec)
Expand Down
1 change: 0 additions & 1 deletion lib/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const (

PROTOCOL_VERSION_0 = 0
PROTOCOL_VERSION_1 = 1
PROTOCOL_VERSION_2 = 2

PDU_ID_SERIAL_NOTIFY = 0
PDU_ID_SERIAL_QUERY = 1
Expand Down

0 comments on commit 7fbfc04

Please sign in to comment.