Skip to content

Commit

Permalink
fw: do not validate packets after parse
Browse files Browse the repository at this point in the history
spec.ReadPacket validates the digest on Interests if app params are
present. This is unnecessary for forwarding.
  • Loading branch information
pulsejet committed Dec 24, 2024
1 parent 236398a commit f1d7f5e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions fw/face/ndnlp-link-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func (l *NDNLPLinkService) handleIncomingFrame(frame []byte) {
IncomingFaceID: utils.IdPtr(l.faceID),
}

L2, _, err := spec.ReadPacket(enc.NewBufferReader(wire))
L2, err := ReadPacketFast(enc.NewBufferReader(wire))
if err != nil {
core.LogError(l, err)
return
Expand Down Expand Up @@ -370,7 +370,7 @@ func (l *NDNLPLinkService) handleIncomingFrame(frame []byte) {
}

// Parse inner packet in place
L3, _, err := spec.ReadPacket(enc.NewBufferReader(wire))
L3, err := ReadPacketFast(enc.NewBufferReader(wire))
if err != nil {
return
}
Expand Down Expand Up @@ -442,3 +442,10 @@ func (op *NDNLPLinkServiceOptions) Flags() (ret uint64) {
}
return
}

// Reads a packet without validating the internal fields
func ReadPacketFast(reader enc.ParseReader) (*spec.Packet, error) {
context := spec.PacketParsingContext{}
context.Init()
return context.Parse(reader, false)
}

0 comments on commit f1d7f5e

Please sign in to comment.