ipv6 mpls support

This commit is contained in:
tsosunchia
2023-10-05 07:25:05 +08:00
parent ba7d6ea87b
commit 2113264336
2 changed files with 5 additions and 2 deletions

View File

@@ -176,7 +176,7 @@ func (t *ICMPTracer) handleICMPMessage(msg ReceivedMessage, icmpType int8, data
t.inflightRequestRWLock.RLock()
defer t.inflightRequestRWLock.RUnlock()
mpls := t.extractMPLS(msg, data)
mpls := extractMPLS(msg, data)
if _, ok := t.inflightRequest[ttl]; ok {
t.inflightRequest[ttl] <- Hop{
Success: true,
@@ -186,7 +186,7 @@ func (t *ICMPTracer) handleICMPMessage(msg ReceivedMessage, icmpType int8, data
}
}
func (t *ICMPTracer) extractMPLS(msg ReceivedMessage, data []byte) string {
func extractMPLS(msg ReceivedMessage, data []byte) string {
extensionOffset := 20 + 8 + 52
if len(data) <= extensionOffset {

View File

@@ -233,10 +233,13 @@ func (t *ICMPTracerv6) listenICMP() {
func (t *ICMPTracerv6) handleICMPMessage(msg ReceivedMessage, icmpType int8, data []byte, ttl int) {
t.inflightRequestRWLock.RLock()
defer t.inflightRequestRWLock.RUnlock()
mpls := extractMPLS(msg, data)
if _, ok := t.inflightRequest[ttl]; ok {
t.inflightRequest[ttl] <- Hop{
Success: true,
Address: msg.Peer,
MPLS: mpls,
}
}
}