diff --git a/pkg/internal/ebpf/common/common.go b/pkg/internal/ebpf/common/common.go index cf2ccf370..89b9863bb 100644 --- a/pkg/internal/ebpf/common/common.go +++ b/pkg/internal/ebpf/common/common.go @@ -231,10 +231,21 @@ func cstr(chars []uint8) string { } func (connInfo *BPFConnInfo) reqHostInfo() (source, target string) { + oneAddress := [16]uint8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1} + src := make(net.IP, net.IPv6len) dst := make(net.IP, net.IPv6len) - copy(src, connInfo.S_addr[:]) - copy(dst, connInfo.D_addr[:]) + + switch { + case bytes.Equal(connInfo.S_addr[:], oneAddress[:]) || + bytes.Equal(connInfo.D_addr[:], oneAddress[:]): + // If the address is not valid, return an empty string + return "", "" + default: + // If the address is valid, copy the entire address + copy(src, connInfo.S_addr[:]) + copy(dst, connInfo.D_addr[:]) + } srcStr := src.String() dstStr := dst.String()