mirror of
https://gitee.com/willfree/mlsr.git
synced 2026-06-07 05:09:28 +08:00
HelloProtocol.go
This commit is contained in:
+10
-6
@@ -15,7 +15,6 @@ import (
|
||||
"minlib/packet"
|
||||
"minlib/security"
|
||||
"mlsr/common"
|
||||
"mlsr/extensions"
|
||||
"mlsr/lsa"
|
||||
"mlsr/lsdb"
|
||||
"time"
|
||||
@@ -221,11 +220,14 @@ func (h *HelloProtocol) onContent(interest *packet.Interest, data *packet.Data)
|
||||
logrus.Debug("Received data for name:v%", data.GetName())
|
||||
Sig, _ := data.GetSignature(0) //获取指定位置的签名
|
||||
kl := Sig.SigInfo.GetKeyLocator()
|
||||
|
||||
//签名的格式如何验证????????????extensions选的是TlvMlsrLsaNamePrefix吗?
|
||||
if kl != nil {
|
||||
if encoding.ExpectType(kl.Raw().GetType(), extensions.TlvMlsrLsaNamePrefix) != nil {
|
||||
//if encoding.ExpectType(kl.Raw().GetType(), extensions.TlvMlsrLsaNamePrefix) != nil {
|
||||
if h.keychain.VerifyData(data) != nil {
|
||||
logrus.Debug("Data signed with:v%", kl.GetIdentifier())
|
||||
}
|
||||
//}
|
||||
}
|
||||
//数据如何校验?????????????
|
||||
}
|
||||
@@ -242,11 +244,13 @@ func (h *HelloProtocol) onContentValidated(data *packet.Data) {
|
||||
logrus.Debug("Data validation successful for name:v%", dataName)
|
||||
info, _ := dataName.Get(-3)
|
||||
if info.ToUri() == INFO_COMPONENT {
|
||||
neighborPrefix, _ := dataName.Get(-4)
|
||||
neighborPrefix, _ := dataName.Get(0) //*identifierComponent
|
||||
var neighbor *component.Identifier
|
||||
neighbor.WireDecode(neighborPrefix.Raw())
|
||||
oldStatus, _ := adjacentList.GetStatusOfNeighbor(neighbor)
|
||||
adjacentList.SetStatusOfNeighbor(neighbor, 1) //邻居路由器的状态:未知-1、未激活0、激活1
|
||||
//neighbor.WireDecode(neighborPrefix.Raw())
|
||||
neighbor.BuildIdentifierByString(neighborPrefix.ToString())
|
||||
|
||||
oldStatus, _ := adjacentList.GetStatusOfNeighbor(neighbor) //*identifier
|
||||
adjacentList.SetStatusOfNeighbor(neighbor, 1) //邻居路由器的状态:未知-1、未激活0、激活1
|
||||
adjacentList.SetTimedOutInterestCount(neighbor, 0)
|
||||
newStatus, _ := adjacentList.GetStatusOfNeighbor(neighbor)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user