mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-07-17 09:51:56 +00:00
Disable IPv4 defragmentation and support IPv6 (#487)
* Remove the extra negation on `nodefrag` flag's value * Support IPv4 fragmentation and IPv6 at the same time * Re-enable `nodefrag` flag
This commit is contained in:
parent
08d7fa988e
commit
02a125bb86
@ -6,12 +6,16 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"net/url"
|
||||||
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
|
|
||||||
"github.com/op/go-logging"
|
"github.com/op/go-logging"
|
||||||
"github.com/up9inc/mizu/shared"
|
"github.com/up9inc/mizu/shared"
|
||||||
"github.com/up9inc/mizu/shared/logger"
|
"github.com/up9inc/mizu/shared/logger"
|
||||||
"github.com/up9inc/mizu/shared/semver"
|
"github.com/up9inc/mizu/shared/semver"
|
||||||
"github.com/up9inc/mizu/tap/api"
|
"github.com/up9inc/mizu/tap/api"
|
||||||
"io"
|
|
||||||
v1 "k8s.io/api/apps/v1"
|
v1 "k8s.io/api/apps/v1"
|
||||||
core "k8s.io/api/core/v1"
|
core "k8s.io/api/core/v1"
|
||||||
rbac "k8s.io/api/rbac/v1"
|
rbac "k8s.io/api/rbac/v1"
|
||||||
@ -32,9 +36,6 @@ import (
|
|||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
watchtools "k8s.io/client-go/tools/watch"
|
watchtools "k8s.io/client-go/tools/watch"
|
||||||
"net/url"
|
|
||||||
"path/filepath"
|
|
||||||
"regexp"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Provider struct {
|
type Provider struct {
|
||||||
|
@ -121,11 +121,8 @@ func (source *tcpPacketSource) readPackets(ipdefrag bool, packets chan<- TcpPack
|
|||||||
}
|
}
|
||||||
|
|
||||||
// defrag the IPv4 packet if required
|
// defrag the IPv4 packet if required
|
||||||
if !ipdefrag {
|
if ipdefrag {
|
||||||
ip4Layer := packet.Layer(layers.LayerTypeIPv4)
|
if ip4Layer := packet.Layer(layers.LayerTypeIPv4); ip4Layer != nil {
|
||||||
if ip4Layer == nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
ip4 := ip4Layer.(*layers.IPv4)
|
ip4 := ip4Layer.(*layers.IPv4)
|
||||||
l := ip4.Length
|
l := ip4.Length
|
||||||
newip4, err := source.defragger.DefragIPv4(ip4)
|
newip4, err := source.defragger.DefragIPv4(ip4)
|
||||||
@ -146,6 +143,7 @@ func (source *tcpPacketSource) readPackets(ipdefrag bool, packets chan<- TcpPack
|
|||||||
_ = nextDecoder.Decode(newip4.Payload, pb)
|
_ = nextDecoder.Decode(newip4.Payload, pb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
packets <- TcpPacketInfo{
|
packets <- TcpPacketInfo{
|
||||||
Packet: packet,
|
Packet: packet,
|
||||||
|
Loading…
Reference in New Issue
Block a user