Skip to content

Commit

Permalink
execute check for loaded kernel modules
Browse files Browse the repository at this point in the history
  • Loading branch information
steiler committed May 4, 2023
1 parent b79847b commit 4c47bf4
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion clab/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,9 @@ func (c *CLab) CheckTopologyDefinition(ctx context.Context) error {
return err
}
}

if err = c.verifyKernelModulesLoaded(); err != nil {
return err
}
if err = c.verifyLinks(); err != nil {
return err
}
Expand Down Expand Up @@ -451,6 +453,22 @@ func (c *CLab) verifyLinks() error {
return nil
}

// verifyKernelModulesLoaded makes sure the listed kernel modules are loaded
func (c *CLab) verifyKernelModulesLoaded() error {
modules := []string{"ip_tables", "ip6_tables"}

for _, m := range modules {
isLoaded, err := utils.IsKernelModuleLoaded(m)
if err != nil {
return err
}
if !isLoaded {
log.Warnf("kernel module %s is not loaded", m)
}
}
return nil
}

// verifyDuplicateAddresses checks that every static IP address in the topology is unique.
func (c *CLab) verifyDuplicateAddresses() error {
dupIps := map[string]struct{}{}
Expand Down

0 comments on commit 4c47bf4

Please sign in to comment.