This repository was archived by the owner on Apr 20, 2024. It is now read-only.
File tree 2 files changed +5
-5
lines changed
2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ import (
14
14
"k8s.io/component-base/logs"
15
15
"k8s.io/klog/v2"
16
16
"k8s.io/utils/ptr"
17
- "sigs.k8s.io/knftables"
18
17
)
19
18
20
19
type netpolTweak func (networkPolicy * networkingv1.NetworkPolicy )
@@ -102,15 +101,13 @@ type networkpolicyController struct {
102
101
}
103
102
104
103
func newController () * networkpolicyController {
105
- nft := knftables .NewFake (knftables .InetFamily , "kube-netpol" )
106
104
client := fake .NewSimpleClientset ()
107
105
informersFactory := informers .NewSharedInformerFactory (client , 0 )
108
106
controller := NewController (client ,
109
107
informersFactory .Networking ().V1 ().NetworkPolicies (),
110
108
informersFactory .Core ().V1 ().Namespaces (),
111
109
informersFactory .Core ().V1 ().Pods (),
112
- nft ,
113
- 100 ,
110
+ Config {},
114
111
)
115
112
controller .networkpoliciesSynced = alwaysReady
116
113
controller .namespacesSynced = alwaysReady
Original file line number Diff line number Diff line change @@ -61,13 +61,17 @@ func parsePacket(b []byte) (packet, error) {
61
61
return t , fmt .Errorf ("unknown versions %d" , version )
62
62
}
63
63
64
+ var dataOffset int
64
65
switch protocol {
65
66
case 6 :
66
67
t .proto = v1 .ProtocolTCP
68
+ dataOffset = int (b [hdrlen + 12 ] >> 4 ) // data offset
67
69
case 17 :
68
70
t .proto = v1 .ProtocolUDP
71
+ dataOffset = hdrlen + 8 // data starts after
69
72
case 132 :
70
73
t .proto = v1 .ProtocolSCTP
74
+ dataOffset = hdrlen + 8
71
75
default :
72
76
return t , fmt .Errorf ("unknown protocol %d" , protocol )
73
77
}
@@ -76,7 +80,6 @@ func parsePacket(b []byte) (packet, error) {
76
80
t .dstPort = int (binary .BigEndian .Uint16 (b [hdrlen + 2 : hdrlen + 4 ]))
77
81
// Obtain the offset of the payload
78
82
// TODO allow to filter by the payload
79
- dataOffset := int (b [hdrlen + 12 ] >> 4 )
80
83
if len (b ) >= hdrlen + dataOffset {
81
84
t .payload = b [hdrlen + dataOffset :]
82
85
}
You can’t perform that action at this time.
0 commit comments