mirror of
https://github.com/moby/moby.git
synced 2026-08-08 00:52:17 +00:00
Check nftables is enabled before applying updates
Signed-off-by: Rob Murray <rob.murray@docker.com>
This commit is contained in:
@@ -259,9 +259,12 @@ table {{$family}} {{$tableName}} {
|
||||
// Apply makes incremental updates to nftables, corresponding to changes to the [TableRef]
|
||||
// since Apply was last called.
|
||||
func (t TableRef) Apply(ctx context.Context) error {
|
||||
var buf bytes.Buffer
|
||||
if !Enabled() {
|
||||
return errors.New("nftables is not enabled")
|
||||
}
|
||||
|
||||
// Update nftables.
|
||||
var buf bytes.Buffer
|
||||
if err := incrementalUpdateTempl.Execute(&buf, t.t); err != nil {
|
||||
return fmt.Errorf("failed to execute template nft ruleset: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user