mirror of
https://github.com/nxtrace/NTrace-core.git
synced 2025-08-12 06:26:39 +00:00
由于部分网络截断icmp data故ttl改为在seq读取
This commit is contained in:
@@ -150,7 +150,7 @@ func (t *ICMPTracer) listenICMP() {
|
||||
}
|
||||
continue
|
||||
}
|
||||
ttl := int(msg.Msg[36])
|
||||
ttl := int64(binary.BigEndian.Uint16(msg.Msg[34:36]))
|
||||
packet_id := strconv.FormatInt(int64(binary.BigEndian.Uint16(msg.Msg[32:34])), 2)
|
||||
if process_id, _, err := reverseID(packet_id); err == nil {
|
||||
if process_id == int64(os.Getpid()&0x7f) {
|
||||
@@ -271,7 +271,8 @@ func (t *ICMPTracer) send(ttl int) error {
|
||||
id := gernerateID(0)
|
||||
// log.Println("发送的", id)
|
||||
|
||||
data := []byte{byte(ttl)}
|
||||
//data := []byte{byte(ttl)}
|
||||
data := []byte{byte(0)}
|
||||
data = append(data, bytes.Repeat([]byte{1}, t.Config.PktSize-5)...)
|
||||
data = append(data, 0x00, 0x00, 0x4f, 0xff)
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ func (t *ICMPTracerv6) listenICMP() {
|
||||
}
|
||||
|
||||
}
|
||||
ttl := int(msg.Msg[56])
|
||||
ttl := int64(binary.BigEndian.Uint16(msg.Msg[54:56]))
|
||||
packet_id := strconv.FormatInt(int64(binary.BigEndian.Uint16(msg.Msg[52:54])), 2)
|
||||
if process_id, _, err := reverseID(packet_id); err == nil {
|
||||
if process_id == int64(os.Getpid()&0x7f) {
|
||||
@@ -264,7 +264,8 @@ func (t *ICMPTracerv6) send(ttl int) error {
|
||||
//id := gernerateID(ttl)
|
||||
id := gernerateID(0)
|
||||
|
||||
data := []byte{byte(ttl)}
|
||||
//data := []byte{byte(ttl)}
|
||||
data := []byte{byte(0)}
|
||||
data = append(data, bytes.Repeat([]byte{1}, t.Config.PktSize-5)...)
|
||||
data = append(data, 0x00, 0x00, 0x4f, 0xff)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user