Skip to content

Commit 6430115

Browse files
committed
IPsec userspace to enable ipsec tracker
Signed-off-by: Mohamed Mahmoud <[email protected]>
1 parent d1d2045 commit 6430115

File tree

8 files changed

+194
-37
lines changed

8 files changed

+194
-37
lines changed

pkg/agent/agent.go

+1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ func FlowsAgent(cfg *Config) (*Flows, error) {
235235
EnablePktTranslation: cfg.EnablePktTranslationTracking,
236236
UseEbpfManager: cfg.EbpfProgramManagerMode,
237237
BpfManBpfFSPath: cfg.BpfManBpfFSPath,
238+
EnableIPsecTracker: cfg.EnableIPsecTracking,
238239
FilterConfig: filterRules,
239240
}
240241

pkg/agent/config.go

+2
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ type Config struct {
236236
BpfManBpfFSPath string `env:"BPFMAN_BPF_FS_PATH" envDefault:"/run/netobserv/maps"`
237237
// EnableUDNMapping to allow mapping pod's interface to udn label
238238
EnableUDNMapping bool `env:"ENABLE_UDN_MAPPING" envDefault:"false"`
239+
// EnableIPsecTracking enable tracking IPsec flows encryption
240+
EnableIPsecTracking bool `env:"ENABLE_IPSEC_TRACKING" envDefault:"false"`
239241
/* Deprecated configs are listed below this line
240242
* See manageDeprecatedConfigs function for details
241243
*/

pkg/decode/decode_protobuf.go

+3
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ func RecordToMap(fr *model.Record) config.GenericMap {
141141
out["XlatSrcAddr"] = model.IP(fr.Metrics.AdditionalMetrics.TranslatedFlow.Saddr).String()
142142
out["XlatDstAddr"] = model.IP(fr.Metrics.AdditionalMetrics.TranslatedFlow.Daddr).String()
143143
}
144+
if fr.Metrics.AdditionalMetrics.FlowEncrypted {
145+
out["EncryptedFlow"] = fr.Metrics.AdditionalMetrics.FlowEncrypted
146+
}
144147
}
145148

146149
if fr.TimeFlowRtt != 0 {

pkg/model/flow_content.go

+4
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ func (p *BpfFlowContent) AccumulateAdditional(other *ebpf.BpfAdditionalMetrics)
116116
if !AllZeroIP(IP(other.TranslatedFlow.Saddr)) && !AllZeroIP(IP(other.TranslatedFlow.Daddr)) {
117117
p.AdditionalMetrics.TranslatedFlow = other.TranslatedFlow
118118
}
119+
// Encryption
120+
if p.AdditionalMetrics.FlowEncrypted != other.FlowEncrypted {
121+
p.AdditionalMetrics.FlowEncrypted = other.FlowEncrypted
122+
}
119123
}
120124

121125
func allZerosMac(s [6]uint8) bool {

pkg/pbflow/flow.pb.go

+46-35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/pbflow/proto.go

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func FlowToPB(fr *model.Record) *Record {
8484
DstPort: uint32(fr.Metrics.AdditionalMetrics.TranslatedFlow.Dport),
8585
ZoneId: uint32(fr.Metrics.AdditionalMetrics.TranslatedFlow.ZoneId),
8686
}
87+
pbflowRecord.FlowEncrypted = fr.Metrics.AdditionalMetrics.FlowEncrypted
8788
}
8889
pbflowRecord.DupList = make([]*DupMapEntry, 0)
8990
for _, intf := range fr.Interfaces {
@@ -166,6 +167,7 @@ func PBToFlow(pb *Record) *model.Record {
166167
Dport: uint16(pb.Xlat.GetDstPort()),
167168
ZoneId: uint16(pb.Xlat.GetZoneId()),
168169
},
170+
FlowEncrypted: pb.FlowEncrypted,
169171
},
170172
},
171173
TimeFlowStart: pb.TimeFlowStart.AsTime(),

0 commit comments

Comments
 (0)