Changes to fix the issues with conntrack test
@@ -77,6 +77,9 @@ func (cmd *conntrackDumpCmd) Args(c *cobra.Command, args []string) error {
func (cmd *conntrackDumpCmd) Run(c *cobra.Command, _ []string) {
mc := &bpf.MapContext{}
ctMap := conntrack.Map(mc)
+ if err := ctMap.EnsureExists(); err != nil {
+ log.WithError(err).Error("Failed to access ConntrackMap")
+ }
err := ctMap.Iter(func(k, v []byte) {
var ctKey conntrack.Key
if len(k) != len(ctKey) {
@@ -190,6 +193,9 @@ func (cmd *conntrackRemoveCmd) Args(c *cobra.Command, args []string) error {
func (cmd *conntrackRemoveCmd) Run(c *cobra.Command, _ []string) {
mc := &bpf.MapContext{}
ctMap := conntrack.Map(mc)
+ if err := ctMap.EnsureExists(); err != nil {
+ log.WithError(err).Error("Failed to access ConntrackMap")
+ }
var keysToRemove []conntrack.Key
err := ctMap.Iter(func(k, v []byte) {
var ctKey conntrack.Key
