BUGFIX: out of index error in omci-sim
Change-Id: Id10076ff14629f279c2caa0fdfcf197e9cb0188b
diff --git a/omci_handlers.go b/omci_handlers.go
index 66007e6..1f0e919 100644
--- a/omci_handlers.go
+++ b/omci_handlers.go
@@ -20,6 +20,7 @@
"encoding/binary"
"errors"
"log"
+ "fmt"
)
type OmciMsgHandler func(class OmciClass, content OmciContent, key OnuKey) ([]byte, error)
@@ -199,8 +200,8 @@
pkt[11] = state.uniGInstance // UNI-G ME Instance
state.uniGInstance++
default:
- log.Printf("Invalid MibUpload request %d", state.mibUploadCtr)
- //return nil, errors.New("Invalid MibUpload request")
+ errstr := fmt.Sprintf("Invalid MibUpload request: %d", state.mibUploadCtr)
+ return nil, errors.New(errstr)
}
state.mibUploadCtr++
diff --git a/omci_sim.go b/omci_sim.go
index a428cb7..20fe8be 100644
--- a/omci_sim.go
+++ b/omci_sim.go
@@ -41,8 +41,10 @@
resp, err = Handlers[msgType](class, content, key)
if err != nil {
- return resp, err
+ log.Println("%s", err)
+ return resp, nil
}
+
resp[0] = byte(transactionId >> 8)
resp[1] = byte(transactionId & 0xFF)
resp[2] = 0x2<<4 | byte(msgType)