From 3eeeef6b917f25a5836aea62bc01a5c17d58e1c6 Mon Sep 17 00:00:00 2001 From: pxy <497407975@qq.com> Date: Thu, 5 May 2022 11:59:21 +0800 Subject: [PATCH] HelloProtocol.go --- hello/HelloProtocol.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hello/HelloProtocol.go b/hello/HelloProtocol.go index 6427889..9ebaf59 100644 --- a/hello/HelloProtocol.go +++ b/hello/HelloProtocol.go @@ -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)